Skip to content

Instantly share code, notes, and snippets.

Adam Wróbel amw

Block or report user

Report or block amw

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@amw
amw / database.yml
Created Dec 21, 2010
Standard rails database.yml with additional definition of live database
View database.yml
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 Jan 19, 2011
A patch that allows lambda arguments to default_scope in rails ~> 3.0.0
View ar_patch.rb
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)
View default scope for uniqueness validator
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]
View spree-tests-fail-on-ruby-1_9_2
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)
View after "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"
View "require faker" patch
$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 Apr 15, 2011
before "require faker"
View 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
Sprockets encoding trace
View Gemfile.lock
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 Jul 19, 2012
Apache's Passenger virtual host config
View site.com.conf
<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 Nov 5, 2012
Uninitialized constants in zendesk API
View output
$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/
You can’t perform that action at this time.