Skip to content

Instantly share code, notes, and snippets.

@chumpy
chumpy / app_contansts.rb
Created October 31, 2012 18:52
Rails app contants in YAML file (adapted from http://goo.gl/9EuAh)
# this goes in config/initializers
APP_CONFIG = YAML.load(File.read(File.expand_path('../../app_constants.yml', __FILE__)))[Rails.env]
@chumpy
chumpy / heroku_data_transfer
Last active October 12, 2015 15:28 — forked from nhocki/gist:1095522
Transfer data from production to staging on Heroku
heroku addons:add pgbackups --remote staging
heroku addons:add pgbackups --remote production
heroku pgbackups:capture --remote production
heroku pgbackups:restore DATABASE `heroku pgbackups:url --remote production` --remote staging
@chumpy
chumpy / rails_admin_notes.md
Last active December 18, 2015 15:19
rails_admin notes

Accessing model instance inside config block:

field :email do 
  formatted_value do
    bindings[:object].user.email
  end
end
@chumpy
chumpy / state_selector.md
Last active December 18, 2015 15:58
State selector

State Selector

def us_states
  [
    ['Alabama', 'AL'],
    ['Alaska', 'AK'],
    ['Arizona', 'AZ'],
    ['Arkansas', 'AR'],
@chumpy
chumpy / distinction.rb
Last active December 25, 2015 21:49
if you're going to hard code the area stuff maybe this is better
#######################
# The following code goes in the distinction model
#######################
# This is the hard-coding alternative to putting these values in the db
DISTINCTION_AREAS = {'01' => 'moira.poe@yale.edu', '02' => 'nicole.chulick@yale.edu'}
def area_email
DISTINCTION_AREAS[self.area]
end
@chumpy
chumpy / README.md
Created March 5, 2014 18:49
test for gist-it

All packages in this directory will be automatically loaded

<% @approval_states.each do |step| %>
<li><%= link_to step.state, garden_meal_path(@garden_meal, garden_meal: { id: @garden_meal.id}, approval_state: step.state), method: :put %></li>
<% end %>
@chumpy
chumpy / wipe_vim_configs.sh
Created June 23, 2014 15:52
Take Vim back to vanilla
#!/bin/bash
# cleanup vim configs and start again with an empty install
cd
mv .vimrc .vimrc-old
mv .vim .vim-old
touch .vimrc
mkdir .vim

Keybase proof

I hereby claim:

  • I am chumpy on github.
  • I am kbeddingfield (https://keybase.io/kbeddingfield) on keybase.
  • I have a public key whose fingerprint is 7AEA FDC5 7533 D5F7 639C 1F65 64FA FEFC 60A9 7D1A

To claim this, I am signing this object:

@chumpy
chumpy / sample_spec.rb
Created November 12, 2019 23:13
test sample
require 'rails_helper'
describe StoreFront do
describe '#shows_meal_label_line?' do
let(:dc_geo) { FactoryGirl.build(:store_front, name: "DC") }
let(:other_geo) { FactoryGirl.build(:store_front) }
it 'true when multiple lines (aka DC)' do
dc_geo.lines << FactoryGirl.create(:line, name: "Paleo")
dc_geo.lines << FactoryGirl.create(:line, name: "Mix")