This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// our GraphQL Query, | |
// get the name and ID of some Starships | |
export const getStarships = gql` | |
query getStarships { | |
starshipList { | |
items { | |
name | |
id | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cache this kind of resource for an hour | |
type Person@cacheControl(maxAge: 3600) { | |
id: ID! | |
name: String! | |
height: Int | |
bio: String | |
# cache the image field for a week | |
picture: String @cacheControl(maxAge: 10080) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// using strict mode | |
var fn3 = function (a) { | |
"use strict"; | |
a = "foo" | |
console.log(arguments[0]) | |
} | |
// arguments, and the arguments object no longer track each other | |
fn3(2) // 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# deprecate a single version | |
npm deprecate [email protected] "this version is not supported any more, pelase update" | |
# deprecate everything below a version | |
# mind the double-qoutes around the version information! | |
npm deprecate my-module@"< 1.0.4" "critical bug fixed in 1.0.4, please update" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// our GraphQL Query, | |
// get the name and ID of some Starships | |
export const getStarships = gql` | |
query getStarships { | |
starshipList { | |
items { | |
name | |
id | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.no-ligature { | |
font-variant-ligatures: none; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const collect = [] | |
collect.push(Uint8Array.of(1,3,5,7)) | |
collect.push(Uint8Array.of(2,4,6,8)) | |
// ... and so on | |
// concat them in the end | |
const gif = new Blob(collect, { type: 'image/gif' }) | |
URL.createObjectURL(gif) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create a function call that looks like | |
// "myfunc(someVar, 'bar')" | |
const callExpr = j.callExpression( | |
j.identifier(‘myFunc’), | |
[ | |
j.indentifier('someVar') | |
j.literal('bar'), | |
] | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const add = function (a, b) { return a + b } | |
const addOne = add(1, ?) // will return a function, that needs one argument | |
addOne(2) // 3 | |
addOne(6) // 7 | |
[ 1,2,3 ].map(addOne) // [ 2,3,4 ] |