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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> | |
<head> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <!-- makes IE8+ use the latest rendering engine --> | |
<style type="text/css" media="screen"> body {margin:0;padding:0} </style> <!-- removes margin --> | |
<!--[if IE]><script type="text/javascript" src="excanvas.compiled.js"></script><![endif]--> <!-- loads excanvas --> | |
<script src="socks-0.7-compressed.js" type="text/javascript" charset="utf-8"></script> <!-- loads socks --> | |
<script type="application/javascript-socks" charset="utf-8"> | |
//Draws a Sierpinski triangle using the game of chaos rules | |
//http://en.wikipedia.org/wiki/Sierpi%C5%84ski_triangle |
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
require 'rubygems' | |
require 'sinatra' | |
require 'rack/test' | |
require 'spec' | |
require 'spec/autorun' | |
require 'spec/interop/test' | |
require 'hpricot' | |
describe "My Sinatra App" do | |
include Rack::Test::Methods |
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
it "should display the header text 'Pity the fool!'" do | |
get '/' | |
tag("h1").inner_text.should == "Pity the fool!" | |
end | |
it "should have menu items" do | |
get '/' | |
(doc/".menu-item").should_not be_nil | |
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
dynamic sampleObject = new ExpandoObject() | |
sampleObject.number = 10; | |
sampleObject.Increment = (Action)(() => { sampleObject.number++; }); | |
// Before calling the Increment method. | |
Console.WriteLine(sampleObject.number); | |
sampleObject.Increment(); |
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 Expando | |
def method_missing(method_id, *arguments) | |
if match = method_id.id2name.match(/(\w*)(\s*)(=)(\s*)(\.*)/) | |
self.class.class_eval{ attr_accessor match[1].to_sym } | |
instance_variable_set(match[1], match[5]) | |
else | |
super.method_missing(method_id, *arguments) | |
end | |
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
testing |
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
[TestClass] | |
class DescribePerson | |
{ | |
private Creature person; | |
[TestInitialize] | |
public void Before() | |
{ | |
person = new Person(); |
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
ruby execfac.rb 10 |
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
require File.join(File.dirname(__FILE__), "flippant") | |
include Flippant | |
#Say you have this | |
class Movie | |
attr_accessor :name | |
attr_accessor :actors | |
def initialize(name) | |
@name = name |
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 NinjectExtensions | |
{ | |
public static T ToFake<T>(this IBindingToSyntax<T> binding) | |
{ | |
var fake = A.Fake<T>(); | |
binding.ToConstant(fake); | |
return fake; | |
} | |
} |
OlderNewer