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
# Use `bundle --gemfile Gemfile.local` to activate | |
# Use `eche -e "Gemfile.local\nGemfile.local.lock" >> ~/.gitignore` to ignore it from all repos | |
# Use `eche -e "*.local*" >> ~/.gitignore` That or just ignore all files that have .local | |
gem 'dotenv-rails', require: 'dotenv/rails-now' | |
# Include global Gemfile | |
eval File.read('Gemfile') | |
# Gems for local host (same syntax as for Gemfile) |
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
#!/bin/bash | |
brew install postgresql | |
set -e | |
pg_directory='/usr/local/var' | |
username='postgres' | |
mkdir $pg_directory/data | |
printf "\033[1;32mcreated $pg_directory/data\033[0m\n" | |
mkdir $pg_directory/log |
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 | |
# frozen_string_literal: true | |
require File.expand_path('ruby_bash', __dir__).to_s | |
require 'date' | |
class ProcessData | |
attr_accessor( | |
:all, :debug, :changes_stashed, :primary_remote_name, :remotes, :current_branch, :git_logs, | |
:min_print_length, :since, :list_branches, :dry_run, :remote_branch_list, :local_branches |
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 | |
files = [] | |
waiting = true | |
threads = [] | |
lines = [] | |
ignore = [ | |
'db/schema.rb' | |
] |
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 | |
# frozen_string_literal: true | |
require 'json' | |
def files | |
@files ||= begin | |
`git diff --staged --name-only --cached`.split("\n").reject do |file| | |
!File.exists?(file) | |
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
#!/usr/bin/env ruby | |
require 'optparse' | |
options = { group: 0, total_groups: 0, pattern: 'spec/**/*_spec.rb' } | |
OptionParser.new do |opts| | |
opts.banner = "Usage: bin/rspec [options]" | |
opts.on('-t', '--total-groups NUMBER', 'Total number of rspec groups') do |t| | |
options[:total_groups] = t.to_i | |
end | |
opts.on('-g', '--group NUMBER', 'Execute group number out of total groups') do |g| |
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
temp = Tempfile.new(['document_content', '.html']) | |
temp.write(options[:document_content]) | |
temp.close | |
prince_cmd = "docker run --network host -v /var/folders:/var/folders -v #{logfile}:#{logfile} --rm conga/prince prince -v --javascript --log=#{logfile} --baseurl=http://host.docker.internal:3000 #{option_str} #{temp.path} - -o #{outfile.path}" |
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 << self | |
protected | |
def gsub_text_nodes_only!(html:, placeholder_name:, placeholder_value:) | |
fragment = Nokogiri::HTML.fragment(html) | |
fragment.traverse do |node| | |
next unless node.text? | |
# Can't use normal gsub! because it makes a copy of the content memory that is not attached | |
# to the node. Have to use the setter provided by nokogiri to update the node |
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 Config | |
attr_accessor :total_threads, :files_per_second, :logger | |
class << self | |
def info | |
@info ||= Config.new | |
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
#!/usr/bin/env ruby | |
require 'fileutils' | |
require 'tempfile' | |
# cn = '*.tb.local.vhost' | |
# server_name = 'dev.tb.local.vhost' | |
# admin_server_name = 'admin.tb.local.vhost' | |