Skip to content

Instantly share code, notes, and snippets.

View tspacek's full-sized avatar

Tom Spacek tspacek

  • Melbourne, Australia
View GitHub Profile
@tspacek
tspacek / Rubocop pre-commit
Last active May 1, 2020 05:53
Pre-commit hook to run Rubocop
#!/usr/bin/env ruby
require 'english'
require 'rubocop'
require 'yaml'
ADDED_OR_MODIFIED = /A|AM|^M/.freeze
ignored_files = YAML.load_file('.rubocop.yml')['AllCops']['Exclude'] rescue []
@tspacek
tspacek / upgrade.rb
Created January 4, 2014 05:37
Quick and dirty script to upgrade a Heroku Postgres DB according to https://devcenter.heroku.com/articles/heroku-postgres-follower-databases#database-upgrades-and-migrations-with-changeovers Usage: ruby upgrade.rb <app_name> with_worker
@app = ARGV[0]
puts @app
@scale_worker = (ARGV.last == "with_worker")
def prepare
db_info = `heroku pg:info -a #{@app}`
@db_name = db_info.split("\n").first.split(" ")[1]
follower_available = db_info.include? "Fork/Follow: Available"