Instantly share code, notes, and snippets.

Craig Phillipscraigtp

• Sort options
Last active May 28, 2019 — forked from gregoryyoung/ProbabilityKata2
Probability Kata part 2
View ProbabilityKata2
 OK so now you have implemented the kata. Your tests should look something like this: We can say that the tests define the object "in a calculus of itself". They are not state based tests, they define how the behaviours of the object interact with each other. To see the real value of this let's introduce some change ... I hear real system's do this occasionally. Because this is a high performance system decimal math is too slow. You now need to use floats instead. Need help on floating point math? Check out: http://www-users.math.umd.edu/~jkolesar/mait613/floating_point_math.pdf
Created May 27, 2019 — forked from gregoryyoung/ProbabilityKata
Greg Young's Probability Kata
View ProbabilityKata
 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)
Created Apr 19, 2018
View keybase.md

Keybase proof

I hereby claim:

• I am craigtp on github.
• I am craigtp (https://keybase.io/craigtp) on keybase.
• I have a public key whose fingerprint is 8FBD 50F4 7D2C E90F 95D6 1B27 3965 4610 07EB B49F

To claim this, I am signing this object:

Last active Oct 24, 2018
Standard Mercurial Config / ini file
View mercurial.ini
 [ui] username = Your Name ignore = D:\Documents\hgignore_global.txt ssh = "C:\Utils\putty\plink.exe" -ssh -2 -batch -C editor="C:\Program Files (x86)\Notepad++\notepad++.exe" -multiInst -nosession [merge-tools] beyondcompare4.args=\$local \$other \$base \$output /ro /lefttitle=local /centertitle=base /righttitle=other /automerge /reviewconflicts /solo beyondcompare4.regkey=Software\Scooter Software\Beyond Compare 4 beyondcompare4.regname=ExePath
Created Sep 23, 2017
Windows Touch - Update Last Write / Modified Date of files recursively.
View touch.ps1
 gci -recu -inc "*.*" | % { \$_.LastWriteTime = Get-Date }
Last active Apr 21, 2017
Provides a function that will allow two imprecise floating point numbers to be compared for "near" equality and also an "IsNumeric" function.
View NumericHelpers.cs
 public static class NumericHelpers { // Float point maths is whack. We can't check for absolute equality as floating point numbers are imprecise // and are subject to rounding issues (See: http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html) // Therefore, we can't check for absolute equality, but instead we have to need to check for values being // "nearly" equal, which allows a small margin of error (i.e. something known as the "Epsilon" value for // the given data type for this CPU that this code is running on). public static bool NearlyEqual(double a, double b, double epsilon) { var absA = Math.Abs(a);
Last active Dec 11, 2018
View .gitconfig