Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
#!/usr/bin/env ruby %w(rubygems hpricot active_support open-uri).each {|lib| require lib} divs = Hpricot(open('http://youtube.com/debates'))/'div.aTitle' candidate_mentions = divs.inject([]) {|candidates, div| (candidates << div.inner_html.split(',')).flatten} sorted = candidate_mentions.group_by(&:to_s).map{|candidate, occurrances| [candidate.strip, occurrances.size]}.sort_by{|a, b| b}.reverse sorted.each {|candidate, number_of_opportunities| puts "#{candidate}: #{number_of_opportunities}"}
This paste will be private.
From the Design Piracy series on my blog: