Get the document library for a site
330822
def get_library_for_site site_id
      url = base_api_url + "/sites/#{site_id}/drive"
      @drives = JSON.parse(HTTParty.get(url,headers: set_headers).body)
    end
200143
function updateSite () {
    start('Adding new version of the docs site...');
    const options = { cwd: './code.material.angularjs.org' };
    writeDocsJson();

    // build files for bower
    exec([
        'rm -rf dist',
        'gulp docs'
    ]);
    replaceFilePaths();

    // copy files over to site repo
    exec([
        `cp -Rf ../dist/docs ${newVersion}`,
        'rm -rf latest && cp -Rf ../dist/docs latest',
        'git add -A',
        `git commit -m "release: version ${newVersion}"`,
        'rm -rf ../dist'
    ], options);
    replaceBaseHref(newVersion);
    replaceBaseHref('latest');

    // update firebase.json file
    updateFirebaseJson();
    exec(['git commit --amend --no-edit -a'], options);
    done();

    // add steps to push script
    pushCmds.push(
        comment('push the site'),
        'cd ' + options.cwd,
        'git pull --rebase --strategy=ours',
        'git push',
        'cd ..'
    );

    function updateFirebaseJson () {
      fs.writeFileSync(options.cwd + '/firebase.json', getFirebaseJson());
      function getFirebaseJson () {
        const json = require(options.cwd + '/firebase.json');
        json.hosting.rewrites = json.hosting.rewrites || [];
        const rewrites = json.hosting.rewrites;

        switch (rewrites.length) {
          case 0:
            rewrites.push(getRewrite('HEAD'));
          case 1:
            rewrites.push(getRewrite('latest'));
          default:
            rewrites.push(getRewrite(newVersion));
        }
        return JSON.stringify(json, null, 2);
        function getRewrite (str) {
          return {
            source:      '/' + str + '/**/!(*.@(js|html|css|json|svg|png|jpg|jpeg))',
            destination: '/' + str + '/index.html'
          };
        }
      }
    }

    function writeDocsJson () {
      const config = require(options.cwd + '/docs.json');
      config.versions.unshift(newVersion);

      // only set to default if not a release candidate
      config.latest = newVersion;
      fs.writeFileSync(options.cwd + '/docs.json', JSON.stringify(config, null, 2));
    }
  }
1370929
def generate(site)
      @site = site
      collections.each do |name, meta|
        Jekyll.logger.info "Jekyll Feed:", "Generating feed for #{name}"
        (meta["categories"] + [nil]).each do |category|
          path = feed_path(:collection => name, :category => category)
          next if file_exists?(path)

          @site.pages << make_page(path, :collection => name, :category => category)
        end
      end
    end
175490
def retrieve_pages(dir, dot_pages)
      site.pages.concat(PageReader.new(site, dir).read(dot_pages))
    end
818033
def get_navpanel_data(kwdb):
    """"""
    data = kwdb.get_keyword_hierarchy()
    for library in data:
        library["url"] = flask.url_for(".doc_for_library", collection_id=library["collection_id"])
        for keyword in library["keywords"]:
            url = flask.url_for(".doc_for_library",
                                collection_id=library["collection_id"],
                                keyword=keyword["name"])
            keyword["url"] = url

    return data
391670
protected function getJsonDocumentList()
    {
        if (!isset($this->config['library'])) {
            return json_encode(static::$apiResponseBody, JSON_PRETTY_PRINT);
        }

        if (!count($this->config['library'])) {
            return json_encode(static::$apiResponseBody, JSON_PRETTY_PRINT);
        }

        foreach (array_keys($this->config['library']) as $document) {
            static::$apiResponseBody['data'][] = [
                'document' => $document,
                'link' => Router::url([
                    'plugin' => 'Alt3/Swagger',
                    'controller' => 'Docs',
                    'action' => 'index',
                    $document
                ], true)
            ];
        }

        return json_encode(static::$apiResponseBody, JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES);
    }
603906
def libraries():
    """"""
    ls = libraries_dir().dirs()
    ls = [str(x.name) for x in ls]
    ls.sort()
    return ls
453019
def _get_elements(self, site):
        
        try:
            if isinstance(site.specie, Element):
                return [site.specie]
            return [Element(site.specie)]
        except:
            return site.species.elements
447839
function getCWD() {
		var result = PageUtil.matchResourceParameters(window.location.href).resource;
		return result.length > 0 ? result : null;
	}
860699
def _get_document(self, source):
        """"""
        scheme_url = source
        if not source.startswith("http"):
            scheme_url = "http://%s" % source

        text = source

        try:
            text = urllib.urlopen(scheme_url).read()
        except:
            pass
        else:
            return (text, scheme_url)

        try:
            text = open(source, "r").read()
        except:
            pass
        else:
            return (text, source)

        return (text, None)
1252526
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'site_collection_path'
                  ) and self.site_collection_path is not None:
            _dict['site_collection_path'] = self.site_collection_path
        if hasattr(self, 'limit') and self.limit is not None:
            _dict['limit'] = self.limit
        return _dict
247041
def document(self):
        """"""
        resp = request.environ.get('pylons.original_response')
        page = error_document_template % \
            dict(prefix=request.environ.get('SCRIPT_NAME', ''),
                 code=request.params.get('code', resp.status_int),
                 message=request.params.get('message', resp.body))
        return page
958124
def getLibraryFiles(self, engineRoot, delimiter=' '):
		
		return delimiter.join(self.resolveRoot(self.libs, engineRoot))
33884
function getCurrentDocumentUrl() {
            var $activePage = $("body").pagecontainer("getActivePage");
            if (null == $activePage) {
                return $.mobile.path.documentBase.hrefNoHash;
            }
            var base = $.mobile.path.documentBase.hrefNoHash;
            var url = $.mobile.activePage.closest(".ui-page").jqmData("url");
            if (!url || !$.mobile.path.isPath(url)) {
                url = base;
            }
            return $.mobile.path.makeUrlAbsolute(url, base);
        }
1315748
def get_for_site(cls, handle, site, fall_back_to_default_site_menus=False):
        """"""
        queryset = cls.objects.filter(handle__exact=handle)

        site_q = Q(site=site)
        if fall_back_to_default_site_menus:
            site_q |= Q(site__is_default_site=True)
        queryset = queryset.filter(site_q)

        # return the best match or None
        return queryset.annotate(matched_provided_site=Case(
            When(site_id=site.id, then=1), default=0,
            output_field=BooleanField()
        )).order_by('-matched_provided_site').first()
724056
def get_plugins(sites=None):
    
    plugins = []
    # collect GoScale plugins
    for plugin in CMSPlugin.objects.all():
        if plugin:
            cl = plugin.get_plugin_class().model
            if 'posts' in cl._meta.get_all_field_names():
                instance = plugin.get_plugin_instance()[0]
                plugins.append(instance)
        # Filter by sites
    if sites and len(sites) > 0:
        onsite = []
        for plugin in plugins:
            try:
                if plugin.page.site in sites:
                    onsite.append(plugin)
            except AttributeError:
                continue
        return onsite
    return plugins
983247
public function getContentLibrary()
    {
        return $this->contentLibrary == null?
            $this->contentLibrary = new SiteContentLibraryImpl($this->container):
            $this->contentLibrary;
    }