Public Gists by hassox

Gravatar
Thu Nov 19 04:43:13 -0800 2009
1
2
3
gem 'warden', '>=0.6.2'
require 'warden'
Gravatar
Thu Nov 19 00:03:25 -0800 2009
1
2
3
class MyCustomAroundMiddleware
  def initialize(app)
    @app = app
Gravatar
Sat Nov 14 21:29:16 -0800 2009
1
2
3
require 'pancake'
require 'blog'
 
Gravatar
Tue Nov 10 13:40:49 -0800 2009
1
2
3
module Foo
  def test
    Baz
Gravatar
Tue Nov 10 02:57:42 -0800 2009
1
2
3
class MyStack < Pancake::Stacks::Short
  add_root(__FILE__, "my_stack")
  initialize_stack
Gravatar
Mon Nov 09 00:38:54 -0800 2009
1
2
3
<html>
  <head><title>Hey There</title></head>
  <body>
Gravatar
Mon Nov 09 00:37:43 -0800 2009
1
2
3
##### Stack Inheritance example
 
class OurBaseStack < Pancake::Stacks::Short
Gravatar
Mon Nov 09 00:35:52 -0800 2009
1
2
3
##### ContentType negotiation
 
# Add a mime type
Gravatar
Mon Nov 09 00:35:08 -0800 2009
1
2
3
##### PATH MANAGEMENT
 
MyStack.push_paths :my_file_group, ["relative/path1", "relative/path2"], "**/*.rb"
Gravatar
Mon Nov 09 00:33:34 -0800 2009
1
2
3
##### Configuration Example
MyStack.configuration do
  default :page_title, "Awesome!"
Gravatar
Mon Nov 09 00:32:33 -0800 2009
1
2
3
##### Middleware example
 
Pancake.stack(:session).use(Rack::Session::Cookie)
Gravatar
Mon Nov 09 00:31:57 -0800 2009
1
2
3
##### ROUTER EXAMPLE
 
MyStack.router do |r|
Gravatar
Mon Nov 09 00:30:15 -0800 2009
1
2
3
##### BOOTLOADER EXAMPLE
 
MyStack::BootLoader.add(:some_bootloader, :before => :mount_applications) do
Gravatar
Thu Nov 05 16:37:36 -0800 2009
1
2
3
get '/geocode/:countryx/:cityx' do
  @geocodes = Geocode.where(:country_code => params[:countryx], :city => params[:cityx]).limit(10)
  codes = @geocodes.map do |g|
Gravatar
Thu Nov 05 15:56:30 -0800 2009
1
2
3
# using warden_strategies
class MyStrategy < WardenStrategies::SimpleStrategy
  config do |c|
Gravatar
Mon Nov 02 15:33:32 -0800 2009
1
2
3
# encoding: utf-8
 
require 'methopara'
Gravatar
Fri Oct 23 22:45:24 -0700 2009
1
2
3
require 'rubygems'
require 'sinatra'
require 'warden'
Gravatar
Tue Sep 22 15:17:47 -0700 2009
1
2
3
the_templates = {}
the_templates[:first] = Tilt::HamlTemplate.new do
out =<<-HAML
Gravatar
Sun Sep 20 05:43:35 -0700 2009
1
2
3
class MyApp < Pancake::Stacks::Short
  roots << Pancake.get_root(__FILE__)
  
Gravatar
Sun Sep 06 00:21:26 -0700 2009
1
2
3
  it "should generate an inherited route" do
    FooApp.router do |r|
      r.add("/simple").name(:simple)