Friday, October 18, 2013

Lolcommits at Work

Last week, I gave a presentation on git hooks for my company's Hack Day. It was well received so I thought I'd do a little write up for anyone who would like to implement them in their development project.

The shiny happy people of Visible Measures!

What is a git hook?
An additional script you can execute when you git commit. Find out more.

Lolcommits
Lolcommits is a nifty little ruby gem by Matthew Rothenberg.  With Lolcommits, every time you git commit your built-in webcam will take and save a picture! In the top right of this picture will be the first bit of the commit's Secure Hash Algorithm and in the bottom will be your commit message. All the install and usage instructions for Lolcommits can be found on Github.

The git hook
Running lolcommits --enable from the terminal, whilst inside a git repository will create a file called post-commit in the hidden subdirectory .git/hooks. That file contains:


With this file in place, every time you git commit, the lolcommits --capture command will also run. Modify the post-commit file for fun gifs.


3 is the length of time, in seconds, that your camera will capture images. "Fork," forks the process so as not to tie up your terminal.

Timelapse
All your images are stored as jpgs (or gifs) in ~/.lolcommits/<your-repository-name>. You can create a timelapse of jpegs easily if you cd into that directory and run 

convert `find . -type f -name "*.jpg" -print0 | xargs -0 ls -tlr | awk '{print $9}'` timelapse.mpeg

I can't wait to document my career at Visible Measures with a super-awesome timelapse!



No comments:

Post a Comment