made with esnextbin
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 PIN = 1234; | |
| const pinMachine = Machine({ | |
| id: "wizard", | |
| context: { | |
| phone: "", | |
| pin: "", | |
| retries: 0 | |
| }, | |
| initial: "phone", | |
| states: { |
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 UserMachine = () => {}; | |
| Machine( | |
| { | |
| id: 'Get UserI', | |
| initial: 'idle', | |
| context: { | |
| user: null, | |
| retries: 0, | |
| maxRetries: 3, | |
| }, |
This file has been truncated, but you can view the full file.
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
| [ | |
| { | |
| "name": "les Escaldes", | |
| "country": "Andorra", | |
| "subcountry": "Escaldes-Engordany", | |
| "geocode": "3040051" | |
| }, | |
| { | |
| "name": "Andorra la Vella", | |
| "country": "Andorra", |
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
| // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions |
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
| export const userType = ` | |
| type User { | |
| id: Int! | |
| title: String! | |
| } | |
| `; | |
| export const resolveUserData() { | |
| return someFunctionThatGetsData(); | |
| } |
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
| export default function(babel) { | |
| const { types: t } = babel; | |
| return { | |
| visitor: { | |
| VariableDeclaration(path) { | |
| const node = path.node; | |
| if (node.declarations && node.declarations.length === 1) { | |
| const [{ init }] = node.declarations; | |
| if (t.isTemplateLiteral(init)) { |
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
| { | |
| "1": [ | |
| [1, 2], | |
| [1, 3], | |
| [1, 9], | |
| [1, 6], | |
| [1, 3], | |
| [1, 9], | |
| [1, 6], | |
| [1, 5], |
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
| import gql from 'graphql-tag'; | |
| import { pick } = 'lodash' | |
| function routeql({ query = {}, params = [], method, apiPrefix = "" }) { | |
| const ast = gql` | |
| ${query} | |
| `; | |
| if ( | |
| ast.definitions.length > 1 || | |
| ast.definitions[0].selectionSet.selections.length > 1 |
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
| export default function subscribableRequest({ baseUrl }) { | |
| let subscriptions = {}; | |
| return { | |
| fetch: ({ endpoint, ...rest }) => ( | |
| fetch(`${baseUrl}/${endpoint}`, ...rest) | |
| .then(res => res.json()) | |
| .then(res => { | |
| subscriptions[endpoint] && | |
| subscriptions[endpoint].forEach(sub => sub(res)); | |
| return res; |
NewerOlder