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 Foo | |
| def bar | |
| Bar.find(bar_id) | |
| 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
| # First do this | |
| Time.zone = 'EST' | |
| # Now you can do this | |
| Time.zone.now | |
| # and this! | |
| Time.zone.local(2013, 1, 1) | |
| # rails/activerecord/arel work with it: |
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 my_method(arg1, arg2) | |
| Foo.typecheck arg1 | |
| Bar.typecheck arg2 | |
| puts "The method finished!" | |
| 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
| class Object | |
| def self.typecheck(object) | |
| unless self == object.class | |
| raise ArgumentError, | |
| "expected type: #{self}. given: #{object.class}." | |
| end | |
| end | |
| end | |
| class Foo; 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
| def my_method(arg1, arg2) | |
| unless Foo == arg1.class | |
| raise ArgumentError, | |
| "A Foo is expected for the first argument. An #{arg1.class} was given." | |
| end | |
| unless Bar == arg2.class | |
| raise ArgumentError, | |
| "A Bar is expected for the first argument. An #{arg2.class} was given." | |
| 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
| function chpwd { | |
| if [ -r $PWD/Gemfile ]; then | |
| export PATH=./bin:${PATH//\.\/bin:} | |
| else | |
| regexp-replace PATH '\./bin:' '' | |
| fi | |
| } |
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
| # diff -c 1.txt 2.txt | |
| *** 1.txt 2012-11-03 23:24:05.000000000 -0400 | |
| --- 2.txt 2012-11-03 23:24:13.000000000 -0400 | |
| *************** | |
| *** 1,2 **** | |
| foo | |
| ! bar | |
| \ No newline at end of file | |
| --- 1,3 ---- | |
| foo |
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
| # diff -c 1.txt 3.txt - lack of newline is announced in output | |
| *** 1.txt 2012-11-03 23:24:05.000000000 -0400 | |
| --- 3.txt 2012-11-03 23:28:44.000000000 -0400 | |
| *************** | |
| *** 1,2 **** | |
| ! foo | |
| bar | |
| \ No newline at end of file | |
| --- 1,2 ---- | |
| ! food |
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
| foo | |
| bar | |
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
| 2012-09-27 18:08:53.258 growlnotify[83684:707] Got disconnected: Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo=0x7fb3e2a0f900 {NSLocalizedDescription=Connection refused, NSLocalizedFailureReason=Error in connect() function} | |
| 2012-09-27 18:08:53.260 growlnotify[83684:707] <GrowlGNTPRegistrationAttempt: 0x7fb3e2a0f770> failed because Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo=0x7fb3e2a0f900 {NSLocalizedDescription=Connection refused, NSLocalizedFailureReason=Error in connect() function} | |
| 2012-09-27 18:08:53.260 growlnotify[83684:707] Failed to register with (null) |