This file contains 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
import { graphql } from 'graphql'; | |
import * as fetch from 'isomorphic-fetch'; | |
interface IResponse<T> { | |
data: T; | |
} | |
export default class GraphqlClient { | |
private static clientInstance: GraphqlClient; |
This file contains 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
await sendWelcomeEmail(...); | |
client.doOperation('mutation', 'mutation editUser ($welcomeEmailSent: true) { ... }'); |
This file contains 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
{ | |
"listings" : [ | |
{ | |
"highlights" : [ | |
"857 SQM WITH 60M FRONTAGE", | |
"60K HOLDING INCOME", | |
"ENORMOUS POTENTIAL" | |
], | |
"price" : 859000, | |
"mainPhoto" : { |
This file contains 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
Show hidden characters
{ | |
"compilerOptions": { | |
"outDir": "./lib/", | |
"module": "commonjs", | |
"target": "es5", | |
"jsx": "react", | |
"typeRoots": [ | |
"custom-types/**/*" | |
], | |
"types": [ |
This file contains 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
functions: | |
heartbeat: | |
handler: lib/endpoints/heartbeat.heartbeat | |
events: | |
- http: | |
path: heartbeat | |
method: get | |
... |
This file contains 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
import Utils from 'utils'; | |
import { expect } from 'chai'; | |
import { myFunc, myOtherFunctionWhichCallsUtl } from 'myModule'; | |
describe('My awesome suite', () => { | |
it('should produce proper output', () => { | |
const actual = myFunc(arg1, arg2, arg3); | |
const expected = { foo: 'bar' } | |
expect(actual).to.eql(expected); |
This file contains 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
// @t "produces output" myFunc('foo', 'bar', 'baz') ~equals {'foo': 'bar'} | |
export function myFunc(arg1, arg2, arg3) { | |
/* ... function content ... */ | |
} | |
// @t "calls util" myOtherFunctionWhichCallsUtil(spy('util')) ~expect spy('util').calledOnce | |
export function myOtherFunctionWhichCallsUtil(utilFn = Utils.utilFunction) { | |
/* ... function content ... */ | |
utilFn(); | |
} |
This file contains 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
// @t "foo" foo(1) ~does-my-domain-specific-stuff | |
export function foo(arg) { | |
// does something domain specific | |
} | |
// @t "foo" foo(1) ~does-my-domain-specific-stuff | |
export function bar(arg) { | |
// does something domain specific, similar to foo() | |
} |
This file contains 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
export const Person = props => | |
<div> | |
<span>{props.firstName}</span> | |
<span>{props.lastName}</span> | |
{ | |
props.age > 18 ? | |
'Adult' : 'NotAdult' | |
} | |
</div> |
This file contains 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
import * as AWS from "aws-sdk"; | |
const configureBucketLifecycle = (s3, bucketName): Promise<void> => { | |
return new Promise((resolve, reject) => { | |
s3.putBucketLifecycleConfiguration({ | |
Bucket: bucketName, | |
LifecycleConfiguration: { | |
Rules: [ | |
{ | |
ID: "Purge if older than 30 days", |