Standard escape codes are prefixed with Escape
:
- Ctrl-Key:
^[
- Octal:
\033
- Unicode:
\u001b
- Hexadecimal:
\x1B
- Decimal:
27
Apache License | |
Version 2.0, January 2004 | |
http://www.apache.org/licenses/ | |
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | |
1. Definitions. | |
"License" shall mean the terms and conditions for use, reproduction, |
/** | |
* @description | |
* Support patch-package in pnpm projects. | |
* | |
* `pnpm` can be tricky to use with patch-package. To minimize friction creating patches, | |
* this script helps automate patching by using npm and a temp workspace to generate | |
* patch files. | |
* | |
* @usage | |
* 0. ensure the dependencies of interest are top level dependencies/devDependencies (no patching transitive deps) |
/* Using a JavaScript proxy for a super low code REST client */ | |
// via https://dev.to/dipsaus9/javascript-lets-create-aproxy-19hg | |
// also see https://towardsdatascience.com/why-to-use-javascript-proxy-5cdc69d943e3 | |
// also see https://github.com/fastify/manifetch | |
// also see https://github.com/flash-oss/allserver | |
// and https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb | |
const createApi = (url) => { | |
return new Proxy({}, { | |
get(target, key) { |
function compress(string, encoding) { | |
const byteArray = new TextEncoder().encode(string); | |
const cs = new CompressionStream(encoding); | |
const writer = cs.writable.getWriter(); | |
writer.write(byteArray); | |
writer.close(); | |
return new Response(cs.readable).arrayBuffer(); | |
} | |
function decompress(byteArray, encoding) { |
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', |
import { debounce } from 'lodash'; | |
import axios from 'axios'; | |
// or vanilla debounce | |
// const debounce = (func, timeOut) => { | |
// let timer | |
// | |
// return (...args) => { | |
// if (timer) clearTimeout(timer) | |
// timer = setTimeout(func, timeOut) |
let NETWORK_PRESETS = { | |
'GPRS': { | |
'offline': false, | |
'downloadThroughput': 50 * 1024 / 8, | |
'uploadThroughput': 20 * 1024 / 8, | |
'latency': 500 | |
}, | |
'Regular2G': { | |
'offline': false, | |
'downloadThroughput': 250 * 1024 / 8, |
These libraries can be used to quickly create a GUI for configureable parameters using sliders, checkboxes, colors pickers etc
import React, { Component, createContext } from 'react' | |
function initStore(store) { | |
const Context = createContext(); | |
class Provider extends React.Component { | |
constructor() { | |
super(); | |
this.state = store.initialState; | |
} |