Skip to content

Instantly share code, notes, and snippets.

View BDQ's full-sized avatar
💥

Brian Quinn BDQ

💥
View GitHub Profile
desc "Duplicates images from all app/assets directories"
task :cache_images_for_development => :environment do
image_paths = Rails.application.assets.paths.select {|path| path.ends_with? "/images" }
image_paths.reverse.each do |path|
Dir.glob(File.join(path, "**/*")) do |file|
puts file.to_s.sub(path, '')
end
Deface::Override.new(:name => 'set_cart_form_enctype',
:virtual_path => 'products/_cart_form',
:replace => "code[erb-loud]:contains('populate_orders_url')",
:text => "<%= form_for :order, :url => populate_orders_url, :html => {:multipart => true} do |f| %>")
require 'sprockets/asset_attributes'
Sprockets::AssetAttributes.class_eval do
alias_method :sprockets_path_with_fingerprint, :path_with_fingerprint
def path_with_fingerprint(digest)
if Rails.env.development?
pathname.to_s
else
sprockets_path_with_fingerprint(digest)
@BDQ
BDQ / gist:1156903
Created August 19, 2011 14:18
Get Add Product to work via js
$('#add_product_name').val('apache');
$('#add_product_name').trigger($.Event('keydown', { which: 34} ));
#### core/lib/spree_core/railtie.rb #####
initializer "spree.environment" do |app|
app.config.spree = Spree::Environment.new
end
initializer "spree.register.payments" do |app|
app.config.spree.payment_methods = [
Gateway::Bogus,
Gateway::AuthorizeNet,
#!/usr/bin/ruby
#url labels can only be /a-zA-Z0-9-/
urls = [
['Spreedemo-home', 'http://demo.spreecommerce.com/'],
['Spreedemo-product', 'http://demo.spreecommerce.com/products/xm-inno-xm2go-portable-satellite-radio-mp3-player-and-home-kit']
]
n = 100
cons = [2, 20]
results = { "rps" => [], "tpr" => [] }
@BDQ
BDQ / Gemfile
Created August 26, 2011 07:39
Spree edge Rails 3.1.0rc6
source 'http://rubygems.org'
gem 'rails', '3.1.0.rc6'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'json'
Deface::Override.new(:virtual_path => "layouts/admin",
:name => "promo_admin_tabs",
:insert_bottom => "[data-hook='admin_tabs'], #admin_tabs[data-hook]",
:text => "<%= tab(:promotions) %>",
:disabled => false)
require 'rubygems'
require 'deface'
html = %q{<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7 ]> <html lang="<%= ::I18n.locale %>" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="<%= ::I18n.locale %>" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="<%= ::I18n.locale %>" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="<%= ::I18n.locale %>" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]> <html lang="<%= ::I18n.locale %>" class="no-js"> <![endif]-->}
echo "test is a test"
echo $?