Skip to content

Instantly share code, notes, and snippets.

View codereflection's full-sized avatar

Jeff Schumacher codereflection

View GitHub Profile
@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;
@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:844226
Created February 25, 2011 18:17
Linq awesomeness for selecting items from a list by their domain name
public class Trade
{
public virtual int TradeId { get; set; }
// some other fields...
public virtual int? PrimaryOrOpposingIndicator { get; set; }
public static Func<Trade, bool> isStreetSide = x => x.PrimaryOrOpposingIndicator == 1;
public static Func<Trade, bool> isClientAllocation = x => x.PrimaryOrOpposingIndicator == 3;
public static Func<Trade, bool> isBlockLevel = x => x.PrimaryOrOpposingIndicator == 4;
public static Func<Trade, bool> isStreetSideOrBlockLevel = x => x.PrimaryOrOpposingIndicator == 1 || x.PrimaryOrOpposingIndicator == 4;
@codereflection
codereflection / gist:859420
Created March 7, 2011 22:41
NHibernate Unit of Work management with ASP.NET MVC
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_BeginRequest(object sender, EventArgs e)
{
var manager = IoC.Container.GetService<IUnitOfWorkManager>();
manager.Begin();
}
@codereflection
codereflection / gist:868875
Created March 14, 2011 07:34
HTML stored in a field
<table cellpadding="0" cellspacing="0" border="1" width="499"
align="center">
<tr>
<td background="IM^./images/AllLarge/electricity.jpgIM^"
width="499" height="286">
<table cellpadding="0" cellspacing="0" border="0" width="499"
height="286">
<tr align="right">
<td width="250"></td>
<td valign="top" align="right">
@codereflection
codereflection / gist:869520
Created March 14, 2011 17:38
I haz a song stuck in mah head
Establish context = () =>
{
fileName = @"some path\\20110303_Executions_US.CSV";
fileSystem.GetFileName(fileName).Returns(@"20110303_Executions_US.CSV");
records = new[]
{
new SixOughtSixFileMap { Instruction = "combo no 1" },
new SixOughtSixFileMap { Instruction = "two" },
new SixOughtSixFileMap { Instruction = "three" },
new SixOughtSixFileMap { Instruction = "four" },
@codereflection
codereflection / ConduitQuartzFacility.cs
Created May 27, 2011 21:54
Custom Quartz Facility for Castle Windsor to dynamically set the quartz_jobs.xml
using System;
using System.Linq;
using Castle.Core.Configuration;
using Castle.Facilities.QuartzIntegration;
using Castle.MicroKernel.Facilities;
using Castle.MicroKernel.Registration;
using Quartz;
using Quartz.Job;
using Quartz.Spi;
PS C:\dev\Dahlia> .\build
The term 'properties' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\dev\Dahlia\build.ps1:1 char:11
+ properties <<<< {
+ CategoryInfo : ObjectNotFound: (properties:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The term 'include' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spe
lling of the name, or if a path was included, verify that the path is correct and try again.
@codereflection
codereflection / gist:1015705
Created June 8, 2011 23:20
This is how you test Elmah...
using System;
using System.Web.Mvc;
namespace Ris.Conduit.Web.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
public interface IHazAQuestionAbout<T>
{
IQueryable<T> AxinYou(IQueryable<T> items);
}