Skip to content

Instantly share code, notes, and snippets.

View alepore's full-sized avatar

Alessandro Lepore alepore

View GitHub Profile
@onedanshow
onedanshow / order_updater_decorator.rb
Created November 26, 2014 02:22
Way to pick the best promotion between order adjustments and line item adjustments in Spree 2.2+
Spree::OrderUpdater.class_eval do
module BetterPromotions
# DD: called by 'update_adjustment_total' before setting totals on order
def recalculate_adjustments
# DD: first, calculate all_adjustments for Order, LineItem, and Shipment using Spree::ItemAdjustments
super
# DD: FYI: promo_totals are negative
@ngauthier
ngauthier / reportable.rb
Last active December 28, 2015 22:09
Reportable Concern
module Reportable
extend ActiveSupport::Concern
module ClassMethods
# Chain on a scope and specify the fields to extract.
# Example:
# User.enabled.report %{
# :email_opt_in,
# 'created_at as sign_up_date'
# }
@alepore
alepore / after_cd_ctags
Last active December 18, 2015 04:49
RVM hook for ctags and gemtags auto generation.put in ~/.rvm/hooks/, remember to chmod +x it
#!/usr/bin/env bash
function generate_tags {
(ctags -R -f .tags 2> /dev/null &)
}
function generate_gemtags {
(bundle show --paths | xargs ctags -R -f .gemtags 2> /dev/null &)
}