Skip to content

Instantly share code, notes, and snippets.

@derekgreer
derekgreer / findDeadProjects.sh
Created November 1, 2011 23:39
Bash script to find dead projects
#!/bin/bash
declare -a SOLUTIONS=$(find . -name "*.sln")
declare -a PROJECTS=$(find . -name "*.csproj")
for PROJECT in ${PROJECTS[*]}
do
PROJECT_NAME=$(basename $PROJECT)
USED=0
@derekgreer
derekgreer / MonarchySpecs.cs
Created July 22, 2011 22:49
Monarchy Refactored Specs
using Machine.Specifications;
namespace Monarchy.Specs
{
[Subject(typeof(ObjectFactory))]
public class when_retrieving_a_type_with_registered_dependency_factory
{
static TestService _instance;
static ObjectFactory _factory;
@derekgreer
derekgreer / Monarchy.cs
Created July 22, 2011 22:48
Monarchy Refactored
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace Monarchy {
public class ObjectFactory {
static readonly IDictionary<Type, Func<object>> Container = new Dictionary<Type, Func<object>>();
public T Get<T>() {
@derekgreer
derekgreer / gist:1065000
Created July 5, 2011 14:59
rake snippet
sh "#{WEB_PACKAGE_LOCATION}/#{PROJECT_NAME}.deploy.cmd /M:localhost /Y \"-skip:objectName=dirPath,skipAction=Delete,absolutePath=logs\""
@derekgreer
derekgreer / custom_assertion_test.cs
Created June 11, 2011 15:56
Custom Assertion Test
public class when_asserting_unsorted_comments_are_sorted_in_descending_order
{
static Exception _exception;
static List<Comment> _unsortedComments;
Establish context = () =>
{
_unsortedComments = new List<Comment>
{
new Comment("comment 1", DateTime.MinValue.AddDays(1)),
[Subject(typeof (FluSectionResultGenerator))]
public class when_applicant_provides_information_indicating_flu_susceptibility : given_a_generator_context
{
Because of = () => Generator.Run(new[] {new Question("Do you have issues?") {Answer = true},});
It should_reflect_susceptibility_to_the_flu = () => FileSystemMock.Verify(x => x.Read( "a/b/c/susceptable.txt"));
}
[Subject(typeof (FluSectionResultGenerator))]
public class when_applicant_provides_no_information_indicating_flu_susceptibility : given_a_generator_context