Skip to content

Instantly share code, notes, and snippets.

Ian Storm Taylor ianstormtaylor

Block or report user

Report or block ianstormtaylor

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ianstormtaylor / .bashrc
Created Aug 28, 2019
Aliases for nicer branching output from Git.
View .bashrc
alias gb="git branch --sort=-committerdate --verbose --format='%(HEAD) %(color:red)%(objectname:short)%(color:reset) - %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) - %(color:green)(%(committerdate:relative))%(color:reset) %(color:blue)<%(authorname)>%(color:reset)'"
alias gba="gb -a"
ianstormtaylor / collapse-regex.js
Created Mar 8, 2019
A script that takes in a regex with lots of character ranges in it and prints out a "minified" version of the regex.
View collapse-regex.js
const regexes = {
'camel-case-regexp-1': /[a-z\xB5\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u037
View with-links.json

In REST you might do a basic filter like...

GET /books?status=published

Which in GraphQL could be...

View slate-reset-on-backspace.js
import { createMatcher } from '../slate-plugin-utils'
* A Slate plugin to reset empty blocks to a default type when the user presses
* backspace at the start of a block.
* @param {Object} opts
* @property {String} defaultType
* @property {Function || Array || String} ignoreIn
ianstormtaylor / css.js
Last active Dec 20, 2016
A simple wrapper around Glamor and Classnames that gives you everything you need for simple styling.
View css.js
import classnames from 'classnames'
import { css as glamor } from 'glamor'
* A thin wrapper around `glamor` to make it return class names.
* @param {Object} object
* @return {String}
View glamor.jsx
import React from 'react'
import css from 'glamor'
import { UI } from '../constants'
const styles = {
wrapper: css`
display: table;
width: 650px;
ianstormtaylor / slate-node-portal.js
Created Sep 13, 2016
A React component example that makes it simple to position an element relative to a Slate node.
View slate-node-portal.js
import React from 'react'
import Portal from 'react-portal'
import getOffsets from 'positions'
import { findDOMNode } from 'slate'
* No-op.
* @type {Function}
ianstormtaylor / 0_reuse_code.js
Created Aug 10, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View default-key-binding-plugin.js
import { getDefaultKeyBinding } from 'draft-js'
* Handle default key bindings.
* @param {Event} event
* @return {String} defaultCommand
You can’t perform that action at this time.