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/bash | |
T=${1:-qa2} | |
git branch -D $T | |
git checkout -b $T && git push --set-upstream origin $T --force | |
git checkout - |
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
--- | |
slug: debug | |
layout_name: | |
--- | |
{% graphql partials %} | |
query partials{ | |
partials: admin_liquid_partials(filter:{ path: { contains: "debug_content" }}){ | |
results{ | |
id | |
physical_file_path |
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
def log(message) | |
memory = `ps -o rss -p #{$$}`.chomp.split("\n").last.to_i/1024 | |
puts "#{Time.now} #{memory}M #{message}" | |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<style> | |
div{ | |
position:relative; | |
} | |
input, span{ | |
top:0; | |
position:absolute; |
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' | |
class A | |
def call_case(var = 'a') | |
case var | |
when 'a' | |
a | |
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
some_method_or_expression | |
File.open('/tmp/puts.txt','a') { |s| s.puts _ } |
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' | |
def normal_param(a, b) | |
return [a, b] | |
end | |
def named_param(a:, b:) | |
return [a, b] | |
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
def generate | |
prefetch_volunteers do |volunteer| | |
csv << VolunteerPresenter.new(volunteer).to_csv | |
end | |
end | |
private | |
def prefetch_volunteers | |
@volunteers.includes( |
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
############################# first version | |
def generate | |
@volunteers.includes( | |
[:user, { taggings: :tag }] | |
).find_each(batch_size: 1000) do |volunteer| | |
csv << VolunteerPresenter.new(volunteer).to_csv | |
end | |
end | |
############################ second version not working |
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
# test/test_helper.rb | |
class ActionDispatch::IntegrationTest | |
def after_teardown | |
if !passed? | |
timestamp = "#{Time.zone.now.strftime('%Y-%m-%d-%H:%M:%S')}" | |
screenshot_name = "screenshot-#{timestamp}.png" | |
# Handle CircleCi too | |
screenshot_path = "#{ENV.fetch('CIRCLE_ARTIFACTS', Rails.root.join('tmp/capybara'))}/#{screenshot_name}" | |
page.save_screenshot(screenshot_path) |
NewerOlder