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 { cloneElement, FC, ReactNode, useRef } from 'react'; | |
import { getAppHasHydrated } from '../MyApp'; | |
export interface HydrateScopeProps { | |
hydrate: boolean; | |
render: () => JSX.Element | ReactNode; | |
} | |
const IS_SERVER = !process.browser; |
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
export const CACHE_STALE_AT_HEADER = 'x-edge-cache-stale-at'; | |
export const CACHE_STATUS_HEADER = 'x-edge-cache-status'; | |
export const CACHE_CONTROL_HEADER = 'Cache-Control'; | |
export const CLIENT_CACHE_CONTROL_HEADER = 'x-client-cache-control'; | |
export const ORIGIN_CACHE_CONTROL_HEADER = 'x-edge-origin-cache-control'; | |
enum CacheStatus { | |
HIT = 'HIT', | |
MISS = 'MISS', | |
REVALIDATING = 'REVALIDATING', |
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
performance.mark('myMark-start'); | |
// your code | |
performance.mark('myMark-end'); | |
performance.measure('myPerfMarker', 'myMark-start', 'myMark-end'); |
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 { isIos } from '~/lib/device/utils'; | |
const fallback = (text: string) => { | |
const textarea = document.createElement('textarea'); | |
// create textarea | |
textarea.value = text; | |
// ios will zoom in on the input if the font-size is < 16px | |
textarea.style.fontSize = '20px'; |
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 { useRef, CSSProperties } from 'react'; | |
import withSpacing, { WithSpacingProps } from '~/lib/hocs/withSpacing'; | |
import useTestIdAttr from '~/lib/hooks/useTestIdAttr'; | |
import { getAspect } from './utils'; | |
import { ImageProps } from '.'; | |
interface BackgroundImageProps extends ImageProps, WithSpacingProps { | |
gradient?: string; | |
borderRadius?: number | 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
const useFoo = () => { | |
const [bar, setBar] = useState(false); | |
const [baz, setBaz] = useState(false); | |
// should not trigger MyComponent to re-render | |
useEffect(() => { | |
setTimeout(() => setBar(true), 1000); | |
}, []); | |
// should trigger MyComponent to re-render |
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
<html> | |
<head> | |
… | |
</head> | |
<body> | |
… | |
<script type="text/javascript"> | |
window.addEventListener('error', function(error) { | |
if (error.target instanceof HTMLScriptElement) { | |
const script = error.target; |
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
tar --exclude=node_modules -cf - . | md5sum |
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 fallback = (text) => { | |
const isIos = navigator.userAgent.match(/ipad|iphone/i); | |
const textarea = document.createElement('textarea'); | |
// create textarea | |
textarea.value = text; | |
// ios will zoom in on the input if the font-size is < 16px | |
textarea.style.fontSize = '20px'; | |
document.body.appendChild(textarea); |
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
[ | |
"AD", | |
"AR", | |
"AU", | |
"AT", | |
"BE", | |
"BO", | |
"BR", | |
"BG", | |
"CA", |
NewerOlder