Skip to content

Instantly share code, notes, and snippets.

Lance Olsen LanceOlsen

Block or report user

Report or block LanceOlsen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@LanceOlsen
LanceOlsen / 0_reuse_code.js
Created Apr 21, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@LanceOlsen
LanceOlsen / separated.rb
Created Dec 1, 2015
Sameness and Differences Separated
View separated.rb
describe Invoice do
subject { described_class.new(user: user, items: items) }
let(:user) { FactoryGirl.create(:user, state: state) }
let(:items) { 2.times.map { FactoryGirl.create(:item, price: 100) } }
let(:state) { 'NY' }
describe '#sales_tax' do
shared_examples_for 'calculates sales tax' do
it 'calculates sales tax' do
invoice.finalize!
@LanceOlsen
LanceOlsen / mp_expected.rb
Created Dec 1, 2015
RSpec Expected Monkey Patch
View mp_expected.rb
module RSpec
module Core
module MemoizedHelpers
module ClassMethods
alias_method :expected, :let
end
end
end
end
View using_context.rb
describe Invoice do
subject { described_class.new(user: user, items: items) }
let(:user) { FactoryGirl.create(:user, state: state) }
let(:items) { 2.times.map { FactoryGirl.create(:item, price: 100) } }
let(:state) { 'NY' }
describe '#sales_tax' do
context 'in CA' do
let(:state) { 'CA' }
View context.rb
describe Invoice do
subject { described_class.new(user: user, items: items) }
let(:user) { FactoryGirl.create(:user) }
let(:items) { 2.times.map { FactoryGirl.create(:item, price: 100) } }
describe '#sales_tax' do
it 'charges sales tax when the user is in CA' do
user.state = 'CA'
expect(subject.sales_tax).to eq(200 * 0.0875)
end
@LanceOlsen
LanceOlsen / unexpressive.rb
Last active Dec 1, 2015
Unexpressive Specs
View unexpressive.rb
describe Invoice do
subject { described_class.new(user: user, items: items) }
let(:user) { FactoryGirl.create(:user) }
let(:items) { 2.times.map { FactoryGirl.create(:item, price: 100) } }
describe '#sales_tax' do
it 'charges sales tax when the user is in CA' do
user.state = 'CA'
invoice.finalize!
expect(subject.sales_tax).to eq(200 * 0.0875)
View happy_git_on_osx.md

Creating a Happy Git Environment on OS X

Step 1: Install Git

Configure things:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global alias.co checkout
git config --global apply.whitespace nowarn
You can’t perform that action at this time.