Skip to content

Instantly share code, notes, and snippets.

Harry McIntyre mcintyre321

  • London
Block or report user

Report or block mcintyre321

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mcintyre321 / Comment.cs
Last active Jan 8, 2019
Siren from IQueryable
View Comment.cs
namespace _10PrintHello.Apps.Things.SirenTables
public class Comment
public int postId { get; set; }
public int id { get; set; }
View gist:5bb6291dfe41054b7393394c46a792ff
  • use nsdepcop instead of project dependencies for layering so you can keep things in the same project
  • generic action result in controllers instead of base type
  • explicitly register your controllers rather than letting Controller Activator use them
  • ditch your IOC container entirely
  • use ValueOf for ids instead of ints
  • hard code all non-secret config values each environment in your source code (using code, not json) and choose the right one based off a single 'env' variable
  • use OneOf instead of custom Result objects/ Exceptions for control flow
  • partition by feature vertical, not layer
  • use delegates for your ports/adapters
  • isolate your domain and use composition root
View tryjsil.cs
using System;
using JSIL;
using JSIL.Meta;
using System.Collections.Generic;
using System.Linq;
public static class Program {
public static void Main () {
Dictionary<string, string[]> data = new Dictionary<string, string[]>(){
View SirenStyles.css
background-color: aliceblue;
background-color: f5fff0
mcintyre321 / Linqpad script.cs
Last active May 18, 2016
Simple Event Sourcing using NMF
View Linqpad script.cs
void Main()
var events = new ObservableCollection<Event>();
var state = new NotifyCollection<object>();
events.OnAdd(next =>
if (next is UserWasAdded)
mcintyre321 / gist:ff67ffa8e2f0c8ef86da
Created Aug 6, 2015
RazorHostFactory for debugging embedded resources
View gist:ff67ffa8e2f0c8ef86da
public class MyCustomRazorHostFactory : WebRazorHostFactory
public override System.Web.WebPages.Razor.WebPageRazorHost CreateHost(string virtualPath, string physicalPath)
// Implementation stolen from MvcRazorHostFactory :)
var host = base.CreateHost(virtualPath, physicalPath);
if (!host.IsSpecialPage)
return new MyCustomRazorHost(virtualPath, physicalPath);
mcintyre321 / gist:1b9d8060acb39a4f39f0
Created Jun 24, 2015
JsonProperty for Entity Framework
View gist:1b9d8060acb39a4f39f0
public class JsonProperty<T> where T : class
public string Json { get; private set; }
protected JsonProperty()
this.SerializerSettings = new PolymorphicJsonSerializerSettings();
View gist:d9a12a991b280461d915
(function() {
var __hasProp = {}.hasOwnProperty;
(function(factory) {
if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {
return factory(require('knockout'), exports);
} else if (typeof define === 'function' && define['amd']) {
return define(['knockout', 'exports'], factory);
} else {
return factory(ko, ko.konva = {});
View gist:1c8494c3cb429bfb90a6
var observify = function (obs, top) {
if (!top && !ko.isObservable(obs)) {
var object = ko.unwrap(obs);
if ( === "[object Array]") {
for (var i = 0; i < object.length; i++) {
var v = object[i];
if (!ko.isObservable(v)) {
if ( === "[object Array]") {
View gist:08b086153f17471b08ba

Test scopes

  • Unit test - an isolated test around a single 'unit' of code, although that can be anything from a method to a class to a series of (related) classes.
  • Component test - same as a unit test
  • Isolated test - a test that doesn't do any I/O, i.e. the Ports have been filled with in-memory Adapters
  • Integration test - a test that interacts with deployed instances of the code and related services, possiby with some Test Doubles (mocked/faked/stubbed etc).
  • End to End test - a test that entirely interacts with deployed instances using public interfaces
  • Test-per-class - a convention that there should be one unit test for each class

Uses of tests

You can’t perform that action at this time.