Skip to content

Instantly share code, notes, and snippets.

@charroch
Created May 12, 2011 14:34
Show Gist options
  • Save charroch/968614 to your computer and use it in GitHub Desktop.
Save charroch/968614 to your computer and use it in GitHub Desktop.
gitlog
#!/usr/bin/ruby
require 'rubygems'
require 'git'
g = Git.open(".")
log = g.log(10000)
c = log.collect {|l| l.date.yday}
(commit_count = {}).default = 0
c.each {|e| commit_count[e] += 1}
min = commit_count.min[0]
max = commit_count.max[0]
values = min.upto(max).collect {|v| ((commit_count.has_key?v) ? commit_count[v] : 0)}
url = "http://chart.apis.google.com/chart
?chxl=0:|#{0.upto(values.count/7).collect{|t| t}.join('|')}|1:|Weeks
&chxp=0,#{0.upto(values.count/7).collect{|t| t*7}.join(',')}|1,#{values.count/2}
&chxr=0,0,#{values.count}|1,0,#{values.count}|2,0,#{values.max + 1}
&chxt=x,x,y
&chbh=a,3,1
&chs=1000x200
&cht=bvg
&chco=76A4FB
&chds=0,#{values.max}
&chd=t:#{values.join(',')}
&chdl=Amount+of+work&chdlp=t".gsub(/(
+)/, '').gsub(/\s+/, '')
puts url.to_s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment