Skip to content

Instantly share code, notes, and snippets.

@jonahoffline
Last active December 10, 2015 08:08
Show Gist options
  • Save jonahoffline/4405233 to your computer and use it in GitHub Desktop.
Save jonahoffline/4405233 to your computer and use it in GitHub Desktop.
Sinatra app.rb fix for jacobbednarz (original gist: https://gist.github.com/00279c2749e202a82d6d).
require 'sinatra/base'
class App < Sinatra::Base
before do
@images = [
{ title: "matrix", url: "http://i0.kym-cdn.com/entries/icons/original/000/009/889/Morpheus2.jpg" },
{ title: "google", url: "http://i0.kym-cdn.com/news_feeds/icons/original/000/006/501/google-search.jpg" },
{ title: "skywalking", url: "http://i2.kym-cdn.com/photos/images/newsfeed/000/295/090/9de.jpg" }
]
end
get '/images' do
@images
end
get '/images/:index' do
@images[params[:index].to_i]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment