Skip to content

Instantly share code, notes, and snippets.

@panesofglass
panesofglass / SynchronousMessagePassing.fs
Created April 27, 2012 17:22 — forked from t0yv0/SynchronousMessagePassing.fs
Demonstrates specializing F# Async for better CML-style channel performance.
(*
Copyright (c) 2008-2011 IntelliFactory
GNU Affero General Public License Usage The code
is free software: you can redistribute it and/or
modify it under the terms of the GNU Affero
General Public License, version 3, as published by
the Free Software Foundation.
(*
Copyright (c) 2008-2011 IntelliFactory
GNU Affero General Public License Usage The code
is free software: you can redistribute it and/or
modify it under the terms of the GNU Affero
General Public License, version 3, as published by
the Free Software Foundation.
type Json =
| Array of list<Json>
| Double of double
| False
| Integer of int64
| Null
| Object of list<string*Json>
| String of string
| True
@panesofglass
panesofglass / ServiceStack_FilesService.cs
Created April 3, 2012 20:25 — forked from mythz/ServiceStack_FilesService.cs
ServiceStack RestFiles vs WCF Web APIs port
/*
Contains the file manager implementation of ServiceStack's REST /files Web Service:
Demo: http://www.servicestack.net/RestFiles/
GitHub: https://github.com/ServiceStack/ServiceStack.Examples/
*/
using System;
using System.IO;
using System.Net;
using RestFiles.ServiceInterface.Support;
@panesofglass
panesofglass / Setup.fsx
Created March 17, 2012 20:27 — forked from ovatsus/Setup.fsx
Script to setup F# Interactive session, loading everything in the current solution
#r "System.Xml.Linq"
open System
open System.IO
open System.Xml.Linq
let mutable script = seq {
//TODO: this currently loads fsproj's in alphabeticall order, we should instead
@panesofglass
panesofglass / SimpleObjectContent.cs
Created January 21, 2012 03:23 — forked from darrelmiller/SimpleObjectContent.cs
Simple Object Content
public class SimpleObjectContent<T> : HttpContent
{
private readonly T _outboundInstance;
private readonly HttpContent _inboundContent;
private readonly MediaTypeFormatter _formatter;
// Outbound constructor
public SimpleObjectContent(T outboundInstance, MediaTypeFormatter formatter)
{
_outboundInstance = outboundInstance;
Originally:
https://gist.github.com/7565976a89d5da1511ce
Hi Donald (and Martin),
Thanks for pinging me; it's nice to know Typesafe is keeping tabs on this, and I
appreciate the tone. This is a Yegge-long response, but given that you and
Martin are the two people best-situated to do anything about this, I'd rather
err on the side of giving you too much to think about. I realize I'm being very
critical of something in which you've invested a great deal (both financially
@panesofglass
panesofglass / server.fs
Created November 15, 2011 23:14 — forked from t0yv0/server.fs
let rec loop : Async<unit> =
async {
let! req = HttpRequestParser.Parse buf read
let! resp = app.Handle req
let kA = isKeepAlive req
do! respond socket buf (setKeepAlive kA resp)
if isKeepAlive req then
return! loop
else
return ()
@panesofglass
panesofglass / wcfowin.cs
Created August 5, 2011 00:51 — forked from jasonsirota/wcfowin.cs
WCF OWIN
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Threading;
/// Converts structural encodings to proper FSCGI.* types.
module FSCGI.Structural.Converter
type private Encodings<'R,'W> =
('W -> Writer<'W>) *
('R -> Response<'R,'W>)
let private ConvertRequest (r : FSCGI.Request) : Request =
(
r.Headers,