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
def render_template template, question: | |
template % { | |
:"question.text" => CGI::escapeHTML(question.display_text.to_s), | |
:"question.name" => CGI::escapeHTML(question.name.to_s), | |
:"question.email" => CGI::escapeHTML(question.email.to_s) | |
} | |
end |
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 |
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 |
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)}} | |
}; |
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}; | |
} | |
} |
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)) | |
} |
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)) | |
} |
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; | |
} |
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) | |
} |
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)) | |
} |