Sorts posts, pages, and static files.
554899
def sort_files!
      site.collections.values.each { |c| c.docs.sort! }
      site.pages.sort_by!(&:name)
      site.static_files.sort_by!(&:relative_path)
    end
1305297
function posts (content, contentType) {
  let output = {}
  const allFiles = content.filter(each => each.dir.includes(`/${contentType}`))
  const index = allFiles.filter(each => each.base === 'index.md')[0]
  index.attr.forEach(each => {
    allFiles.forEach(file => {
      if (file.name === each) {
        output[each] = file
      }
    })
  })
  return output
}
745895
def _sort_locations(locations):
        
        files = []
        urls = []

        # puts the url for the given file path into the appropriate
        # list
        def sort_path(path):
            url = path_to_url2(path)
            if mimetypes.guess_type(url, strict=False)[0] == 'text/html':
                urls.append(url)
            else:
                files.append(url)

        for url in locations:
            if url.startswith('file:'):
                path = url_to_path(url)
                if os.path.isdir(path):
                    path = os.path.realpath(path)
                    for item in os.listdir(path):
                        sort_path(os.path.join(path, item))
                elif os.path.isfile(path):
                    sort_path(path)
            else:
                urls.append(url)
        return files, urls
795642
def sort_entries(self):
        """"""
        return sorted(self.data, key=self.sort_func, reverse=self.get_reverse())
1283254
function sortPosts (posts) {
  return Object.keys(posts).map(function (post) { return posts[post]; })
    .sort(function (a,b) {
      if ( a.date < b.date ) return 1;
      if ( a.date > b.date ) return -1;
      return 0;
    });
}
939069
function(list, patterns) {

        var sorted = [];
        patterns.forEach(function(p) {
            sorted.push.apply(sorted, list.filter(function(file) {
                return p(file);
            }));
        });

        return sorted;

    }
736382
private void sortActivities() {
        synchronized (mInstanceLock) {
            if (mActivitySorter != null && !mActivites.isEmpty()) {
                mActivitySorter.sort(mIntent, mActivites,
                        Collections.unmodifiableList(mHistoricalRecords));
                notifyChanged();
            }
        }
    }
703654
public static Array<FileHandle> sortFiles (FileHandle[] files, Comparator<FileHandle> comparator) {
		return sortFiles(files, comparator, false);
	}
740327
void sortPrefixes() {
        if (whitelistPrefixesSet != null) {
            whitelistPrefixes = new ArrayList<>(whitelistPrefixesSet);
        }
        if (whitelistPrefixes != null) {
            CollectionUtils.sortIfNotEmpty(whitelistPrefixes);
        }
        if (blacklistPrefixes != null) {
            CollectionUtils.sortIfNotEmpty(blacklistPrefixes);
        }
    }
1110599
def sorted_filetype_items(self):
        """"""
        processed_types = []
        file_type_items = deque(self.config['file_types'].items())
        while len(file_type_items):
            filetype, filetype_info = file_type_items.popleft()

            requirements = filetype_info.get('requires')
            if requirements is not None:
                # requirements have not been processed yet -> wait
                missing = [req for req in requirements
                           if req not in processed_types]
                if missing:
                    file_type_items.append((filetype, filetype_info))
                    continue

            processed_types.append(filetype)
            yield filetype, filetype_info
469752
public function sortRoutes()
    {
        $originalRoutes = \Route::getRoutes();
        $routesByMethod = $originalRoutes->getRoutesByMethod();

        //remove all previous routes
        \Route::setRoutes(new RouteCollection());

        $sortedRoutes = [];
        foreach($routesByMethod as $method => $methodRoutes){
            foreach($methodRoutes as $uri => $route){
                $sort = (substr_count($uri, '/'));

                //front page has the higher priority
                if($uri == '/') {
                    $sort = 0;
                }
                else {
                    $explodeURI = explode('/', $uri);

                    //increase weight based on number of slashes
                    if ($sort > 1) {
                        $sort = $sort * 2;
                    }

                    foreach ($explodeURI as $param) {
                        if ($param) {
                            // Uri with one parameter should be sorted upper
                            if ($sort == 0) {
                                $sort = (strpos($param, '{') === 0 ? 2 : 1);
                            }
                            else {
                                // Custom uri parameters should have a lower priority
                                // than hard coded parameters
                                $sort .= (strpos($param, '{') === 0 ? 1 : 0);
                            }
                        }
                    }
                }
                $sortedRoutes[$method][$uri] = intval($sort);
            }

            //sort routes ASC
            asort($sortedRoutes[$method]);

            foreach($sortedRoutes[$method] as $uri => $route){
                \Route::getRoutes()->add($methodRoutes[$uri]);
            }
        }
    }
698899
private static List<Link> sortLinks(List<Link> links)
	{
		List<Link> result = new ArrayList<Link>();
		for (Link l : links)
		{
			int pos = 0;
			while (pos < result.size()
					&& l.getPos().getStart() > result.get(pos).getPos()
							.getStart())
			{
				pos++;
			}
			result.add(pos, l);
		}
		return result;
	}
567473
public function index()
    {
        $query = $this->Pages->find()->contain(['Categories' => ['fields' => ['id', 'title']]]);

        $this->paginate['order'] = ['created' => 'DESC'];

        $pages = $this->paginate($this->Pages->queryFromFilter($query, $this->request->getQueryParams()));

        $this->set(compact('pages'));
    }
766165
function filterFiles( files ){
    var filtered = [],
        file,
        i;
    for( i = 0; i < files.length; i++ ){
        file = files[ i ];
        if( file.height &&
            file.width &&
            file.url ){
            //This is sufficient to serve as a level
            filtered.push({
                url: file.url,
                width: Number( file.width ),
                height: Number( file.height )
            });
        }
        else {
            $.console.error( 'Unsupported image format: %s', file.url ? file.url : '<no URL>' );
        }
    }

    return filtered.sort(function(a, b) {
        return a.height - b.height;
    });

}
47366
def typeSort(self):
        '''
        
        '''
        self.children.sort()
        for c in self.children:
            c.typeSort()
121279
def retrieve_posts(dir)
      return if outside_configured_directory?(dir)

      site.posts.docs.concat(post_reader.read_posts(dir))
      site.posts.docs.concat(post_reader.read_drafts(dir)) if site.show_drafts
    end
65697
protected function sortParams(): void
    {
        $sorted = [];
        foreach ($this->params as $paramName => $paramSet) {
            if (0 != strlen($paramSet->prefix)) {
                $sorted[$paramName] = $paramSet;
            }
        }
        foreach ($this->params as $paramName => $paramSet) {
            if (0 == strlen($paramSet->prefix)) {
                $sorted[$paramName] = $paramSet;
            }
        }
        $this->params = $sorted;
    }