This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class GroupOfThingies | |
| attr_accessor :thingies | |
| # Use like this: | |
| # | |
| # group_of_thingies = GroupOfThingies.new | |
| # group_of_thingies.each do |thing| | |
| # puts "Check out this awesome thing: #{thing}!" | |
| # end | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * See: http://www.css-101.org/articles/ken-burns_effect/css-transition.php | |
| */ | |
| /** | |
| * Styling the container (the wrapper) | |
| * | |
| * position is used to make this box a containing block (it becomes a reference for its absolutely positioned children). overflow will hide part of the images moving outside of the box. | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # A chainable Either monad for Ruby | |
| # | |
| # Examples | |
| # | |
| # Either.right('s') >> proc { |s| Either.right(s + '-1') } >> proc { |s| Either.right(s + '-2') } | |
| # #=> #<Either @left=nil, @right="s-1-2"> | |
| # | |
| # Either.right('s') >> proc { |s| Either.left('error!') } >> proc { |s| Either.right(s + '-2') } | |
| # #=> #<Either @left='error!', @right=nil> | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| get '/give/me/gazebo/not/gazelle/:min_size' do | |
| pricing = PriceCalculator.new | |
| ParamsExtractor.new(pricing).parse(params) | |
| GazelleFinder.new(pricing).find_all_gazelles | |
| GazelleFilter.new(pricing).remove_sick_gazelles # pricing has access to #gazelles | |
| GazeboBuilder.new(pricing).calculate_size_of_gazebo | |
| GazeboPricer.new(pricing).calculate_final_price # pricing no longer has #gazelles |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://gist.github.com/2032303 | |
| module MiniTest::Assertions | |
| def assert_palindrome(string) | |
| assert string == string.reverse, "Expected #{string} to read the same way backwards and forwards" | |
| end | |
| def assert_default(hash, default_value) | |
| assert default_value == hash.default, "Expected #{default_value} to be default value for hash but was #{hash.default.inspect}" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Step 1: install flac via Homebrew | |
| brew install flac | |
| Step 2: decode FLAC to AIFF | |
| cd path/to/directory/with/files/to/convert | |
| for i in *.flac; do | |
| flac -d --force-aiff-format "$i" | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Don't write to Disk on Sleep | |
| sudo pmset -a hibernatemode 0 | |
| # Install Developer Tools (no XCode) | |
| # https://developer.apple.com/downloads/index.action# | |
| # Install DropBox | |
| # Install 1Password | |
| # Install Homebrew |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # config/initializers/char_converter.rb | |
| require 'uri' | |
| module Support | |
| class CharConverter | |
| SANITIZE_ENV_KEYS = [ | |
| "HTTP_COOKIE", # bad cookie encodings kill rack: https://github.com/rack/rack/issues/225 | |
| "HTTP_REFERER", | |
| "PATH_INFO", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| group :production, :acceptance do | |
| gem 'rpm_contrib' | |
| gem 'newrelic-moped' # https://github.com/joinwire/newrelic-moped | |
| gem 'newrelic_rpm' | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Equalable | |
| def ==(o) | |
| o.class == self.class && o.equality_state == equality_state | |
| end | |
| alias_method :eql?, :== | |
| def hash | |
| equality_state.hash | |
| end | |
| end |