Skip to content

Instantly share code, notes, and snippets.

View carllerche's full-sized avatar
😎
working

Carl Lerche carllerche

😎
working
View GitHub Profile
def create
@user = User.new
respond_with(@user) do
format.xml
format.html do
if @user.saved?
format.html { redirect_to(@user) }
else
render :action => "new"
end
<p><%= @name %> is awesome</p>
<p>OMG: <%= link_to "click", url(:hello) %></p>
module NewRelic
class MerbBootLoader < Merb::BootLoader
after Merb::BootLoader::ChooseAdapter
def self.run
NewRelic::Control.instance.init_plugin
end
end
end
class Merb::Slices::Initialize < Merb::BootLoader
before AfterAppLoads
def self.run
Merb::Slices.each_slice do |slice|
Merb.logger.verbose!("Initializing slice '#{slice}' ...")
slice.init if slice.respond_to?(:init)
end
end
class Splinter::RegexpParser
rule
\[(\^)? { state = :CCLASS ; [:LSQUARE, ss[1] && :negate] }
\( { [:LPAREN, text] }
\) { [:RPAREN, text] }
\| { [:PIPE, text] }
\+ { [:PLUS, text] }
\* { [:STAR, text] }
module Awesome
def baz
puts "baz"
end
end
class Foo
end
require "rubygems"
require "mq"
require "shared"
EM.run do
@connection = AMQP.connect(:host => "localhost", :user => "carllerche", :pass => "enter", :vhost => "/testing")
@channel = MQ.new(@connection)
@xchange = @channel.fanout('my_exchange', :durable => true)
EM.add_timer(1) do
| rack-router | merb routing | rails routing |
--A 1352 route set with routes sequential at the top level-------------------------------------------------------------
Matching the first route x1000 | 0.008 | 0.009 | 0.271 |
Matching the middle route x1000 | 0.009 | 0.110 | 1.378 |
Matching the last route x1000 | 0.008 | 0.242 | 3.426 |
[carllerche@carl-lerches-macbook-pro pipes (master)]$ macruby spec/spec_helper.rb
/Users/carllerche/Developer/Source/pipes/lib/tubes/rubygems_hax.rb:5: [BUG] Segmentation fault
MacRuby version 0.4 (ruby 1.9.1) [universal-darwin9.0, x86_64]
-- stack frame ------------
0000 (0xc08000060): 00000004
0001 (0xc08000068): 00000000
0002 (0xc08000070): 00000004
0003 (0xc08000078): 00000000
0004 (0xc08000080): 00000004
| rack-router | merb routing | rails routing |
--Route generation-----------------------------------------------------------------------------------------------------------------------------------
A simple string x10000 | 0.098 | 0.102 | 0.473 |
A simple string with query parameters x10000 | 0.277 | 0.353 | 0.630 |
A couple variable segments x10000 | 0.149 | 0.482 | 0.602 |
A lot of variable segments x10000 | 0.217 | 0.422 | 0.843 |
Conditions that matches x10000 | 0.190 |