Skip to content

Instantly share code, notes, and snippets.

🎩

Brandt Lareau brand-it

🎩
Block or report user

Report or block brand-it

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View pg_slave_setup
#!/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
View core_menu_item.rb
require 'csv'
require 'fileutils'
require 'open-uri'
require 'net/ftp'
class CoreMenuItem
UPLOAD_URI = URI.parse('https://api.github.com/gists')
CSV_PATH = File.expand_path("tmp/#{Time.now.to_i}_core.csv")
HEADERS = [
:id, :name, :slug, :product_id, :category_slugs, :published,
View touch_menu_items.rb
class TouchMenuItems
TOUCHED_CSV = File.expand_path('tmp/menu_items_touched.csv')
attr_reader :max_per_second, :ids
def initialize(max_per_second:, ids:)
@max_per_second = max_per_second
@ids = ids
@started_at = Time.now.to_i
end
View csv_uploader.rb
require 'net/http'
require 'csv'
class CSVUploader
UPLOAD_URI = URI.parse('https://api.github.com/gists')
attr_reader :headers, :rows, :github_token, :file_name
def initialize(headers:, rows:, github_token:, file_name:)
@headers = headers
View create_gist.rb
require 'net/http'
require 'json'
def create_csv_gist(file_name, rows)
uri = URI("https://api.github.com/gists")
payload = {
'description' => "IDS",
'public' => false,
'files' => {
@brand-it
brand-it / branch_cleaning.rb
Last active Jul 25, 2019
This lets you destroy branches that are older then a given amount of time.
View branch_cleaning.rb
#!/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 Jul 26, 2019
just a script to check code climate stuff on git commit or what ever
View code-climate-pre-hook-git.rb
#!/usr/bin/env ruby
files = []
waiting = true
threads = []
lines = []
ignore = [
'db/schema.rb'
]
@brand-it
brand-it / rubocop_pre_commit_hook
Last active Dec 10, 2019 — 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.
View rubocop_pre_commit_hook
#!/usr/bin/env ruby
# frozen_string_literal: true
files = []
waiting = true
threads = []
lines = []
ignore = []
def compile_lines_changed(files)
View grouping_rspec_test
#!/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|
View prince_docker.rb
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}"
You can’t perform that action at this time.