View gist:41758
This file contains 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 Rectangle | |
attr_accessor :width, :height | |
def initialize(width, height) | |
self.width = width | |
self.height = height | |
end | |
def area | |
width * height |
View string_tokenizer.rb
This file contains 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 StringTokenizer | |
VERSION = '0.0.1' | |
def tokenize(context) | |
self.gsub(/\$[^ ]*/) {|match| | |
context[match[1..-1].to_sym] | |
} | |
end | |
end | |
View gist:54731
This file contains 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
List<MyThing> things = new List<MyThing> { | |
new MyThing { DueDate = DateTime.Now.AddDays(1), | |
new MyThing { DueDate = DateTime.Now.AddDays(-14)}} | |
}; |
View gist:54735
This file contains 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
List<MyThing> things = new List<MyThing> { | |
thing(DateTime.Now.AddDays(1)), | |
thing(DateTime.Now.AddDays(-14)) | |
} |
View gist:54737
This file contains 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
public MyThing thing(DateTime duedate){ | |
return new MyThing {DueDate = duedate}; | |
} |
View gist:54738
This file contains 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
public static class ThingTestingUtilities { | |
public static Thing NewThing(this TestsThings tester, DateTime duedate) { | |
return new MyThing { DueDate = duedate}; | |
} | |
} |
View gist:54739
This file contains 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
List<MyThing> things = new List<MyThing> { | |
this.NewThing(DateTime.Now.AddDays(1)), | |
this.NewThing(DateTime.Now.AddDays(-14)) | |
} |
View gist:54741
This file contains 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
List<MyThing> things = new List<MyThing> { | |
this.NewThing().WithDueDate(DateTime.Now.AddDays(1)), | |
this.NewThing().WithDueDate(DateTime.Now.AddDays(-14)) | |
} |
View gist:54742
This file contains 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
public static class ThingTestingUtilities { | |
public static Thing NewThing(this TestsThings tester) { | |
return new MyThing; | |
} | |
public static Thing WithDueDate(this MyThing thing, DateTime duedate) { | |
thing.DueDate = duedate; | |
return thing; | |
} | |
} |
View gist:54744
This file contains 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
List<MyThing> things = new List<MyThing> { | |
this.NewThing().WithAnOffsetDueDateInDays(1), | |
this.NewThing().WithAnOffsetDueDateInDays(-14) | |
} |
OlderNewer