Skip to content

Instantly share code, notes, and snippets.

View westonplatter's full-sized avatar

westonplatter

View GitHub Profile
@westonplatter
westonplatter / Guardfile
Created September 12, 2013 22:30
my Guardfile for rails projects
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard :rspec do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
git clone https://github.com/think602/spree_wizard.git
cd spree_wizard
rake test_app
cd spec/dummy
rake db:migrate
rake db:seed
rake spree_sample:load
rake spree_wizard:sample_load # custom sample load to demonstrate spree_wizard
@westonplatter
westonplatter / double_nested_spree.rb
Last active December 23, 2015 13:59
Preforms a Double Nested includes to save us from N+1 queries. Used the bullet gem (https://github.com/flyerhzm/bullet) to fine tune this => thanks @flyerhzm
# //////////////////////////////////////////////////////
#
# spree_wizard, https://github.com/think602/spree_wizard
#
# //////////////////////////////////////////////////////
# ================================================
# Controller code preforming Rails SQL lookup
@westonplatter
westonplatter / $.ajax-context.js.coffee
Last active December 23, 2015 14:09
How to pass context into a AJAX request
#
# from a future commit on spree_wizard, https://github.com/think602/spree_wizard
#
SpreeWizard.Views.Steps ||= {}
class SpreeWizard.Views.Steps.IndexView extends Marionette.CompositeView
itemView: SpreeWizard.Views.Steps.StepView
template: JST["backbone/templates/steps/index"]
el: '#steps'
@westonplatter
westonplatter / questions.md
Last active December 24, 2015 10:29
objective C questions
  • What effect does & have on the method/fucntion argument? EG,
_assetCurrent = [_director getCurrentAsset:&current_time];
# my_spree_app/config/initializers/qe.rb
module Qe
# prefix for database tables
mattr_accessor :table_name_prefix
self.table_name_prefix ||= 'qe_'
end
# my_spree_app/models/some_class.rb
class SomeClass < ActiveRecord::Base
// some ObjectiveC class implementation
// manages some models within a CoreData ManagedObjectContext
//
// example for getting first object within a NSSet by object's "start" attribute
//
-(Asset *)getFirstAssetByStart
{
Asset *asset = nil;
@westonplatter
westonplatter / turbolinks_each_all_request_solution.js
Last active December 25, 2015 20:39
How are other people ensuring that, 1) JS frameworkinitializers are properly kicking off2) page/DOM specific bindings are being set@westonplatter
$ rake db:migrate
DEPRECATION WARNING: Model based mass assignment security has been extracted
out of Rails into a gem. Please use the new recommended protection model for
params or add `protected_attributes` to your Gemfile to use the old one.
To disable this message remove the `whitelist_attributes` option from your
`config/application.rb` file and any `mass_assignment_sanitizer` options
from your `config/environments/*.rb` files.
## in main app
Spree::UserRegistrationsController.class_eval do
include SpreeMailchimpGibbon::SpreeUserRegistrationsControllerConcern
end
## in spree_mailchimp_gibbon extension
module SpreeMailchimpGibbon
module SpreeUserRegistrationsControllerConcern