Skip to content

Instantly share code, notes, and snippets.

View FixieConventions.cs
public class CustomConvention : Convention
{
public CustomConvention()
{
Cases.Where(StartsWith("should", "it"));
FixtureExecution.CreateInstancePerFixture();
InstanceExecution.SetUpTearDown(StartsWithWhen(), StartsWithAfter());
}
@mhinze
mhinze / build.cmd
Created Feb 22, 2013
Updated build.cmd psake launcher ... useful for pulling down solution package (like psake) .. since later this script actually invokes psake.
View build.cmd
@echo off
rem source arg below can be semicolon-delim ie '-source "https://nuget.org/api/v2/;\\server\share"'
.\src\.nuget\nuget.exe install src\.nuget\packages.config -source "" -RequireConsent -o "src\packages"
if '%1'=='/?' goto help
if '%1'=='-help' goto help
if '%1'=='-h' goto help
powershell -NoProfile -ExecutionPolicy Bypass -Command "& '%~dp0\src\packages\psake.4.2.0.1\tools\psake.ps1' %*; if ($psake.build_success -eq $false) { exit 1 } else { exit 0 }"
@mhinze
mhinze / ArrangeActAssertTemplate.cs
Created Jan 14, 2013
A template for Arrange / Act / Assert
View ArrangeActAssertTemplate.cs
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Should;
namespace $NAMESPACE$
{
[TestClass]
public class ArrangeActAssertTemplate
{
[TestMethod]
@mhinze
mhinze / TestCaseClassPerFixtureTemplate.cs
Created Jan 14, 2013
A template for "test case path per fixture" test organization pattern from http://xunitpatterns.com/Testcase%20Class%20per%20Fixture.html
View TestCaseClassPerFixtureTemplate.cs
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Should;
namespace $NAMESPACE$
{
[TestClass]
public class TestCaseClassPerFixtureTemplate
{
public static string actual;
@mhinze
mhinze / ExpectedExceptionWithMessageAttribute.cs
Created Jan 14, 2013
Extend the ridiculous MSTest ExpectedExceptionBaseAttribute to assert on message
View ExpectedExceptionWithMessageAttribute.cs
using System;
using System.Text.RegularExpressions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace $NAMESPACE$
{
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class ExpectedExceptionWithMessageAttribute : ExpectedExceptionBaseAttribute
{
readonly bool _allowDerivedTypes;
@mhinze
mhinze / bench.txt
Created Aug 1, 2012
benchmarque output
View bench.txt
c:\dev\FOO\IntegrationTests\bin\Release>..\..\..\packages\Benchmarque.0.1.10\tools\Benchmarque.Console.exe .\IntegrationTests.dll
Subject Assembly: .\IntegrationTests.dll
Loading subject assembly: c:\dev\FOO\IntegrationTests\bin\Release\IntegrationTests.dll
Benchmark ReadingBenchmark, Runner IDeserializeContent, 1 iterations
Implementation Duration Difference Each Multiplier
==============================================================================
Resx -0- -0- 89
Protobuf -0- -0- 1135 12.75x
MsgPack 2ms 2ms 3786 42.54x
View redis-server-for-init.d-startup
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@mhinze
mhinze / bloody.txt
Created May 3, 2012
[The Listserve] A Bloody Mar/y/ia from Juba, South Sudan
View bloody.txt
here is something that i have worked on for a long time.
you can sort out the proportions to taste, but it will make you a solid bloody maria.
even in south sudan you can find most of these things.
you may need to sneak the tomato juice in, or use ceres.
i have not put in proportions, but have listed these things in order of importance/operation/process. it's art. deal.
if you hate things that taste good you can substitute vodka for tequila
juba / 2012
==================================
View gist:2049855
static Task<TResult> WrapTask<TResult>(this Task<TResult> task, Action<TResult> failedResultFactory)
{
TaskCompletionSource<TResult> tcs = new TaskCompletionSource<TResult>();
task.ContinueWith(result => tcs.SetResult(result);
task.Catch(exception => tcs.SetResult(failedResultFactory()));
return tcs.Task;
}
@mhinze
mhinze / exposeiis.ps1
Created Feb 22, 2012
Sample solutionscript to expose IIS
View exposeiis.ps1
function global:ExposeIIS()
{
$config = [xml] ( get-content $env:IIS_USER_HOME/config/applicationhost.config )
# Add in new bindings for computer name
foreach($site in $config.configuration."system.applicationHost".sites.site)
{
foreach($bindings in $site.bindings)
{
# no need to add another binding for machine name if its exists