Skip to content

Instantly share code, notes, and snippets.

View jmarnold's full-sized avatar

Josh Arnold jmarnold

View GitHub Profile
@jmarnold
jmarnold / IModelTypeCoordinator.cs
Created July 29, 2011 06:03 — forked from schotime/gist:1113211
ValidationBehavior<T>
public interface IModelTypeCoordinator
{
IValidationModel FindGetFor(Type postType);
}
public interface IConfigurationAction
{
void Configure(SemanticModel model);
}
@jmarnold
jmarnold / ConfigureStringifierExpression.cs
Created July 12, 2011 15:34
Stringification Registry
public class ConfigureStringifierExpression
{
private readonly Func<StringifyRequest, bool> _predicate;
private readonly StringifierModel _model;
public ConfigureStringifierExpression(Func<StringifyRequest, bool> predicate, StringifierModel model)
{
_predicate = predicate;
_model = model;
}
@jmarnold
jmarnold / IStringifier.cs
Created July 12, 2011 04:55
Simplistic Stringification
public interface IStringifier
{
bool Matches(StringifyRequest request);
string Stringify(StringifyRequest request);
}
@jmarnold
jmarnold / DefaultPolicy.cs
Created July 9, 2011 21:09
Compositional Patterns: Policies
public class DefaultPolicy : IPolicy
{
public bool Matches()
{
return true;
}
public void Execute()
{
// default behavior
@jmarnold
jmarnold / IContentPart.cs
Created July 4, 2011 17:39
MultipleViews
public interface IContentPart { }
public class TitlePart : IContentPart { // whatever else }
public class BodyPart : IContentPart { // whatever else }
@jmarnold
jmarnold / JsonResponse.cs
Created July 2, 2011 15:16
ActionLess JSON
public class JsonResponse
{
private readonly IList<string> _errors = new List<string>();
public bool Success { get; set; }
public IEnumerable<string> Errors { get { return _errors; } }
public void RegisterError(string error)
{
_errors.Fill(error);
@jmarnold
jmarnold / SMBug.cs
Created June 28, 2011 13:58
SM Bug
using System;
using System.Diagnostics;
using System.Linq;
using StructureMap;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
@jmarnold
jmarnold / SampleDashboardModel.cs
Created June 23, 2011 19:05
Sample Dashboard
public class SampleDashboardModel
{
public IEnumerable<IDashboardWidget> Widgets { get; set;
}
@jmarnold
jmarnold / jbus-example.js
Created June 17, 2011 21:56
Example bootstrapping
jBus.routing.initialize(function() {
this.connectTo('ws://jmarnold-logist:8181');
this.on('TimestampCaseCommand', function(msg) {
$('#Case1').find('.checkpoint-' + msg.Checkpoint).html(msg.Value);
});
this.on('PulseCommand', function(msg) {
$('#Pulse').html(msg.Message);
});
});