Skip to content

Instantly share code, notes, and snippets.

@rtomayko
rtomayko / console
Created February 6, 2009 06:55 — forked from jfarmer/gist:59255
$ ab -n 10000 -c 150 -k http://localhost:3000/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Server Software: thin
Server Hostname: localhost
require 'sinatra'
require 'compass'
require 'ostruct'
enable :static, :logging
set :views, "#{root}/app/views"
set :haml, :format => :html4, :attr_wrapper => '"'
set :sass, :style => :compact
# BAD:
foo.bar = 25
foo.biz = 'Hello World'
foo.bazzle = 42
# GOOD:
foo.bar = 25
foo.biz = 'Hello World'
foo.bazzle = 42
@rtomayko
rtomayko / base.rb
Created January 30, 2009 01:56 — forked from bmizerany/base.rb
class Foo < Sinatra::Base
host_name "sinatrarb.com"
user_agent /Mosaic/
provides :xml
get '/' do
"Welcome!"
end
get '/' do
"You are not to be welcomed!"
require 'sinatra'
enable :sessions
before do
if session['rand'].nil?
session['rand'] = rand(1000)
end
if session['object'].nil?
@rtomayko
rtomayko / gist:53726
Created January 28, 2009 00:17 — forked from sr/gist:53511
def run(app, &blk)
app = app.new(&blk) if blk && app.respond_to?(:new)
@ins << app
end
require 'rubygems'
require 'sinatra/base'
class App < Sinatra::Base
enable :static
set :app_file, __FILE__
get '/' do
'See <a href="/thing.txt">this text file</a>.'
end
require 'sinatra'
require 'sinatra/test/rspec'
require File.join(File.dirname(__FILE__), '../../server.rb')
Dir.chdir('../../')
describe 'Game logic' do
it 'should be able to play in 0,0' do
get '/new'
Let's make a list of Sinatra-based apps!
Apps:
- http://github.com/cschneid/irclogger "Sinatra based irclogger.com"
- http://github.com/rtomayko/wink "minimalist blogging engine"
- http://github.com/foca/integrity "The easy and fun Continuous Integration server"
- http://github.com/sr/git-wiki "git-powered wiki"
- http://github.com/entp/seinfeld "Seinfeld-inspired productivity calendar to track your public github commits."
- http://github.com/karmi/marley "Marley, the blog engine without <textareas>."
- http://github.com/ichverstehe/gaze "Serve up your Markdown files with this tiny Sinatra app!"