Skip to content

Instantly share code, notes, and snippets.

View BDQ's full-sized avatar
💥

Brian Quinn BDQ

💥
View GitHub Profile
#longest actions (total)
grep "Completed 200 OK in" log/production.log | cut -d' ' -f 5 | grep '[0-9.]*' -o | sort -n
#longest actions (view)
# grep "Completed 200 OK in" log/production.log | cut -d' ' -f 7 | grep '[0-9.]*' -o | sort -n
# longest actions (database)
require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
@BDQ
BDQ / gist:1300654
Created October 20, 2011 08:16
Apartment Test output
bqimac:apartment[master]$ bundle exec rake spec
(in /Users/briandquinn/Development/apartment)
/Users/briandquinn/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -S bundle exec rspec spec/adapters/mysql_adapter_spec.rb spec/adapters/postgresql_adapter_spec.rb spec/apartment_spec.rb spec/integration/apartment_rake_integration_spec.rb spec/integration/database_integration_spec.rb spec/integration/delayed_job_integration_spec.rb spec/integration/middleware/subdomain_elevator_spec.rb spec/tasks/apartment_rake_spec.rb spec/unit/config_spec.rb spec/unit/middleware/subdomain_elevator_spec.rb spec/unit/migrator_spec.rb spec/unit/reloader_spec.rb
/Users/briandquinn/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV_
Apartment::Adapters::MysqlAdapter
using databases
#create
DEPRECATION WARNING: Arel::Visitors::VISITORS is deprecated and will be removed. Database adapters should define a visitor_for method which returns the appropriate visitor for the
describe "States" do
before(:each) do
visit admin_path
click_link "Configuration"
end
context "admin visiting states listing" do
it "should correctly display the states" do
Factory(:state, :name => "Maryland", :abbr => "MD", :country => Factory(:country))
@BDQ
BDQ / Gemfile
Created October 28, 2011 07:40
gem 'deface', :git => 'git://github.com/railsdog/deface.git', :ref => '881e6d09f292a58d929abc19feac5ef2f8d87b70'
@BDQ
BDQ / gist:1321842
Created October 28, 2011 08:05
Deface DSL
surround :body, :for => 'layouts/spree_application', :name => 'wrap_body' do
%Q{<div class="wrapper">
<div class="w1">
<div class="w2">
<div class="w3">
<div class="main">
<div id="header">
<h1><a href="http://depts.washington.edu/uwc4c/">University of Washington Center for Commercialization</a></h1><a href="http://www.washington.edu/" class="ad-w">UW</a>
</div>
<%= render_original %>
ruby-1.9.2-p290 :001 > Spree::Product.search({:name_in => "Shirt"}).relation
Spree::Product Load (18.3ms) SELECT "spree_products".* FROM "spree_products" WHERE "spree_products"."name" IN ('Shirt')
=> []
def connect_to_new(database)
klass_name = database.underscore.classify
# define class for each database so we get connection pool usage
unless (Module.const_get(klass_name) rescue false)
klass = Class.new(ActiveRecord::Base)
Object.const_set klass_name, klass
# only establish connection once
end
@BDQ
BDQ / gist:1345547
Created November 7, 2011 17:10
mysql settings for testing
max_connections = 5000
wait_timeout = 600
export RUBY_HEAP_MIN_SLOTS=800000
export RUBY_HEAP_SLOTS_INCREMENT=300000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=80000000
export RUBY_HEAP_FREE_MIN=100000