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
| ## Isn't this... | |
| # | |
| let :a_record do | |
| SomeObject.new | |
| end | |
| it "should" do | |
| a_record.do_something | |
| a_record.do_something_else |
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
| for i in `find . -name .git | xargs -n1 dirname` | |
| do | |
| pushd $i | |
| git pull | |
| popd | |
| 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
| for i in `find . -name .git | xargs -n1 dirname` | |
| do | |
| pushd $i | |
| git status -uno -s | |
| popd | |
| 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
| require 'test_helper' | |
| require 'capybara/rails' | |
| Capybara.default_driver = :selenium | |
| class AddingPartsToGuidesTest < ActionDispatch::IntegrationTest | |
| include Capybara::DSL | |
| def teardown | |
| DatabaseCleaner.clean |
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
| require 'test_helper' | |
| require 'capybara/rails' | |
| Capybara.default_driver = :selenium | |
| class AddingPartsToGuidesTest < ActionDispatch::IntegrationTest | |
| include Capybara::DSL | |
| def teardown | |
| DatabaseCleaner.clean |
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
| require 'open-uri' | |
| require 'timeout' | |
| require 'ping' | |
| def can_connect? | |
| begin | |
| Timeout::timeout(2) do | |
| open("http://169.254.169.254") | |
| return true | |
| 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
| - (NSString *)stringByCapitalisingFirstLetter:(NSString *)string | |
| { | |
| return [string stringByReplacingCharactersInRange:NSMakeRange(0,1) withString:[[string substringToIndex:1] uppercaseString]]; | |
| } | |
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
| def swap(array,indexa,indexb) | |
| value_to_swap = array[indexa] | |
| array[indexa] = array[indexb] | |
| array[indexb] = value_to_swap | |
| end | |
| def biased_shuffle(array) | |
| array = array.dup | |
| array.size.times do |i| | |
| swap(array,rand(array.size),i) |
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
| def encode(arr) | |
| last_byte = nil | |
| count = 1 | |
| (arr + [nil]).each do |byte| | |
| if byte == last_byte && count < 255 | |
| count = count + 1 | |
| else | |
| yield [count,last_byte] if last_byte | |
| last_byte = byte | |
| count = 1 |
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
| require 'capybara' | |
| require 'capybara/dsl' | |
| require 'capybara/poltergeist' | |
| require 'chunky_png' | |
| require 'tempfile' | |
| Capybara.run_server = false | |
| Capybara.default_driver = :poltergeist | |
| Capybara.javascript_driver = :poltergeist |