Skip to content

Instantly share code, notes, and snippets.

View lsdr's full-sized avatar

Luiz Rocha lsdr

  • São Paulo, Brazil
  • 06:06 (UTC -03:00)
View GitHub Profile
#!/bin/sh
#
# Stupid script that handles big Rails logs in search for activation emails queued on DelayedJobs.
# Like I said, stupid. No more than the bug that created the need to do this, but still.
#
# And nevermind the name. I decided to look the web for inspiration and got an article on Ford,
# Chrysler and Lee Iacocca. Thus, iacocca.sh.
#
echo "spliting log file in 30M tempfiles..."
database: &database
adapter: mysql
username: <pwd>
password: <pwd>
host: localhost
encoding: utf8
development:
<<: *database
database: <proj>_development
@lsdr
lsdr / results
Created September 8, 2009 20:53
benchmarking Symbol#to_proc on Ruby 1.8.7 and 1.9.1
MAC OS X:
*** ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9.7.0]
user system total real
Symbol#to_proc 97.820000 26.180000 124.000000 (128.542748)
*** ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-darwin9.7.0]
@lsdr
lsdr / upstream.rb
Created August 21, 2009 19:56
Experimentations with Ruby's super
module Upstream
module Streamer
def self.included(receiver)
receiver.extend ExtensionMethods
end
module ExtensionMethods
def streamable!
self.send :include, InstanceMethods
@lsdr
lsdr / method_missing.rb
Created August 4, 2009 23:25
benchmarking method_missing
# http://www.jroller.com/dscataglini/entry/speeding_up_method_missing
require 'benchmark'
include Benchmark
class A
def foo(a, b, c)
1
end
end
# make gvim set its servername to the current dir
_basedir() {
basename `pwd`
}
alias gvim='/Applications/MacVim.app/Content/MacOS/Vim -g --servername $(_basedir)'