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
| model = Object::const_get(ARGV[0]) | |
| rows = model.find(:all) | |
| # Any columns you don't want output, list here as symbols | |
| # e.g. BLACKLIST = [:user_id, :workout_id] | |
| BLACKLIST = [] | |
| # Any columns that you'd like to rename on the output, list in this hash | |
| # e.g. TRANSFORM = {:percentOfMax => :percent_of_max} | |
| TRANSFORM = {} |
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
| RSpec::Matchers.define(:be_same_file_as) do |exected_file_path| | |
| match do |actual_file_path| | |
| expect(md5_hash(actual_file_path)).to eq(md5_hash(expected_file_path)) | |
| end | |
| def md5_hash(file_path) | |
| Digest::MD5.hexdigest(File.read(file_path)) | |
| 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
| #the new tap method of ruby will always return itself, but lets you play with! | |
| data = (1..10).to_a | |
| data.tap{|x| print x}.to_a.join(', ') | |
| p | |
| #alias will redirect method calls to method with a different name, useful for api changing | |
| class SomeClass | |
| def new_method(x) | |
| p "The value is #{x}" |
NewerOlder