This file contains hidden or 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> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>sidera</title> | |
<link href="/css/default.css" rel="stylesheet" /> | |
<script src="requestAnimationFrameShim.js"></script> | |
<script src="bootstrap.js"></script> |
This file contains hidden or 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 SomeClass { | |
public void SomeMethod() { | |
this.Log().Info(() => "Here is a log message with params which can be in Razor Views as well: '{0}'".FormatWith(typeof(SomeClass).Name)); | |
} | |
} |
This file contains hidden or 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
Greg's Stop Loss Kata | |
Testing is very hard when time is involved ... | |
A trailing stop loss is a term used in financial trading. For a very in depth explanation you can read here http://www.investopedia.com/articles/trading/03/080603.asp and http://en.wikipedia.org/wiki/Order_(exchange)#Stop_orders | |
However we do not need a huge amount of background in order to do the kata as we are going to limit the problem a bit. | |
The general idea is that when you buy into a stock at a price say $10. You want it to automatically get sold if the stock goes below $9 (-$1). If we use the term "trailing" that means that id the price goes up to $11 then the sell point becomes $10. |
This file contains hidden or 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
//mapping | |
public class EntityMapping<T> : ClassMapping<T> where T : IEntity | |
{ | |
public EntityMapping() | |
{ | |
DynamicInsert(true); | |
DynamicUpdate(true); | |
Lazy(false); | |
Id(x => x.Id, mapper => mapper.Generator(Generators.Identity)); | |
} |
This file contains hidden or 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.IO; | |
using System.Net; | |
using System.Reactive.Concurrency; | |
using System.Reactive.Disposables; | |
using System.Reactive.Linq; | |
namespace NodeSharp | |
{ | |
class Program |
This file contains hidden or 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
// snippet is for http://abdullin.com/journal/2011/6/26/event-sourcing-a-la-lokad.html | |
// simple helper, that looks up and calls the proper overload of | |
// When(SpecificEventType event). Reflection information is cached statically | |
// once per type. | |
public static class RedirectToWhen | |
{ | |
static class Cache<T> | |
{ | |
public static readonly IDictionary<Type, MethodInfo> Dict = typeof(T) |
This file contains hidden or 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 int Count<TSource>(this IEnumerable<TSource> source) { | |
if (source == null) { | |
throw Error.ArgumentNull("source"); | |
} | |
var collectionT = source as ICollection<TSource>; | |
if (collectionT != null) { | |
return collectionT.Count; | |
} | |
var collection = source as ICollection; | |
if (collection != null) { |
This file contains hidden or 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; | |
namespace CG2.ExamplePOC | |
{ | |
public class WithDrawCashContext : WithDrawCashHandler | |
{ | |
protected Guid CardId = Guid.NewGuid(); | |
protected Guid AccountId = Guid.NewGuid(); | |
protected Guid AtmId = Guid.NewGuid(); | |
} |