Skip to content

Instantly share code, notes, and snippets.

/*
apxs -c mod_helloworld.c
LoadModule helloworld_module modules/mod_helloworld.so
<Location /helloworld>
SetHandler helloworld
</Location>
*/
# Allow the metal piece to run in isolation
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
class Scaling
def self.call(env)
if env["PATH_INFO"] =~ /^\/scaling/
[200, {"Content-Type" => "text/html"}, ["Hello, World!"]]
else
[404, {"Content-Type" => "text/html"}, ["Not Found"]]
end
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb
index dddad17..acfb10c 100644
--- a/actionpack/lib/action_controller/test_process.rb
+++ b/actionpack/lib/action_controller/test_process.rb
@@ -388,20 +388,33 @@ module ActionController #:nodoc:
module TestProcess
def self.included(base)
- # execute the request simulating a specific HTTP method and set/volley the response
- # TODO: this should be un-DRY'ed for the sake of API documentation.
commit 96e2c827ea2d6f147fbcfc1d986f39f146df3b6e
Author: Pratik Naik <[email protected]>
Date: Sun Dec 28 16:03:49 2008 +0000
Revert "Revert inline docs"
This reverts commit aaea12c497ca86a86fbda8409c226630ade22f89.
diff --git a/actionpack/lib/action_controller/routing/route_set.rb b/actionpack/lib/action_controller/routing/route_set.rb
index 13646ae..d4c53ff 100644
Query String : x[y][z][]=10&x[y][z][]=5
Rails : [["x[y][z][]", "10"], ["x[y][z][]", "5"]]
Rack::Utils : [["x[y][z][]", ["10", "5"]]]
@lifo
lifo / evil.rb
Created January 13, 2009 04:21
module Rack
class Evil
def initialize(app)
@app = app
end
def call(env)
catch(:response) { @app.call(env) }
end
end
module Rack
class Callbacks < ::Array
DUMMY_APP = proc {|env| }
def initialize(app, &block)
@app = app
instance_eval(&block) if block_given?
end
def use(middleware, *args, &block)
module Rack
class Callbacks
def initialize(&block)
@before = []
@after = []
instance_eval(&block) if block_given?
end
def before(middleware, *args, &block)
if block_given?
class RailsHelpers
def form_for(object)
is_record_new = api_hook_record_new(object)
end
private
def api_hook_record_new(object)
# option 1 : raise "Should be overridden by ORM"
# option 2 : object.new_record?
@lifo
lifo / db.rb
Created January 17, 2009 20:57
class User < ActiveRecord::Base
# establish_connection :main_database
end
class Book < ActiveRecord::Base
establish_connection :second_database
end
ActiveRecord::Base.with_connection do
Book.do_some_shit!