Skip to content

Instantly share code, notes, and snippets.

@swindsor
Created February 7, 2011 16:24
Show Gist options
  • Save swindsor/814650 to your computer and use it in GitHub Desktop.
Save swindsor/814650 to your computer and use it in GitHub Desktop.
find the worst movies from the redis sorted set
#!/usr/bin/env ruby
require 'rubygems'
require 'redis'
redis = Redis.new
ratings = redis.zrangebyscore("netflix_ratings", 0, 5, :with_scores => true, :limit => [0, 100])
counter = 0
index = 1
while counter < ratings.length do
puts "#{index}. #{ratings[counter]} #{ratings[counter+1]}"
counter += 2
index += 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment