Remove files from a repo's history
git fetch heroku && git log heroku/master --pretty=oneline | grep $(git log -1 --format="%H") || echo 'nope'
# Match query params on some url somewhere in a text [actually a mail.body, hence the to_s] | |
# Not tested in production | |
RSpec::Matchers.define :include_query_params do |expected| | |
match do |actual| | |
query_finder = /http\S+\?(\S+)["\s'>]/ | |
queries = query_finder.match actual.to_s | |
queries.captures.any? do |q| | |
q_hash = Rack::Utils.parse_nested_query(q).symbolize_keys | |
q_hash.merge(expected) == q_hash | |
end |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
{ | |
"scripts": { | |
"jshint:branch": "jshint $(git diff --name-only --diff-filter=ACMRTUXB $(git merge-base head master) | grep '.js$') || true", | |
"jshint:diff": "jshint $(git diff --name-only --diff-filter=ACMRTUXB | grep '.js$') || true", | |
"jshint:prev": "jshint $(git diff head~1 --name-only --diff-filter=ACMRTUXB | grep '.js$') || true", | |
"coffeelint:diff": "coffeelint $(git diff --name-only --diff-filter=ACMRTUXB | grep '.coffee$') || true" | |
} |
// Save as a bookmarklet | |
// unhides out of date comments on a Github PR, coloring the title bars in these code blocks. | |
javascript:void function(){ | |
document.querySelectorAll(".show-outdated-button").forEach(function(button){ | |
var banner = button.parentNode; | |
button.click(); | |
banner.style.backgroundColor = '#e2d2ff'; | |
banner.childNodes.forEach(function(child){}); | |
}); | |
}(); |
Remove files from a repo's history
git fetch heroku && git log heroku/master --pretty=oneline | grep $(git log -1 --format="%H") || echo 'nope'
sudo lsof | grep -i kernel
# also works for accountsd
# =>
# KernelEve 118 root txt REG 1,4 662257664 20143772 /private/var/db/dyld/dyld_shared_cache_x86_64h
# 7th col '662257...' is file size (big). in this case it is dyld shared cache, related to xcode.
# CLOSURES IN RUBY Paul Cantrell http://innig.net | |
# Email: username "cantrell", domain name "pobox.com" | |
# I recommend executing this file, then reading it alongside its output. | |
# | |
# Alteratively, you can give yourself a sort of Ruby test by deleting all the comments, | |
# then trying to guess the output of the code! | |
# A closure is a block of code which meets three criteria: |
// currently this assumes every input is a string | |
export interface InputStrings { | |
[everyProp: string]: string | |
} | |
type ValidationRule = (val: string) => boolean | |
type Errors<Inputs> = Partial<{ [P in keyof Inputs]: string }> | |
type Validator = (val: string) => string | void | |
type MakeValidator = (msg?: string) => Validator | |
type MakeValidatorWithArg = (arg: any, msg?: string) => Validator |
#!/usr/bin/env bash | |
# Start your built mycoolservice image with a bind mount on its source files in your ./myservice folder | |
DIR=$(dirname "$0") # relative | |
ROOT="$( cd "$DIR/.." && pwd )" # root, absolutized and normalized | |
Start the backend (docker) | |
cmd="docker run -p 8000:8000"\ | |
" --mount src=$ROOT/myservice,target=/code,type=bind"\ |
I hereby claim:
To claim this, I am signing this object: