Skip to content

Instantly share code, notes, and snippets.

View jmarnold's full-sized avatar

Josh Arnold jmarnold

View GitHub Profile
@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 / 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 / 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)
public class DiagnosticsTemplateBinder : ITemplateBinder
{
public bool CanBind(IBindRequest request)
{
var descriptor = request.Target.Descriptor as ViewDescriptor;
if(descriptor == null || descriptor.ViewModel == null)
{
return false;
}
public class AddBehaviorChainNotificationPolicy : INotificationPolicy
{
private readonly BehaviorGraph _graph;
public AddBehaviorChainNotificationPolicy(BehaviorGraph graph)
{
_graph = graph;
}
public bool Applies()
@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)
@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 / 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(),
public interface IPackageInfo
{
string Name { get; }
string Role { get; set; }
void LoadAssemblies(IAssemblyRegistration loader);
void ForFolder(string folderName, Action<string> onFound);
void ForData(string searchPattern, Action<string, Stream> dataCallback);
}
@jmarnold
jmarnold / gm.sh
Created October 12, 2011 04:35
The Good Morning Command
# the good-morning command (where upstream is your target remote -- or could be origin)
function gm {
branch_name="$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1 /')"
echo "Currently on $branch_name"
git checkout master
git pull upstream master
git checkout $branch_name
git rebase master
}