Skip to content

Instantly share code, notes, and snippets.

@ecavazos
Created March 23, 2012 21:06
Show Gist options
  • Save ecavazos/2175064 to your computer and use it in GitHub Desktop.
Save ecavazos/2175064 to your computer and use it in GitHub Desktop.
tiny sinatra for inside joke
require 'sinatra'
get '/' do
haml :index
end
post '/' do
name = params[:name].downcase
if name == "jim" || name == "jim clenney" || name == "bubba"
@greeting = "Yam pie for you."
else
@greeting = "One cocoanut cream pie coming up!"
end
haml :index
end
__END__
@@ layout
%html
= yield
@@ index
- steez = 'margin: 40px auto; width:400px;text-align:center;'
%form{ :method => 'post', :style => steez }
%label{ :for => 'name'}Please enter your name?
%input{ :id => 'name', :name => 'name', :type => 'input' }
%input{ :type => 'submit' }
- if @greeting
%h1{ :style => steez }= @greeting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment