Skip to content

Instantly share code, notes, and snippets.

@gnurag
Created December 29, 2011 08:36
Show Gist options
  • Save gnurag/1532969 to your computer and use it in GitHub Desktop.
Save gnurag/1532969 to your computer and use it in GitHub Desktop.
Sorts and prints highest votes pics.
# Paste all the urls (newline separated) into a file named "urls" in the following format.
# [http://www.flickr.com/photos/example/123456789]
u = File.open('urls').readlines
h = {}
u.each{|url| url.strip!; h[url].nil? ? h[url]=1 : h[url]+=1 }
h.sort{|a,b| a[1] <=> b[1]}.reverse.each{|x| puts "#{x[0].chomp} => #{x[1]}"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment