Skip to content

Instantly share code, notes, and snippets.

@famulus
Created May 8, 2009 04:56
Show Gist options
  • Select an option

  • Save famulus/108634 to your computer and use it in GitHub Desktop.

Select an option

Save famulus/108634 to your computer and use it in GitHub Desktop.
require 'fastercsv'
require 'google-rest'
arr_of_arrs = FasterCSV.read("/Users/famulus/Desktop/gem_download_stats.csv") # in the interest of dirty hack I just made a CSV of the data.
google = GoogleSearch.new
puts "<table>"
arr_of_arrs.map do |row|
begin
result = google.search(:q => "#{row[0]} ruby gem")[0]
puts "<tr style=\"padding-top:8px\">
<td>#{row[0]}</td>
<td style=\"padding-top:8px\"><a href=\"#{result.url}\" >#{result.content}</a></td>
</tr>"
rescue SyntaxError => error
rescue => exc
end
end
puts "</table>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment