Skip to content

Instantly share code, notes, and snippets.

@hyrmn
hyrmn / EndToEndTests.cs
Created July 29, 2012 16:27
My incomplete but evolving understanding of CQRS
using System;
using System.Reflection;
using CommonDomain;
using CommonDomain.Core;
using CommonDomain.Persistence;
using CommonDomain.Persistence.EventStore;
using EventStore;
using EventStore.Dispatcher;
public static class Guard
{
public static void EnsureNotNull<TProperty>(Expression<Func<TProperty>> propertyName)
{
var expression = GetMemberExpression(propertyName);
var value = GetValue(expression);
if (ReferenceEquals(null, value))
{
throw new ArgumentNullException(expression.Member.Name);
}
[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");
}
}
@hyrmn
hyrmn / gist:4950442
Last active December 13, 2015 17:48
Things I wouldn't do
public class Customer
{
public string Name { get; set; }
public int LifetimeValue { get; set; }
}
class Program
{
public const int NoDiscountThreshold = 3;
public const int LowDiscountThreshold = 6;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication8
{
public class Person
{
@hyrmn
hyrmn / gist:6217484
Last active December 21, 2015 00:08
From work... 2008. Tension was rought as we went through some 'transformational activities' (outsourcing), I thought some fitting book titles would be in order to help break the tension. Feel free to add anything
  • Who Stole My Cheese
  • Daddy doesn't love you if you don't work at least 50 hours a week (it's a working title)
  • Heather has two preferred vendors
  • The Director Principle
  • Frustrated and Broke: IT isn't the Glamor Job I Wanted
  • Mommy outsourced loving you
  • Insolence for the 21st Century: How one man survived
  • Hitchhiker's Guide to Outsourcing
  • What's Ravi doing in my Cube? A manager's guide on how not to let your team know they just got outsourced
  • Knock Knock. Who's There? Not you any more: How to use humor to make layoffs fun again
@hyrmn
hyrmn / .gitconfig
Last active December 21, 2015 05:49
my .gitconfig
[user]
name = Ben Hyrman
email = ben.hyrman@gmail.com
[core]
autocrlf = true
editor = vim
excludesfile = C:\\Users\\Ben\\Documents\\gitignore_global.txt
[credential]
helper = !~/AppData/Roaming/GitCredStore/git-credential-winstore
[merge]
@hyrmn
hyrmn / gist:6378802
Created August 29, 2013 14:26
A Quick (and not best) way to use resolveusing for custom AutoMapper interestingness
using Shouldly;
public class PhotoModel
{
public string Name { get; set; }
public string Url { get; set; }
}
public class TargetModel
{
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
Cool Cat List:<br />
@Each.Cats
@hyrmn
hyrmn / Example.cs
Last active December 24, 2015 14:19
A modest proposal for routing in Nancy
// Now, there are instances where you don't actually care about parameters passed in. A GET route to an about page for example.
// The normal route might look like:
Get["/"] = parameters => View["about"];
// However, since parameters are not used, the convention is to use an underscore:
Get["/"] = _ => View["about"];
// That works, but, frankly, it's a little hard to read and gets lost in the shuffle.