Skip to content

Instantly share code, notes, and snippets.

@zph
Created July 29, 2013 02:16
Show Gist options
  • Save zph/6101785 to your computer and use it in GitHub Desktop.
Save zph/6101785 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
#
#
require 'json'
require 'open-uri'
require 'pry'
nonstandard_url = "http://xkcd.com/info.0.json"
start_url = "http://xkcd.com/1/info.0.json"
end_url = "http://xkcd.com/1243/info.0.json"
starting_integer = 1
ending_integer = 12 # 1243
sequential_urls = starting_integer.upto(ending_integer).map do |i|
"http://xkcd.com/#{i}/info.0.json"
end
urls = [nonstandard_url, sequential_urls].flatten
content = urls.map do |url|
JSON.parse open(url).read
end
require'pry';binding.pry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment