Skip to content

Instantly share code, notes, and snippets.

View codereflection's full-sized avatar

Jeff Schumacher codereflection

View GitHub Profile
@codereflection
codereflection / gist:792993
Created January 24, 2011 09:11
my loverly commit comment...
Fixed Object Ref exception when 1000 card quantity was selected. Encountered ugliest code base I've seen in years. Tweeted lots about it.. and fixed stupid HTML fucked-up-ed-ness. Word.
@codereflection
codereflection / gist:792981
Created January 24, 2011 08:57
This, kids, is a great example of "write your own shopping cart F A I L"
protected void GetPriceDetails()
{
var oc = new MiddleTier.BLL.OrderConfirmation();
oc = OrderConfirmationUtility.GetOrderConfirmation(Convert.ToInt32(this.OrderConfirmationID));
var Quantity = oc.Quantity;
var Paper = oc.Paper;
var DeliverySpeed = oc.DeliverySpeed;
public class LocationClassifier : ILocationClassifier
{
private readonly IFixMessageRepository fixRepo;
private readonly IExecutingBrokerFactory executingBrokerFactory;
public LocationClassifier(IFixMessageRepository fixRepo, IExecutingBrokerFactory executingBrokerFactory)
{
this.fixRepo = fixRepo;
this.executingBrokerFactory = executingBrokerFactory;
}
@codereflection
codereflection / gist:663016
Created November 4, 2010 19:22
out refs suck.
using System;
using System.IO;
namespace OutRefsSuck
{
internal static class Program
{
private static void CallSomeFunction(string value1, string value2, Action<string> doneAction)
{
doneAction(value1 + value2);
@codereflection
codereflection / gist:638733
Created October 21, 2010 15:46
Results for multiple test frameworks: Gallio, NUnit, MSpec, and XUnit.net
------ Test started: Assembly: GallioTestRunner.dll ------
Gallio TestDriven.Net Runner - Version 3.2 build 601
Test Files:
D:\Dev\Playground\MultiTestRunners\GallioTestRunner\bin\Debug\GallioTestRunner.dll
Start time: 8:43 AM
Verifying test files.
Initializing the test runner.
public static IMappingExpression<Procurement, ProcurementViewModel> CreateDestinationMap()
{
return Mapper.CreateMap<Procurement, ProcurementViewModel>()
.ForMember(dest => dest.Id, opt => opt.MapFrom(p => p.Procurement_ID))
.ForMember(dest => dest.Donors,
opt => opt.MapFrom(p =>
Mapper.Map<IEnumerable<Donor>, IEnumerable<ProcurementDonorViewModel>>(p.ProcurementDonors.Select(x => x.Donor))
));
}
public static class ReadAllLinesHelper
{
public static IEnumerable<string> For(this string[] lines)
{
return lines;
}
public static IEnumerable<T> EachLineWeCareAbout<T>(this IEnumerable<string> lines, IParser parser)
{
return lines.Where(parser.CanParse).Select(parser.Parse) as IEnumerable<T>;
public int Import(string filePathAndName)
{
if(!fileSystem.FileExists(filePathAndName))
throw new FileNotFoundException();
return fileSystem.ReadAllLines(filePathAndName)
.For()
.EachLineWeCareAbout<Message>(parser)
.Save(repo)
.Count();
public int Import(string filePathAndName)
{
if(!fileSystem.FileExists(filePathAndName))
throw new FileNotFoundException();
var messages = fileSystem.ReadAllLines(filePathAndName)
.Select(line => parser.Parse(line));
messages.Each(message => repo.Save(message));
public static IEnumerable<T> Each<T>(this IEnumerable<T> things, Action<T> action)
{
if (things == null)
yield break;
foreach (var thing in things)
{
action(thing);
yield return thing;
}