Skip to content

Instantly share code, notes, and snippets.

@mat-mcloughlin
mat-mcloughlin / Sample.cs
Last active August 29, 2015 14:13
Sample
public class SubmitOrder
{
public SubmitOrder(int orderId)
{
OrderId = orderId;
}
public int OrderId { get; private set; }
}
@mat-mcloughlin
mat-mcloughlin / init.el
Last active August 29, 2015 14:09
init.el
(require 'package)
(add-to-list 'package-archives'("melpa" . "http://melpa.milkbox.net/packages/"))
(package-initialize)
(require 'smex) ; Not needed if you use package.el
(smex-initialize) ; Can be omitted. This might cause a (minimal) delay
; when Smex is auto-initialized on its first run.
(global-set-key (kbd "M-x") 'smex)
(require 'twittering-mode)
/*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */
/*global define, $, brackets, window */
define(function (require, exports, module) {
'use strict';
var CodeHintManager = brackets.getModule('editor/CodeHintManager'),
EditorManager = brackets.getModule("editor/EditorManager"),
Helpers = require('modules/helpers'),
Omnisharp = require('modules/omnisharp');
var decision = "Dave".DecidesTo<InviteToLobby>();
decision.ProvidedDataIs("something");
decision.NewKnowledgeIs<InvitedToLobby>((e) => e.Something.ShouldBe("test"));
decision.IsAvailableWhen(() => new TestTopicInValidState());
decision.IsntAvailableWhen<ExpectedException>(() => new TestTopicInInvalidState());
public class GameId : TypedGuid
{
}
public class TypedGuid
{
protected Guid Value { get; set; }
public static implicit operator Guid(TypedGuid typedGuid)
{
@mat-mcloughlin
mat-mcloughlin / reservation-pattern
Created July 17, 2014 10:38
Attempt at reservation pattern
public class FooReserver
{
private readonly int reserveFor;
public static List<string> ReservedFoos = new List<string>();
public FooReserver(int reserveFor)
{
this.reserveFor = reserveFor;
}
namespace Kata
{
using System.Collections.Generic;
using System.Linq;
using Xunit;
public interface ICheckout
{
void Scan(string item);
@mat-mcloughlin
mat-mcloughlin / ಠ_ಠAttribute.cs
Created December 11, 2013 16:33
This code is bad and you should feel bad
[AttributeUsage(System.AttributeTargets.All, AllowMultiple = true, Inherited = true)]
public class ಠ_ಠAttribute : Attribute
{
public ILog Log { get; set; }
public ಠ_ಠAttribute()
{
Log.Info("This code is bad and you should feel bad");
}
}
@mat-mcloughlin
mat-mcloughlin / Attempt One
Created December 10, 2013 16:28
Some random attempts at god knows what
public class Program
{
public static void Main(string[] args)
{
var store = Wireup.Init().UsingInMemoryPersistence().Build();
var repository = new EventStoreRepository(store, new AggregateFactory(), new ConflictDetector());
var handler = new CreatePostCommandHandler(repository);
handler.Execute(new CreatePostCommand(new Guid(), "Test Title", "Test Description"));
}
class RandomObject
{
public decimal? PropertyA { get; set; }
public decimal? PropertyB { get; set; }
}
class CalculatePropertyA : ICalculator
{
string Name { get { return "PropertyA"; } }