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
# spec/support/capybara_chrome.rb | |
require 'selenium/webdriver' | |
require 'capybara/rspec' | |
require 'capybara-screenshot/rspec' | |
RSpec.configure do | |
Capybara.server = :puma | |
Capybara.server_port = 5000 |
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 A | |
def func | |
p 'A' | |
super | |
end | |
end | |
class B | |
def func | |
p 'B' |
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' | |
require 'benchmark/ips' | |
seed = [1,2,3] | |
map_proc = ->(i){ [i,i] } | |
Benchmark.ips do |x| | |
x.report('inject') { seed.inject({}){ |mem, i| mem[i]=i; mem } } | |
x.report('to_h') { seed.map(&map_proc).to_h } | |
x.report('Hash[map]') { Hash[seed.map(&map_proc)] } |
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' | |
require 'benchmark/ips' | |
NORMAL_ITERATIONS = 100 | |
LONG_ITERATIONS = 2000 | |
def map_to_self(array, iterations) | |
iterations.times do | |
array = array.map{ |i| i } | |
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
require 'benchmark' | |
require 'benchmark/ips' | |
seed = 1239012 | |
Benchmark.ips do |x| | |
x.report('bitwise multiplication by 2') { seed << 1 } | |
x.report('arithmetic multiplication by 2') { seed * 2 } | |
x.report('bitwise division by 2') { seed >> 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
require 'benchmark' | |
MAX = 10**8 | |
puts Benchmark.measure{ | |
a = MAX | |
while(true) | |
a -= 1 | |
break if a == 0 |
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
$ ssh-add ~/.ssh/id_rsa_some_other_github_account_name | |
$ git clone git@some_other_github_account_name.github.com:community/repo.git | |
# Add to repo/.git/config the `name` section like this | |
# [user] | |
# name = some_other_github_account_name | |
# email = some_other_github_account_name@users.noreply.github.com |