Enable Option Key as Meta
in iTerm. Set as Esc+
- http://stackoverflow.com/a/438892
Ctrl + a
Go to the beginning of the line (Home)Ctrl + e
Go to the End of the line (End)Ctrl + p
Previous command (Up arrow)Ctrl + n
Next command (Down arrow)
Enable Option Key as Meta
in iTerm. Set as Esc+
- http://stackoverflow.com/a/438892
Ctrl + a
Go to the beginning of the line (Home)Ctrl + e
Go to the End of the line (End)Ctrl + p
Previous command (Up arrow)Ctrl + n
Next command (Down arrow)import {retry} from './retry'; | |
jest.spyOn(global, 'setTimeout'); | |
test('retries a function and increases the backoff for each failure', async () => { | |
const rejectingFunc = jest.fn( | |
(() => { | |
let failCount = 5; | |
return () => { | |
if (failCount === 0) { |
const scripts = new Map<string, Promise<unknown>>(); | |
export function loadScript( | |
src: string, | |
additionalScriptAttrs: Record<string, string> = {} | |
): Promise<unknown> { | |
if (scripts.has(src)) { | |
// TypeScript cannot narrow down type with `has` | |
// https://github.com/microsoft/TypeScript/issues/13086 | |
return scripts.get(src) as Promise<unknown>; |
function deparam(str) { | |
var o = {}; | |
var reg = /\\?([^?=&]+)(=([^&#]*))?/g; | |
str.replace(reg, function($0, $1, $2, $3) { | |
if (typeof $3 == 'string') { | |
o[decodeURIComponent($1)] = decodeURIComponent($3); | |
} | |
}); |
import {useState} from 'react'; | |
export const requestStatus = { | |
IDLE: 'IDLE', | |
PENDING: 'PENDING', | |
REJECTED: 'REJECTED', | |
FULFILLED: 'FULFILLED', | |
}; | |
export const useRequestStatus = () => { |
// UMD dance - https://github.com/umdjs/umd | |
!function(root, factory) { | |
if (typeof define === 'function' && define.amd) { | |
define(['jquery'], factory); | |
} else { | |
factory(root.jQuery); | |
} | |
}(this, function($) { | |
'use strict'; |
/** | |
* Spacing classes | |
* | |
* Used to override styles on components without need for | |
* additional modifier classes | |
* | |
* Usage: | |
* <div class="u-mbZ"> // margin-bottom: 0 | |
* <div class="u-mt20"> // margin-top: 20px | |
*/ |
const tape = require('tape'); | |
const test = require('tape-css')(tape); | |
const h = require('hyperscript'); | |
const getStyle = require('computed-style'); | |
const $ = selector => document.querySelector(selector); | |
const styles = require('./my-component.css'); | |
const dom = () => ( | |
h('div.MyComponent', |
module.exports = withAjax; | |
function withAjax() { | |
'use strict'; | |
this.get = function(url, options) { | |
this.ajax(url, options, 'get'); | |
}; | |
this.post = function(url, options) { |