Here is a command for TextMate’s Git bundle, that’s, well, kind of useless but makes me happy. The code comes from Chris on the GitHub IRC:
require 'time'
lines = `git log --pretty=format:%ai`
times = lines.map { |l| Time.parse l }
dots = []
0.upto(7) { |wday|
0.upto(23) { |hour|
dots << [hour, wday, times.find_all { |t| t.hour == hour && t.wday == wday }.size]
}
}
max = dots.map { |h,w,c| c }.max
puts "http://chart.apis.google.com/chart?chs=800x300&chds=-1,24,-1,7,0,#{max}&chf=bg,s,efefef&chd=t:#{dots.transpose.map { |c| c.join(",") }.join("|")}&chxt=x,y&chm=o,333333,1,1.0,25.0&chxl=0:||12am|1|2|3|4|5|6|7|8|9|10|11|12pm|1|2|3|4|5|6|7|8|9|10|11||1:||Sun|Mon|Tue|Wed|Thr|Fri|Sat|&cht=s"
Save this in a file called gitlog.rb. The script generates a URL that calls the Google Chart API. Assuming that gitlog.rb is in ~/bin (put it wherever you like), open the Bundle Editor and create the following TextMate command:
URL=`ruby ~/bin/gitlog.rb`
echo "<meta http-equiv='Refresh' content='0;
URL=$URL'>"
with the following settings:
- Save: Nothing
- Input: None
- Output: Show as HTML
- Activation: Key Equivalent ⌃⇧G

Calling the command produces the following chart that plots the number of commits you made per hour to your Git repository:

Post a Comment