Skip to content

Instantly share code, notes, and snippets.

View brand-it's full-sized avatar

Brandt Lareau brand-it

View GitHub Profile
#!/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
@brand-it
brand-it / branch_cleaning.rb
Last active July 25, 2019 15:53
This lets you destroy branches that are older then a given amount of time.
#!/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
@brand-it
brand-it / code-climate-pre-hook-git.rb
Last active July 26, 2019 01:58
just a script to check code climate stuff on git commit or what ever
#!/usr/bin/env ruby
files = []
waiting = true
threads = []
lines = []
ignore = [
'db/schema.rb'
]
@brand-it
brand-it / rubocop_pre_commit_hook
Last active July 21, 2020 15:50 — forked from mpeteuil/rubocop_pre_commit_hook
Ruby style guide git pre-commit hook using Rubocop as the style guide checker. Only runs on staged ruby files that have been added and/or modified.
#!/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
@brand-it
brand-it / grouping_rspec_test
Created January 30, 2019 16:06
Grouping Rspec Tests
#!/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|
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}"
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
class Config
attr_accessor :total_threads, :files_per_second, :logger
class << self
def info
@info ||= Config.new
end
end
@brand-it
brand-it / create_ssl.sh
Last active June 9, 2022 16:05
This build tinderbox ssl certs for local development. Can be used for other things but. Also designed to add it to Mac credentials
#!/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'
@brand-it
brand-it / index.html
Last active October 5, 2018 16:19
here is some code or testing.
<table style="width: 100%; height: 304px;">
<tbody>
<tr style="height: 21px;">
<th style="width: 50%; height: 21px;">Token Name</th>
<th style="width: 50%; height: 21px;">Value</th>
</tr>
<tr style="height: 21px;">
<td style="width: 50%; height: 21px;">Proposal Title</td>
<td style="width: 50%; height: 21px;"><span allowstyling="true" data-name="proposal_title" data-type="string"
data-variable-content="inline" data-source="" data-raw-value="Cy Kosis" class="inline-variable mceNonEditable"