Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Take a photo of you, whenever you make a commit
#!/bin/sh
#
# Take a photo of you, whenever you make a commit
#
# This is an improved version of Víctor Martínez original post:
# http://coderwall.com/p/xlatfq
#
# Improvements:
# * This is non-blocking (you dont have to wait for your image to be taken)
# * It's plug-and-play (and creates the required folder)
# * We include the repository name (or the folder name of the repository to be exact)
# * It's not requiring ruby to run (it just uses bash)
#
#
# > brew install imagesnap
# Save this file as ~/.git_template/hooks/post-commit
# then do:
# > chmod +x ~/.git_template/hooks/post-commit
# > git config --global init.templatedir '~/.git_template'
#
# this will add the post-commit to all new repositories.
# To add to an existing one, run
# > git init
# in the repository.
#
# Want to create a cool video? Use this to assemble the pictures:
# http://www.dayofthenewdan.com/projects/tlassemble
forked_image() {
mkdir -p ~/.git_shots
imagesnap -q -w 3 ~/.git_shots/$(date +%s)_$(basename $PWD).jpg &
}
forked_image &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment