Skip to content

Instantly share code, notes, and snippets.

@Lanayx
Lanayx / vide_global.fs
Created December 8, 2023 02:32
Vide global state example
module Components.Demo
open Fable.Core
open Fable.Core.JsInterop
open Vide
open type Html
importSideEffects("./Demo.scss")
@Lanayx
Lanayx / routing.fs
Created November 30, 2023 04:14
Strongly typed routing
open Printf
open System
open System.Threading
open System.Text.RegularExpressions
type Response =
{
Code: int
Body: string
}
@Lanayx
Lanayx / bench.fs
Last active April 7, 2020 17:56
Records vs Interfaces speed
namespace Benchmarks
open BenchmarkDotNet.Attributes
open System.IO
open System.Runtime.CompilerServices
[<Interface>]
type ILogger =
abstract Info: string -> unit
open BenchmarkDotNet.Attributes
open System.IO
open System.Runtime.CompilerServices
[<Interface>]
type ILog =
abstract Info: string -> unit
module Log =
type MailboxMessage =
| AddMessage of Message
| GetMessage of AsyncReplyChannel<Message>
type Consumer() =
let queue = new ConcurrentQueue<Message>()
let connectionHandler = ConnectionHandler()
let mb = MailboxProcessor.Start(fun inbox ->
@Lanayx
Lanayx / Program.fs
Last active July 1, 2018 12:05
Array flattener
type MyElement =
| MyNumber of int
| MyArray of MyElement list
let rec flatten = function
| [] -> []
| (MyNumber head) :: tail -> head :: flatten tail
| (MyArray head) :: tail -> List.append (flatten head) (flatten tail)
[<EntryPoint>]
RAMS:
----------------------
RAMS-QA 10.221.12.93
RAMS-T 10.219.15.110
RAMS-P 10.219.13.31
Snappy:
----------------------
QA 10.221.15.19