Skip to content

Instantly share code, notes, and snippets.

View DejanMilicic's full-sized avatar
🎯
Focusing

Dejan Milicic DejanMilicic

🎯
Focusing
View GitHub Profile
@pchiusano
pchiusano / instructions.md
Last active June 24, 2025 14:34
LLM context for passable Unison coding assistence. Paste this into the context of your preferred LLM to get an assistant that is more familiar with Unison syntax, its standard library, and its concurrency support.

Rules

Follow the Unison Programming Language Guide

Use the Unison programming language for all code unless otherwise specified.

Use the following procedure to assist me with writing code.

Step 1, before writing any code: confirm types and signatures

@OnurGumus
OnurGumus / fix-references.fsx
Created October 5, 2024 21:02
Fixes generated fsi references
open System.IO
let lines = File.ReadAllLines "references.fsx"
let fixedLines = lines |> Array.map (fun line ->
if line.StartsWith("#r") then
if line.Contains("/usr/share/dotnet/packs/") then
line.Replace("/packs/", "/shared/")
.Replace(".Ref/","/")
.Replace("/ref/net8.0/", "/")
@jkone27
jkone27 / cover.fsx
Last active December 15, 2023 18:50
coverlet coverage fsc script using fli, creates a report and shows it in browser
#r "nuget: Fli"
open Fli
open System
open System
let isHelpRequested = fsi.CommandLineArgs |> Seq.contains "--h"
[<Literal>]
@jkone27
jkone27 / orderExample.fsx
Created September 30, 2023 13:39
fsharp test order oms example
#r "nuget: NodaMoney"
open NodaMoney
open System
open System.Threading.Tasks
module Products =
type Product =
| Shoes
| Skirt
@lukaszkrzywizna
lukaszkrzywizna / srtp_net6.fs
Last active April 20, 2023 20:44
SRTP F# .Net 6
type MyType =
| MyCase
static member statFun x = match x with MyCase -> "I'm static member function!"
static member statFunUnit () = "I'm static member function with unit param!"
static member statFunGeneric (x, y) =
match x with MyCase -> $"I'm static member function with generic param with value = %O{y}!"
static member statProp = "I'm static member property!"
member this.objProp = match this with MyCase -> "I'm object member property!"
member this.objFunGen x = match this with MyCase -> $"I'm object member function with param with value = %O{x}!"
member this.objFunUnit () = match this with MyCase -> "I'm object member function with unit param!"
@Savelenko
Savelenko / Program.fs
Last active November 14, 2022 12:56
A modeling exercise in two acts with banning or verifying users in F# and the Onion architecture
(*
An exercise in modeling. Users can be verified or banned. A user can be banned only if their username is "offensive".
We assume the Onion architecture. Modules `User` and `Verification` belong to the model. Module `UserVerification`
belongs to the application layer. Data access layer is omitted completely; it should be fairly trivial.
Note that the verified/banned aspect of a user is modeled "externally" to the notion of user itself. In particular,
there are no "aggregates" below which combine all aspects of a user.
*)
@OnurGumus
OnurGumus / Dat.fs
Last active November 21, 2023 20:21
three.js fable
module rec Dat
open Browser.Types
open Fable.Core
open System
[<ImportAll("dat.gui")>]
let exports: IExports = jsNative
[<AllowNullLiteral>]
@michaeloyer
michaeloyer / srtp.fsx
Last active July 1, 2024 03:15
F# SRTP Example
// SRTP: Statically Resolved Type Parameters
// https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/generics/statically-resolved-type-parameters
// SRTP Allows for pulling members out of types that where the member is named and typed the same
// In this example SRTP will be used to pull out the 'First: string' and 'Last: string' members
// from different types
// One example of SRTP in the F# Base Class Library is the (+) operator.
// You'll see that it has this type signature:
@luisquintanilla
luisquintanilla / script.fsx
Created December 21, 2021 19:06
Style Transfer: Image to Mosaic F#, ML.NET, ONNX Sample
#r "nuget:Microsoft.ML"
#r "nuget:Microsoft.ML.OnnxRuntime"
#r "nuget:Microsoft.ML.OnnxTransformer"
#r "nuget:Microsoft.ML.ImageAnalytics"
#r "nuget:System.Drawing.Common"
open System.IO
open System.Drawing
open Microsoft.ML
open Microsoft.ML.Data