Skip to content

Instantly share code, notes, and snippets.

@thomd
Last active September 2, 2017 16:59
Show Gist options
  • Select an option

  • Save thomd/e95f38dd7c376312bd94 to your computer and use it in GitHub Desktop.

Select an option

Save thomd/e95f38dd7c376312bd94 to your computer and use it in GitHub Desktop.
git hooks
#!/bin/sh
# take a picture and play happykids.wav (http://collectiveidea.com/assets/4c58e4c1dabe9d50eb000087/happykids.wav)
# from: collectiveidea.com/blog/archives/2010/08/03/happy-git-commits
imagesnap -q ~/.gitshots/$(date +"%Y-%m-%d_%H:%M:%S")_$(basename `pwd`).jpg & afplay ~/Music/happykids.wav > /dev/null 2>&1 &
#!/bin/zsh
function lintit () {
OUTPUT=$(git diff --name-only | grep -E '(.js)$')
a=("${(f)OUTPUT}")
e=$(eslint -c eslint.json $a)
echo $e
if [[ "$e" != *"0 problems"* ]]; then
echo "ERROR: Check eslint hints."
exit 1 # reject
fi
}
lintit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment