Created
June 20, 2011 07:35
-
-
Save ymrl/1035264 to your computer and use it in GitHub Desktop.
sinatra_lecture_sample
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
| 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 |
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
| <% 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 %> | |
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
| <!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