Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Sevestre msevestre

View GitHub Profile
View stateMock.js
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{
View gist:c51f609d1460a9a2fdad

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.

View gist:6582416

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.

@msevestre
msevestre / Calculator::CanadianTax
Last active Dec 21, 2015
Eligible promotions are excluded from tax Warning: Only works if you have one Tax category
View Calculator::CanadianTax
require_dependency 'spree/calculator'
module Spree
class Calculator::CanadianTax < Calculator::DefaultTax
def self.description
"Canadian tax (Eligible promotions are excluded from tax)"
end
private
View capybara cheat sheet
=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')
View 20120607164104_add_name_to_tax_rates
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
View tax_rate_decorator.rb
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) }
You can’t perform that action at this time.