Skip to content

Instantly share code, notes, and snippets.

#if run_with_bin_sh
# See why this works at http://stackoverflow.com/a/21948918/637783
exec fsharpi --define:mono_posix --exec $0 $*
#endif
(*
* Crossplatform FSharp Makefile Bootstrapper
* Apache licensed - Copyright 2014 Jay Tuley <jay+code@tuley.name>
* v 2.0 https://gist.github.com/jbtule/9243729
*
open System.Net
open Microsoft.FSharp.Control.WebExtensions
open System.Diagnostics
open System
let fetch name (url:string) =
printfn "fetching %s" name
let uri = new System.Uri(url)
use webClient = new WebClient()
let stopwatch = Stopwatch()
@panesofglass
panesofglass / Global.asax.fs
Created July 10, 2014 18:40
Taliesin Sample
namespace FSharpWeb4
open Owin
open Microsoft.Owin
open System
open System.Net
open System.Net.Http
open System.Web
open Dyfrig
open Taliesin
namespace Tsunami.Server
open System
open System.IO
open System.Linq
open System.Net
open System.Net.Sockets
open System.Text
open System.Threading
open System.Runtime.Serialization
namespace WebSocket
// Appache 2.0 license
// References:
// [1] Proposed WebSockets Spec December 2011 http://tools.ietf.org/html/rfc6455
// [2] John McCutchan (Google Dart Team Member) http://www.altdevblogaday.com/2012/01/23/writing-your-own-websocket-server/
// [3] A pretty good Python implemenation by mrrrgn https://github.com/mrrrgn/websocket-data-frame-encoder-decoder/blob/master/frame.py
// [4] WebSockets Organising body http://www.websocket.org/echo.html
// [5] AndrewNewcomb's Gist (starting point) https://gist.github.com/AndrewNewcomb/711664
@panesofglass
panesofglass / Runtime exception
Last active August 29, 2015 14:06
Repro of failing Katana app in Xamarin Studio
System.MissingMethodException
Method not found: 'System.Web.HttpApplication.RegisterModule'.
Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): mscorlib.
Exception stack trace:
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /Volumes/build-root-ramdisk/mono-3.8.0/mcs/class/corlib/System.Reflection/MonoMethod.cs:230
@panesofglass
panesofglass / protocols-experiment-2.fsx
Last active August 29, 2015 14:12
Experimenting with a potential solution for implementing protocols in F#
#nowarn "0686"
[<AbstractClass>]
type ListLike<'T>() =
abstract Head : 'T with get
abstract Tail : ListLike<'T> with get
abstract Length : int
static member op_Implicit(list: 'T list) =
{ new ListLike<'T>() with
@panesofglass
panesofglass / app.js
Last active August 29, 2015 14:13
d3.js - rendering a navigation tree
(function (global, Data, Nav, f) {
f(global, Data, Nav);
})(window, window.Data, window.Nav,
function app(global, data, Nav) {
"use strict";
var nav = Nav("nav.nav");
nav(data);
global.setTimeout(function () {

MVC with RxJS and D3

Prototype MVC (or MVI) client-side with RxJS and D3 to show use with various component libraries.

At present, RxJS Subjects are used like channels and not as part of an inheritance hierarchy.

A Pen by Ryan Riley on CodePen.

License.

@panesofglass
panesofglass / MVC-with-RxJS-and-D3-(inheritance).markdown
Created January 19, 2015 21:55
MVC with RxJS and D3 (inheritance)

MVC with RxJS and D3 (inheritance)

Prototype MVC (or MVI) client-side with RxJS and D3 to show use with various component libraries.

At present, RxJS Subjects are used as part of an inheritance hierarchy.

A Pen by Ryan Riley on CodePen.

License.