Skip to content

Instantly share code, notes, and snippets.

View BDQ's full-sized avatar
💥

Brian Quinn BDQ

💥
View GitHub Profile
def rake(cmd, options={}, &block)
command = "cd #{current_path} && bundle exec rake #{cmd}"
run(command, options, &block)
end
$ cap rake 'db:admin:create'
Deface::Override.new(:virtual_path => "products/show",
:name => "tweak_thumbs",
:replace => "div#main-image",
:closing_selector => "div#thumbnails",
:text => %q{<span>Hello World</span>})
['products/show', 'orders/show', 'taxons/show'].each do |virtual_path|
Deface::Override.new(:virtual_path => virtual_path,
:name => %q{del_accurate_title},
:remove => %q{h1})
end
S3_CREDENTIALS = {:access_key_id => ENV['S3_KEY'], :secret_access_key => ENV['S3_SECRET'], :bucket => ENV['S3_BUCKET']}
Image.class_eval do
Image.attachment_definitions[:attachment].tap do |a|
a[:styles][:large] = '600x350>'
a[:styles][:small] = '260x170>'
a[:styles][:mini] = '60x60#'
a[:styles][:square] = '78x78#'
@BDQ
BDQ / deploy.rb
Created December 1, 2011 13:39
Capistrano Recipe for Spree 0.70.0 - Single Server
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path.
require "rvm/capistrano" # Load RVM's capistrano plugin.
require "bundler/capistrano"
load 'deploy/assets'
set :application, "YOUR_APP_NAME"
set :user, 'spree'
set :group, 'www-data'
set :domain, "#{application}.spreeworks.com"
//set hook frame positions
var show_frames = false;
var frame_level = 0;
function show_hook_frames(){
$jQ.each($("[data-hook]"), function(i, hook){
$jQ(hook).popover('disable');
});
if(show_frames){
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
@BDQ
BDQ / gist:1345547
Created November 7, 2011 17:10
mysql settings for testing
max_connections = 5000
wait_timeout = 600
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
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')
=> []