Skip to content

Instantly share code, notes, and snippets.

public MyThing thing(DateTime duedate){
return new MyThing {DueDate = duedate};
}
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;
}
}
List<MyThing> things = new List<MyThing> {
this.NewThing().WithAnOffsetDueDateInDays(1),
this.NewThing().WithAnOffsetDueDateInDays(-14)
}
<div id='pass_div' style='width:200px;background-color:green'>Pass</div>
<div id='fail_div' style='width:200px;background-color:red'>Fail</div>
<ul>
<li><a onclick='first_thing_to_check()'>first_thing_to_check</a></li>
</ul>
<script type='text/javascript'>
function assertEquals(expected, actual) {
if(expected == actual) {
$('#pass_div').show();
}else{
$('#failure_div').show();
}
}
</script>
@times_2_green = []
Autotest::add_hook :all_good do |at|
@times_2_green << Time.now.to_i
data = []
@times_2_green.uniq.each_with_index do |time, index|
if index > 0
data << time - @times_2_green[index-1]
end
class Array
def last_index
self.length - 1
end
end
def get_my_args(arg1, another_arg)
local_variables.each do |arg_name|
p "#{arg_name} has value #{eval(arg_name)}"
end
end
/Users/coreyhaines/.gem/ruby/1.8/gems/heroku-1.5.3/bin/../lib/heroku/command.rb:43:in `run_internal': undefined method `new' for Rake:Module (NoMethodError)
from /Users/coreyhaines/.gem/ruby/1.8/gems/heroku-1.5.3/bin/../lib/heroku/command.rb:17:in `run'
from /Users/coreyhaines/.gem/ruby/1.8/gems/heroku-1.5.3/bin/heroku:14
from /usr/bin/heroku:19:in `load'
from /usr/bin/heroku:19
@coreyhaines
coreyhaines / describe_old_update_sticky_text.js
Created January 3, 2010 21:11
learning to do javascript unit testing
describe("#old_update_sticky_text", function(){
before(function(){
this.sticky_update_url_for = function(x) { return null; }
this.parent_sticky = function(x) { return null; }
this.update_sticky = function(x) { return null; }
});
it("returns the value passed in", function(){
var value = old_update_sticky_text("foo", null);