Skip to content

Instantly share code, notes, and snippets.

View jmarnold's full-sized avatar

Josh Arnold jmarnold

View GitHub Profile
@jmarnold
jmarnold / gist:1252725
Created September 30, 2011 05:05 — forked from msbukkuri/gist:1252697
CsvPrinter
class Program
{
static void Main(string[] args)
{
var values = new List<Sample>();
for (var i = 0; i < 10; i++)
{
values.Add(new Sample
{
Prop1 = Guid.NewGuid().ToString(),
@jmarnold
jmarnold / ICommandInvoker.cs
Created September 24, 2011 19:31
Fleck Fun
public interface ICommandInvoker
{
void InvokeFor(SocketMessage message);
}
public class CommandInvoker : ICommandInvoker
{
public void InvokeFor(SocketMessage message)
{
//no-op..just an example
@jmarnold
jmarnold / Order.cs
Created September 22, 2011 04:04
Simple Ball of Mud
public class Order
{
private readonly List<OrderLineItem> _lineItems = new List<OrderLineItem>();
public Guid Id { get; set; }
public IEnumerable<OrderLineItem> LineItems { get { return _lineItems; } }
public bool IsInterational { get; set; }
public bool IsReadyToShip { get; set; }
public void AddLineItem(OrderLineItem item)
public class AddBehaviorChainNotificationPolicy : INotificationPolicy
{
private readonly BehaviorGraph _graph;
public AddBehaviorChainNotificationPolicy(BehaviorGraph graph)
{
_graph = graph;
}
public bool Applies()
public class DiagnosticsTemplateBinder : ITemplateBinder
{
public bool CanBind(IBindRequest request)
{
var descriptor = request.Target.Descriptor as ViewDescriptor;
if(descriptor == null || descriptor.ViewModel == null)
{
return false;
}
@jmarnold
jmarnold / CommandInvocationSource.cs
Created September 10, 2011 18:06
Conventional Command Invocation
public class CommandInvocationSource : IActionSource
{
private readonly IContainer _container;
public CommandInvocationSource()
{
_container = ObjectFactory.Container;
}
public IEnumerable<ActionCall> FindActions(TypePool types)
@jmarnold
jmarnold / todo.markdown
Created September 8, 2011 03:04
Diagnostics TODO

Advanced Diagnostics Cleanup

Some core things

  • Notifications should be actionless views
  • Use IPartialModel for wiring up actionless views (INotificationModel should be an IPartialModel)
  • Endpoints to Handlers
  • Beef up coverage on handlers

BehaviorChain visualization

  • BehaviorNode partial mechanism
@jmarnold
jmarnold / Global.cs
Created September 7, 2011 21:40
NuGet Testing
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
FubuApplication
.For<Test>()
.StructureMapObjectFactory()
.Bootstrap(RouteTable.Routes);
}
@jmarnold
jmarnold / routing.js
Created August 29, 2011 17:10
Simple JS DSL example
jBus.routing = new (function() {
function lazy(builder) {
this.builder = builder;
this.buildWith = function(func) {
this.builder = func;
};
this.value = function() {
return this.builder();
};
@jmarnold
jmarnold / ModelFinder.cs
Created August 19, 2011 19:36
ModelFinder
public class ModelFinder : IModelFinder
{
private readonly BehaviorGraph _graph;
public ModelFinder(BehaviorGraph graph)
{
_graph = graph;
}
public Type FindRelatedModel(Type type)