I hereby claim:
- I am remiprev on github.
- I am remi (https://keybase.io/remi) on keybase.
- I have a public key whose fingerprint is 0EB8 6575 1221 3709 D835 08F6 2601 D146 D7E8 4CB5
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| #!/usr/bin/env ruby | |
| module Memoizable | |
| # This would be `extend ActiveSupport::Concern` in Rails | |
| def self.included(base) | |
| base.extend ClassMethods | |
| end | |
| module ClassMethods | |
| def define_memoized(method) |
| # Remove the useless and harmful ActiveRecord::SchemaDumper vertical alignment | |
| module ActiveRecord | |
| class SchemaDumper | |
| def table_with_sane_alignment(table, main_stream) | |
| # Call the original method to populate our custom stream | |
| stream = StringIO.new | |
| table_without_sane_alignment(table, stream) | |
| # Rewind the stream and remove useless whitespace | |
| content = stream.tap(&:rewind).read.gsub(/(?<!^)(?<!\s)[ ]{2,}/, ' ') |
| $ brew update | |
| $ brew install bash | |
| $ sudo mv /bin/bash /bin/bash-what-the-hell-man | |
| $ sudo ln -s `brew --prefix`/bin/bash /bin/bash |
| # config/routes.rb | |
| get 'mailer_test', to: 'application#mailer_test' | |
| # app/controllers/application_controller.rb | |
| def mailer_test | |
| render text: UserMailer.welcome_email(User.first).body.to_s | |
| end |
I hereby claim:
To claim this, I am signing this object:
| #!/usr/bin/env ruby | |
| require 'benchmark' | |
| require 'date' | |
| Benchmark.bm do |x| | |
| x.report('Time.now') { 100_000.times { Time.now.year } } | |
| x.report('Date.today') { 100_000.times { Date.today.year } } | |
| end |
| # Migrate data from two ActiveRecord databases. | |
| # Works with ActiveRecord 3 and above. | |
| # | |
| # Written by Rémi Prévost | |
| # Based on the work of Rama McIntosh & Mike Castleman | |
| # | |
| # This task is released under this BSD license: | |
| # | |
| # Copyright (c) 2008, Matson Systems, Inc. | |
| # Copyright (c) 2010, Roasted Vermicelli LLC. |
| require "rack" | |
| class Rack::Date | |
| def initialize(app) | |
| @app = app | |
| end | |
| def call(env) | |
| status, headers, body = @app.call(env) | |
| headers.merge! 'Date' => Time.now.httpdate |