Skip to content

Instantly share code, notes, and snippets.

@mattfinlayson
Created June 16, 2014 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattfinlayson/7d20977c696107593b50 to your computer and use it in GitHub Desktop.
Save mattfinlayson/7d20977c696107593b50 to your computer and use it in GitHub Desktop.
Prints a command line graph of when people commit: git log --pretty="format:%ai,%an"| ~/gitty.rb Assembled from an old 37signals post.
#!/usr/bin/ruby
require 'date';
people = {};
ARGF.each_line {
|l| time, author = l.split(',');
people[author] ||= Array.new(24, 0);
hour = DateTime.parse(time).hour;
people[author][hour] += 1;
};
people.each_pair {
|name, times| puts name;
tot = times.inject(0) {
|sum, t| sum + (t || 0)
};
times.each_with_index {
|t, i| puts i.to_s.rjust(2) + ': ' + '█' * (t.to_f/tot * 100).round
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment