GET /categories/1
 GET /categories/1.json
778868
def show
      @category = Category.find(params[:id])
      session[:current_filter] = params[:filter] || session[:current_filter]
      @keys = @category.send("#{session[:current_filter]}_keys", session[:lang_to]).offset(@page - 1).limit(TranslationKey::PER_PAGE)
      @untranslated_keys_count = @category.untranslated_keys(session[:lang_to]).count
      @translated_keys_count = @category.translated_keys(session[:lang_to]).count
      @pending_keys_count = @category.pending_keys(session[:lang_to]).count
      @all_keys_count = @untranslated_keys_count + @translated_keys_count + @pending_keys_count
      respond_to do |format|
        format.html # show.html.erb
        format.js
      end
    end
281038
public function getCategory($categories)
    {
        $this->validateNumericArray('categories', $categories);
        $stats = $this->getGlobal();
        $stats['categories'] = $categories;
        return $stats;
    }
231930
function getTree($gets,$category='fid',$order='id desc')
	{
		$gets['order'] = $category . ',' . $order;
		$list = $this->gets($gets);
		foreach ($list as $li)
		{
			if ($li[$category] == 0)
			{
				$new[$li[$this->primary]] = $li;
			}
			else
			{
				$new[$li[$category]]['child'][$li[$this->primary]] = $li;
			}
		}
		return $new;
	}
665171
function list(category){
	let list = [];

	if (category && typeof(category) === 'string') {
		list = _(goblin.ambush).filter(function(current) {
			return _.includes(current.category, category);
		}).map('id').value();
	} else {
		list = _(goblin.ambush).map('id').value();
	}
	
	return list;

}
892085
def get_top_level_categories(parser, token):
    
    bits = token.split_contents()
    usage = 'Usage: {%% %s [using "app.Model"] as <variable> %%}' % bits[0]
    if len(bits) == 3:
        if bits[1] != 'as':
            raise template.TemplateSyntaxError(usage)
        varname = bits[2]
        model = "categories.category"
    elif len(bits) == 5:
        if bits[1] not in ('as', 'using') and bits[3] not in ('as', 'using'):
            raise template.TemplateSyntaxError(usage)
        if bits[1] == 'using':
            model = bits[2].strip("'\"")
            varname = bits[4].strip("'\"")
        else:
            model = bits[4].strip("'\"")
            varname = bits[2].strip("'\"")

    return TopLevelCategoriesNode(varname, model)
702802
def load_categories(self, max_pages=30):
        
        logger.info("loading categories")

        # clear them all out so we don't get dupes if requested
        if self.purge_first:
            Category.objects.filter(site_id=self.site_id).delete()

        path = "sites/{}/categories".format(self.site_id)
        params = {"number": 100}
        page = 1

        response = self.get(path, params)

        if not response.ok:
            logger.warning("Response NOT OK! status_code=%s\n%s", response.status_code, response.text)

        while response.ok and response.text and page < max_pages:
            logger.info(" - page: %d", page)

            api_categories = response.json().get("categories")
            if not api_categories:
                # we're done here
                break

            categories = []
            for api_category in api_categories:

                # if it exists locally, update local version if anything has changed
                existing_category = Category.objects.filter(site_id=self.site_id, wp_id=api_category["ID"]).first()
                if existing_category:
                    self.update_existing_category(existing_category, api_category)
                else:
                    categories.append(self.get_new_category(api_category))

            if categories:
                Category.objects.bulk_create(categories)
            elif not self.full:
                # we're done here
                break

            # get next page
            page += 1
            params["page"] = page
            response = self.get(path, params)

            if not response.ok:
                logger.warning("Response NOT OK! status_code=%s\n%s", response.status_code, response.text)
                return
860191
function getCategories (poet) {
  return poet.cache.categories ||
    (poet.cache.categories = utils.getCategories(getPosts(poet)));
}
221649
public function getCategory($key)
    {
        return array_key_exists($key, $this->_categories) ? $this->_categories[$key] : null;
    }
915147
public function categoryList($site_id)
    {
        $response = $this->getGuzzleClient()
            ->get('/sites/' . $site_id . '/categories', $this->setQuery());

        return $this->serializer->deserialize(
            $response->getBody()->getContents(),
            "array<" . Category::class . ">",
            'json'
        );
    }
1018324
def get_category(self, id, **data):
        
        
        return self.get("/categories/{0}/".format(id), data=data)
557083
function getCategories (posts) {
  var categories = posts.reduce(function (categories, post) {
    if (!post.category) return categories;
    return categories.concat(post.category);
  }, []);

  return _.unique(categories).sort();
}
125041
public function get($categoryId, $params = array())
    {
        $resource = 'category/' . $categoryId . '.json';
        $resource .= '?' . $this->buildQueryString($params);
        $response = $this->getServiceResponse($resource);

        $getCategoryResponse = new Models\ResponseCategoryGet($response);

        return $getCategoryResponse->getCategory();
    }
64195
function addonsManager_getCategoryId(aSpec) {
    var spec = aSpec || { };
    var category = spec.category;

    if (!category)
      throw new Error(arguments.callee.name + ": Category not specified.");

    return category.getNode().id;
  }
1180829
def new
      @category = Category.new
  
      respond_to do |format|
        format.html # new.html.erb
        format.json { render json: @category }
      end
    end
454779
def get_netid_categories(netid, category_codes):
    
    url = _netid_category_url(netid, category_codes)
    response = get_resource(url)
    return _json_to_categories(response)
1135148
function showCategories() {
	//http://ibl.api.bbci.co.uk/ibl/v1/categories?lang=en&api_key=APIKEY
	//http://ibl.api.bbci.co.uk/ibl/v1/categories/drama-and-soaps?lang=en&api_key=APIKEY
	//http://www.bbc.co.uk/iplayer/js/categories.json
	var query = nitro.newQuery();
	query.add(ibl.commonLangEn);
	nitro.make_request(ibl.host,ibl.getCategories,ibl_key,query,{},function(obj){
		console.log();
		for (var i in obj.categories) {
			var cat = obj.categories[i];
			console.log(cat.id+' '+cat.title+' '+cat.kind);
			var sQuery = nitro.newQuery();
			sQuery.add(ibl.commonLangEn);
			//console.log(cat);
			nitro.make_request(ibl.host,ibl.getCategories2(cat.id),ibl_key,sQuery,{},function(obj){
				for (var sc in obj.category.sub_categories) {
					var subcat = obj.category.sub_categories[sc];
					console.log('  '+subcat.id+' '+subcat.contextual_title+' '+subcat.kind+' '+subcat.child_programme_count+'>'+subcat.child_episode_count);
					if (subcat.sub_categories.length>0) {
						console.log(JSON.stringify(subcat.sub_categories,null,2));
					}
				}
			});
		}
		return false;
	});
}
303189
def categories_from_path(special_dir)
      superdirs = relative_path.sub(%r!#{special_dir}(.*)!, "")
        .split(File::SEPARATOR)
        .reject do |c|
        c.empty? || c == special_dir || c == basename
      end
      merge_data!({ "categories" => superdirs }, :source => "file path")
    end