Skip to content

Instantly share code, notes, and snippets.

const cheerio = require('cheerio')
const $ = cheerio.load('<h2 class="title">Hello world</h2>')
$('h2.title').text('Hello there!')
$('h2').addClass('welcome')
$.html()
//=> <h2 class="title welcome">Hello there!</h2>
var collection=[{"category":"version control",url:"https://www.github.com"},{"category":"search engine",url:"https://www.google.com"}];
//Provide key value pair in which key is old key and value is new key(renamed key)
var newKeys={"category":"type"};
var isAllowKeyOverwrite=false;
// By default isAllowKeyOverwrite is true in utils, you can override by pssing appropriate flag
var newCollection=DTO.mapTo(collection,newKeys,isAllowKeyOverwrite);
@anomepani
anomepani / data.json
Created August 16, 2018 09:57 — forked from erquhart/data.json
Staticgen.org development caching
{"BrandonRomano/static-lite":{"17550":{"size":69,"stargazers_count":25,"watchers_count":25,"forks_count":5,"open_issues_count":1,"forks":5,"open_issues":1,"watchers":25,"network_count":5,"subscribers_count":4}},"Frozen-Flask/Frozen-Flask":{"17550":{"size":323,"stargazers_count":510,"watchers_count":510,"forks_count":47,"open_issues_count":15,"forks":47,"open_issues":15,"watchers":510,"network_count":47,"subscribers_count":18}},"tightenco/jigsaw":{"17550":{"size":1678,"stargazers_count":730,"watchers_count":730,"forks_count":84,"open_issues_count":22,"forks":84,"open_issues":22,"watchers":730,"network_count":84,"subscribers_count":34}},"JavaEden/Orchid":{"17550":{"size":19747,"stargazers_count":5,"watchers_count":5,"forks_count":2,"open_issues_count":27,"forks":2,"open_issues":27,"watchers":5,"network_count":2,"subscribers_count":1}},"wiztools/stagen":{"17550":{"size":151,"stargazers_count":38,"watchers_count":38,"forks_count":19,"open_issues_count":1,"forks":19,"open_issues":1,"watchers":38,"network_count":19
@anomepani
anomepani / tutorial.md
Created July 29, 2018 14:21 — forked from swalkinshaw/tutorial.md
Designing a GraphQL API

Tutorial: Designing a GraphQL API

This tutorial was created by Shopify for internal purposes. We've created a public version of it since we think it's useful to anyone creating a GraphQL API.

It's based on lessons learned from creating and evolving production schemas at Shopify over almost 3 years. The tutorial has evolved and will continue to change in the future so nothing is set in stone.