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
# garbage | |
- Object syntax kind of ridiculous. Obscure and unintuitive. | |
# mid | |
- for loop syntax unnecessarily bespoke | |
- Optional field and optional labelled function argument syntax is weird, but I could get used to it | |
- Why the hell are we using JavaScripts Array interface. WTF | |
- Rescript vs JS exceptions are fundamental distinct concepts, why are they not distinct modules? | |
- == for deep equality check is pretty nuts, ~= would have been better |
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 { pipe, tap } from "wonka"; | |
import { Exchange } from "urql"; | |
import { | |
IntrospectionListTypeRef, | |
IntrospectionNamedTypeRef, | |
IntrospectionQuery, | |
IntrospectionType, | |
IntrospectionTypeRef, | |
Kind, | |
OperationDefinitionNode, |
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 disableTimeout = 999999999; | |
Cypress.Commands.add( | |
"shouldFor", | |
( | |
condition, | |
requiredDuration, | |
{ | |
name = "Condition", | |
interval = 10, |
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 { | |
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 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
type A = number; | |
type B = string; | |
type Lists = { | |
a: A[]; | |
b: B[]; | |
}; | |
export const selectList = <ListName extends keyof Lists>( | |
listName: ListName |
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 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 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 { 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 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
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 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 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); |
NewerOlder