Skip to content

Instantly share code, notes, and snippets.

View ssboisen's full-sized avatar

Simon Stender Boisen ssboisen

View GitHub Profile

Keybase proof

I hereby claim:

  • I am ssboisen on github.
  • I am ssboisen (https://keybase.io/ssboisen) on keybase.
  • I have a public key ASAx14dDln2g4CZ0iAfqva-VUr6A54ul2NRVcQBFjX69ugo

To claim this, I am signing this object:

#include "stdafx.h"
#include <iostream>
#include <functional>
class FunctionTester
{
public:
FunctionTester();
std::function<int(bool)> DoStuff();
};
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace SuffixTreeAlgorithm
{
public class SuffixTree
{
@ssboisen
ssboisen / Test.cs
Last active December 25, 2015 06:39
public enum TradeStatusEnum { Created, Approved }
public class Party
{
//ctor etc.
public string Name { get; protected set; }
}
public class Trade
open System;
open System.Diagnostics;
[<EntryPoint>]
let main argv =
let rec cc amount coins =
match (amount, coins) with
| (0,_) -> 1
| (_,[]) -> 0
| (amount,_) when amount < 0 -> 0
let memoize2 f =
let cache = ref Map.empty
fun a b ->
match (!cache).TryFind (a,b) with
| Some(cv) -> cv
| None ->
let v = f a b
cache := Map.add (a,b) v !cache
v
@ssboisen
ssboisen / gist:6533869
Created September 12, 2013 07:09
Static duck-typing in F#
let inline inTheForest (a: ^a) =
(^a : (member Quack: unit -> unit) (a))
(^a : (member Feathers: unit -> unit) (a))
()
type Duck() =
member x.Quack() = printfn "Quaaaaaack!"
member x.Feathers() = printfn "The duck has white and gray feathers."
type Person() =
[Route('/person/{id}')]
public class Person
{
public Int Id;
public string Name;
public Address HomeAddress;
}
[Route('/address/{id}')]
public Address
@ssboisen
ssboisen / GzipJsonServiceClient.cs
Created November 14, 2012 12:48
Silverlight, GZip and ServiceStack
public class GzipJsonServiceClient : JsonServiceClient
{
public GzipJsonServiceClient(string baseUri) : base(baseUri) { }
public GzipJsonServiceClient(string syncReplyBaseUri, string asyncOneWayBaseUri) : base(syncReplyBaseUri, asyncOneWayBaseUri) { }
public override void SerializeToStream(IRequestContext requestContext, object request, Stream stream)
{
using (var memStream = new MemoryStream())
{
@ssboisen
ssboisen / huffman.clj
Last active October 12, 2015 10:38
Hoffman encoding in Clojure
(defn branch? [node]
(= (:type node) :branch))
(defn get-chars [node]
(if (branch? node)
(:chars node)
[(:char node)]))
(defn leaf [char weight]
{:char char :weight weight :type :leaf})