This file contains hidden or 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
LOCAL_IP=$(ip route get 8.8.8.8 | awk '{print $NF; exit}') | |
t() { | |
tmux send-keys -t $1 "$2" 'C-m' | |
} | |
tmux new-session -d | |
tmux split-window -v -p 100 | |
tmux split-window -v -p 100 | |
tmux split-window -v -p 100 |
This file contains hidden or 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 fs from 'fs'; | |
class FSError extends Error {} | |
const readFile = (...args) => | |
new Promise((resolve, reject) => { | |
fs.readFile(...args, (err, data) => { | |
if (err) { | |
return reject(new FSError(err)); | |
} |
This file contains hidden or 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 myPromise = new Promise((res) => setTimeout(res, 10)); | |
myPromise | |
.then(() => { throw new Error('shit\'s fucked'); }) | |
.then(() => console.log('won\'t ever run')) | |
.catch(err => console.log('how is shit?', err)) | |
.then(() => console.log('will run')) | |
.then(() => { throw new Error('some other error'); }) | |
.then(() => console.log('won\'t run')) |
This file contains hidden or 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 fs = require('fs-extra'); | |
const path = require('path'); | |
function isRepo(folder) { | |
const contents = fs.readdirSync(folder); | |
return contents.includes('.git'); | |
} | |
function parseConfig(config) { | |
const output = {} |
This file contains hidden or 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
# File activerecord/lib/active_record/enum.rb, line 146 | |
# https://github.com/rails/rails/blob/919a876a04d991bb5a984314ca985168cfbbbef5/activerecord/lib/active_record/enum.rb#L146 | |
# rails 5 backport so we can get the _prefix and _suffix features | |
if Rails::VERSION::MAJOR < 5 | |
module ActiveRecord | |
module Enum | |
def enum(definitions) | |
klass = self | |
enum_prefix = definitions.delete(:_prefix) |
This file contains hidden or 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
// ==UserScript== | |
// @name Github Whitespace | |
// @namespace http://deecewan.com/ | |
// @version 0.1 | |
// @description Add a checkbox to the Github Compare screen to ignore white space. | |
// @author David Buchan-Swanson | |
// @match https://github.com/*/*/compare/* | |
// @grant none | |
// ==/UserScript== |
This file contains hidden or 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
SHELL=zsh | |
.PHONY: all copy clean | |
all: copy out/main.tex | |
clean: | |
rm -r out/* | |
copy: | |
zsh -c 'setopt extendedglob; cp -r src/^(template.tex|*.md) out/' |
This file contains hidden or 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
# ... | |
brw() { | |
brew $@ | |
brew list --versions | perl -pe 's/([\w-(@\d\.\d)]+).*/$1/' > $CONFIG/brew_installed.txt | |
} | |
restore_from_brew() { | |
cat $CONFIG/brew_installed.txt | xargs brew install | |
} |
This file contains hidden or 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
Show hidden characters
{ | |
"presets": [["env", { | |
"targets": { | |
"node": 6.9 | |
} | |
}], "stage-0"], | |
"plugins": [ | |
"babel-plugin-syntax-trailing-function-commas", | |
"babel-plugin-transform-class-properties", | |
"babel-plugin-transform-flow-strip-types", |
This file contains hidden or 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 | |
const join = require('path').join; | |
const read = require('fs').readFileSync; | |
const args = process.argv.slice(2); | |
const fnName = args[0]; | |
const payload = args[1]; | |
const fileBuffer = read(join(__dirname, 'payloads', `${payload}.json`)); |