Skip to content

Instantly share code, notes, and snippets.

Avatar

Simon Stender Boisen ssboisen

View GitHub Profile
View keybase.md

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:

View ConsoleApplication.cpp
#include "stdafx.h"
#include <iostream>
#include <functional>
class FunctionTester
{
public:
FunctionTester();
std::function<int(bool)> DoStuff();
};
View 0.suffixtree.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace SuffixTreeAlgorithm
{
public class SuffixTree
{
View Test.cs
public enum TradeStatusEnum { Created, Approved }
public class Party
{
//ctor etc.
public string Name { get; protected set; }
}
public class Trade
View count_change.fs
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
View count_change.fs
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 Sep 12, 2013
Static duck-typing in F#
View gist:6533869
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() =
View gist:5199725
[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 Nov 14, 2012
Silverlight, GZip and ServiceStack
View GzipJsonServiceClient.cs
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 Oct 12, 2015
Hoffman encoding in Clojure
View huffman.clj
(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})