Skip to content

Instantly share code, notes, and snippets.

View mtodd's full-sized avatar
🔐
[redacted]

Matt Todd mtodd

🔐
[redacted]
View GitHub Profile
# Rack Nested Params Parser Spec
Rack::Utils.parse_query("x[y][z]=10").
should.equal "x" => {"y" => {"z" => "10"}}
Rack::Utils.parse_query("x[y][z][]=10").
should.equal "x" => {"y" => {"z" => ["10"]}}
Rack::Utils.parse_query("x[y][z][]=10&x[y][z][]=5").
should.equal "x" => {"y" => {"z" => ["10", "5"]}}
Rack::Utils.parse_query("x[y][][z]=10").
should.equal "x" => {"y" => [{"z" => "10"}]}
Rack::Utils.parse_query("x[y][][z]=10&x[y][][w]=10").
@mtodd
mtodd / init.rb
Created January 22, 2009 17:32 — forked from jnewland/init.rb
#don't use sinatra/main. we don't want the kitchen sink, just pretty rack apps
require 'sinatra/base'
class SinatraRailsPlugin < Sinatra::Base
get '/foo' do
'bar'
end
#this hackeration is required for sinatra to be a nice rack citizen
class Rack::Logger
def initialize(app, logger)
@app = app
@logger = logger
end
def call(env)
env["rack.logger"] = @logger
result = @app.call(env)
@logger.flush if @logger.respond_to?(:flush)
@mtodd
mtodd / App.java
Created July 31, 2008 20:16 — forked from anonymous/App.java
undefined
import java.util.HashMap;
public class App {
private static int installWindowWidth = 500, installWindowHeight = 350;
private static int adminWindowWidth = 400, adminWindowHeight = 275;
private static String server = "168.28.247.195", port = "3306", database = "software";
private static String user = "root", password = "";
private static String axeServer = "https://168.28.245.221:6467";
private static String webServer = "http://168.28.247.195:3000";