Skip to content

Instantly share code, notes, and snippets.

View 7sharp9's full-sized avatar

Dave Thomas 7sharp9

  • Moirae Software Engineering Ltd
  • UK
  • X @7sharp9_
View GitHub Profile
@praeclarum
praeclarum / Parsing.fs
Last active November 26, 2020 22:29
Parser combinator in F# tuned to perform "well enough" on iOS (Xamarin)
module Parsing
/// Remember where we are in the code.
/// This is a struct to keep memory pressure down.
/// (Significant perf improvements on iOS.)
type ParseState =
struct
val Code : string
val Index : int
new (code : string, index : int) =
@praeclarum
praeclarum / AlgorithmW.fs
Last active March 19, 2024 17:44
Algorithm W - or Hindley-Milner polymorphic type inference - in F#
module AlgorithmW
// HINDLEY-MILNER TYPE INFERENCE
// Based on http://catamorph.de/documents/AlgorithmW.pdf
// (Now at http://web.archive.org/web/20170704013532/http://catamorph.de/documents/AlgorithmW.pdf)
type Lit =
| LInt of int
| LBool of bool
@Clancey
Clancey / BrightlyBlurredUIView
Last active December 24, 2015 14:59
A brightly colored iOS 7 UIBlurView
using System;
using MonoTouch.UIKit;
using MonoTouch.CoreAnimation;
public class BrightlyBlurredUIView: UIView
{
CALayer blurLayer,accentLayer;
UIView accentView;
UIToolbar toolbar;
public BrightlyBlurredUIView()
@lobrien
lobrien / gist:5250556
Created March 27, 2013 00:24
Video Capture in MonoTouch
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using System.Drawing;
using MonoTouch.CoreGraphics;
using MonoTouch.CoreAnimation;
using MonoTouch.AVFoundation;
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain',
'Connection': 'keep-alive'});
res.end('Hello World\n');
}).listen(8080, "192.168.56.1");
console.log('Server running');
@mnmly
mnmly / coffee-stained-paper.js
Created August 23, 2011 05:57 — forked from j4mie/example.html
A tiny shim for Paper.js/CoffeeScript prototyping
window.stainedPaper = function (func) {
var canvas = document.createElement('canvas');
document.body.appendChild(canvas);
paper.setup(canvas);
func.call(paper);
};