Skip to content

Instantly share code, notes, and snippets.

View seth-macpherson's full-sized avatar

Seth MacPherson seth-macpherson

  • Appfolio
  • Hood River, OR
View GitHub Profile
@seth-macpherson
seth-macpherson / .gitconfig
Last active May 9, 2024 22:37
Just a happy little .gitconfig
[core]
# Use custom `.gitignore` and `.gitattributes`
attributesfile = ~/.gitattributes
editor = /opt/homebrew/bin/code -w
excludesfile = ~/.gitignore
ignorecase = false
noAheadBehind = true
pager = delta
preloadIndex = true
@seth-macpherson
seth-macpherson / processing.rb
Created November 19, 2018 19:38
Processing Pricing
PROCESSING = {
cb: {
1 => {
cost: 1500.00
},
2 => {
cost: 2200.00
},
3 => {
cost: 2900.00
@seth-macpherson
seth-macpherson / storage.rb
Created November 19, 2018 19:37
Storage Pricing
STORAGE = {
cb: {
1 => {
annual: 149.00,
prepaid_term: 2199.00,
prepaid_life: 3199.00
},
2 => {
annual: 298.00,
prepaid_term: 4398.00,
@seth-macpherson
seth-macpherson / database_config_testing.rb
Created March 2, 2018 18:27
Validate changes made to database.yml
# To validate the changes I made to database config I ran the following under Rails console
original = YAML.load(ERB.new(File.read("#{Rails.root}/config/database.yml")).result)
new_config = YAML.load(ERB.new(File.read("#{Rails.root}/config/database_new.yml")).result)
# require 'pp'
# pp original ->
{"local"=>
{"adapter"=>"mysql2",
"encoding"=>"utf8",
"database"=>"connect",
@seth-macpherson
seth-macpherson / panda.md
Last active October 4, 2017 23:07
Known Panda Dependencies

Known Panda Dependencies

Background:

  • All directions assume each app passes a health_check
  • All projects should be using their correct ruby version
  • All projects should run against master or develop to test Panda
  • dropdb [site]_dev will fail if delayed_job is running for that app
  • dropdb [site]_dev will fail if pow/rails is running against that app

Order of Configuration

@seth-macpherson
seth-macpherson / .rubocop.yml
Created March 23, 2017 19:47 — forked from jhass/.rubocop.yml
My preferred Rubocop config
AllCops:
RunRailsCops: true
# Commonly used screens these days easily fit more than 80 characters.
Metrics/LineLength:
Max: 120
# Too short methods lead to extraction of single-use methods, which can make
# the code easier to read (by naming things), but can also clutter the class
Metrics/MethodLength:

Jenkins Installation

Create EC2 instance

  • Choose Amazon Linux AMI as it comes configured with a strong set of tools
  • Create security group with access to TCP on ports 22, 80, 8080, and 52698
  • Generate key-pair called jenkins -> download as jenkins.pem
    • move jenkins.pem into ~/.ssh
    • run chmod 400 on jenkins.pem to set correct permissions
  • Launch Instance
  • Locate public IP settings in AWS instance management console and copy to clipboard
@seth-macpherson
seth-macpherson / install-redis.sh
Last active May 31, 2016 14:24 — forked from four43/install-redis.sh
Install Redis
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://gist.github.com/seth-macpherson/04287d9b1cb7ca1a5caf/raw/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"
@seth-macpherson
seth-macpherson / mappings.rb
Created October 2, 2015 19:08
ActiveSupport::Timezone Mappings
MAPPING = {
"International Date Line West" => "Pacific/Midway",
"Midway Island" => "Pacific/Midway",
"Samoa" => "Pacific/Pago_Pago",
"Hawaii" => "Pacific/Honolulu",
"Alaska" => "America/Juneau",
"Pacific Time (US & Canada)" => "America/Los_Angeles",
"Tijuana" => "America/Tijuana",
"Mountain Time (US & Canada)" => "America/Denver",
"Arizona" => "America/Phoenix",
@seth-macpherson
seth-macpherson / grape.rake
Last active September 5, 2015 06:31 — forked from pragmaticivan/grape.rake
Grape Rake (routes)
namespace :grape do
desc "Condensed API Routes"
task :routes => :environment do
mapped_prefix = '' # where mounted in routes.rb
format = "%46s %3s %7s %50s %12s: %s"
API.routes.each do |grape_route|
info = grape_route.instance_variable_get :@options
puts format % [
info[:description] ? info[:description][0..45] : '',
info[:version],