Skip to content

Instantly share code, notes, and snippets.

View chip's full-sized avatar

Chip Castle chip

View GitHub Profile
# Setup a new project
# rails project -m http://gist.github.com/105257
#
# Or apply to an existing project
# rake rails:template LOCATION=http://gist.github.com/105257
############## plugin commands #################
plugin 'app_helpers', :git => '[email protected]:chip/app_helpers.git'
plugin 'ubistrano', :git => '[email protected]:chip/ubistrano.git', :to => 'config/ubistrano'
plugin 'haml', :git => "git://github.com/nex3/haml.git"
@chip
chip / spec_helper.rb
Created August 29, 2011 17:17
Spork config for spec_helper.rb
require 'rubygems'
require 'spork'
Spork.prefork do
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
@chip
chip / basecamp2github.rb
Created October 26, 2011 19:16
Convert Basecamp tasks to Github issues
require 'rubygems'
require 'hash'
require 'active_resource'
require 'basecamp'
require 'httparty'
require 'json'
class GithubIssues
include HTTParty
base_uri "https://api.github.com"
@chip
chip / gist:1934131
Created February 28, 2012 18:23
Copy the last commit message to the Mac clipboard
git log --pretty=oneline | head -1 | perl -pne 's/^(.{1,41}) (.*)$/$2/; s/\n//g' | pbcopy
@chip
chip / gist:1988614
Created March 6, 2012 19:51
Spec failures after Rails 3.2.2 upgrade
Failures:
1) OrderNote resolving issues With an existing order Charge the customer 100% of the purchase price should charge the customer
Failure/Error: subject.resolves(params, creator)
NoMethodError:
undefined method `[]' for nil:NilClass
# ./app/models/order_transaction.rb:199:in `fee!'
# ./app/models/order_note.rb:167:in `charge'
# ./app/models/order_note.rb:88:in `resolves'
# ./spec/models/order_note_spec.rb:290
@chip
chip / Gemfile
Created March 30, 2012 13:11
Gemfile for "factory_girl requires Ruby version >= 1.9.2" error
source 'http://rubygems.org'
gem 'rack-test'
gem 'rails', '3.1.3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
@chip
chip / gist:2338199
Created April 8, 2012 16:10
Pry as the rails console
# Gemfile
gem 'pry', :group => :development
# config/environments/development.rb
silence_warnings do
require 'pry'
IRB = Pry
end
AN AUTHORIZATION IS CHARGEABLE
==============================
* It's still valid, which means it's Authorization.state = 'authorized'
* It's not monitored (handled by the backend scripts. Is "monitored" a valid Authorization.state setting?)
* Is completely or partially shipped (at least 1 shipped item)
* Was created at least 2 Business days ago
How to test:
1. Buy a book on both Cybersource and PlugnPay
@chip
chip / Gemfile
Created November 28, 2012 00:09
Sinatra app to deploy master branch based on SemaphoreApp payload
source :rubygems
gem 'shotgun'
gem 'sinatra'
gem 'yajl-ruby'
@chip
chip / app.rb
Created December 4, 2012 20:05
Deploy to staging server based on Payload JSON from SemaphoreApp
post '/deploy' do
json = request.body.read
data = Yajl::Parser.parse(json)
token = ENV['CAMPFIRE_TOKEN']
account = ENV['CAMPFIRE_ACCOUNT']
campfire = Tinder::Campfire.new account, :token => token, :ssl_verify => false
room = campfire.find_room_by_name("Rental Dev")
commit = data['commit']