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 AbortablePromise (fn) { | |
var abortHandler; | |
function onAbort (abortFn) { | |
abortHandler = abortFn; | |
} | |
var promise = new Promise(function (resolve, reject) { | |
fn.call(null, resolve, reject, onAbort); |
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
Verifying I am +ricardobeat on my passcard. https://onename.com/ricardobeat |
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
Promise.prototype.spread = function (fn) { | |
this.then(function (values) { | |
fn.apply(this, values) | |
}) | |
} | |
function when () { | |
var requirements = Array.prototype.slice.call(arguments, 0) | |
return Promise.all(requirements.map(function(name){ |
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 () { | |
var doc = document.documentElement | |
var IE7 = navigator.userAgent.indexOf('MSIE 7') > 0 | |
logpane = document.createElement('div') | |
var height = 180 | |
var width = 480 | |
document.body.appendChild(logpane) | |
logpane.style.background = '#fff' | |
logpane.style.padding = '10px' | |
logpane.style.position = IE7 ? 'absolute' : 'fixed' |
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
#!/usr/bin/env node | |
var fs = require('fs') | |
var path = require('path') | |
var dir = process.argv[2] | |
if (!dir) throw new Error('Usage: ./chess.js path-to-pgn-files/ ') | |
var white = 0 | |
var black = 0 |
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 _e () { | |
local color; local escape; local newline; local bold=0 | |
if [[ $1 == "bold" ]]; then | |
shift; bold=1 | |
fi | |
case $1 in | |
white ) color=37 ;; | |
red ) color=31 ;; | |
green ) color=32 ;; | |
yellow ) color=33 ;; |
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
[alias] | |
lg = log -20 --graph --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn\\ %C(cyan)%cr]" --decorate --abbrev-commit --date=relative | |
who = shortlog -sn | |
dip = diff --patience | |
stat = status -sb | |
snapshot = !git stash save "snapshot: $(date)" && git stash apply "stash@{0}" | |
word = diff --word-diff=color | |
up = "!git fetch --all -p && git rebase @{u}" | |
mine = "!git lg --author=\"$(git config user.name)\"" | |
aliases = "!git config --list | grep alias | cut -c 7- | sed 's/=//' | column -t -s ''" |
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(global){ | |
var library = {} | |
var instances = {} | |
function define (name, factory) { | |
if (library[name]) { | |
throw new Error('Module '+ name +' already registered.') | |
} | |
library[name] = factory |
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
#!/bin/bash | |
# | |
# Open all changed files in Sublime Text | |
# | |
# Install: | |
# save this file to /usr/local/bin/git-open | |
# chmod +x /usr/local/bin/git-open | |
# | |
# It will now be available as 'git open' | |
# |
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
git ls-files | grep $1 | sed s%`git rev-parse --show-prefix`%% |