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
| ssd_map = [ | |
| [1,1,1,0,1,1,1], #0 | |
| [0,0,1,0,0,1,0], #1 | |
| [1,0,1,1,1,0,1], #2 | |
| [1,0,1,1,0,1,1], #3 | |
| [0,1,1,1,0,1,0], #4 | |
| [1,1,0,1,0,1,1], #5 | |
| [1,1,0,1,1,1,1], #6 | |
| [1,0,1,0,0,1,0], #7 | |
| [1,1,1,1,1,1,1], #8 |
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 BNRMapPoint | |
| attr_reader :coordinate, :title | |
| def initialize(coordinate, title) | |
| @coordinate, @title = coordinate, title | |
| end | |
| 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
| require 'spec_helper' | |
| describe MerchantAccount do | |
| it "can find an appropriate merchant" do | |
| { | |
| 'GND130415A' => 'GRAZ_1', | |
| 'MIS130417A' => 'GRAZ_2', | |
| 'ROA130417A' => 'GRAZ_2', | |
| 'LON130417A' => 'GRAZ_3', | |
| }.each do |tour_code, expected_merchant_account_descriptor| |
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
| # The main parse method is mostly borrowed from a tweet by @JEG2 | |
| class StrictTsv | |
| attr_reader :filepath | |
| def initialize(filepath) | |
| @filepath = filepath | |
| end | |
| def parse | |
| open(filepath) do |f| | |
| headers = f.gets.strip.split("\t") |
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 TSV | |
| class LineReader | |
| attr_reader :filepath | |
| def initialize(filepath) | |
| @filepath = filepath | |
| end | |
| def each | |
| buffer = "" | |
| open(filepath) do |f| |
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
| describe "my request" do | |
| it "should update the model" do | |
| Model.any_instance.should_receive(:save) do | |
| self.changes.should include(:attribute) | |
| self.attribute.should == 'value' | |
| end | |
| xhr :put, model_path(model), {attribute: 'value'} | |
| end | |
| 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 ActsAsCsv | |
| def read | |
| @csv_contents = [] | |
| filename = self.class.to_s.downcase + '.csv' | |
| file = File.new(filename) | |
| @headers = file.gets.chomp.split(', ') | |
| file.each do |row| | |
| @csv_contents << row.chomp.split(', ') | |
| 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
| $ rubyhop | |
| /Users/michael.ries/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `require': dlopen(/Users/michael.ries/.rvm/gems/ruby-2.1.0/extensions/x86_64-darwin-12/2.1.0-static/gosu-0.7.50/gosu.bundle, 9): Symbol not found: __ZNSbIwSt11char_traitsIwESaIwEE4_Rep11_S_terminalE (LoadError) | |
| Referenced from: /Users/michael.ries/.rvm/gems/ruby-2.1.0/extensions/x86_64-darwin-12/2.1.0-static/gosu-0.7.50/gosu.bundle | |
| Expected in: flat namespace | |
| in /Users/michael.ries/.rvm/gems/ruby-2.1.0/extensions/x86_64-darwin-12/2.1.0-static/gosu-0.7.50/gosu.bundle - /Users/michael.ries/.rvm/gems/ruby-2.1.0/extensions/x86_64-darwin-12/2.1.0-static/gosu-0.7.50/gosu.bundle | |
| from /Users/michael.ries/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require' | |
| from /Users/michael.ries/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require' | |
| from /Users/michael.ries/.rvm/gems/ruby-2.1.0/gems/gos |
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
| $ ruby -v | |
| ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin12.0] | |
| $ ruby tmp/tcp_server.rb | |
| Server :: client says: ping | |
| Client :: server says: Hello! Time is 2014-02-28 12:55:54 -0700 | |
| Server :: client says: die! | |
| Server :: farewell cruel world! | |
| All 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
| source "https://rubygems.org" | |
| gem "avro", "1.7.5" |
OlderNewer