Skip to content

Instantly share code, notes, and snippets.

@iconara
Created January 24, 2011 16:20
Show Gist options
  • Save iconara/793462 to your computer and use it in GitHub Desktop.
Save iconara/793462 to your computer and use it in GitHub Desktop.
How to query StackOverflow for the most recent, unanswered but upvoted, questions tagged "redis"
#!/usr/bin/env ruby
require 'zlib'
require 'open-uri'
require 'json'
io = Zlib::GzipReader.new(open("http://api.stackoverflow.com/1.0/questions?tagged=redis&sort=votes&min=1"))
obj = JSON.parse(io.read)
questions = obj['questions']
unanswered_questions = questions.reject { |q| q.has_key?('accepted_answer_id') }
unanswered_questions.each do |question|
puts "#{question['title']} http://stackoverflow.com/questions/#{question['question_id']}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment