Created
December 5, 2013 04:09
-
-
Save weatheredwatcher/7799939 to your computer and use it in GitHub Desktop.
This is a ruby snippet I use in a TextMate Bundle for Hipster Ipsum
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'open-uri' | |
require 'json' | |
url = 'http://hipsterjesus.com/api?paras=1' | |
buffer = open(url, "UserAgent" => "Ruby-Wget").read | |
# convert JSON data into a hash | |
result = JSON.parse(buffer) | |
hipster = result['text'] | |
puts hipster |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment