Skip to content

Instantly share code, notes, and snippets.

@tristanperalta
Created February 22, 2014 06:27
Show Gist options
  • Save tristanperalta/9149560 to your computer and use it in GitHub Desktop.
Save tristanperalta/9149560 to your computer and use it in GitHub Desktop.
require 'uri'
require 'net/http'
require 'json'
uri = URI('http://www.reddit.com/r/showerthoughts.json')
response = Net::HTTP.get_response(uri)
json = JSON.parse(response.body)
title = json["data"]["children"][rand(25)]["data"]["title"]
puts title
@rstacruz
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment