Skip to content

Instantly share code, notes, and snippets.

View BDQ's full-sized avatar
💥

Brian Quinn BDQ

💥
View GitHub Profile
compile_styles: function(){
var palette = Spraycan.palettes.find(function(palette){ return palette.get('active') });
var config_template = JST["spraycan/templates/shared/less_config"];
var less_css = config_template({ palette: palette});
less_css += window.frames[0].$jQ('style#source')[0].textContent;
var parser = less.Parser();
parser.parse(less_css, function(error, result){
if(error == null){
" changing tabs with number keys
let mapleader=','
map <leader>1 1gt
map <leader>2 2gt
map <leader>3 3gt
map <leader>4 4gt
map <leader>5 5gt
map <leader>6 6gt
map <leader>7 7gt
map <leader>8 8gt
== AddApiKeyToSpreeUsers: migrating ==========================================
-- add_column(:spree_users, :api_key, :string, {:limit=>40})
rake aborted!
An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: no such table: spree_users: ALTER TABLE "spree_users" ADD "api_key" varchar(40)
NoMethodError in Spree::OmniauthCallbacksController#spree_works
undefined method `collect' for nil:NilClass
Rails.root: /Users/briandquinn/Development/store_works
Application Trace | Framework Trace | Full Trace
app/controllers/spree/omniauth_callbacks_controller.rb:19:in `check_for_store_ownership'
app/controllers/spree/omniauth_callbacks_controller.rb:4:in `spreeworks'
actionpack (3.2.2) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
== AddIndexOnUsersPersistenceToken: migrating ================================
-- add_index(:users, :persistence_token)
rake aborted!
An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: table users has no column named persistence_token: CREATE INDEX "index_users_on_persistence_token" ON "users" ("persistence_token")
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
== RenameApiKeyToSpreeApiKey: migrating ======================================
-- rename_column(:spree_users, :api_key, :spree_api_key)
rake aborted!
An error has occurred, this and all later migrations canceled:
Could not find table 'spree_users'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
@BDQ
BDQ / gist:3016726
Created June 29, 2012 08:49
Example of editing existing State Machine
# Adding a new state
Order.state_machine.states << skrill_state = StateMachine::State.new(Order.state_machine, 'skrill')
# Redefining an event
Order.state_machine.events << next_event = StateMachine::Event.new(Order.state_machine, :next)
next_event.transition :from => 'cart', :to => 'address'
next_event.transition :from => 'address', :to => 'delivery'
next_event.transition :from => 'delivery', :to => 'payment', :if => :payment_required?
next_event.transition :from => 'payment', :to => 'skrill', :if => lambda {true}
next_event.transition :from => 'skrill', :to => 'complete'
@BDQ
BDQ / gist:3164364
Created July 23, 2012 15:55
Create Spree::Promotion for free shipping via console.
p = Spree::Promotion.create(event_name: "spree.checkout.coupon_code_added", name: "Free Shipping", code: "FREESHIPBD")
p.promotion_actions << Spree::Promotion::Actions::CreateAdjustment.create()
pa = p.promotion_actions.first
pa.calculator = Spree::Calculator::FreeShipping.new
Spree::Activator
event_names
event_names
Failures:
1) Spree::Activator event_names
Failure/Error: Unable to find matching line from backtrace
NoMethodError:
Failures:
1) Spree::Api::V1::ProductsController as a normal user pagination can select the next page of products
Failure/Error: json_response["products"].first.should have_attributes(attributes)
NoMethodError:
undefined method `first' for nil:NilClass
# ./spec/controllers/spree/api/v1/products_controller_spec.rb:36:in `block (4 levels) in <module:Spree>'
Finished in 10.91 seconds
108 examples, 1 failure