-
-
Save dentarg/2066446 to your computer and use it in GitHub Desktop.
How many fucking people have gitub hired?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'activesupport' | |
require 'bad_ass_extensions' | |
require 'nokogiri' | |
require 'open-uri' | |
require 'date' | |
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" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment