Skip to content

Instantly share code, notes, and snippets.

@panesofglass
panesofglass / Actor.fs
Created September 21, 2020 16:47 — forked from bent-rasmussen/Actor.fs
Experimental high performance actor implementation for F# using channel and task computation expression.
// NOTE: import this Nuget package: TaskBuilder.fs (written using 2.1.0)
//
// Tested in LINQPad (hence Dump method usage).
open System
open System.Collections
open System.Collections.Generic
open System.Diagnostics
open System.Linq
open System.Threading
@panesofglass
panesofglass / machine.js
Last active June 17, 2020 23:07
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@panesofglass
panesofglass / azure-static-web-apps.yml
Last active June 4, 2020 05:22
Simple Static Page Generator
name: Azure Static Web Apps CI/CD
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- master
@panesofglass
panesofglass / winforms-mvu.fsx
Last active November 22, 2023 15:30
Sample WinForms F# Script
#r "mscorlib.dll"
#r "System.dll"
open System
open System.Windows.Forms
type Update<'Msg, 'Model> = 'Msg -> 'Model -> 'Model
type Dispatch<'Msg> = 'Msg -> obj -> EventArgs -> unit
type View<'Model, 'Msg> = 'Model -> Dispatch<'Msg> -> Control
name: Azure Static Web Apps CI/CD
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- master
@panesofglass
panesofglass / python.fsx
Created April 26, 2020 13:55 — forked from nasser/python.fsx
Python from F#
// make sure codegen.py (https://github.com/CensoredUsername/codegen/blob/master/codegen.py) is in the same folder
// and you've added the IronPython package
open System.IO
open IronPython.Hosting
open IronPython.Runtime
open Microsoft.FSharp.Reflection
let engine = Python.CreateEngine()
@panesofglass
panesofglass / mixed-applicative-mondaic-result-ce.fsx
Created March 19, 2020 21:19 — forked from cartermp/mixed-applicative-mondaic-result-ce.fsx
Shows mixing of monadic and applicative CEs with a result builder
type ResultBuilder() =
member _.MergeSources(t1: Result<'T,'U>, t2: Result<'T1,'U>) = Result.zip t1 t2
member _.BindReturn(x: Result<'T,'U>, f) = Result.map f x
member _.Return (value: 'T) : Result<'T, 'TError> = Ok value
member _.ReturnFrom (result: Result<'T, 'TError>) : Result<'T, 'TError> = result
member this.Zero () : Result<unit, 'TError> = this.Return ()
@panesofglass
panesofglass / Thermometer.ts
Created February 5, 2020 16:18 — forked from spatney/Thermometer.ts
Custom Visual for Power BI: Thermometer
module powerbi.visuals {
export interface ViewModel {
value: number;
color?: string;
min?: number;
max?: number;
}
export class Thermometer implements IVisual {
public static capabilities: VisualCapabilities = {
@panesofglass
panesofglass / Fiber.fs
Created December 8, 2019 02:53 — forked from Horusiath/Fiber.fs
Custom fibers implementation in F#
open System
open System.Threading
type FiberResult<'a> = Result<'a, exn> option
[<Sealed;AllowNullLiteral>]
type Cancel(parent: Cancel) =
let mutable flag: int = 0
let mutable children: Cancel list = []
new() = Cancel(null)
@panesofglass
panesofglass / README.md
Created June 18, 2018 21:46 — forked from shawnbot/README.md
d3 voronoi interpolation!