Skip to content

Instantly share code, notes, and snippets.

@sindrenm
Created March 24, 2014 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sindrenm/9739330 to your computer and use it in GitHub Desktop.
Save sindrenm/9739330 to your computer and use it in GitHub Desktop.
require "open-uri"
BASE_URL = "http://lorempixel.com"
WIDTH = 1920
HEIGHT = 1080
CATEGORIES = [ :abstract, :animals, :business, :cats, :city, :food, :nightlife,
:fashion, :people, :nature, :sports, :technics, :transport ]
CATEGORIES.each do |category|
url = [ BASE_URL, WIDTH, HEIGHT, category ].join "/"
5.times do |n|
filename = "Dummies/#{category}-#{WIDTH}x#{HEIGHT}_#{"%02d" % n}.jpg"
puts "Downloading #{filename}..."
open(url) do |connection|
File.open(filename, "wb") { |file| file.puts connection.read }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment