Skip to content

Instantly share code, notes, and snippets.

@thinkbeforecoding
thinkbeforecoding / EventSourcing.fsx
Created February 28, 2020 17:32
DDDEU Functional Event Sourcing
//------------------------------------------
let title = "Functional Event Sourcing"
let speaker = "Jérémie Chassaing"
let company = "d-edge / Availpro Hospitality Tech"
let twitter = @"thinkb4coding"
let blog = "https://thinkbeforecoding.com"
//------------------------------------------
System.Environment.CurrentDirectory <- __SOURCE_DIRECTORY__
#load ".paket/load/netstandard2.0/main.group.fsx"
@thinkbeforecoding
thinkbeforecoding / ApplicativeProfunctor.fsx
Created December 23, 2020 15:35
This is an example of Applicative on a Profunctor.
open System
// this is our basis to define values over time.
// It will be the basis for our data.
// we define a Period with a start and en Time
// start is included, end is excluded (closed on the left, open on the right)
// this way, of consecutive periods px and py we known that px.End = py.Start
type Period = { Start: DateTime; End: DateTime }
open System
type LicencePlate = LicencePlate of string
module LicencePlate =
open System.Text.RegularExpressions
let plateEx = Regex @"^[0-9]{3}-[0-9]{3}$"
let parse input =
@thinkbeforecoding
thinkbeforecoding / Bench.txt
Created February 17, 2022 17:53
StackStack
| Method | Mean | Error | StdDev | Ratio | RatioSD |
|-------------- |---------:|--------:|--------:|------:|--------:|
| UseSpan | 241.7 ns | 2.98 ns | 2.64 ns | 1.00 | 0.00 |
| UseCollection | 403.4 ns | 5.58 ns | 5.22 ns | 1.67 | 0.03 |
@thinkbeforecoding
thinkbeforecoding / deciders-dddeu-2022.fsx
Created June 29, 2022 08:21
Deciders implementation
/// +--------------------------------------+
/// | |
/// | Decider |
/// | |
/// | Jérémie Chassaing |
/// | @thinkb4coding |
/// +--------------------------------------+
// A decider is a structure define by 7 parameters:
@thinkbeforecoding
thinkbeforecoding / gitlab.fsx
Created October 19, 2022 21:52
Yzl for gitlab-ci
#r "nuget: Yzl"
open Yzl.Core
let stages = Yzl.seq "stages" << Yzl.liftMany
let stage = Yzl.str "stage"
let job (name: string) = Yzl.map name
let tags = Yzl.seq "tags" << Yzl.liftMany
let image = Yzl.str "image"
let script = Yzl.seq "script" << Yzl.liftMany
let variables vs = "variables" .= [for k,v in vs -> k .= v]
open System
type Machine =
{ program: string
data: byte[]
ip: int
dp: int
output: string
}