Skip to content

Instantly share code, notes, and snippets.

@panesofglass
panesofglass / Actor.fs
Created Sep 21, 2020 — forked from bent-rasmussen/Actor.fs
Experimental high performance actor implementation for F# using channel and task computation expression.
View Actor.fs
// 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
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@panesofglass
panesofglass / azure-static-web-apps.yml
Last active Jun 4, 2020
Simple Static Page Generator
View azure-static-web-apps.yml
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 May 24, 2020
Sample WinForms F# Script
View winforms-mvu.fsx
#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
View azure-static-web-apps-yellow-dune-06aa0141e-1.yml
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 Apr 26, 2020 — forked from nasser/python.fsx
Python from F#
View python.fsx
// 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 Mar 19, 2020 — forked from cartermp/mixed-applicative-mondaic-result-ce.fsx
Shows mixing of monadic and applicative CEs with a result builder
View mixed-applicative-mondaic-result-ce.fsx
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 Feb 5, 2020 — forked from spatney/Thermometer.ts
Custom Visual for Power BI: Thermometer
View Thermometer.ts
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 Dec 8, 2019 — forked from Horusiath/Fiber.fs
Custom fibers implementation in F#
View Fiber.fs
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 Jun 18, 2018 — forked from shawnbot/README.md
d3 voronoi interpolation!
View README.md