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
% bin/turbo_rspec | |
Using recorded test runtime | |
Setting up parallel test mode - starting Redis 9 on port 10009 | |
Setting up parallel test mode - starting Redis 2 on port 10002 | |
Setting up parallel test mode - starting Redis 1 on port 10001 | |
Setting up parallel test mode - starting Redis 14 on port 10014 | |
Setting up parallel test mode - starting Redis 6 on port 10006 | |
Setting up parallel test mode - starting Redis 10 on port 10010 | |
Setting up parallel test mode - starting Redis 5 on port 10005 | |
Setting up parallel test mode - starting Redis 13 on port 10013 |
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 'benchmark/ips' | |
numbers = (1..10000).to_a | |
numbers_as_string = "," + (1..10000).to_a.join(",") + "," | |
numbers_as_hash = {} | |
(1..10000).each {|n| numbers_as_hash[n] = true } | |
serialized_numbers = Marshal.dump(numbers) | |
serialized_string = Marshal.dump(numbers_as_string) | |
serialized_hash = Marshal.dump(numbers_as_hash) |
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 'benchmark/ips' | |
require 'json' | |
require 'oj' | |
count = 1 | |
numbers_as_string_json = ("," + (1..count).to_a.join(",") + ",").to_json | |
numbers_json = (1..count).to_a.to_json | |
needle = 1000000 |
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 'benchmark/ips' | |
require 'json' | |
require 'oj' | |
numbers_as_string_json = ("," + (1..10000).to_a.join(",") + ",").to_json | |
numbers_json = (1..10000).to_a.to_json | |
Benchmark.ips do |x| |
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 'benchmark/ips' | |
numbers = (1..10000).to_a | |
numbers_as_string = "," + (1..10000).to_a.join(",") + "," | |
Benchmark.ips do |x| | |
x.report("binary search numbers") do |i| | |
while i > 0 |
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
# frozen_string_literal: true | |
require_relative '../rerunner/rerunner.rb' | |
class Car | |
def self.all_blue! | |
puts "all blue called" | |
sleep 0.1 | |
puts "all blue set" | |
@@all_blue = true |
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
# frozen_string_literal: true | |
# tiny rerunner (I use this on local to rerun script) | |
require_relative '../rerunner/rerunner.rb' | |
require 'yaml' | |
require 'psych' | |
yaml = <<~YAML | |
# amazing YAML file | |
# | |
# hello |
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
from ruamel.yaml import YAML | |
import sys | |
example = """ | |
# hello | |
test: "test\\ntest\\ntest" # a test | |
test2: hello.. #world | |
""" | |
rt_yaml=YAML(typ='rt') |
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
# frozen_string_literal: true | |
# we should set the locale before the migration | |
task 'set_locale' do | |
begin | |
I18n.locale = (SiteSetting.default_locale || :en) rescue :en | |
rescue I18n::InvalidLocale | |
I18n.locale = :en | |
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
# frozen_string_literal: true | |
# we should set the locale before the migration | |
task 'set_locale' do | |
begin | |
I18n.locale = (SiteSetting.default_locale || :en) rescue :en | |
rescue I18n::InvalidLocale | |
I18n.locale = :en | |
end | |
end |