Skip to content

Instantly share code, notes, and snippets.

@jbrechtel
Created January 26, 2013 00:03
Show Gist options
  • Select an option

  • Save jbrechtel/4639025 to your computer and use it in GitHub Desktop.

Select an option

Save jbrechtel/4639025 to your computer and use it in GitHub Desktop.
wget -O ~/deleting_code.mp3 https://dl.dropbox.com/u/2233/deleting_code.mp3
echo '#!/usr/bin/env ruby
deletions = `git diff HEAD --numstat`.lines.to_a.map do |l|
l.split(" ")
end.map do
|(add,del,_)| del.to_i - add.to_i
end.inject(:+).to_i
Process.fork do
`afplay #{ENV["HOME"]}/deleting_code.mp3` if deletions > 0
end' > .git/hooks/pre-commit
chmod u+x .git/hooks/pre-commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment