Takes in our html and bindings, and rezero's the comment names, and the
 bindings.  Returns an updated bindings hash
519186
def set_content_and_rezero_bindings(html, bindings)
      html, bindings = rezero_bindings(html, bindings)

      if @binding_name == 'main'
        @target.html = html
      else
        @target.find_by_binding_id(@binding_name).html = html
      end

      bindings
    end
372841
function updateGlobals(init) {
                var oldTags = tagList;

                tagList = $('.json-tag-editor-tag:not(.deleted)', ed).map(function(i, e) {
                    var tag = {};
                    if ($(this).hasClass('active')) {
                        Object.assign(tag, $(this).find('input').get(0).dataset);
                        tag.value = $(this).find('input').val();
                    }
                    else {
                        Object.assign(tag, $(e).get(0).dataset, {value: $(e).get(0).dataset.value})
                    }

                    if (tag.value) {
                        return tag;
                    }
                }).get();

                ed.data('tags', tagList);
                el.val(tagList.reduce(function(previous, current) {return previous + o.delimiter[0] + current.value}, ''));

                // Change callback except for plugin init
                if (!init) {
                    if (!deepEquals(oldTags, tagList)) {
                        o.onChange(el, ed, tagList);
                    }
                }

                setPlaceholder();
            }
904784
def fetch_comments_async(prs)
      threads = []

      prs.each_slice(MAX_THREAD_NUMBER) do |prs_slice|
        prs_slice.each do |pr|
          threads << Thread.new do
            pr["comments"] = []
            iterate_pages(@client, "issue_comments", pr["number"]) do |new_comment|
              pr["comments"].concat(new_comment)
            end
            pr["comments"] = pr["comments"].map { |comment| stringify_keys_deep(comment.to_hash) }
          end
        end
        threads.each(&:join)
        threads = []
      end
      nil
    end
108516
def comment(request, template="generic/comments.html", extra_context=None):
    
    response = initial_validation(request, "comment")
    if isinstance(response, HttpResponse):
        return response
    obj, post_data = response
    form_class = import_dotted_path(settings.COMMENT_FORM_CLASS)
    form = form_class(request, obj, post_data)
    if form.is_valid():
        url = obj.get_absolute_url()
        if is_spam(request, form, url):
            return redirect(url)
        comment = form.save(request)
        response = redirect(add_cache_bypass(comment.get_absolute_url()))
        # Store commenter's details in a cookie for 90 days.
        for field in ThreadedCommentForm.cookie_fields:
            cookie_name = ThreadedCommentForm.cookie_prefix + field
            cookie_value = post_data.get(field, "")
            set_cookie(response, cookie_name, cookie_value)
        return response
    elif request.is_ajax() and form.errors:
        return HttpResponse(dumps({"errors": form.errors}))
    # Show errors with stand-alone comment form.
    context = {"obj": obj, "posted_comment_form": form}
    context.update(extra_context or {})
    return TemplateResponse(request, template, context)
843193
function() {
        var htmlState = htmlMode.startState();
        var rubyState = rubyMode.startState();
        return {
          htmlState: htmlState,
          rubyState: rubyState,
          indented: 0,
          previousToken: { style: null, indented: 0},
          tokenize: html
        };
      }
1238323
def bind(self):
        
        self._COOKIES = None
        self.status = 200
        self.headers = HeaderDict()
        self.content_type = 'text/html; charset=UTF-8'
711270
def html_state(self):
        """"""
        ret = ""
        state = json.loads(self.state)
        for (app, appstate) in state.items():
            for (model, modelstate) in appstate.items():
                ret += "<p>%s.models.%s</p>" % (app, model,)
                ret += "<ul>"
                for field in modelstate["fields"] + ["uid"]:
                    ret += "<li>%s</li>" % field
                for fk in modelstate["foreignkeys"]:
                    ret += "<li>%s (foreign key)</li>" % fk
                ret += "</ul>"
        return ret
368964
function getCommentsList(comments) {
  if (!comments.body || !comments.headers) return;

  let pageInfo = getPage(comments.headers.link);
  let pageList = [];

  comments.body.forEach((item) => {
    pageList.push(getComments(item));
  });

  return {
    page: pageInfo,
    list: pageList
  }
}
386529
def bindings
      results = Hash.new { |hash, key| hash[key] = [] }
      api_client.bindings.each do |binding|
        next if binding['destination'] == binding['routing_key']
        next unless binding['source'] == @config[:mq_exchange]
        next unless binding['vhost'] == @config[:mq_vhost]
        results[binding['destination']] << binding['routing_key']
      end
      results
    end
996789
def get_bindings(self):
        
        path = Client.urls['all_bindings']
        bindings = self._call(path, 'GET')
        return bindings
749991
def find_namelists(text, before_contains=nil)
      return nil if !text
      result = ""
      lines = "#{text}"
      before_contains = "" if !before_contains
      while lines =~ /^\s*?namelist\s+\/\s*?(\w+)\s*?\/([\s\w\,]+)$/i
        lines = $~.post_match
        nml_comment = COMMENTS_ARE_UPPER ? 
            find_comments($~.pre_match) : find_comments($~.post_match)
        nml_name = $1
        nml_args = $2.split(",")
        result << "\n\n=== NAMELIST <tt><b>" + nml_name + "</tt></b>\n\n"
        result << nml_comment + "\n" if nml_comment
        if lines.split("\n")[0] =~ /^\//i
          lines = "namelist " + lines
        end
        result << find_arguments(nml_args, "#{text}" + "\n" + before_contains)
      end
      return result
    end
665402
def data
      templates = @templates.deep_clone

      templates.each_pair do |name, value|
        if value['bindings']
          value['bindings'].each_pair do |number, binding|
            value['bindings'][number] = binding.map { |code| eval(code) }
          end
        end
      end

      templates
    end
112995
function() {

      var attrs, x, y, z, key, value, html, inputs, textarea;

      console.log(hashedit.current.node);

      if (hashedit.current.node !== null) {

        // get attributes
        attrs = hashedit.current.node.attributes;

        for (x = 0; x < attrs.length; x += 1) {

          // get key and value
          key = attrs[x].nodeName.replace(/-([a-z])/g, function(g) {
            return g[1].toUpperCase();
          });
          value = attrs[x].nodeValue;

          // if is numeric
          if (!isNaN(parseFloat(value)) && isFinite(value)) {
            value = parseFloat(value);
          }

          // set value
          inputs = document.querySelectorAll('[data-model="node.' + key + '"]');

          for (y = 0; y < inputs.length; y += 1) {
            inputs[y].value = value;
          }

        }

        // get html
        html = hashedit.current.node.innerHTML;

        // remove the element menu
        var i = html.indexOf('<span class="hashedit-element-menu"');
        html = html.substring(0, i);

        inputs = document.querySelectorAll('[data-model="node.html"]');

        for (y = 0; y < inputs.length; y += 1) {
          inputs[y].value = html;
        }


      }


    }
692731
def _build_comments(self, soup):
        

        comments = []
        current_page = 1

        while True:
            # Get the table holding all comments:
            if current_page == 1:
                table = soup.findChildren('table')[3]
            elif current_page > 1:
                table = soup.findChildren('table')[2]
            # get all rows (each comment is duplicated twice)
            rows = table.findChildren(['tr'])
            # last row is more, second last is spacing
            rows = rows[:len(rows) - 2]
            # now we have unique comments only
            rows = [row for i, row in enumerate(rows) if (i % 2 == 0)]

            if len(rows) > 1:
                for row in rows:

                    # skip an empty td
                    if not row.findChildren('td'):
                        continue

                    # Builds a flat list of comments

                    # level of comment, starting with 0
                    level = int(row.findChildren('td')[1].find('img').get(
                        'width')) // 40

                    spans = row.findChildren('td')[3].findAll('span')
                    # span[0] = submitter details
                    # [<a href="user?id=jonknee">jonknee</a>, u' 1 hour ago  | ', <a href="item?id=6910978">link</a>]
                    # span[1] = actual comment

                    if str(spans[0]) != '<span class="comhead"></span>':
                        # user who submitted the comment
                        user = spans[0].contents[0].string
                        # relative time of comment
                        time_ago = spans[0].contents[1].string.strip(
                        ).rstrip(' |')
                        try:
                            comment_id = int(re.match(r'item\?id=(.*)',
                                                      spans[0].contents[
                                                          2].get(
                                                          'href')).groups()[0])
                        except AttributeError:
                            comment_id = int(re.match(r'%s/item\?id=(.*)' %
                                                      BASE_URL,
                                                      spans[0].contents[
                                                          2].get(
                                                          'href')).groups()[0])

                        # text representation of comment (unformatted)
                        body = spans[1].text

                        if body[-2:] == '--':
                            body = body[:-5]

                        # html of comment, may not be valid
                        try:
                            pat = re.compile(
                                r'<span class="comment"><font color=".*">(.*)</font></span>')
                            body_html = re.match(pat, str(spans[1]).replace(
                                '\n', '')).groups()[0]
                        except AttributeError:
                            pat = re.compile(
                                r'<span class="comment"><font color=".*">(.*)</font></p><p><font size="1">')
                            body_html = re.match(pat, str(spans[1]).replace(
                                '\n', '')).groups()[0]

                    else:
                        # comment deleted
                        user = ''
                        time_ago = ''
                        comment_id = -1
                        body = '[deleted]'
                        body_html = '[deleted]'

                    comment = Comment(comment_id, level, user, time_ago,
                                      body, body_html)
                    comments.append(comment)

            # Move on to the next page of comments, or exit the loop if there
            # is no next page.
            next_page_url = self._get_next_page(soup, current_page)
            if not next_page_url:
                break

            soup = get_soup(page=next_page_url)
            current_page += 1

        previous_comment = None
        # for comment in comments:
        # if comment.level == 0:
        #         previous_comment = comment
        #     else:
        #         level_difference = comment.level - previous_comment.level
        #         previous_comment.body_html += '\n' + '\t' * level_difference \
        #                                       + comment.body_html
        #         previous_comment.body += '\n' + '\t' * level_difference + \
        #                                  comment.body
        return comments
472256
function(f) {
        var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,
            fn_text        = this.reflector.getProto()[this.name].toString().replace(STRIP_COMMENTS, '');

        return fn_text.substr(fn_text.indexOf('{') + 1, fn_text.lastIndexOf('}') - 4).replace(/}([^}]*)$/, '$1');
    }
974149
def code(app_reference)
      code = ''
      templates.each_pair do |name, template|
        binding_code = []

        if template['bindings']
          template['bindings'].each_pair do |key, value|
            binding_code << "#{key.inspect} => [#{value.join(', ')}]"
          end
        end

        binding_code = "{#{binding_code.join(', ')}}"

        code << "#{app_reference}.add_template(#{name.inspect}, #{template['html'].inspect}, #{binding_code})\n"
      end

      code
    end
609914
def comment(string, options = {})
      options = {
        style: :css,
        per_line: true
      }.update(options)

      commenters = {
        html: proc { |s| "<!-- #{s} -->" },
        css: proc { |s| "/* #{s} */" },
        js: proc { |s| "/* #{s} */" }
      }

      commenter = commenters[options[:style]] || commenters[:js]

      if options[:per_line]
        string = string.split(/\r?\n/)
        string.map { |s| commenter.call(s) }.join("\n")
      else
        commenter.call(string)
      end
    end