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.
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
// 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 |
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
# 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: |
Remove files from a repo's history
git fetch heroku && git log heroku/master --pretty=oneline | grep $(git log -1 --format="%H") || echo 'nope'
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
// 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){}); | |
}); | |
}(); |
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
{ | |
"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" | |
} |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
# 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 |
NewerOlder