Skip to content

Instantly share code, notes, and snippets.

@lazyatom
Created March 26, 2012 10:25
Show Gist options
  • Save lazyatom/2204339 to your computer and use it in GitHub Desktop.
Save lazyatom/2204339 to your computer and use it in GitHub Desktop.
Looking at comment quality with EuRuKo 2012's pull request CFP strategy
source :rubygems
gem "multi_json"
gem "yajl-ruby"
require "rubygems"
require "bundler/setup"
require "multi_json"
def getJSON(url)
MultiJson.decode(`curl -s -u "#{ENV["email"]}:#{ENV["password"]} #{url}`)
end
all_requests = getJSON("https://api.github.com/repos/euruko2012/call-for-proposals/pulls?per_page=100")
open_requests = all_requests.select { |r| r["state"] == "open" }
comments = open_requests.inject({}) do |h, request|
title = request["title"]
data = getJSON(request["_links"]["comments"]["href"])
comment_count = data.length
plus_one_count = data.select { |c| c["body"] =~ /^\:?\+1\:?$/ }.count
h[title] = [comment_count, plus_one_count]
puts "#{title} => #{h[title].inspect}"
h
end
comments # => {"Proposal: Lean DDD for hackers"=>[0, 0], "CocoaPods - A tale of two star-cross’d communities"=>[1, 0], "Building a Ruby Library, the Parts No One Talks About"=>[1, 1], "Rack Middleware as a General Purpose Abstraction"=>[0, 0], "rvm talk proposal"=>[3, 1], "\"How we learn a language\" by Ryan Stenhosue"=>[0, 0], "Add proposal: Evented Ruby vs Node.js"=>[0, 0], "Add proposal: Performance Strategies for Ruby and the Web"=>[0, 0], "Add proposal: Reading Rainbow: How to Read Code and Documentation"=>[0, 0], "2 demistifying password security"=>[2, 0], "1 krypt the next level of ruby cryptography"=>[7, 4], "Adam Rogers - Awesome Source: Lessons learned in open source"=>[6, 1], "Ruby's bin men: a closer look at the garbage collector"=>[24, 6], "Dependency Injection, the Dependency Inversion Principle, and You"=>[6, 4], "Sting Like a Bee -- Introducing the Swarm Architecture"=>[21, 15], "Talk proposal: Ok, tests should be fast. Now what?"=>[8, 7], "Talk proposal: debugging ruby"=>[3, 1], "Talk proposal: We buried fixtures too soon"=>[1, 0], "Linked Data and Hypermedia APIs: a match made in heaven"=>[0, 0], "Learning to build distributed systems the hard way"=>[3, 3], "Scaling MongoDB for realtime ad analytics"=>[2, 0], "Laugh now but one day we'll be in charge"=>[1, 0], "Built to scale"=>[0, 0], "Standing on the shoulders of giants with JRuby"=>[2, 0], "Shortcuts around the mistakes I've made building a realtime ad analytics platform"=>[0, 0], "Arduino, Ruby & Sinatra - The Internet Of Things's Rat Pack"=>[13, 3], "Using Ruby for testing BASH - DTF / RVM"=>[2, 1], "Develop your consciousness by Jorge Dias"=>[4, 2], "Ruby: You've Changed, Bro"=>[15, 8], "\"Mine Camp\" and \"Building Bulletproof Web APIs\""=>[1, 0], "\"Cultured localisation\" by Ryan Stenhouse"=>[2, 0], "Convention Over Configuration Design by Rida Al Barazi"=>[1, 1], "From cowboy to pro"=>[3, 3], "Drupal: what the Ruby community can learn from it"=>[1, 0], "Your Application, Your Business"=>[1, 1], "Ruby & Erlang -- At Scale with Style"=>[19, 13], "Of Remote Islands, Monsters, and Polyglot Knights "=>[5, 2], "Overcoming fear and bringing Clojure and C on board"=>[3, 3], "Practical REST with Roar!"=>[7, 7], "Your infrastructure is obsolete, deprecate it!"=>[8, 6], "Enter the App Era with Ruby on Rails"=>[1, 1], "Proposal: I'll replace you with a small Ruby script"=>[2, 2], "Chef for Rubyists"=>[8, 6], "Ruby With Rails"=>[2, 2], "Ruby on the Command-Line"=>[3, 1], "Going Clean and Simple with minitest/spec"=>[5, 4], "Decoupling Persistence (Like There’s Some Tomorrow)"=>[9, 7], "Rails doesn't scale"=>[8, 6], "A Case of Accidental Concurrency"=>[7, 5], "Designing Hypermedia APIs"=>[18, 9], "Exploring MagLev - A Ruby Object Database"=>[3, 1], "Smalltalk On Rubinius - or How To Implement Your Own Programming Language"=>[11, 4], "Almost Sinatra talk proposal"=>[5, 2], "Rake It In"=>[0, 0], "Proposal 2: Someone is Wrong"=>[5, 1], "Proposal 1: Killing Art"=>[1, 1], "JRuby, dudes!"=>[27, 20], "My two talk proposals."=>[6, 0], "Talk Submission for Call for Proposals "=>[1, 1], "Code Insight: Rubinius 2.0 and Nikita"=>[4, 3], "Ruby is unlike a Banana"=>[5, 4], "Debugging With Pry"=>[10, 9], "Therapeutic Refactoring"=>[2, 1], "Maintain Less, Mentor More: Community Building Techniques"=>[0, 0], "API: Assumptions Probably Incorrect"=>[2, 2], "Persist, Little Objects!"=>[3, 2], "How to slay a dragon"=>[1, 0], "README.md.erb."=>[0, 0], "Everything needs an API."=>[2, 2], "At light speed to lunar station"=>[0, 0], "ascii.io: No nonsense termcasting for developers"=>[2, 1], "Rspeccin' #!/bin/bash"=>[5, 2], "Cucumber: The Right Way - Better acceptance testing"=>[6, 4], "ZeroMQ: Supercharged Sockets by @technoweenie"=>[14, 10], "Distributed Systems: Tales From the Crypt"=>[8, 1], "Modular & reusable front-end code with HTML5, Sass and CoffeeScript"=>[13, 5], "DRY up your application: write an API and use it"=>[2, 2], "CoffeeScript for the Rubyist"=>[2, 2], "Testing your JavaScript with Jasmine"=>[10, 5], "Backbone.js – Clientside MVC"=>[4, 2], "Beyond Ruby proposal"=>[11, 9]}
# total number of proposals
comments.keys.count # => 81
# proposals with any comments
comments.values.select { |(c,p)| c > 0 }.count # => 68
# proposals with any '+1' comments
comments.values.select { |(c,p)| p > 0 }.count # => 57
# number of proposals with ONLY '+1' comments
comments.values.inject(0) { |a, (c,p)| a + (c == p ? 1 : 0) } # => 29
# total number of comments
comments.values.inject(0) { |a, (c,p)| a + c } # => 404
# total number of '+1' comments
comments.values.inject(0) { |a, (c,p)| a + p } # => 232
# >> Proposal: Lean DDD for hackers => [0, 0]
# >> CocoaPods - A tale of two star-cross’d communities => [1, 0]
# >> Building a Ruby Library, the Parts No One Talks About => [1, 1]
# >> Rack Middleware as a General Purpose Abstraction => [0, 0]
# >> rvm talk proposal => [3, 1]
# >> "How we learn a language" by Ryan Stenhosue => [0, 0]
# >> Add proposal: Evented Ruby vs Node.js => [0, 0]
# >> Add proposal: Performance Strategies for Ruby and the Web => [0, 0]
# >> Add proposal: Reading Rainbow: How to Read Code and Documentation => [0, 0]
# >> 2 demistifying password security => [2, 0]
# >> 1 krypt the next level of ruby cryptography => [7, 4]
# >> Adam Rogers - Awesome Source: Lessons learned in open source => [6, 1]
# >> Ruby's bin men: a closer look at the garbage collector => [24, 6]
# >> Dependency Injection, the Dependency Inversion Principle, and You => [6, 4]
# >> Sting Like a Bee -- Introducing the Swarm Architecture => [21, 15]
# >> Talk proposal: Ok, tests should be fast. Now what? => [8, 7]
# >> Talk proposal: debugging ruby => [3, 1]
# >> Talk proposal: We buried fixtures too soon => [1, 0]
# >> Linked Data and Hypermedia APIs: a match made in heaven => [0, 0]
# >> Learning to build distributed systems the hard way => [3, 3]
# >> Scaling MongoDB for realtime ad analytics => [2, 0]
# >> Laugh now but one day we'll be in charge => [1, 0]
# >> Built to scale => [0, 0]
# >> Standing on the shoulders of giants with JRuby => [2, 0]
# >> Shortcuts around the mistakes I've made building a realtime ad analytics platform => [0, 0]
# >> Arduino, Ruby & Sinatra - The Internet Of Things's Rat Pack => [13, 3]
# >> Using Ruby for testing BASH - DTF / RVM => [2, 1]
# >> Develop your consciousness by Jorge Dias => [4, 2]
# >> Ruby: You've Changed, Bro => [15, 8]
# >> "Mine Camp" and "Building Bulletproof Web APIs" => [1, 0]
# >> "Cultured localisation" by Ryan Stenhouse => [2, 0]
# >> Convention Over Configuration Design by Rida Al Barazi => [1, 1]
# >> From cowboy to pro => [3, 3]
# >> Drupal: what the Ruby community can learn from it => [1, 0]
# >> Your Application, Your Business => [1, 1]
# >> Ruby & Erlang -- At Scale with Style => [19, 13]
# >> Of Remote Islands, Monsters, and Polyglot Knights => [5, 2]
# >> Overcoming fear and bringing Clojure and C on board => [3, 3]
# >> Practical REST with Roar! => [7, 7]
# >> Your infrastructure is obsolete, deprecate it! => [8, 6]
# >> Enter the App Era with Ruby on Rails => [1, 1]
# >> Proposal: I'll replace you with a small Ruby script => [2, 2]
# >> Chef for Rubyists => [8, 6]
# >> Ruby With Rails => [2, 2]
# >> Ruby on the Command-Line => [3, 1]
# >> Going Clean and Simple with minitest/spec => [5, 4]
# >> Decoupling Persistence (Like There’s Some Tomorrow) => [9, 7]
# >> Rails doesn't scale => [8, 6]
# >> A Case of Accidental Concurrency => [7, 5]
# >> Designing Hypermedia APIs => [18, 9]
# >> Exploring MagLev - A Ruby Object Database => [3, 1]
# >> Smalltalk On Rubinius - or How To Implement Your Own Programming Language => [11, 4]
# >> Almost Sinatra talk proposal => [5, 2]
# >> Rake It In => [0, 0]
# >> Proposal 2: Someone is Wrong => [5, 1]
# >> Proposal 1: Killing Art => [1, 1]
# >> JRuby, dudes! => [27, 20]
# >> My two talk proposals. => [6, 0]
# >> Talk Submission for Call for Proposals => [1, 1]
# >> Code Insight: Rubinius 2.0 and Nikita => [4, 3]
# >> Ruby is unlike a Banana => [5, 4]
# >> Debugging With Pry => [10, 9]
# >> Therapeutic Refactoring => [2, 1]
# >> Maintain Less, Mentor More: Community Building Techniques => [0, 0]
# >> API: Assumptions Probably Incorrect => [2, 2]
# >> Persist, Little Objects! => [3, 2]
# >> How to slay a dragon => [1, 0]
# >> README.md.erb. => [0, 0]
# >> Everything needs an API. => [2, 2]
# >> At light speed to lunar station => [0, 0]
# >> ascii.io: No nonsense termcasting for developers => [2, 1]
# >> Rspeccin' #!/bin/bash => [5, 2]
# >> Cucumber: The Right Way - Better acceptance testing => [6, 4]
# >> ZeroMQ: Supercharged Sockets by @technoweenie => [14, 10]
# >> Distributed Systems: Tales From the Crypt => [8, 1]
# >> Modular & reusable front-end code with HTML5, Sass and CoffeeScript => [13, 5]
# >> DRY up your application: write an API and use it => [2, 2]
# >> CoffeeScript for the Rubyist => [2, 2]
# >> Testing your JavaScript with Jasmine => [10, 5]
# >> Backbone.js – Clientside MVC => [4, 2]
# >> Beyond Ruby proposal => [11, 9]
@joshk
Copy link

joshk commented Mar 26, 2012

This is awesome!

Thank you :)

@sardaukar
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment