View useRequestStatus.js
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 {useState} from 'react'; | |
export const requestStatus = { | |
IDLE: 'IDLE', | |
PENDING: 'PENDING', | |
REJECTED: 'REJECTED', | |
FULFILLED: 'FULFILLED', | |
}; | |
export const useRequestStatus = () => { |
View load-script.ts
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 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>; |
View unit.js
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 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', |
View example.js
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
var gulp = require('gulp'); | |
var bemLinter = require('postcss-bem-linter'); | |
var atImport = require('postcss-import'); | |
var cssnext = require('cssnext'); | |
var postcss = require('gulp-postcss'); | |
var concat = require('gulp-concat'); | |
var notify = require('gulp-notify'); | |
var stylus = require('gulp-stylus'); | |
gulp.task('css', function() { |
View with-feature-detect.js
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.exports = withFeatureDetect; | |
function withFeatureDetect() { | |
'use strict'; | |
this.addFeatureDetectClass = function(feature, supported) { | |
var prefix = (supported ? 'is-' : 'is-not-'); | |
this.$node.addClass(prefix + feature + '-enabled'); | |
}; |
View space.styl
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
/** | |
* Spacing utilities | |
* | |
* 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 | |
* <div class="u-m25"> // margin: 25px |
View function-bind.js
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.prototype.bind = (function() { | |
}).bind || function(b) { | |
if (typeof this !== "function") { | |
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); | |
} | |
function c() { | |
} | |
var a = [].slice, f = a.call(arguments, 1), e = this, d = function() { | |
return e.apply(this instanceof c ? this : b || window, f.concat(a.call(arguments))); |
View utils-size.scss
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
/** | |
* 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 | |
*/ |
View hotkeys.md
Bash Keyboard Shortcuts - Mac
Enable Option Key as Meta
in iTerm. Set as Esc+
- http://stackoverflow.com/a/438892
Moving the cursor
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)
NewerOlder