Skip to content

Instantly share code, notes, and snippets.

View dagda1's full-sized avatar

Paul dagda1

View GitHub Profile
export type PreserveAspectRatioAlignment =
| 'xMinYMin'
| 'xMidYMin'
| 'xMaxYMin'
| 'xMinYMid'
| 'xMidYMid'
| 'xMaxYMid'
| 'xMinYMax'
| 'xMidYMax'
| 'xMaxYMax';
let isActive
if (inactive === false || (active && !inactive)) {
isActive = true
} else if (active === false || (inactive && !active)) {
isActive = false
}
// mutually exclusive string union cures this
// type State = 'ACTIVE' | 'INACTIVE';
type Service {
name: String!
ur!: String!
}
union Any = String | Float | Int | Boolean
type KeyValue {
key: String!
value: Any
{"lastUpload":"2021-01-31T09:57:25.656Z","extensionVersion":"v3.4.3"}
{
"extends": "@cutting/eslint-config/react",
"rules": {
"react-hooks/rules-of-hooks": ["error", {
"additionalHooks": "(useIsomorphicLayoutEffect)"
}],
"react-hooks/exhaustive-deps": ["error", {
"additionalHooks": "(useIsomorphicLayoutEffect)"
}]
@dagda1
dagda1 / a.ts
Created November 28, 2020 22:16
const setCount = (n: number) => {
return {
type: 'SET_COUNT',
payload: n
} as const;
}
const resetCount = () => {
return {
type: 'RESET_COUNT'
@dagda1
dagda1 / a.ts
Created November 28, 2020 22:14
const
const setCount = (n: number) => {
return <const>{
type: 'SET_COUNT',
payload: n
}
}
const resetCount = () => {
return <const>{
type: 'RESET_COUNT'
@dagda1
dagda1 / i.ts
Created September 5, 2020 22:11
export type BundlerState =
| { type: 'UNBUNDLED' }
| { type: 'BUILDING'; warnings: BundlerWarning[] }
| { type: 'GREEN'; path: string; warnings: BundlerWarning[] }
| { type: 'ERRORED'; error: BundlerError }
export type BundlerTypes = Pick<BundlerState, 'type'>['type'];
type CallBackFN<T, R> = (value: T, index: number, array: T[]) => Promise<R>;
export const flatten = <T>(arr: T[][]): T[] => {
return arr.reduce((acc, value) => acc.concat(value), [] as T[]);
};
export const asyncMap = <T, R>(arr: T[], asyncFn: CallBackFN<T, R>): Promise<R[]> => {
return Promise.all(arr.map(asyncFn));
};
feature.children = e
.flatMap(el => (notNothing(el.pickle) ? [el.pickle] : []))
.flatMap(pickle => {
let scenario = testBuilder(`scenario: ${pickle.name}`);