Skip to content

Instantly share code, notes, and snippets.

View phillip-haydon's full-sized avatar
💭
Banana's are yellow.

Phillip Haydon phillip-haydon

💭
Banana's are yellow.
View GitHub Profile
@phillip-haydon
phillip-haydon / JabbRAuthenticationCallbackProvider.cs
Created January 30, 2013 15:41
JabbRAuthenticationCallbackProvider used by JabbR, mirrored here for blog post to prevent dead-links in the future.
using System;
using JabbR.Infrastructure;
using JabbR.Models;
using JabbR.Services;
using Nancy;
using Nancy.Authentication.WorldDomination;
using WorldDomination.Web.Authentication;
namespace JabbR.Nancy
{
namespace NooVerbs
{
public class MyBadgerModule : NooModuleBase
{
public MyBadgerModule()
{
this.Get["/"] = _ => "erm";
}
}
}
@phillip-haydon
phillip-haydon / gist:4134416
Created November 23, 2012 07:47
Granular Route Extensions for Nancy
public class HomeModule : NancyModule
{
public HomeModule()
{
this.RequireClaim("stuff")
.For("GET")
.On("/test/{claim}")
.With(o =>
{
return "YAY";
@phillip-haydon
phillip-haydon / gist:4089657
Last active October 12, 2015 21:28
Custom Route Builder for Nancy
public class NancyModule : NancyModule<RouteBuilder>
{
}
public class NancyModule<T> where T : RouteBuilder
{
private static ConcurrentDictionary<Type, Func<object>> CompiledRouteBuilders = new ConcurrentDictionary<Type, Func<object>>();
public virtual T Get
{
@phillip-haydon
phillip-haydon / gist:3798206
Created September 28, 2012 06:15
Dynamic Chained API (playing around to see possibilities)
using System;
using System.Dynamic;
using System.Linq;
using System.Reflection;
using Raven.Client;
using Raven.Client.Document;
using Raven.Json.Linq;
namespace ChainedAPISample
@phillip-haydon
phillip-haydon / program.cs
Created March 4, 2012 11:50
RavenDB Projection Sample
using System;
using System.Collections.Generic;
using System.Linq;
using Raven.Abstractions.Indexing;
using Raven.Client;
using Raven.Client.Document;
using Raven.Client.Indexes;
using Raven.Client.Linq;
namespace RavenDBProjectionTest
@phillip-haydon
phillip-haydon / Blobbed.cs
Created February 28, 2012 23:35
NHibernate Custom User Type for serializing a property to JSON
[Serializable]
public class Blobbed<T> : IUserType where T : class
{
public new bool Equals(object x, object y)
{
if (x == null && y == null)
return true;
if (x == null || y == null)
return false;