rubocop:enable Style/For
 Sort all tags by date, newest to oldest
439508
def sort_tags_by_date(tags)
      puts "Sorting tags..." if options[:verbose]
      tags.sort_by! do |x|
        get_time_of_tag(x)
      end.reverse!
    end
584707
function() {
    var allTags = [];
    
    for (var key in this.posts) {
      if (this.posts[key].tags) {
        for (var i = 0; i < this.posts[key].tags.length; i++) {
          var tag = this.posts[key].tags[i];
          if (allTags.indexOf(tag) === -1) allTags.push(tag);
        }
      }
    }

    allTags.sort(function(a, b) {
      a = a.toLowerCase();
      b = b.toLowerCase();
      if (a < b) return -1;
      if (a > b) return 1;
      return 0;
    });

    return allTags;
  }
280400
def add_tags(self, archive_name, tags):
        '''
        

        '''
        updated_tag_list = list(self._get_tags(archive_name))
        for tag in tags:
            if tag not in updated_tag_list:
                updated_tag_list.append(tag)

        self._set_tags(archive_name, updated_tag_list)
1134640
def index
      if params[:filters]
        @tags = build_query_from_filters Tag, params[:filters]
      else
        @tags = Tag.all
      end

      respond_to do |format|
        format.html # index.html.erb
        format.json { render json: @tags }
      end
    end
467278
def tags_by_type(type)
      type = Util.to_constant(Constants::DT, type)
      each_tags.select { |tag| tag.header.d_tag == type }
    end
153700
function handleReSort(link) {
    var classes = link.attr('class').split(/\s+/);
    for (var i=0; i<classes.length; i++) {
      if (classes[i] != 'sort-option') {
	by = classes[i].substring(2);
      }
    }
    setComparator();
    // Save/update the sortBy cookie.
    var expiration = new Date();
    expiration.setDate(expiration.getDate() + 365);
    document.cookie= 'sortBy=' + escape(by) +
                     ';expires=' + expiration.toUTCString();
    $('ul.comment-ul').each(function(index, ul) {
      var comments = getChildren($(ul), true);
      comments = sortComments(comments);
      appendComments(comments, $(ul).empty());
    });
  }
735473
def tag(self, *tags):
        
        if not all(isinstance(tag, collections.Hashable) for tag in tags):
            raise TypeError('Tags must be hashable')
        self.tags.update(tags)
        return self
295950
def sorts_by_method?
      @clauses.any? { |sorting| sorting[0].sort.is_a?(Hash) && sorting[0].sort.key?(:method) }
    end
688334
def semantic_date_range_tag(date_from, date_to, options = {})
      SemanticDateTimeTags::Tag::DateRange.new(date_from, date_to, options).to_html
    end
939008
def index(options = {}, &block)
      respond_with(collection, options,  &block) if stale?(collection, last_modified: collection.maximum(:updated_at))
    end
82654
def create_next_tag():
    
    date = datetime.utcnow()
    date_tag = '{}.{}.{}'.format(date.year, date.month, date.day)
    if date_tag in latest_tag(): # if there was an update already today
        latest = latest_tag().split('.') # split by spaces
        if len(latest) == 4: # if it is not the first revision of the day
            latest[-1]= str(int(latest[-1])+1)
        else: # if it is the first revision of the day
            latest+=['1']
        date_tag = '.'.join(latest)
    return date_tag
1165956
def newest(versions)
      versions.sort { |x,y| compare(x,y) }.last
    end
168516
def lookup_tag_due_date
      config.fetch(:tags).fetch(match[:tag])
    rescue KeyError
      msg = "#{match[:tag]} tag not defined in config file"
      raise KeyError, msg
    end
456015
def set_tags(self, tags):
        

        c_old_tags = []
        old_tags = []
        c_new_tags = []
        new_tags = []

        to_remove = []
        to_add = []

        tags_on_server = self.get_tags()

        for tag in tags_on_server:
            c_old_tags.append(tag.get_name().lower())
            old_tags.append(tag.get_name())

        for tag in tags:
            c_new_tags.append(tag.lower())
            new_tags.append(tag)

        for i in range(0, len(old_tags)):
            if not c_old_tags[i] in c_new_tags:
                to_remove.append(old_tags[i])

        for i in range(0, len(new_tags)):
            if not c_new_tags[i] in c_old_tags:
                to_add.append(new_tags[i])

        self.remove_tags(to_remove)
        self.add_tags(to_add)
973158
def add_tags(new_tags)
      case new_tags
      when Array # Called with an array
        # Call recursively for each entry
        new_tags.each do |tag_hash|
          add_tags(tag_hash)
        end
      when Hash # Called with a hash
        #check if it is weird {'k' => 'key', 'v' => 'value'} syntax
        if (new_tags.size == 2 && new_tags.keys.include?('k') && new_tags.keys.include?('v'))
          # call recursively with values from k and v keys.
          add_tags({new_tags['k'] => new_tags['v']})
        else
          # OK, this seems to be a proper ruby hash with a single entry
          new_tags.each do |k,v|
            self.tags[k] = v
          end
        end
      end
      self    # return self so calls can be chained
    end
745088
function swagSort(sort) {

	// TODO unstable sorts

	var param = {};
	for (var p in params) {
		if (params[p].name == 'sort') {
			param = params[p];
		}
	}
	if (!param.name) {
		param.name = 'sort';
		param.in = 'query';
		param.description = 'Sorts:\n';
		param.schema = {};
		param.schema.type = 'string';
		param.required = false;
		param.schema.enum = [];
		params.push(param);
	}
	param.schema.enum.push(sort.name);
	param.description += '* '+sort.name+': '+sort.title+'\n';
}
632448
def _get_last_tag(self):
        

        current_version = LooseVersion(
            self._get_version_from_tag(self.release_notes_generator.current_tag)
        )

        versions = []
        for tag in self.repo.tags():
            if not tag.name.startswith(self.github_info["prefix_prod"]):
                continue
            version = LooseVersion(self._get_version_from_tag(tag.name))
            if version >= current_version:
                continue
            versions.append(version)
        if versions:
            versions.sort()
            return "{}{}".format(self.github_info["prefix_prod"], versions[-1])