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
// ==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 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 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 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 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 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 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
let myVar = 1; | |
function deleteIfBad() { | |
if (myVar > 1) { | |
deleteProductionDatabase(); | |
} | |
} |
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 doSomething() { | |
myVar = 3; | |
if (someCondition) { | |
myVar = 4; | |
} | |
} |
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
Error: node_modules/redux-persist/es/persistStore.js.flow:67 | |
67: persistor.purge = () => { | |
^^^^^ property `purge`. Property not found in | |
67: persistor.purge = () => { | |
^^^^^^^^^ object type | |
Error: node_modules/redux-persist/es/persistStore.js.flow:78 | |
78: persistor.flush = () => { | |
^^^^^ property `flush`. Property not found in | |
78: persistor.flush = () => { |
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 with_amazon_keys() { | |
local chosen_profile=$1 | |
if [ $# -gt 0 ]; then | |
shift; | |
fi; | |
local AWS_CREDENTIAL_LOCATION="$HOME/.aws/credentials" | |
local old_ifs="$IFS" | |
local IFS=$'\n' | |
local aws_credentials=("${(@f)$(cat $AWS_CREDENTIAL_LOCATION)}") |