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
# WEBrick doesn't support keep alive connections for 204 and 304 responses. If a 204 or 304 response is made along with a keepalive, a warning is issued and webrick closes the connection. | |
# WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true | |
# https://github.com/rails/rails/issues/3164 | |
# https://bugs.ruby-lang.org/issues/5737 | |
# ~/.rbenv/versions/1.9.3-pXXX/lib/ruby/1.9.1/webrick/httpresponse.rb | |
# Change line 205 to: |
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
require 'benchmark' | |
TIMES = 100000 | |
s = "carlos" | |
Benchmark.bm(10) do |x| | |
x.report('[1...-1]') do | |
TIMES.times do | |
s.encode(s.encoding, :xml => :attr)[1...-1] | |
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
# Include works from right to left | |
module X | |
def self.included(base) | |
puts 'include X' | |
end | |
end | |
module Y | |
def self.included(base) |
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
require 'active_support/all' | |
class A | |
class_attribute :attrs | |
self.attrs = {} | |
end | |
class B < A | |
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
# encoding: UTF-8 | |
# pt-BR translations for Devise | |
pt-BR: | |
errors: | |
messages: | |
expired: "expirou, por favor, solicite uma nova" | |
not_found: "não encontrado" | |
already_confirmed: "já foi confirmado" | |
not_locked: "não foi bloqueado" | |
not_saved: |
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 A | |
def initialize_dup(other) | |
puts 'init dup' | |
super | |
end | |
def initialize_clone(other) | |
puts 'init clone' | |
super | |
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
## Running wycats/rails-simple-benches | |
Changes: https://github.com/carlosantoniodasilva/rails/compare/render-partial-refactor | |
### Master | |
$ time ruby minimal.rb | |
......... | |
overhead index template_1 partial partial_10 coll_10 partial_100 coll_100 uniq_100 diff_100 | |
195 376 483 519 2144 1447 17997 11109 11438 14620 |
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 Support | |
module WorkerExampleGroup | |
include RSpec::Rails::RailsExampleGroup | |
def self.included(base) | |
base.metadata[:type] = :worker | |
end | |
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
var Placeholder = { | |
init: function(selector) { | |
if (!this.supportPlaceholder()) { | |
$(selector).placeholder(); | |
} | |
}, | |
supportPlaceholder: function() { | |
return 'placeholder' in document.createElement('input'); | |
} | |
} |
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
# Acceptance spec | |
require "acceptance_helper" | |
feature "Rspec before blocks" do | |
before(:suite) do | |
puts "I'll run just once, before suite" | |
end | |
before(:all) do | |
puts "I'll run 3 times, before all" |