Skip to content

Instantly share code, notes, and snippets.

@syntacticsugar
Created February 22, 2012 17:05
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 syntacticsugar/1886090 to your computer and use it in GitHub Desktop.
Save syntacticsugar/1886090 to your computer and use it in GitHub Desktop.
Veggie Festival - a light Sinatra foray
.DS_Store
*~
*.swp
*.i
*.i.*

#Veggie Festival (Beta)

##Intro

Sinatra is a delectable framework I would love to explore in hours off from Rails.

$LOAD_PATH.unshift File.expand_path("..", __FILE__)
require 'simple'
run Sinatra::Application
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
source :rubygems
gem "sinatra"
gem "haml"
group :production do
gem "thin"
end
GEM
remote: http://rubygems.org/
specs:
daemons (1.1.5)
eventmachine (0.12.10)
haml (3.1.4)
rack (1.4.1)
rack-protection (1.2.0)
rack
sinatra (1.3.2)
rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2)
tilt (~> 1.3, >= 1.3.3)
thin (1.3.1)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
tilt (1.3.3)
PLATFORMS
ruby
DEPENDENCIES
haml
sinatra
thin
!!! 5
%html{ :lang => "en"}
%head
%title= "Your Website"
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
%meta{ :content => "", :name => "description" }
%meta{ :content => "", :name => "author" }
%meta{ :content => "3 days", :name => "revisit-after" }
%link{ :href => "http://creativecommons.org/licenses/by/3.0/", :rel => "license", :title => "Creative Commons Attribution 3.0 Unported License" }
%link{ :href => "/feed", :rel => "alternate", :title => "Atom", :type => "application/atom+xml" }
%link{ :charset => "utf-8", :href => "/css/screen.css", :media => "screen", :rel => "stylesheet", :type => "text/css" }
%body
%header
%nav
%ul
%li= "Menu Item"
%section
%article
%header
%h2= "Article Title"
%p
Posted on
%time{ :datetime => "2009-09-04T16:31:24+02:00" }= "September 4th 2009"
by
%a{ :href => "#" }= "Author Name"
-
%a{ :href => "#" }= "6 comments"
%article
%p
It doesn&#39;t look so shiny to me. I just want to talk. It has nothing to do
with mating. Fry, that doesn&#39;t make sense. Why would I want to know that?
%p
They&#39;re like sex, except I&#39;m having them! You seem malnourished. Are
you suffering from intestinal parasites? Yeah. Give a little credit
to our public schools.
%aside
%h2= "The Sidebar"
%p
Michelle, I don&#39;t regret this, but I both rue and lament it. Our love isn&#39;t any
different from yours, except it&#39;s hotter, because I&#39;m involved. Bender, quit
destroying the universe! Robot 1-X, save my friends! And Zoidberg!
%footer
%p
Copyright 2011 My Name
!!! 5
%html
%head
%title Celery and Almond Butter
%link{ :charset => "utf-8", :href => "/css/screen.css", :meda => "screen", :rel => "stylesheet", :type => "text/css" }
%body#wrapper
%header
%h2
welcome to the veggie festival
%section#content
%p
========> celery says "bonjour!"
%p
========> almond butter says "c'est la vie!"
%p
========> carrot says "konbanwa!"
%p
========> tahini says "pull up a seat and join us!"
%aside
aside bar contains pebbles, twigs, and stones.
%footer
%p
shhhh... this is the footer
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<section id="wrapper">
</section>
<footer>
</footer>
</body>
</html>
/** font **/
/** fanwood **/
@font-face {
font-family: 'FanwoodRegular';
src: url('Fanwood-webfont.eot');
src: url('Fanwood-webfont.eot?#iefix') format('embedded-opentype'),
url('Fanwood-webfont.woff') format('woff'),
url('Fanwood-webfont.ttf') format('truetype'),
url('Fanwood-webfont.svg#FanwoodRegular') format('svg');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'FanwoodItalic';
src: url('Fanwood-Italic-webfont.eot');
src: url('Fanwood-Italic-webfont.eot?#iefix') format('embedded-opentype'),
url('Fanwood-Italic-webfont.woff') format('woff'),
url('Fanwood-Italic-webfont.ttf') format('truetype'),
url('Fanwood-Italic-webfont.svg#FanwoodItalic') format('svg');
font-weight: normal;
font-style: normal;
}
#wrapper{
width:66%;
margin:auto;
font-family: 'FanwoodRegular';
background-color:#bdbdbd;
color:#000000;
}
header{
/** background-color:#aea; **/
}
header>h1{
font-size:250%;
}
h2{
font-size:230%;
}
section#content{
margin:12px 0;
float:left;
}
article, article p{
margin:12px 0;
float:left;
}
aside{
padding:5px;
margin:15px;
width :30%;
float:right;
clear:none;
color:#4e4e4e;
background-color:#d2d2d2;
}
h1{
font-size:150%;
}
footer p{
width: 25%;
/** margin: 0 auto; **/
clear:both;
background-color:#c7c7c7;
font-family:fanwood;
text-decoration: italic;
color:#616161;
border-top:dotted 2px #5b5b5b;
}
ol{
padding-top:20px;
background-color:#ade;
display:block;
}
li{
color:white;
text-align:center;
display:inline;
padding:5px 10px 0 10px;
margin-right:2px;
background-color: #69a;
}
a{
text-decoration:none;
}
::-moz-selection{ background: #FF5E99; color:#fff; text-shadow: none; }
::selection { background:#FF5E99; color:#fff; text-shadow: none; }
require 'rubygems'
require 'bundler'
Bundler.require :default, ENV["RACK_ENV"].to_sym # bill: "this allows one to load gems in different locations...
# Bundler.require :default => requires all gems in the Gemfile, not in a specific group.
# Bundler.require ENV['RACK_ENV'].to_sym => Bundler.require :development/:test or :production,
# depending on the environment, which means it loads those grouped gems.
# ...and that means that thin will only be used on the production server,
# since it is irrelevant for local testing.
get '/' do
haml :index
end
get '/' do
haml :index
end
#get '/bonjour/:prenom' do
# "<br><br><blockquote>Bonjour #{params[:prenom]}</blockquote>"
#end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment