Skip to content

Instantly share code, notes, and snippets.

View tomwscott's full-sized avatar

Tom Scott tomwscott

  • Deliberate
  • United Kingdom
View GitHub Profile

Keybase proof

I hereby claim:

  • I am tomwscott on github.
  • I am tomwscott (https://keybase.io/tomwscott) on keybase.
  • I have a public key ASD3y3y6edK4Yw6g2BGFtx86wYiKSdA6_BPhdNaOdMQmmQo

To claim this, I am signing this object:

@tomwscott
tomwscott / Employee.cs
Last active August 29, 2015 13:57
Aggregate Event Sourcing example and tests
public class Employee : Aggregate {
private boolean hasBeenReprimanded = false;
public void Reprimand(ReprimandReason reason) {
Raise(new EmployeeReprimanded(id, reason, DateTime.Now));
}
public void Fire(FiringReason reason) {
if(hasBeenReprimanded) {
@tomwscott
tomwscott / gist:5582789
Last active December 17, 2015 08:49
Trivial example of encapsulation
public class NaughtyRectangle
{
private int width;
private int height;
public NaughtyRectangle(){}
public void SetHeight(int h){
height = h;
}
@tomwscott
tomwscott / ErrorCode.cs
Created November 18, 2012 14:58
(mostly) Unique error code generation to make sifting through log files a little easier
class Program
{
static void Main()
{
System.Console.Out.WriteLine("ErrorCode: {0}", new ErrorCode());
System.Console.ReadLine();
}
}
// Error code unique ids inspired by: Chris's UID Generation Part II
@tomwscott
tomwscott / install_gitosis.sh
Created June 20, 2011 08:58
Commands & output from installing Gitosis
Script started on Mon 20 Jun 2011 08:46:01 AM UTC
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
>>$ sudo apt-get install gitosis
Reading package lists... 0%
Reading package lists... 0%