Skip to content

Instantly share code, notes, and snippets.

@OakRaven
OakRaven / app.coffee
Created January 6, 2012 17:31
HTML Test for CoffeeScript and KnockoutJS
class ComboBoxItem
constructor: (@id, @name) ->
class App
textEntry: ko.observable("")
collection: ko.observableArray([])
addToCollection: ->
item = new ComboBoxItem(@collection().length, @textEntry())
@gregoryyoung
gregoryyoung / gist:1500720
Created December 20, 2011 08:00
Greg's Stop Loss Kata
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.
@chitchcock
chitchcock / 20111011_SteveYeggeGooglePlatformRant.md
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@JamesTryand
JamesTryand / about.md
Created August 10, 2011 18:16 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@chrisortman
chrisortman / gist:1123807
Created August 3, 2011 21:25
vim script to remove webforms tags and replace with razor
function! DumpWebforms()
%s/<% \([^}]\)/@\1
%s/<%= /@
%s/<%=/@
%s/<%//
%s/%>//
endfunction
@yevhen
yevhen / SpecificationFixture.cs
Created July 27, 2011 15:26
NUnit support for Greg Young's Simple.Testing "framework"
[TestFixture]
public class SpecificationFixture
{
[Test, TestCaseSource("GetSpecificationTestCases")]
public void Verify(SpecificationToRun spec)
{
var runner = new SpecificationRunner();
RunResult result = runner.RunSpecifciation(spec);
if (result.Passed)
@gregoryyoung
gregoryyoung / Sample.cs
Created July 4, 2011 14:51
Sample Test From Simple.Testing
//This is a sample specification.
public SutSpecification<Depositor> when_withdrawing_money_from_empty_account = new SutSpecification<Depositor>
{
On = () => new Depositor(13),
When = depositor => depositor.Withdraw(50.00m),
Expect =
{
depositor => depositor.Balance > 0.01m,
depositor => depositor.AccountIsOpen
@dauger
dauger / NDC2011ViewingList.tdl
Created June 19, 2011 20:40
List of NDC 2011 videos in ToDoList Format (see www.abstractspoon.com for ToDoList application)
<?xml version="1.0" encoding="windows-1252" ?>
<TODOLIST FILENAME="C:\Projects\Programming\Blog\ND2011 Video Checklist\ND2011.tdl" PROJECTNAME="ND2011" FILEFORMAT="9" NEXTUNIQUEID="166" LASTMODIFIED="2011-06-19" FILEVERSION="111" EARLIESTDUEDATE="0.00000000">
<TASK TITLE="Day 1" ID="1" ICONINDEX="-1" POS="1" PRIORITY="5" RISK="0" PERCENTDONE="0" COST="0.00000000" CALCCOST="0.00000000" STARTDATE="40713.00000000" STARTDATESTRING="2011-06-19" CREATIONDATE="40713.53445602" CREATIONDATESTRING="2011-06-19 12:49 PM" LASTMOD="40713.53452546" LASTMODSTRING="2011-06-19 12:49 PM" PRIORITYCOLOR="15732480" PRIORITYWEBCOLOR="#000FF0">
<TASK TITLE="Keynote - Cloud Computing and Azure" ID="16" ICONINDEX="-1" COMMENTS="Scott Guthrie
http://ndc2011.aventia.no/" POS="1" PRIORITY="5" RISK="0" PERCENTDONE="0" COST="0.00000000" CALCCOST="0.00000000" STARTDATE="40713.00000000" STARTDATESTRING="2011-06-19" CREATIONDATE="40713.54113426" CREATIONDATESTRING="2011-06-19 12:59 PM" LASTMOD="40713.54435185" LASTMODSTRING="2011-06-19 1:03 P
@gregoryyoung
gregoryyoung / ProbabilityKata
Created June 10, 2011 09:56
Greg Young's Probability Kata
Value objects are an important concept in DDD. This kata is made both to learn value objects and to learn better ways of testing.
Write a probability value object. It should contain the following methods:
Probability CombinedWith(Probability)
Probability InverseOf()
Probability Either(Probability)
if you forget your probability math:
Either:P(A) + P(B) - P(A)P(B)
CombinedWith: P(A)P(B)
@mariusk
mariusk / gist:917391
Created April 13, 2011 11:39
Updated clojure-clr WPF celcius example
; A CLR port of http://bestinclass.wordpress.com/2009/09/24/chaos-theory-vs-clojure/
; Updated to use Rich Hickey's changes: http://paste.lisp.org/display/87799
;
; A WPF app is fired up in another thread. Anything you type in the REPL
; is dispatched to the WPF thread and evaluated there.
;
; Requires the following addition to ClojureCLR's GenDelegate.cs:
; public static Delegate CreateFunc(IFn fn)
; {
; Type delegateType = typeof(Func<>).MakeGenericType(new Type[] { typeof(object) });