Skip to content

Instantly share code, notes, and snippets.

@tmaeda
Created May 24, 2012 16:37
Show Gist options
  • Save tmaeda/2782620 to your computer and use it in GitHub Desktop.
Save tmaeda/2782620 to your computer and use it in GitHub Desktop.
sprk2012 pull req graph
# sprk2012 pull req graph
require 'date'
require 'time'
require 'octokit'
client = Octokit::Client.new({:auto_traversal => true})
pulls = client.pulls("sprk2012/sprk2012-cfp")
days = (Date.new(2012,4,26)..Date.new(2012,5,25)).to_a.map{|d| [d.to_s, 0]}
pulls.each_with_object(days){|pull, acc|
target = acc.detect{|day| day[0] == Time.parse(pull["created_at"]).getlocal.strftime("%F") }
target[1] += 1
}
days.map{|o| "#{o[0]}: #{"*" * o[1]}"}.join("\n").display
2012-04-26:
2012-04-27:
2012-04-28: **
2012-04-29: *
2012-04-30:
2012-05-01: *
2012-05-02:
2012-05-03:
2012-05-04:
2012-05-05:
2012-05-06:
2012-05-07:
2012-05-08: *
2012-05-09:
2012-05-10: *
2012-05-11:
2012-05-12:
2012-05-13: ****
2012-05-14: *
2012-05-15:
2012-05-16: *
2012-05-17: *
2012-05-18: *
2012-05-19: ****
2012-05-20: **
2012-05-21: **
2012-05-22: ***
2012-05-23: ****
2012-05-24: *******************************************
2012-05-25: ***
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment