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
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
/** | |
* Registers module as CommonJS or AMD if support is found | |
* and creates an exports object for the module to use | |
* | |
* @param {boolean} cjs | |
* @param {boolean} amd | |
* @param {Object} ex | |
* @return {Object} | |
*/ | |
var exports = (function(cjs, amd, ex){ |
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 Storage(name) { | |
this.ready = new Promise((resolve, reject) => { | |
var request = window.indexedDB.open(location.origin); | |
request.onupgradeneeded = e => { | |
this.db = e.target.result; | |
this.db.createObjectStore('store'); | |
}; | |
request.onsuccess = e => { |
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
// module dependencies | |
var http = require('http'), | |
url = require('url'); | |
/** | |
* UrlReq - Wraps the http.request function making it nice for unit testing APIs. | |
* | |
* @param {string} reqUrl The required url in any form | |
* @param {object} options An options object (this is optional) |
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
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
[ | |
"AD", | |
"AR", | |
"AU", | |
"AT", | |
"BE", | |
"BO", | |
"BR", | |
"BG", | |
"CA", |
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; |
NewerOlder