Skip to content

Instantly share code, notes, and snippets.

@gregoryyoung
gregoryyoung / ProbabilityKata2
Created June 10, 2011 09:51
Probability Kata part 2
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
You will need to use a non-exact equality... How will this change your code?
@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)
@coldnebo
coldnebo / Default (Linux).sublime-keymap
Created August 10, 2011 23:20
simple scripts to prettify your xml and json in sublime text 2
[
{ "keys": ["ctrl+shift+x"], "command": "tidy_xml" },
{ "keys": ["ctrl+shift+j"], "command": "prettify_json" }
]
@matthewmccullough
matthewmccullough / .gitconfig.ini
Created December 31, 2011 18:16
Alternate URLs (insteadOfs) for GitHub Git repos
[url "git://github.com/"]
insteadOf = "ghg://"
pushInsteadOf = "ghg://"
# Example: git clone ghg://ntschutta/emacs
[url "git://github.com/matthewmccullough/"]
insteadOf = "ghgm://"
pushInsteadOf = "ghgm://"
# Example: git clone ghgm://hellogitworld
[url "git@github.com:"]
insteadOf = "ghs://"
@alexbeletsky
alexbeletsky / gist:1836711
Created February 15, 2012 15:32
Sublime Text 2 Build System for .NET solutions
{
"shell": true,
"working_dir": "${project_path:${folder}}",
"cmd": ["%WINDIR%\\Microsoft.NET\\Framework\\v4.0.30319\\msbuild", "${project_base_name}.sln"]
}
@alexbeletsky
alexbeletsky / gist:1884547
Created February 22, 2012 12:11
My git config
[user]
name = alexander.beletsky
email = alexander.beletsky@gmail.com
[alias]
lg = log --all --graph --pretty=format:'%C(bold blue)<%an>%Creset %Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci)%Creset' --abbrev-commit
[merge]
tool = p4merge
[diff]
tool = p4diff
@chaliy
chaliy / C#.sublime-build
Created March 18, 2012 21:17
Sublime Build to compile and run C# program
{
// This build system will build your cs file to exe file and will run it
"cmd": ["del ${file/\\.cs/\\.exe/} 2>NUL", "& csc /nologo /out:${file/\\.cs/\\.exe/} $file", "& ${file/\\.cs/\\.exe/}"],
"file_regex": "^(...*?)[(]([0-9]*),([0-9]*)[)]",
// By default csc is not in your PATH, so add it to your path
// or uncomment "path" and check that it has correct value
//"path": "C:/Windows/Microsoft.NET/Framework64/v4.0.30319/",
"shell": true, // Without this sublime has hard times to parse "&" in out command line
"selector": "source.cs"
}
@yevhen
yevhen / gist:5199613
Created March 19, 2013 20:07
The concept of message handling Component and the example of message handler chaining via functional composition
/* somewhere in your Core.CQRS */
// Base class for all ES-based aggregate command handling components;
//
// NOTE: "Component" is a logical grouping of message handlers by function
// They provide good place to encapsulate chaining of cross-cutting concerns
// into a pipeline, providing simplified helper methods for registration of message handlers
//
// Components are similar to Services, thus they only contain handlers of single type (ie Command Handlers only)
// Components operate on envelope (infrastructure) level
@chaliy
chaliy / SetupDev.ps1
Last active December 19, 2015 04:48
cinst git
cinst gitextensions
cinst paint.net
cinst Inkscape
cinst skydrive
cinst sublimetext2
cinst VisualStudio2012Professional # requires modification to install web tools
cinst resharper
cinst winmerge
cinst 7zip
@jbenet
jbenet / simple-git-branching-model.md
Last active June 17, 2024 14:53
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.