Skip to content

Instantly share code, notes, and snippets.

View trbngr's full-sized avatar

Chris Martin trbngr

  • Phoenix, AZ, USA
View GitHub Profile
var context = new CrusherContext();
var source = new FileSource(new FileInfo("your js file"));
IEngine engine = context.GetDefaultEngineFor(source);
ICrushResult result = engine.TransformSource(source);
//stream back result.Result
public class TestRunner
{
private static readonly ILog log = LogManager.GetLogger(typeof (TestRunner));
public static void Main()
{
Action foo = () =>
{
const string ID = "gsp";
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApplication3
{
class Program
{
static void Main()
{
@trbngr
trbngr / gist:673616
Created November 12, 2010 02:09
Specification Pattern
using System;
namespace ConsoleApplication3
{
internal class Program
{
private static void Main()
{
var chris = new Person {name = "Chris", age = 36};
@trbngr
trbngr / gist:868281
Created March 13, 2011 17:41
Using Entity inside AggregateRoot - NCQRS
public class Order : AggregateRoot
{
private readonly List<OrderItem> orderItems = new List<OrderItem>();
public void UpdateOrderItem(Guid orderItemId, int quantity)
{
var orderItem = orderItems.Where(q => q.EntityId ==
orderItemId).FirstOrDefault();
if (orderItem == null)
@trbngr
trbngr / gist:983108
Created May 20, 2011 15:06
Get Local Application Data Directory
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
namespace ConsoleApplication1
{
internal class Program
{
@trbngr
trbngr / ExtendCqrsClientBuilder.cs
Created May 25, 2011 22:25
Lokad.Cqrs.SimpleSynchronousMessageSender
using System;
using Lokad.Cqrs.Build.Client;
namespace Lokad.Cqrs.Extensions.Build
{
public static class ExtendCqrsClientBuilder
{
public static CqrsClientBuilder AddSynchronousMessageSender(this CqrsClientBuilder builder)
{
@trbngr
trbngr / ExtendImmutableEnvelope.cs
Created June 28, 2011 18:10
Injecting Message Information in Lokad CQRS v2
public static class ExtendImmutableEnvelope
{
public static Guid GetGuid(this ImmutableEnvelope envelope, string key)
{
return Get(envelope, key, s =>
{
Guid result;
return Guid.TryParse(s, out result) == false ? Guid.Empty : result;
});
}
public class Program
{
private static void Main()
{
var instance = new SomeClass
{
SomePropertyWithAttribute = "I have an attribute",
SomeProperty = "I don't have an attribute"
};
@trbngr
trbngr / ApiResourceSerializationTests.cs
Created August 26, 2012 09:54
Demonstrating how to skip fields that aren't decorated with a certain attribute using json.net.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using GuessWho;
using NUnit.Framework;