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 'spec_helper' | |
class Dummy | |
def go(a:) | |
end | |
end | |
RSpec.describe 'test' do | |
# All these tests should fail, but the misbehavior makes "with double with `have_received`" pass. | |
subject { Dummy.new.go(args) } |
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 BM | |
def self.bm(name) | |
@stats ||= {} | |
@stats[name] ||= { time: 0, times_called: 0, avg_time: 0 } | |
start_time = Time.zone.now | |
yield | |
@stats[name][:time] += (Time.zone.now - start_time) | |
@stats[name][:times_called] += 1 | |
@stats[name][:avg_time] = @stats[name][:time].to_f / @stats[name][:times_called] | |
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
p `heroku apps -o barkibu`.split("\n").drop(1).map { |app| app.gsub(/\s\(.*\)/, '') }.each_with_object({}) { |app, collector| collector[app] = `heroku ps -a #{app}` }.keep_if { |k,v| !(v =~ /No dynos/) }.keys |
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
#!/usr/bin/ruby | |
require 'fileutils' | |
def basename(file) | |
File.basename(file, File.extname(file)) | |
end | |
def all | |
Dir.glob('*').map |
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
#!/usr/bin/env ruby | |
require 'fileutils' | |
require 'byebug' | |
VERBOSE = false | |
DRY_RUN = false | |
class Conflict | |
SUFFIX_SEPARATOR = '-' |
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
LOG_FILENAME = 'heroku-logs' | |
REQUEST_START_REGEX = /(.+)Started (.+) \"(.+)\"/ | |
REDIRECT_REGEX = /(.+)Redirected to (.+barkibu.com)(.+)/ | |
log_lines = File.readlines(LOG_FILENAME) | |
redirects = [] | |
last_request = {} | |
log_lines.each do |line| |
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
LOG_FILENAME = 'heroku-logs' | |
REQUEST_START_REGEX = /(.+)Started (.+) \"(.+)\"/ | |
REDIRECT_REGEX = /(.+)Redirected to (.+barkibu.com)(.+)/ | |
log_lines = File.readlines(LOG_FILENAME) | |
redirects = [] | |
last_request = {} | |
log_lines.each do |line| |
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
#!/usr/bin/env ruby | |
require 'json' | |
exec 'rspec --format json --out rspec_results.json' unless File.exists? 'rspec_results.json' | |
results = JSON.parse(File.read 'rspec_results.json') | |
total_runtime = results['summary']['duration'] | |
total_examples = results['examples'] |
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
mysqldump -h origin.server.com -u the_origin_user -p the_origin_database --ignore-table=the_origin_database.that_huge_table | tee dump.sql | mysql the_database -u the_user --password=ThePassword | |
mysqldump -h origin.server.com -u the_origin_user -p the_origin_database that_huge_table --no-data | mysql the_database -u the_user --password=ThePassword | |
mysqldump -h origin.server.com -u the_origin_user -p the_origin_database that_huge_table | mysql the_database -u the_user --password=ThePassword |
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
StripeI18n = { | |
es: { | |
errors: { | |
incorrect_number: "El número de tarjeta es incorrecto.", | |
invalid_number: "El número de tarjeta no es un número de tarjeta válido.", | |
invalid_expiry_month: "El mes de caducidad de la tarjeta no es válido.", | |
invalid_expiry_year: "El año de caducidad de la tarjeta no es válido.", | |
invalid_cvc: "El código de seguridad de la tarjeta no es válido.", | |
expired_card: "La tarjeta ha caducado.", | |
incorrect_cvc: "El código de seguridad de la tarjeta es incorrecto.", |
NewerOlder