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 { pipe, tap } from "wonka"; | |
import { Exchange } from "urql"; | |
import { | |
IntrospectionListTypeRef, | |
IntrospectionNamedTypeRef, | |
IntrospectionQuery, | |
IntrospectionType, | |
IntrospectionTypeRef, | |
Kind, | |
OperationDefinitionNode, |
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
const disableTimeout = 999999999; | |
Cypress.Commands.add( | |
"shouldFor", | |
( | |
condition, | |
requiredDuration, | |
{ | |
name = "Condition", | |
interval = 10, |
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 { | |
useContext, | |
useState, | |
createContext, | |
useRef, | |
PropsWithChildren, | |
} from "react"; | |
import { useInterval } from "../hooks/useInterval"; | |
import { useApi } from "./ApiProvider"; | |
import { AuthTokens } from "../api/types/AuthTokens"; |
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
type A = number; | |
type B = string; | |
type Lists = { | |
a: A[]; | |
b: B[]; | |
}; | |
export const selectList = <ListName extends keyof Lists>( | |
listName: ListName |
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 React from "react"; | |
import { createTemplateComponent } from "./createTemplateComponent"; | |
/** | |
* Form elements displayed as a list by default but with customizable template. | |
*/ | |
export const Form = createTemplateComponent( | |
renderElements, | |
({foo, bar, baz, other}) => ( | |
<ul> |
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 { EffectCallback, useEffect } from 'react'; | |
export const usePureEffect = <T extends EffectCallbackWithParams>( | |
effect: T, | |
...params: Parameters<T> | |
) => useEffect(() => effect.apply(null, params), params); | |
type EffectCallbackWithParams = (...args: any) => ReturnType<EffectCallback>; |
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 slide = document.querySelectorAll('.slideUp'); | |
slide.forEach(function (el) { | |
el.addEventListener('click', function () { | |
let parent = el.parentElement; | |
let links = parent.querySelectorAll('.link'); | |
let rotationTranform = 'rotate(45deg)'; | |
let isRotated = el.style.transform === rotationTranform; | |
if (!isRotated) { | |
el.style.transform = rotationTransform; |
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
const container = document.getElementById('container'); | |
const element1 = document.createElement('div'); | |
const element2 = document.createElement('div'); | |
if (element2.classList.contains('specific')) { | |
container.prepend(element1); | |
container.prepend(element2); | |
} else { | |
container.prepend(element2); |
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 React from 'react'; | |
const hoistNonReactStatic = require('hoist-non-react-statics'); | |
/** | |
* Decorator to form a HOC that acts like a react context consumer. | |
* Useful when you want context to be made available in an entire component and not just in render. | |
* | |
* Example: | |
* type MyContextProps = {foo: string}; | |
* const MyContext = createContext<MyContextProps>({foo: 'bar'}); |
NewerOlder