Skip to content

Instantly share code, notes, and snippets.

View damonjmurray's full-sized avatar

Damon J. Murray damonjmurray

View GitHub Profile
@damonjmurray
damonjmurray / ruby_evens_and_odds.rb
Created January 26, 2016 22:26
Basic example of multiple assignment in Ruby
evens, odds = (1..10).partition(&:even?)
@damonjmurray
damonjmurray / Rspec_subject_behaviour_question.rb
Created February 10, 2016 02:53
RSpec subject behaviour question
require 'spec_helper'
class Foo
def self.bar(first, second, third)
err_msg = '%s cannot be nil'
raise ArgumentError, err_msg % 'first' unless first
raise ArgumentError, err_msg % 'second' unless second
raise ArgumentError, err_msg % 'third' unless third
"#{first} #{second} #{third}"
@damonjmurray
damonjmurray / state_machine_sandpit.rb
Last active July 20, 2016 06:17
after_transition on: vs. after_transition to:
require 'state_machine'
module Sandpit
class Foo
state_machine :state, initial: :created do
event :start do
transition created: :running
transition running: same
end
event :stop do
@damonjmurray
damonjmurray / macbook-setup-script.sh
Last active February 26, 2024 04:36
Ready, Aim, FI-YAAAAAAR!!!
#!/bin/sh
# Set up a fresh MacBook for software development with my personal preferences.
#
# Inspiration taken from the following:
# - Mathias Bynen's popular config: https://github.com/mathiasbynens/dotfiles
# - Thoughtbot's dev-centric script: https://github.com/thoughtbot/laptop
# - The legendary Jessie Frazelle: https://github.com/jessfraz
# - Defaults-Write: https://www.defaults-write.com/
#