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
function Hello($name) { | |
"Hello, $name, from included file." | |
} |
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
namespace StupidExample { | |
public class CustomerGateway { | |
IUnitOfWorkManager work; | |
public CustomerGateway(IUnitOfWorkManager work) { this.work = work; } | |
public IEnumerable<Customer> GetNewCustomersSince(DateTime time) { | |
work.On("CustomerDB", session => | |
session.CreateCriteria<Customer>() |
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 class when_a_benchmark_has_more_than_3_percent_assets_more_than_5_percent_change_in_weight | |
{ | |
Establish context = () => | |
{ | |
Input input; | |
given.input.for_account("XYZ123").called(out input) | |
.with_position().on(Clock.Today) | |
.with_an_asset_valued_at(10).cusip("1") | |
.with_an_asset_valued_at(90).cusip("2") |
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
#------------------------------------------------------------------------------- | |
# Downloads photos from National Geographic's Photo Contest | |
#------------------------------------------------------------------------------- | |
param($res = '1280', $year = '2008') | |
$client = New-Object System.Net.WebClient | |
$client.Headers.Add('User-agent', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)') | |
$prefixes = @{ | |
'2008' = @('1107', '1103', '1027', '1020', '1014', '1006', '0929', '0922', |
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
using System; | |
using System.Collections.Generic; | |
using System.Data; | |
using System.Data.SqlClient; | |
namespace DbSlim | |
{ | |
public class Insert | |
{ | |
private string connectionString; |
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
(* | |
Very ugly, very rough, very F# 101 <- my attempt to implement | |
STOMP [http://stomp.codehaus.org/Protocol]. | |
This is the first time I've really tried using active patterns and | |
absolutely the first time I've used MailboxProcessors. | |
There are a couple of concepts I am still trying to work out: | |
1) What exactly happens with AsyncResponse's in mailboxes...I think I |
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
// Adds the integers in a string like "1,2,3" = 6, | |
// or "//;\n1;2;3" = 6 | |
public int Add(string value) | |
{ | |
if (string.IsNullOrEmpty(value)) | |
return 0; | |
var delimters = new char[] { ',', '\n' }; | |
if (value.StartsWith("//")) | |
{ |
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
char[] GetDelimeters(string s) | |
{ | |
if (s.StartsWith("//")) | |
return s.Substring(2, 1).ToCharArray(); | |
else | |
return new char[] { ',', '\n' }; | |
} | |
string GetValueToParse(string s) | |
{ |
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
char[] GetDelimeters(string s) | |
{ | |
return HasCustomTokens(s) ? | |
s.Substring(2, 1).ToCharArray() | |
: new char[] { ',', '\n' }; | |
} | |
string GetValueToParse(string s) | |
{ | |
return HasCustomTokens(s) ? |
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
let ex (p : bool) = | |
if p then ignore() | |
else failwith "gusto" | |
let f () : unit = | |
ex false | |
(* stack trace doesn't include f's body. why? *) | |
f() |