This file contains hidden or 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 ActionController::Base | |
alias_method_chain :render, :log | |
def render_with_log(*args) | |
old, ActiveRecord::Base.logger = ActiveRecord::Base.logger, ActiveSupport::BufferedLogger.new("fucked_up.log") | |
render_without_log(args) | |
ensure | |
ActiveRecord::Base.logger = old | |
end | |
end |
This file contains hidden or 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 ActiveRecord::Base | |
extend PoorMigrations | |
end | |
class User < ActiveRecord::Base | |
column :age, :integer | |
# Always recreate name column | |
column :name, :string, :force => true | |
end | |
This file contains hidden or 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
# Released under WTFPL - http://sam.zoy.org/wtfpl/ | |
module PoorMansMigrations | |
def self.extended(base) | |
base.class_inheritable_accessor :migration_columns | |
base.migration_columns = [] | |
end | |
def column(name, type, options = {}) | |
self.migration_columns << {:column_name => name, :column_type => type, :options => options} | |
end |
This file contains hidden or 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
Without Block map: allocated: 11992K total in 2040004 allocations, GC calls: 645, GC time: 394 msec | |
With Block map: allocated: 6992K total in 90004 allocations, GC calls: 10, GC time: 17 msec | |
Without Block min: allocated: 78K total in 20004 allocations, GC calls: 5, GC time: 4 msec | |
With Block min: allocated: 78K total in 20004 allocations, GC calls: 4, GC time: 3 msec |
This file contains hidden or 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
actionpack/test/controller/components_test.rb: assert_deprecated do | |
actionpack/test/controller/render_test.rb: assert_deprecated do | |
activerecord/test/cases/aggregations_test.rb: assert_deprecated 'conversion block has been deprecated' do | |
activerecord/test/cases/pooled_connections_test.rb: assert_deprecated('ActiveRecord::Base.allow_concurrency') do | |
activerecord/test/cases/validations_i18n_test.rb: assert_deprecated('ActiveRecord::Errors.default_error_messages') do | |
activerecord/test/cases/validations_i18n_test.rb: assert_deprecated('using %s in messages') do | |
This file contains hidden or 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 Object | |
def try(method, default = nil) | |
respond_to?(method) ? send(method) : default | |
end | |
end |
This file contains hidden or 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
def self.get_object_with_sex(attrs) | |
new(attrs) do |o| | |
o.uuid = 'wow' | |
end | |
end |
This file contains hidden or 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
require 'performance/test_helper' | |
class BrowsingTest < ActionController::PerformanceTest | |
self.profile_options = { :benchmark => false, | |
:runs => 1000, | |
:min_percent => 0.01, | |
:metrics => [:process_time], | |
:formats => [:graph_html], | |
:output => 'tmp/performance' } | |
This file contains hidden or 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
puts "Hello world" |
This file contains hidden or 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
def hello(proc) | |
proc.call | |
end | |
hello proc{puts "hey"} | |
hello proc{puts 1+1} |
OlderNewer