Skip to content

Instantly share code, notes, and snippets.

@ymrl
Created June 20, 2011 07:35
Show Gist options
  • Save ymrl/1035264 to your computer and use it in GitHub Desktop.
Save ymrl/1035264 to your computer and use it in GitHub Desktop.
sinatra_lecture_sample
require 'rubygems'
require 'sinatra'
get '/hello/world' do
'hello world'
end
get '/beer' do
@title = '99 bottles of beer on the walll'
erb :beer
end
<% 99.times do |i| %>
<% j = 99 - i %>
<p>
<%= j %>
<% if j>1 %>
bottles
<% else %>
bottle
<% end %>
of beer on the wall, <%= j %> bottles of beer<br>
Take one down and pass it around,
<% if j-1 > 0 %>
<%= j-1 %>
<% else %>
no more
<% end %>
bottles of beer on the wall
</p>
<% end %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title><%= @title %></title>
</head>
<body>
<%= yield %>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment