Skip to content

Instantly share code, notes, and snippets.

@huned
Created March 1, 2012 16:20
Show Gist options
  • Select an option

  • Save huned/1950973 to your computer and use it in GitHub Desktop.

Select an option

Save huned/1950973 to your computer and use it in GitHub Desktop.
ruby-1.9.2-p180 :004 > puts Answer.where(question_id: nil).order('created_at ASC').inject(Hash.new(0)) {|h, a| h[a.created_at.to_date] += 1; h }.to_yaml
---
2011-06-26: 24
2011-07-12: 2
2011-07-13: 2
2011-07-22: 2
2011-09-24: 1
2011-10-10: 4
2011-10-13: 8
2011-10-14: 4
2011-10-15: 4
2011-11-03: 24
2011-11-04: 24
2011-11-08: 18
2011-11-09: 15
2011-11-12: 6
2011-11-20: 12
2011-11-23: 3
2011-12-13: 5
2011-12-20: 6
2011-12-21: 6
2011-12-27: 11
2012-02-26: 1
2012-02-27: 67
2012-02-28: 136
2012-02-29: 38
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment