Skip to content

Instantly share code, notes, and snippets.

@bentayloruk
bentayloruk / csharp.cs
Last active August 29, 2015 13:56 — forked from ToJans/csharp.cs
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
namespace TDDCoverage
{
public class Order
{

Keybase proof

I hereby claim:

  • I am bentayloruk on github.
  • I am bentayloruk (https://keybase.io/bentayloruk) on keybase.
  • I have a public key whose fingerprint is 7373 887D 9B5F B35E DA6E BA7E 8CC9 2FEA 809C C2B8

To claim this, I am signing this object:

@bentayloruk
bentayloruk / ZoneGroupTopology.fs
Last active August 29, 2015 14:07
One of many Sonos services in the F# type system
namespace Peelio.ZonePlayer.ZoneGroupTopology
open System
open System.Linq
open System.Xml.Linq
open Peelio
/// Union types for those state vars with a set of allowed values.
type A_ARG_TYPE_UpdateType = | All | Software
with
@bentayloruk
bentayloruk / DefaultParameterValueFixupFilter.fs
Created March 23, 2015 11:12
ActionFilter for ASP.NET Web API DefaultParameterValue support in F#
namespace System.Web.Http
open System.Reflection
open System.Web.Http.Filters
open System.Web.Http.Controllers
open System.Runtime.InteropServices
/// Responsible for populating missing action arguments from DefaultParameterValueAttribute values.
/// Created to handle this issue https://github.com/aspnet/Mvc/issues/1923
/// Note: This is for later version of System.Web.Http but could be back-ported.
namespace Newtonsoft.Json.Converters
open Microsoft.FSharp.Reflection
open Newtonsoft.Json
open System
type IdiomaticDuConverter() =
inherit JsonConverter()
[<Literal>]
@bentayloruk
bentayloruk / Lucene.md
Created April 13, 2015 19:57
Lucene.NET Notes
// Safely get Some head of Seq or None.
let maybeHead = someSeq |> Seq.tryPick Some
@bentayloruk
bentayloruk / Promise<T>.cs
Created March 31, 2011 15:16
Promise a non-null IEnumerable in your method chains. Simplicity.
public static IEnumerable<T> Promise<T>(this IEnumerable<T> enumerable)
{
return enumerable ?? Enumerable.Empty<T>();
}
@bentayloruk
bentayloruk / config.ru
Created August 18, 2011 13:34
Rack re-write config
require "rack/jekyll"
require "rack-rewrite"
use Rack::Rewrite do
rewrite %r{^\/(.+)\/(\?.*)?$}, '/$1$2'
r301 %r{.*}, 'http://bentaylor.org$&', :if => Proc.new {|rack_env|
rack_env['SERVER_NAME'] != 'bentaylor.org'
}