Skip to content

Instantly share code, notes, and snippets.

@amw
amw / database.yml
Created December 21, 2010 16:12
Standard rails database.yml with additional definition of live database
development:
adapter: mysql2 # must =~ /mysql/
database: adamDb # required
username: your_user
password: keep_secret
live:
ssh_user: # optional, use if live system user differs from your dev user
host: example.com # required, can be IP
adapter: mysql2 # must =~ /mysql/
@amw
amw / ar_patch.rb
Created January 19, 2011 19:19
A patch that allows lambda arguments to default_scope in rails ~> 3.0.0
module ActiveRecord
class Base
class << self
def default_scope(options = {})
reset_scoped_methods
default_scoping = self.default_scoping.dup
previous = default_scoping.pop
if previous.respond_to?(:call) or options.respond_to?(:call)
module SharedDatabase
module UniquenessValidator
def self.included(validator)
validator.class_eval do
def setup_with_subdomain_account(klass)
return unless klass.table_exists?
if klass.column_names.include? 'subdomain_account_id'
scope = [:subdomain_account_id]
spree[fix-order-scopes]$rake spec
(in /Users/amw/Projects/spree)
########################### api #########################
rm api/Gemfile*
cd api && /opt/local/bin/rake test_app
(in /Users/amw/Projects/spree/api)
run rake spree_core:install from "./test_app"
(in /Users/amw/Projects/spree/api/spec/test_app)
run rake spree_auth:install from "./test_app"
(in /Users/amw/Projects/spree/api/spec/test_app)
$rake spec
(in /home/amw/spree)
########################### api #########################
rm api/Gemfile*
cd api && /var/lib/gems/1.8/bin/rake test_app
(in /home/amw/spree/api)
run rails new test_app --database=sqlite3 -GJTq --skip-gemfile from "./spec"
run rake spree_core:install from "./test_app"
(in /home/amw/spree/api/spec/test_app)
run rake spree_auth:install from "./test_app"
$git diff
diff --git a/auth/spec/spec_helper.rb b/auth/spec/spec_helper.rb
index 2d271e6..825c2d2 100644
--- a/auth/spec/spec_helper.rb
+++ b/auth/spec/spec_helper.rb
@@ -3,6 +3,7 @@
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../test_app/config/environment", __FILE__)
require 'rspec/rails'
+require 'faker'
@amw
amw / before "require faker"
Created April 15, 2011 03:37
before "require faker"
$rake spec
(in /home/amw/spree)
########################### api #########################
rm api/Gemfile*
cd api && /var/lib/gems/1.8/bin/rake test_app
(in /home/amw/spree/api)
run rails new test_app --database=sqlite3 -GJTq --skip-gemfile from "./spec"
run rake spree_core:install from "./test_app"
(in /home/amw/spree/api/spec/test_app)
run rake spree_auth:install from "./test_app"
@amw
amw / Gemfile.lock
Created May 30, 2011 17:11
Sprockets encoding trace
GEM
remote: http://rubygems.org/
specs:
actionmailer (3.1.0.rc1)
actionpack (= 3.1.0.rc1)
mail (~> 2.3.0)
actionpack (3.1.0.rc1)
activemodel (= 3.1.0.rc1)
activesupport (= 3.1.0.rc1)
builder (~> 3.0.0)
@amw
amw / site.com.conf
Created July 19, 2012 07:39
Apache's Passenger virtual host config
<IfModule mod_passenger.c>
<VirtualHost 68.168.103.75:80>
DocumentRoot /rails/public
ServerName site.com
ServerAlias www.site.com
RackBaseURI /
XSendFile on
XSendFilePath /rails
@amw
amw / output
Created November 5, 2012 15:34
Uninitialized constants in zendesk API
$ruby zentest.rb
W, [2012-11-05T16:32:03.672936 #15942] WARN -- : ZendeskAPI::User - find
W, [2012-11-05T16:32:03.673034 #15942] WARN -- : uninitialized constant ZendeskAPI::Middleware::Response::Gzip::Zlib
W, [2012-11-05T16:32:03.673071 #15942] WARN -- : /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/zendesk_api-0.1.10/lib/zendesk_api/middleware/response/gzip.rb:11:in `block in <class:Gzip>'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/faraday_middleware-0.9.0/lib/faraday_middleware/response_middleware.rb:48:in `call'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/faraday_middleware-0.9.0/lib/faraday_middleware/response_middleware.rb:48:in `parse'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/faraday_middleware-0.9.0/lib/faraday_middleware/response_middleware.rb:39:in `process_response'
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/faraday_middleware-0.9.0/lib/faraday_middleware/response_middleware.rb:32:in `block in call'
/usr/local/Cellar/