Skip to content

Instantly share code, notes, and snippets.

View JDutil's full-sized avatar
🍁

Jeff Dutil JDutil

🍁
View GitHub Profile
@gmacdougall
gmacdougall / gist:868779d05133680f3859
Last active August 29, 2015 14:09
Spree Performance Improvements

Goals

  1. Identify Areas of Performance Problems
  2. Prioritize by Pain
  3. Short Term Fixes
  4. Long term Fixes
  5. Bencharks measurements

Areas of Performance Problems

@djones
djones / add_handoff_to_orders.rb
Created June 10, 2014 20:49
Handoff in iOS 8 and OS X Yosemite with Spree Commerce
# Generate this migration by running:
#
# bundle exec rails g migration add_handoff_to_spree_orders handoff:string
# bundle exec rake db:migrate
#
# db/migrate/add_handoff_to_orders.rb
class AddHandoffToOrders < ActiveRecord::Migration
def change
add_column :spree_orders, :handoff, :string
# The fundamantal design opinion is that a Stock Return has many Returned Items
# Each Returned Item effectively has one of 3 actions associated with it return, exchange OR replace
# Any of these action can involve a refund, although the most common is that a return involves a refund
# You may wish to refund a replacement Or exchange to maintain customer relations
#
# Once all Returned Items and their actions have been set then you can commence to attempt to process the Stock Return
# Processing the Stock Return will automate the Order Adjustments, Addiitonal Shipments and any Refunds / Payments
# It should be exstensible so that developers can easily implement their own behaviour here
#
# It could be that a developer can extend this to Create New Orders instead of Additional Shipments under certain scenarios:
@markbrown4
markbrown4 / jquery.magicPaginate.coffee
Last active December 9, 2015 21:48
Replaces will_paginate with automatic paging on scroll.
class MagicPaginator
constructor: (el, options)->
@callback = options.callback || -> false
@$el = $(el)
@$pagination = @$el.parent().find '.pagination'
return if @$pagination.length == 0
@render()
$(window).scroll @scrollFetch

It All Starts With Templates

An Ember application starts with its main template. Put your header, footer, and any other decorative content in application.handlebars.

<header>
  <img src="masthead">
</header>

<footer>
@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'
@adarsh
adarsh / anonymizer_source.rake
Created February 20, 2012 20:09
Code from blog post on anonymizing sensitive user data
task :env_checker do
unless Rails.env.development?
puts "Not in development environment, exiting!"
exit 1
end
end
namespace :app_name do
desc 'Anonymize user, company, and location information'
task :anonymize => [:environment, :env_checker] do
@robbyrussell
robbyrussell / ohmyzsh-dropbox-sync.sh
Created February 8, 2012 15:20
Keep your @ohmyzsh ~/.zshrc in sync via dropbox
# Was asked how I keep my zshrc config sync'd between my computers with Dropbox
# Add a new directory in your Dropbox (or use an existing one)
mkdir -p ~/Dropbox/ohmyzsh
# move existing file to Dropbox
mv ~/.zshrc ~/Dropbox/ohmyzsh/zshrc
# symlink file back to your local directory
ln -s ~/Dropbox/ohmyzsh/zshrc ~/.zshrc
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.