Skip to content

Instantly share code, notes, and snippets.

View msevestre's full-sized avatar

Michael Sevestre msevestre

View GitHub Profile
@msevestre
msevestre / tax_rate_decorator.rb
Created June 13, 2012 18:29
Override TaxRate
Spree::TaxRate.class_eval do
attr_accessible :name
# Creates necessary tax adjustments for the order.
def adjust(order)
label = create_label
if included_in_price
if Zone.default_tax.contains? order.tax_zone
order.line_items.each { |line_item| create_adjustment(label, line_item, line_item) }
class AddNameToTaxRates < ActiveRecord::Migration
def change
add_column :spree_tax_rates, :name, :string
add_index :spree_tax_rates, :name, :name => 'index_tax_rates_on_name'
end
end
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@msevestre
msevestre / Calculator::CanadianTax
Last active December 21, 2015 20:59
Eligible promotions are excluded from tax Warning: Only works if you have one Tax category
require_dependency 'spree/calculator'
module Spree
class Calculator::CanadianTax < Calculator::DefaultTax
def self.description
"Canadian tax (Eligible promotions are excluded from tax)"
end
private

Bearded's Hourly Contract

Date: [[Date of Document]] Between [Our Company] and [Your Company]

Summary

We’re not big on formality, but sometimes it’s best to have a few simple things written down so that we’re all on the same page. In this contract you won’t find complicated legal terms or large passages of unreadable text. We have no desire to trick you into signing something that you might later regret. We do want what’s best for the safety of both parties, now and in the future.

Bearded's Hourly Contract

Date: [[Date of Document]] Between [Our Company] and [Your Company]

Summary

We’re not big on formality, but sometimes it’s best to have a few simple things written down so that we’re all on the same page. In this contract you won’t find complicated legal terms or large passages of unreadable text. We have no desire to trick you into signing something that you might later regret. We do want what’s best for the safety of both parties, now and in the future.

angular.module('stateMock',[]);
angular.module('stateMock').service("$state", function($q){
this.expectedTransitions = [];
this.transitionTo = function(stateName){
if(this.expectedTransitions.length > 0){
var expectedState = this.expectedTransitions.shift();
if(expectedState !== stateName){
throw Error("Expected transition to state: " + expectedState + " but transitioned to " + stateName );
}
}else{