Class names are CamelCase
.
Methods and variables are snake_case
.
Methods with a ?
suffix will return a boolean.
function error_message { | |
echo -e >&2 \ | |
"---------------------------------------------------------------------------------------------------------" \ | |
"\n$1" \ | |
"\n---------------------------------------------------------------------------------------------------------" | |
} | |
function undo_merge { | |
error_message "Undoing your merge. Please fix the problem and try again." |
# Usage: reload-db /path/to/sqldump dbname | |
function reload-db { | |
for f in "$1"/*.sql; do | |
printf "%-${COLUMNS}s" "$f">&2; | |
cat "$f"; | |
done \ | |
| pv -s `du -sb "$1" | awk '{print $1}'` \ | |
| mysql -uroot "$2"; | |
if [ $? != 0 ]; then echo 'ERRORS!!!!!!!!!!!!!'; return $?; fi |
[diff "ruby"] | |
wordRegex = (@@?|\\b:|[^:]:)?[[:alnum:]_]+|:\"[^\"]+\"|::|[^[:space:]] | |
[diff "php"] | |
wordRegex = \\${0,2}[[:alnum:]_]+|::|->|[^[:space:]] |
[core] | |
excludesfile = /Users/ian/.gitignore | |
[color] | |
ui = auto | |
[alias] | |
co = checkout | |
st = status | |
br = branch | |
ci = commit | |
m = checkout master |
# Cumulative totals of lines added/deleted | |
git log --numstat STARTING_HASH..ENDING_HASH -M | grep '^[0-9]\+[[:space:]]\+[0-9]\+[[:space:]]' | awk '{added+=$1} {deleted+=$2} END { print added, deleted }' |
#!/bin/bash | |
# Monitors for signals from gnome-screensaver and activates or deactivates | |
# bitcoin miners accordingly. | |
# Params to the mining programs are all hardcoded. Change 'em manually. Leave the "&"s. | |
dbus-monitor --session "type='signal',interface='org.gnome.ScreenSaver',member='ActiveChanged'" | \ | |
while read line; do | |
case "$line" in |
export target=my_dir | |
git remote add "$target" file:////path/to/original/repo | |
git fetch "$target" | |
git co -b "$target" "$target/master" | |
# Probably breaks on whitespace, sorry dawg. | |
git filter-branch -f --tree-filter "mkdir -p \"$target\"; git ls-tree \$GIT_COMMIT --name-only | xargs --no-run-if-empty mv -t $target" "$target" | |
git co master | |
git merge "$target" | |
git remote remove "$target" | |
git br -d "$target" |
#!/bin/bash | |
# THE MULTI-PURPOSE NPM TROUBLESHOOTING SCRIPT | |
# Guaranteed to fix any and every problem with your npm install!** | |
# | |
# © ️Ian Young 2016 | |
# | |
# Usage: | |
# Simply run the script, passing as arguments the command that is failing. | |
# Come back in 1-45 minutes to a totally fixed npm install. |