Skip to content

Instantly share code, notes, and snippets.

@jamster
Created April 1, 2011 18:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jamster/898650 to your computer and use it in GitHub Desktop.
Save jamster/898650 to your computer and use it in GitHub Desktop.
How many fucking people have gitub hired?
require 'rubygems'
require 'activesupport'
require 'bad_ass_extensions'
require 'nokogiri'
require 'open-uri'
class GitHubber
attr_accessor :header, :name, :date, :date_string, :links, :post
def initialize(hash, post)
@header = hash[:header]
@name = hash[:name]
@date_string = hash[:date].to_s
@date = DateTime.parse(@date_string)
@links = hash[:links]
@post = post
end
def to_s
output = <<-OUTPUT
Name: #{@name}
Hire Date: #{@date}
Links:
\t#{@links.join("\n\t")}
OUTPUT
end
end
BASE_URL = 'https://github.com/blog?page='
hires = []
# Scrape the past 30 Github Blog Pages
30.times.each do |page|
doc = Nokogiri::HTML(open(BASE_URL+page.to_s))
posts = doc.css('li.hentry')
posts.each do |post|
hires << post if post.css('h2').text.downcase =~ /is a githubber/
end
end
# Get the name, hire date, and some links
hires = hires.map do |hire|
header = hire.css('h2').text
name = header.split(" is a GitHubber").first
date = hire.css('span.published').attribute('title')
github_links = hire.css('div.entry-content a').select{|a| a.attribute('href').to_s =~ /^https:\/\/github\.com\/([^blog])/}
githubber = {
:header => header,
:name => name,
:date => date,
:links => github_links
}
# Build that githubber, biotch
GitHubber.new(githubber, hire)
end
# HOW MANY FUCKING GITHUBBERS WERE FUCKING HIRED!?!?!?!
hires.each{|h| puts h}
dates = hires.map{|h| h.date}.sort
start = dates.first
finish = dates.last
# HOW LONG HAVE THEY BEEN SUCKING UP ALL THE FUCKING TALENT?!?!?!?!
time_between = Date.days_between(start.to_date, finish.to_date)
puts "Github has hired #{hires.length} talented fucking people in the past #{time_between} fucking days"
@buzain
Copy link

buzain commented Jun 17, 2011

DateTime.parse won't work without require 'date' on Ubuntu 10.10 and ruby-1.9.2-p136

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