Skip to content

Instantly share code, notes, and snippets.

View jeffrafter's full-sized avatar
You are amazing

Jeff Rafter (he/him) jeffrafter

You are amazing
View GitHub Profile
require 'rubygems'
require 'fog'
require 'yaml'
require 'colorize'
# This script is for provisioning ebs and ec2 compute instances
ami_ebs = {:image_id => "ami-a2f405cb", :flavor_id => 't1.micro'}
ami_ec2 = {:image_id => "ami-88f504e1", :flavor_id => 'm1.small'}
repo = "git@github.com:user/repo.git"
@jeffrafter
jeffrafter / slimgem-install.sh
Created June 1, 2011 18:03
Install slimgems
#!/bin/sh
cd ~
git clone git://github.com/slimgems/slimgems.git
cd slimgems && ruby -Ilib -S gem build slimgems.gemspec
echo "Now, change to your folder where you are running RVM \
\
gem install ~/slimgems/slimgems-1.3.8.gem"
@jeffrafter
jeffrafter / active_record_overrides.rb
Created May 31, 2011 20:47
Why doesn't this work
module ActiveRecordOverrides
module ClassMethods
def find(*args)
super
rescue ActiveRecord::RecordNotFound
find_by_url!(*args)
end
end
def self.included(base)
@jeffrafter
jeffrafter / addSpriteWithColor.c
Created May 26, 2011 07:58
Extract a sprite by frame name and display with red background
// Based on http://www.cocos2d-iphone.org/forum/topic/9473
- (void) addSpriteWithColor:(NSString *)frameName {
CGSize winSize = [CCDirector sharedDirector].winSize;
CCSprite *spr = [CCSprite spriteWithSpriteFrameName:frameName];
spr.visible = YES;
// Center sprite
spr.anchorPoint = ccp(0, 0);
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe InterestsController do
render_views
before :each do
@interest = Factory(:interest, :name => 'interest')
end
@jeffrafter
jeffrafter / case_carrier.js
Created March 10, 2011 06:12
List of case carriers and bookmarklet script
var caseCarriers = [
"Angelides, Laura",
"Amendarez, Manuel",
"Arvidson, Sofia",
"Bamberger, Sally",
"Banks, Jacqueline",
"Bates, Shirleyne",
"Batie, Julie",
"Beaird-Rucker, Lisa",
"Beigle, Rebecca",
Vagrant::Config.run do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "base"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
#!/usr/bin/env sh
# Script will watch the current working folder every $interval seconds for changes (modifications,
# deletions, additions and do something cool if a change is detected. By default it will always
# run once on start
watch=`pwd`
interval="1"
verbose="0"
if [ $verbose -eq "1" ] ;then echo "Watching: $watch"; fi
Autotest.add_discovery { "rails" }
Autotest.add_discovery { "rspec2" }
Autotest.add_hook :initialize do |at|
at.add_mapping(%r%^spec/(workers|services)/.*rb$%) { |filename, _|
filename
}
at.add_mapping(%r%^app/workers/(.*)\.rb$%) { |_, m|
["spec/workers/#{m[1]}_spec.rb"]
}
at.add_mapping(%r%^app/services/(.*)\.rb$%) { |_, m|
@jeffrafter
jeffrafter / Rakefile
Created February 16, 2011 20:42
Working with ActiveRecord in Sinata
require 'rubygems'
require 'active_support'
require 'active_record'
require 'rake'
require 'yaml'
task :default => :setup
task :load do
# Change application as needed...