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
let currentListener = undefined; | |
function createSignal(initialValue) { | |
let value = initialValue; | |
const subscribers = new Set(); | |
const read = () => { | |
if (currentListener !== undefined) { | |
subscribers.add(currentListener); |
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
function toRawType (value) { | |
let _toString = Object.prototype.toString; | |
let str = _toString.call(value) | |
return str.slice(8, -1) | |
} | |
toRawType('test') === 'String' |
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
function generatePipeline(pipelines = []) { | |
const callable = () => {}; | |
callable.pipelines = pipelines; | |
return new Proxy(callable, { | |
get(callable, propKey) { | |
return (props) => { | |
if (propKey === 'run') { | |
return callable.pipelines; | |
} | |
callable.pipelines.push({ [`$${propKey}`]: props }); |
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
npx autocannon -c10 -d5 'http://localhost:4040/graphql' -m 'POST' --headers 'Authorization: <Token>' --headers 'Content-Type: application/json' --body '<body>' |
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 { useReducer, useCallback } from 'react'; | |
export const INITIAL_STATE = {}; | |
function formReducer(state, action) { | |
switch (action.type) { | |
case '__reset__': | |
return INITIAL_STATE; | |
case action.type: | |
return { | |
...state, |
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 { useReducer, useCallback, useRef, useEffect } from 'react'; | |
import cond from 'lodash/cond'; | |
import includes from 'lodash/fp/includes'; | |
import stubTrue from 'lodash/stubTrue'; | |
const initialState = { | |
response: null, // could be whatever type of response they are ,expecting | |
loading: false, | |
success: false, | |
error: false, |