Skip to content

Instantly share code, notes, and snippets.

@scottburton11
Forked from tsnow/README.md
Last active December 14, 2015 04:28
Show Gist options
  • Select an option

  • Save scottburton11/5028085 to your computer and use it in GitHub Desktop.

Select an option

Save scottburton11/5028085 to your computer and use it in GitHub Desktop.

Revisions

  1. scottburton11 revised this gist Feb 25, 2013. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion gh_repo_stats
    Original file line number Diff line number Diff line change
    @@ -149,7 +149,7 @@ class Github::Stats
    gzip = Zlib::GzipReader.new(open(uri)).read
    Yajl::Parser.parse(gzip) do |hash|
    if hash['type'] == options[:event_type]
    event = Github::Events::const_get(options[:event_type]).new(hash)
    event = event_class.new(hash)
    event_index << event if (from <= event.created_at && event.created_at < to)
    end
    end
    @@ -171,6 +171,10 @@ class Github::Stats
    def valid?
    true
    end

    def event_class
    @event_class ||= Github::Events::const_get(options[:event_type])
    end
    end

    options = {}
  2. scottburton11 revised this gist Feb 25, 2013. 1 changed file with 10 additions and 1 deletion.
    11 changes: 10 additions & 1 deletion gh_repo_stats
    Original file line number Diff line number Diff line change
    @@ -80,6 +80,13 @@ module Github
    include Repository
    end

    # Had I time, or were so inclined, I would define an Event subclass for each
    # type at http://developer.github.com/v3/activity/events/types that responds
    # to #key.
    # Why are we doing this? Because, regardless of what Github claims, the JSON
    # schema for each event type is not all that similar. Since we only ever filter
    # by one event type, it's reasonable to expect different result types.

    class Index < Hash
    def <<(event)
    if self[event.key]
    @@ -101,7 +108,9 @@ module Github
    end

    class Github::Stats
    GITHUB_ARCHIVE_TOTALLY_ARBITRARY_TIMEZONE_WAT = "-07:00" #WAT
    # WAT - http://data.githubarchive.org expects keys in Mountain time zone,
    # and returns events in it as well.
    GITHUB_ARCHIVE_TOTALLY_ARBITRARY_TIMEZONE_WAT = "-07:00"

    attr_reader :options, :errors
    def initialize(options)
  3. scottburton11 revised this gist Feb 25, 2013. 2 changed files with 4 additions and 11 deletions.
    8 changes: 0 additions & 8 deletions Gemfile.lock
    Original file line number Diff line number Diff line change
    @@ -1,18 +1,10 @@
    GEM
    remote: http://rubygems.org/
    specs:
    ethon (0.5.9)
    ffi (~> 1.2.0)
    mime-types (~> 1.18)
    ffi (1.2.1)
    mime-types (1.21)
    typhoeus (0.6.1)
    ethon (~> 0.5.9)
    yajl-ruby (1.1.0)

    PLATFORMS
    ruby

    DEPENDENCIES
    typhoeus
    yajl-ruby
    7 changes: 4 additions & 3 deletions gh_repo_stats
    Original file line number Diff line number Diff line change
    @@ -166,15 +166,16 @@ end

    options = {}
    OptionParser.new do |opts|
    opts.on("--after DATE", "After") do |a|
    opts.banner = "Usage gh_repo_stats --after 2012-11-01T13:00:00Z --before 2012-11-02T03:12:14-03:00 --event PushEvent --count 42"
    opts.on("--after DATE", "Query dates on or after DATE, an ISO-8601 formatted date string") do |a|
    options[:from] = a
    end

    opts.on("--before DATE", "Before") do |b|
    opts.on("--before DATE", "Query dates before DATE, an ISO-8601 formatted date string") do |b|
    options[:to] = b
    end

    opts.on("--event TYPE", "Event type") do |e|
    opts.on("--event TYPE", "Filter event type; see http://developer.github.com/v3/activity/events/types/#gistevent for details") do |e|
    options[:event_type] = e
    end

  4. scottburton11 revised this gist Feb 25, 2013. 3 changed files with 22 additions and 1 deletion.
    3 changes: 3 additions & 0 deletions Gemfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    source :rubygems

    gem 'yajl-ruby'
    18 changes: 18 additions & 0 deletions Gemfile.lock
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    GEM
    remote: http://rubygems.org/
    specs:
    ethon (0.5.9)
    ffi (~> 1.2.0)
    mime-types (~> 1.18)
    ffi (1.2.1)
    mime-types (1.21)
    typhoeus (0.6.1)
    ethon (~> 0.5.9)
    yajl-ruby (1.1.0)

    PLATFORMS
    ruby

    DEPENDENCIES
    typhoeus
    yajl-ruby
    2 changes: 1 addition & 1 deletion gh_repo_stats
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,9 @@
    #!/usr/bin/env ruby

    require 'bundler/setup'
    require 'yajl'
    require 'zlib'
    require 'uri'
    require 'pry'
    require 'time'
    require 'open-uri'
    require 'optparse'
  5. scottburton11 renamed this gist Feb 25, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. scottburton11 revised this gist Feb 25, 2013. 1 changed file with 195 additions and 0 deletions.
    195 changes: 195 additions & 0 deletions gh-archive.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,195 @@
    #!/usr/bin/env ruby

    require 'yajl'
    require 'zlib'
    require 'uri'
    require 'pry'
    require 'time'
    require 'open-uri'
    require 'optparse'

    class DateRange
    include Enumerable

    attr_reader :from, :to
    def initialize(from, to)
    @from, @to = from, to
    end

    def hour_blocks
    return [hour_block(from)] if seconds_between == 0
    @hour_blocks ||= (seconds_between/3600).ceil.times.map do |i|
    hour_block(from + (i * 3600))
    end
    end

    def seconds_between
    to - from
    end

    def hour_block(time)
    time.strftime("%Y-%m-%d-") + time.hour.to_s
    end

    def each
    hour_blocks.each {|block| yield block }
    end

    end

    module Github
    module Events
    class Event
    attr_reader :attrs
    def initialize(attrs)
    @attrs = attrs
    end

    def event_name
    attrs['type']
    end

    def created_at
    Time.parse(attrs['created_at'])
    end
    end

    module Repository
    def repository
    attrs['repository']
    end

    def owner_name
    repository['owner']
    end

    def repo_name
    repository['name']
    end

    def key
    "#{owner_name}/#{repo_name}"
    end
    end

    class PushEvent < Event
    include Repository
    end

    class PullRequestEvent < Event
    include Repository
    end

    class Index < Hash
    def <<(event)
    if self[event.key]
    self[event.key][:count] += 1
    self[event.key][:events] << event
    else
    self[event.key] = {
    :count => 1,
    :events => [event]
    }
    end
    end

    def sort
    to_a.sort { |a,b| a[1][:count] <=> b[1][:count] }
    end
    end
    end
    end

    class Github::Stats
    GITHUB_ARCHIVE_TOTALLY_ARBITRARY_TIMEZONE_WAT = "-07:00" #WAT

    attr_reader :options, :errors
    def initialize(options)
    @options = options
    @errors = []
    end

    def to
    Time.parse(options[:to]).localtime(GITHUB_ARCHIVE_TOTALLY_ARBITRARY_TIMEZONE_WAT)
    end

    def from
    Time.parse(options[:from]).localtime(GITHUB_ARCHIVE_TOTALLY_ARBITRARY_TIMEZONE_WAT)
    end

    def limit
    options[:limit].to_i
    end

    def base_uri
    URI.parse("http://data.githubarchive.org/")
    end

    def date_range
    DateRange.new(from, to)
    end

    def event_index
    @event_index ||= Github::Events::Index.new
    end

    def gather
    date_range.each do |block|
    uri = base_uri
    uri.path = "/#{block}.json.gz"
    gzip = Zlib::GzipReader.new(open(uri)).read
    Yajl::Parser.parse(gzip) do |hash|
    if hash['type'] == options[:event_type]
    event = Github::Events::const_get(options[:event_type]).new(hash)
    event_index << event if (from <= event.created_at && event.created_at < to)
    end
    end
    end
    end

    def report
    event_index.sort.reverse.take(limit).each do |event|
    reporter.puts "#{event[0].to_s} - #{event[1][:count]} events"
    end
    end

    attr_writer :reporter
    def reporter
    @reporter ||= STDOUT
    end

    # Let's just say every input is valid, and if the program blows up, it's user error.
    def valid?
    true
    end
    end

    options = {}
    OptionParser.new do |opts|
    opts.on("--after DATE", "After") do |a|
    options[:from] = a
    end

    opts.on("--before DATE", "Before") do |b|
    options[:to] = b
    end

    opts.on("--event TYPE", "Event type") do |e|
    options[:event_type] = e
    end

    opts.on("--count N", "Report on the top (n) results") do |c|
    options[:limit] = c
    end
    end.parse!

    stats = Github::Stats.new(options)

    if stats.valid?
    stats.gather
    stats.report
    else
    stats.errors.each do |error|
    puts error
    end
    end
  7. @tsnow tsnow revised this gist Feb 20, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions problem.md
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ Here's some example interactions:

    ```sh
    > ./gh_repo_stats --after 2012-10-12T10:00:00-08:00 --before 2012-10-12T11:00:00-08:00 \
    --event PushEvent -n 20
    --event PushEvent -n 20
    hughht5/Guido - 30 events
    gordonbrander/French-Toast-Assets - 19 events
    iblanky/iblanky.github.com - 18 events
    @@ -31,7 +31,7 @@ Here's some example interactions:
    pfinette/finettedotcom - 8 events
    >
    > ./gh_repo_stats --after 2013-01-12T10:00:01Z --before 2013-01-12T11:00:00Z \
    --event WatchEvent -n 2
    --event WatchEvent -n 2
    airbnb/javascript - 19 events
    piranha/gostatic - 4 events
    ```
  8. @tsnow tsnow revised this gist Feb 20, 2013. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions problem.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,8 @@ Create a ruby script utilizing http://www.githubarchive.org/ which has the follo
    Here's some example interactions:

    ```sh
    > ./gh_repo_stats --after 2012-10-12T10:00:00-08:00 --before 2012-10-12T11:00:00-08:00 --event PushEvent -n 20
    > ./gh_repo_stats --after 2012-10-12T10:00:00-08:00 --before 2012-10-12T11:00:00-08:00 \
    --event PushEvent -n 20
    hughht5/Guido - 30 events
    gordonbrander/French-Toast-Assets - 19 events
    iblanky/iblanky.github.com - 18 events
    @@ -29,7 +30,8 @@ Here's some example interactions:
    lanticezdd/uni - 8 events
    pfinette/finettedotcom - 8 events
    >
    > ./gh_repo_stats --after 2013-01-12T10:00:01Z --before 2013-01-12T11:00:00Z --event WatchEvent -n 2
    > ./gh_repo_stats --after 2013-01-12T10:00:01Z --before 2013-01-12T11:00:00Z \
    --event WatchEvent -n 2
    airbnb/javascript - 19 events
    piranha/gostatic - 4 events
    ```
  9. @tsnow tsnow revised this gist Feb 20, 2013. 1 changed file with 24 additions and 24 deletions.
    48 changes: 24 additions & 24 deletions problem.md
    Original file line number Diff line number Diff line change
    @@ -7,29 +7,29 @@ Create a ruby script utilizing http://www.githubarchive.org/ which has the follo
    Here's some example interactions:

    ```sh
    > ./gh_repo_stats --after '2012-03-08T00:00:00-08:00' --before '2012-03-08T01:00:00-08:00' --event WatchEvent -n 20
    FortAwesome/Font-Awesome - 20 events
    twitter/bootstrap - 8 events
    yodasw16/date-picker - 8 events
    jondot/graphene - 5 events
    jkbr/httpie - 4 events
    edjafarov/remote-impress - 4 events
    arturadib/shelljs - 3 events
    thoughtbot/bourbon - 3 events
    xk/node-threads-a-gogo - 2 events
    kartograph/kartograph.py - 2 events
    Induction/Induction - 2 events
    ajaxorg/cloud9 - 1 event
    pa7/heatmap.js - 1 event
    fuelphp/kernel - 1 event
    documentcloud/backbone - 1 event
    johnjbarton/UglifyJS - 1 event
    jquery/jquery - 1 event
    zendframework/zf2 - 1 event
    umpirsky/country-list - 1 event
    ncb000gt/node-cron - 1 event
    > ./gh_repo_stats --after 2012-10-12T10:00:00-08:00 --before 2012-10-12T11:00:00-08:00 --event PushEvent -n 20
    hughht5/Guido - 30 events
    gordonbrander/French-Toast-Assets - 19 events
    iblanky/iblanky.github.com - 18 events
    honielui/hackathon_hnb - 17 events
    MilkZoft/codejobs - 16 events
    danberindei/infinispan - 12 events
    gilgomesp/site - 11 events
    HKCodeCamp/bartr - 11 events
    josephwilk/tlearn-rb - 10 events
    soapboxCommunications/Young-Final - 10 events
    sakai-mirror/melete - 10 events
    fabiantheblind/auto-typo-adbe-id - 9 events
    demobox/jclouds-maven-site-1.5.2 - 9 events
    davecoa/opendataday_workshop - 9 events
    freebsd/freebsd-ports - 9 events
    joonasrouhiainen/studio4-election - 9 events
    bunuelo/funk2 - 9 events
    Certainist/To_aru_Library - 9 events
    lanticezdd/uni - 8 events
    pfinette/finettedotcom - 8 events
    >
    > ./gh_repo_stats --after '2012-03-08T10:00:00Z' --before '2012-03-08T11:00:00Z' --event WatchEvent -n 2
    ChiperSoft/Kalendae - 33 event(s)
    FortAwesome/Font-Awesome - 19 event(s)
    > ./gh_repo_stats --after 2013-01-12T10:00:01Z --before 2013-01-12T11:00:00Z --event WatchEvent -n 2
    airbnb/javascript - 19 events
    piranha/gostatic - 4 events
    ```
  10. @tsnow tsnow revised this gist Feb 15, 2013. 2 changed files with 4 additions and 7 deletions.
    6 changes: 1 addition & 5 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,4 @@
    Prior to your phone call with Taxi Magic:

    - Familiarize yourself briefly with the assignment and http://www.githubarchive.org/.

    After your phone call, spend 5 *literal* minutes thinking:
    Spend 5 *literal* minutes thinking:

    - How much time do you have to devote to this exercise?
    - How can you verify that your solution is correct?
    5 changes: 3 additions & 2 deletions problem.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,10 @@
    Create a ruby script utilizing http://www.githubarchive.org/ which has the following options:
    Create a ruby script utilizing http://www.githubarchive.org/ which has the following options and output:

    ```sh
    > ./gh_repo_stats -h
    gh_repo_stats [--after DATETIME] [--before DATETIME] [--event EVENT_NAME] [-n COUNT]
    ```
    And the following interface:
    Here's some example interactions:

    ```sh
    > ./gh_repo_stats --after '2012-03-08T00:00:00-08:00' --before '2012-03-08T01:00:00-08:00' --event WatchEvent -n 20
    @@ -28,6 +28,7 @@ And the following interface:
    zendframework/zf2 - 1 event
    umpirsky/country-list - 1 event
    ncb000gt/node-cron - 1 event
    >
    > ./gh_repo_stats --after '2012-03-08T10:00:00Z' --before '2012-03-08T11:00:00Z' --event WatchEvent -n 2
    ChiperSoft/Kalendae - 33 event(s)
    FortAwesome/Font-Awesome - 19 event(s)
  11. @tsnow tsnow revised this gist Feb 12, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion problem.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ Create a ruby script utilizing http://www.githubarchive.org/ which has the follo
    > ./gh_repo_stats -h
    gh_repo_stats [--after DATETIME] [--before DATETIME] [--event EVENT_NAME] [-n COUNT]
    ```
    And responds like so:
    And the following interface:

    ```sh
    > ./gh_repo_stats --after '2012-03-08T00:00:00-08:00' --before '2012-03-08T01:00:00-08:00' --event WatchEvent -n 20
  12. @tsnow tsnow revised this gist Feb 12, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -10,6 +10,6 @@ After your phone call, spend 5 *literal* minutes thinking:
    Then:

    1. Fork this gist and clone it locally.
    2. Send [[email protected] and [email protected]](mailto:[email protected],[email protected]?subject=[gh_repo_stats]) a link to your forked gist with the subject "[gh_repo_stats]". Provide an estimate of how long you'll be working on your solution in man-hours and an estimate of when you will be finished. Feel free to ask any questions about the assignment, as well.
    2. Send [[email protected] and [email protected]](mailto:[email protected],[email protected]?subject=[gh_repo_stats]) a link to your forked gist with "[gh_repo_stats]" in the subject. Provide an estimate of how long you'll be working on your solution in man-hours and an estimate of when you will be finished. Feel free to ask any questions about the assignment, as well.
    3. Complete the exercise, pushing your changes to the gist repo as you go.
    4. Send [[email protected] and [email protected]](mailto:[email protected],[email protected]?subject=[gh_repo_stats]) a link to your forked gist, along with the actual amount of time you spent on the problem, and a discussion of your solution. If you choose to use external dependencies besides ruby, please provide a Rakefile which allows one to run `rake install` to install the dependencies.
  13. @tsnow tsnow revised this gist Feb 12, 2013. 1 changed file with 2 additions and 4 deletions.
    6 changes: 2 additions & 4 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -2,11 +2,9 @@ Prior to your phone call with Taxi Magic:

    - Familiarize yourself briefly with the assignment and http://www.githubarchive.org/.

    After your phone call:
    After your phone call, spend 5 *literal* minutes thinking:

    Spend 5 *literal* minutes thinking about the following.

    - How much time you have to devote to this exercise?
    - How much time do you have to devote to this exercise?
    - How can you verify that your solution is correct?

    Then:
  14. @tsnow tsnow revised this gist Feb 12, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    Prior to your phone call with Taxi Magic:

    Familiarize yourself briefly with the assignment and http://www.githubarchive.org/.
    - Familiarize yourself briefly with the assignment and http://www.githubarchive.org/.

    After your phone call:

  15. @tsnow tsnow revised this gist Feb 12, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    Prior to your phone call with Taxi Magic:

    Familiarize yourself briefly with the assignment and http://www.githubarchive.org/.
    Familiarize yourself briefly with the assignment and http://www.githubarchive.org/.

    After your phone call:

  16. @tsnow tsnow revised this gist Feb 12, 2013. 1 changed file with 9 additions and 3 deletions.
    12 changes: 9 additions & 3 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,17 @@
    Spend 5 *literal* minutes thinking about:
    Prior to your phone call with Taxi Magic:

    Familiarize yourself briefly with the assignment and http://www.githubarchive.org/.

    After your phone call:

    Spend 5 *literal* minutes thinking about the following.

    - How much time you have to devote to this exercise?
    - How can you verify that your solution is correct?

    Then:

    1. Fork this gist and clone it locally.
    2. Send [[email protected] and [email protected]](mailto:[email protected],[email protected]?subject=[gh_repo_stats]) a link to your forked gist, along with an estimate of how long the solution should take in man-hours and an estimate of when you will be finished.
    3. Complete the exercise, pushing your changes as you go.
    2. Send [[email protected] and [email protected]](mailto:[email protected],[email protected]?subject=[gh_repo_stats]) a link to your forked gist with the subject "[gh_repo_stats]". Provide an estimate of how long you'll be working on your solution in man-hours and an estimate of when you will be finished. Feel free to ask any questions about the assignment, as well.
    3. Complete the exercise, pushing your changes to the gist repo as you go.
    4. Send [[email protected] and [email protected]](mailto:[email protected],[email protected]?subject=[gh_repo_stats]) a link to your forked gist, along with the actual amount of time you spent on the problem, and a discussion of your solution. If you choose to use external dependencies besides ruby, please provide a Rakefile which allows one to run `rake install` to install the dependencies.
  17. @tsnow tsnow revised this gist Feb 11, 2013. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -7,5 +7,5 @@ Then:

    1. Fork this gist and clone it locally.
    2. Send [[email protected] and [email protected]](mailto:[email protected],[email protected]?subject=[gh_repo_stats]) a link to your forked gist, along with an estimate of how long the solution should take in man-hours and an estimate of when you will be finished.
    3. Complete the exercise.
    3. Complete the exercise, pushing your changes as you go.
    4. Send [[email protected] and [email protected]](mailto:[email protected],[email protected]?subject=[gh_repo_stats]) a link to your forked gist, along with the actual amount of time you spent on the problem, and a discussion of your solution. If you choose to use external dependencies besides ruby, please provide a Rakefile which allows one to run `rake install` to install the dependencies.
    2 changes: 1 addition & 1 deletion problem.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ Create a ruby script utilizing http://www.githubarchive.org/ which has the follo
    And responds like so:

    ```sh
    > ./gh_repo_stats --after '2012-03-08T00:00:00Z' --before '2012-03-08T01:00:00Z' --event WatchEvent -n 20
    > ./gh_repo_stats --after '2012-03-08T00:00:00-08:00' --before '2012-03-08T01:00:00-08:00' --event WatchEvent -n 20
    FortAwesome/Font-Awesome - 20 events
    twitter/bootstrap - 8 events
    yodasw16/date-picker - 8 events
  18. @tsnow tsnow revised this gist Feb 4, 2013. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions problem.md
    Original file line number Diff line number Diff line change
    @@ -28,9 +28,6 @@ And responds like so:
    zendframework/zf2 - 1 event
    umpirsky/country-list - 1 event
    ncb000gt/node-cron - 1 event
    ```

    ```sh
    > ./gh_repo_stats --after '2012-03-08T10:00:00Z' --before '2012-03-08T11:00:00Z' --event WatchEvent -n 2
    ChiperSoft/Kalendae - 33 event(s)
    FortAwesome/Font-Awesome - 19 event(s)
  19. @tsnow tsnow revised this gist Feb 4, 2013. 1 changed file with 8 additions and 2 deletions.
    10 changes: 8 additions & 2 deletions problem.md
    Original file line number Diff line number Diff line change
    @@ -2,12 +2,12 @@ Create a ruby script utilizing http://www.githubarchive.org/ which has the follo

    ```sh
    > ./gh_repo_stats -h
    gh_repo_stats [--after DATETIME] [--before DATETIME] [--event EVENT_NAME]
    gh_repo_stats [--after DATETIME] [--before DATETIME] [--event EVENT_NAME] [-n COUNT]
    ```
    And responds like so:

    ```sh
    > ./gh_repo_stats --after '2012-03-08T00:00:00Z' --before '2012-03-08T01:00:00Z' --event WatchEvent
    > ./gh_repo_stats --after '2012-03-08T00:00:00Z' --before '2012-03-08T01:00:00Z' --event WatchEvent -n 20
    FortAwesome/Font-Awesome - 20 events
    twitter/bootstrap - 8 events
    yodasw16/date-picker - 8 events
    @@ -28,4 +28,10 @@ And responds like so:
    zendframework/zf2 - 1 event
    umpirsky/country-list - 1 event
    ncb000gt/node-cron - 1 event
    ```

    ```sh
    > ./gh_repo_stats --after '2012-03-08T10:00:00Z' --before '2012-03-08T11:00:00Z' --event WatchEvent -n 2
    ChiperSoft/Kalendae - 33 event(s)
    FortAwesome/Font-Awesome - 19 event(s)
    ```
  20. @tsnow tsnow revised this gist Jan 29, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion problem.md
    Original file line number Diff line number Diff line change
    @@ -27,5 +27,5 @@ And responds like so:
    jquery/jquery - 1 event
    zendframework/zf2 - 1 event
    umpirsky/country-list - 1 event
    ncb000gt/node-cron - 1 event
    ncb000gt/node-cron - 1 event
    ```
  21. @tsnow tsnow revised this gist Jan 29, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions problem.md
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,12 @@
    Create a ruby script utilizing http://www.githubarchive.org/ which has the following options:

    ```ruby
    ```sh
    > ./gh_repo_stats -h
    gh_repo_stats [--after DATETIME] [--before DATETIME] [--event EVENT_NAME]
    ```
    And responds like so:

    ```ruby
    ```sh
    > ./gh_repo_stats --after '2012-03-08T00:00:00Z' --before '2012-03-08T01:00:00Z' --event WatchEvent
    FortAwesome/Font-Awesome - 20 events
    twitter/bootstrap - 8 events
  22. @tsnow tsnow revised this gist Jan 29, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion problem.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ Create a ruby script utilizing http://www.githubarchive.org/ which has the follo
    And responds like so:

    ```ruby
    > ./gh_repo_stats --after 2012-03-08T00:00:00Z --before 2012-03-08T01:00:00Z --event WatchEvent
    > ./gh_repo_stats --after '2012-03-08T00:00:00Z' --before '2012-03-08T01:00:00Z' --event WatchEvent
    FortAwesome/Font-Awesome - 20 events
    twitter/bootstrap - 8 events
    yodasw16/date-picker - 8 events
  23. @tsnow tsnow renamed this gist Jan 29, 2013. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion problem.sh → problem.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    Create a ruby script utilizing http://www.githubarchive.org/ which has the following options:

    ```ruby
  24. @tsnow tsnow created this gist Jan 29, 2013.
    11 changes: 11 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    Spend 5 *literal* minutes thinking about:

    - How much time you have to devote to this exercise?
    - How can you verify that your solution is correct?

    Then:

    1. Fork this gist and clone it locally.
    2. Send [[email protected] and [email protected]](mailto:[email protected],[email protected]?subject=[gh_repo_stats]) a link to your forked gist, along with an estimate of how long the solution should take in man-hours and an estimate of when you will be finished.
    3. Complete the exercise.
    4. Send [[email protected] and [email protected]](mailto:[email protected],[email protected]?subject=[gh_repo_stats]) a link to your forked gist, along with the actual amount of time you spent on the problem, and a discussion of your solution. If you choose to use external dependencies besides ruby, please provide a Rakefile which allows one to run `rake install` to install the dependencies.
    32 changes: 32 additions & 0 deletions problem.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@

    Create a ruby script utilizing http://www.githubarchive.org/ which has the following options:

    ```ruby
    > ./gh_repo_stats -h
    gh_repo_stats [--after DATETIME] [--before DATETIME] [--event EVENT_NAME]
    ```
    And responds like so:

    ```ruby
    > ./gh_repo_stats --after 2012-03-08T00:00:00Z --before 2012-03-08T01:00:00Z --event WatchEvent
    FortAwesome/Font-Awesome - 20 events
    twitter/bootstrap - 8 events
    yodasw16/date-picker - 8 events
    jondot/graphene - 5 events
    jkbr/httpie - 4 events
    edjafarov/remote-impress - 4 events
    arturadib/shelljs - 3 events
    thoughtbot/bourbon - 3 events
    xk/node-threads-a-gogo - 2 events
    kartograph/kartograph.py - 2 events
    Induction/Induction - 2 events
    ajaxorg/cloud9 - 1 event
    pa7/heatmap.js - 1 event
    fuelphp/kernel - 1 event
    documentcloud/backbone - 1 event
    johnjbarton/UglifyJS - 1 event
    jquery/jquery - 1 event
    zendframework/zf2 - 1 event
    umpirsky/country-list - 1 event
    ncb000gt/node-cron - 1 event
    ```