Skip to content

Instantly share code, notes, and snippets.

View albertoperdomo's full-sized avatar

Alberto Perdomo albertoperdomo

View GitHub Profile
@albertoperdomo
albertoperdomo / application_controller.rb
Created April 3, 2012 14:51 — forked from Fernan2/application_controller.rb
Duda de inherited_resources
...
def decorate_resource_or_collection(item_or_items)
klass = item_or_items.is_a?(Array) ? item_or_items.first.class.to_s : item_or_items.class.to_s
(klass + "Decorator").constantize.decorate(item_or_items)
rescue NameError
item_or_items
end
...
@albertoperdomo
albertoperdomo / 0-readme.md
Created February 21, 2012 12:47 — forked from burke/0-readme.md
ruby-1.9.3-p125 cumulative performance patch.

Patched ruby 1.9.3-p125 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p125 with patches to make ruby-debug work again (#47) and boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84).

Huge thanks to funny-falcon for the performance patches.

@albertoperdomo
albertoperdomo / 0-readme.md
Created February 16, 2012 12:44 — forked from burke/0-readme.md
ruby-1.9.3-p0 cumulative performance patch.

Patched ruby 1.9.3-p0 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p0 with patches to make ruby-debug work again (#47) and boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84).

Huge thanks to funny-falcon for the performance patches.

class Configuration
attr_accessor :tail_logs, :max_connections, :admin_password
attr_accessor :app_server
def app_server
@app_server_config ||= AppServer.new
yield @app_server_config if block_given?
@app_server_config
end
end
#----------------------------------------------------------------------------
# Git Setup
#----------------------------------------------------------------------------
file '.gitignore', <<-FILE
.DS_Store
log/*.log
tmp/**/*
config/database.yml
db/*.sqlite3
public/uploads/*
A backup of http://sites.google.com/site/redcodenl/creating-shazam-in-java-1 just in case
Why is this necessary? Read http://sites.google.com/site/redcodenl/patent-infringement
Please fork, tweet about, etc.
----
Creating Shazam in Java
A couple of days ago I encountered this article: How Shazam Works
This got me interested in how a program like Shazam works… And more importantly, how hard is it to program something similar in Java?
## I18n backends benchmarks
#
# All these benchmarks were performed using REE with the suite at
# at http://github.com/svenfuchs/i18n/tree/master/benchmark/run.rb
#
# When compared to ActiveRecord backend, Redis and Tokyo
# just cannot store procs. All other tests pass.
#
# Used rufus-tokyo (1.0.7) and redis (2.0.0) as gems and N = 10.
Before("@culerity,@celerity,@javascript") do |scenario|
unless @env_rvm_jruby
@env_rvm_jruby = {}
require 'yaml'
rvm_info = YAML::load(`bash -l -c 'source ~/.rvm/scripts/rvm; rvm jruby ; rvm info'`)
rvm_info['environment'].each do |k, v|
@env_rvm_jruby[k] = v
end
@env_jruby_path = rvm_info['binaries']['ruby'].gsub(%r{^(.*)/ruby$}, '\1')
end