This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 837ab30d309d44511429cf58b24fe72cb6250474 Mon Sep 17 00:00:00 2001 | |
From: Luca Guidi <[email protected]> | |
Date: Fri, 29 Aug 2008 16:05:01 +0200 | |
Subject: [PATCH] Speed up for Backend::Simple#interpolate | |
--- | |
lib/i18n/backend/simple.rb | 37 ++++++++++++++++++++----------------- | |
1 files changed, 20 insertions(+), 17 deletions(-) | |
diff --git a/lib/i18n/backend/simple.rb b/lib/i18n/backend/simple.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AuthorsController < ApplicationController | |
# GET /authors/1 | |
def show | |
@author = Author.find(params[:id]) | |
end | |
end | |
class CachedAuthorsController < ApplicationController | |
# GET /cached_authors/1 | |
def show |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SQLite 3 | |
SELECT * FROM "articles" INNER JOIN "articles_categories" ON "articles".id = "articles_categories".article_id WHERE ("articles_categories".category_id = 1 ) | |
+-----+-----------------+---------------------+---------------------+----+------------+-------------+ | |
| id2 | title | created_at | updated_at | id | article_id | category_id | | |
+-----+-----------------+---------------------+---------------------+----+------------+-------------+ | |
| 2 | Cached Models | 2008-11-05 10:28:10 | 2008-11-05 10:28:10 | 1 | 2 | 1 | | |
| 1 | Rails Conf 2009 | 2008-11-05 10:28:10 | 2008-11-05 10:28:10 | 2 | 1 | 1 | | |
+-----+-----------------+---------------------+---------------------+----+------------+-------------+ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hash | |
def deep_has_key?(key) | |
self.has_key?(key) || any? {|k, v| v.deep_has_key?(key) if v.is_a? Hash} | |
end | |
alias :deep_include? :deep_has_key? | |
alias :deep_key? :deep_has_key? | |
alias :deep_member? :deep_has_key? | |
def deep_has_value?(value) | |
self.has_value?(value) || any? {|k,v| v.deep_has_value?(value) if v.is_a? Hash} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0] | |
test | old | new | boost | |
SymbolCallbackPerson | 0.418285131454468 | 0.198039770126343 | 2.11x | |
ProcCallbackPerson | 0.478709936141968 | 0.309146881103516 | 1.55x | |
MethodCallbackPerson | 0.298830032348633 | 0.114556074142456 | 2.60x | |
StringCallbackPerson | 0.782155990600586 | 0.653557062149048 | 1.97x | |
ObjectCallbackPerson | 0.49412202835083 | 0.30273699760437 | 1.63x | |
ConditionalPerson | 5.81794190406799 | 5.45951700210571 | 1.07x | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SessionController < ApplicationController | |
def read | |
render :text => session[:user_id], :status => :ok | |
end | |
def write | |
render :text => session[:user_id] = 23, :status => :ok | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Autotest::Growl | |
Autotest.add_hook :ran_command do |at| | |
output = at.results.last.slice(/(\d+).*(failure|error)/).gsub(/31m/, "") | |
if output !~ /\s0\s/ | |
status, priority = "fail", "High" | |
else | |
status, priority = "pass", "Normal" | |
end | |
image_dir = "~/Library/autotest" | |
growl_notify status, "Test Results", output, "#{image_dir}/rails_#{status}.p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Allow the metal piece to run in isolation | |
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails) | |
class LegacyRoutes | |
class << self | |
def call(env) | |
if env["PATH_INFO"] =~ /^\/pages\// | |
[301, {"Location" => "/projects", "Content-Type" => "text/html"}, ["Moved Permanently"]] | |
else | |
[404, {"Content-Type" => "text/html"}, ["Not Found"]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
devel:redis-store luca$ rake --trace | |
(in /Users/luca/Projects/redis-store) | |
** Invoke default (first_time) | |
** Invoke spec (first_time) | |
** Execute spec | |
/Users/luca/ruby19/lib/ruby/gems/1.9.1/gems/merb-core-1.0.11/lib/merb-core/dispatch/router/behavior.rb:18: warning: undefining `object_id' may cause serious problem | |
/Users/luca/ruby19/lib/ruby/gems/1.9.1/gems/merb-core-1.0.11/lib/merb-core/dispatch/router/behavior.rb:18: warning: undefining `__send__' may cause serious problem | |
/Users/luca/ruby19/lib/ruby/gems/1.9.1/gems/ParseTree-3.0.3/lib/parse_tree.rb:3:in `<top (required)>': ParseTree doesn't work with ruby 1.9.1 (LoadError) | |
from /Users/luca/ruby19/lib/ruby/gems/1.9.1/gems/merb-action-args-1.0.11/lib/merb-action-args/get_args.rb:2:in `require' | |
from /Users/luca/ruby19/lib/ruby/gems/1.9.1/gems/merb-action-args-1.0.11/lib/merb-action-args/get_args.rb:2:in `<top (required)>' |
OlderNewer