Skip to content

Instantly share code, notes, and snippets.

@craigmcnamara
craigmcnamara / database.yml
Last active January 25, 2023 12:57
Database per branch
# To enable a per branch DBs, go to .env and add `DB_PER_BRANCH=true`
<% branch_suffix = ENV["DB_PER_BRANCH"] ? ("--" + `git rev-parse --abbrev-ref HEAD`.chomp)&.gsub(/\./, '')&.split('/')&.last : "" %>
development:
database: app_development<%= branch_suffix %>
@craigmcnamara
craigmcnamara / debugger.rb
Last active March 26, 2021 19:43
A container config debugger in Ruby and Sinatra
# A utility app to debug the Docker on AWS.
#
require 'sinatra'
require 'active_record'
require 'redis'
configure do
use Rack::CommonLogger, $STDOUT
end
@craigmcnamara
craigmcnamara / kill-all-chrome
Created July 9, 2020 00:14
Add to your ~/bin to kill all chrome processes on OSX
ps -ef | grep Chrome | grep -v grep | awk '{print $2}' | xargs kill
@craigmcnamara
craigmcnamara / active_storage_fixtures.rb
Created June 23, 2020 23:03
An example of setting up an ActiveStorage attachment
FactoryBot.define do
factory :thing do
after(:build) do |thing, evaluator|
file_path = Rails.root.join('spec/fixtures/files/image-needs-auto-orient.jpg')
thing.photos.attach(io: File.open(file_path), filename: 'photo.jpg')
end
end
end
end
@craigmcnamara
craigmcnamara / invoker.ini
Created December 12, 2018 19:06
Sample invoker config for caring
; I autostart because I am relied on by everything
[dir.caring]
port = 9000
directory = /Users/craig/work/dir.caring.com
command = RBENV_VERSION=$(cat .ruby-version) zsh -c "source ~/.zshrc && ./bin/rails s -p $PORT"
; The rest of us must be started with `invoker add {app}.caring`
[find.caring]
directory = /Users/craig/work/find.caring.com
command = RBENV_VERSION=$(cat .ruby-version) zsh -c "source ~/.zshrc && ./bin/rails s -p $PORT"
@craigmcnamara
craigmcnamara / error.html
Created November 3, 2018 00:21
Reveiw moderation error
<!DOCTYPE html><html><head><title>Your access to this site has been limited</title><style>html {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.42857143;
color: #333;
background-color: #fff;
}
body {
padding: 2rem;
@craigmcnamara
craigmcnamara / query.graphql
Created August 7, 2018 22:18
Seniorhomes Listing Query
query($id: ID!){
localProperty(id: $id) {
id
name
status
description
sh_description
enhanced
latitude
@craigmcnamara
craigmcnamara / workflow.md
Last active May 17, 2018 21:29
Feature Branch Workflow

Branch Workflow

  • Create your feature branch
    • git checkout -b my-new-feature
  • Add your changes
    • git add changed-file
  • Commit your changes
    • git commit
  • Push to the branch
  • git push origin my-new-feature
@craigmcnamara
craigmcnamara / cilantro_lime_shrimp.md
Last active August 22, 2016 19:20
Grilled Cilantro Lime Shrimp

Planning

  • 2 pound large shrimp (about 30) peeled, deveined
  • 1 cup picked cilantro leaves (about 1 bunch trimmed of most long stems.)
  • 6 garlic cloves
  • 3 limes, zested and juiced
  • 1 tablespoon salt
  • 1/2 tablespoon black pepper
  • 1 cup olive oil
  • Red pepper flakes to taste
sudo ls -l /usr/local/lib/libmy*
lrwxr-xr-x  1 craig  staff  50 Apr 16  2015 /usr/local/lib/libmysqlclient.18.dylib -> ../Cellar/mysql/5.6.23/lib/libmysqlclient.18.dylib
lrwxr-xr-x  1 craig  staff  43 Apr 16  2015 /usr/local/lib/libmysqlclient.a -> ../Cellar/mysql/5.6.23/lib/libmysqlclient.a
lrwxr-xr-x  1 craig  staff  47 Apr 16  2015 /usr/local/lib/libmysqlclient.dylib -> ../Cellar/mysql/5.6.23/lib/libmysqlclient.dylib
lrwxr-xr-x  1 craig  staff  52 Apr 16  2015 /usr/local/lib/libmysqlclient_r.18.dylib -> ../Cellar/mysql/5.6.23/lib/libmysqlclient_r.18.dylib
lrwxr-xr-x  1 craig  staff  45 Apr 16  2015 /usr/local/lib/libmysqlclient_r.a -> ../Cellar/mysql/5.6.23/lib/libmysqlclient_r.a
lrwxr-xr-x  1 craig  staff  49 Apr 16  2015 /usr/local/lib/libmysqlclient_r.dylib -> ../Cellar/mysql/5.6.23/lib/libmysqlclient_r.dylib
lrwxr-xr-x  1 craig  staff  38 Apr 16  2015 /usr/local/lib/libmysqld.a -> ../Cellar/mysql/5.6.23/lib/libmysqld.a
lrwxr-xr-x  1 craig  staff  45 Apr 16  2015 /usr/local/lib/libmysqlservices.a ->