Skip to content

Instantly share code, notes, and snippets.

View DejanMilicic's full-sized avatar
🎯
Focusing

Dejan Milicic DejanMilicic

🎯
Focusing
View GitHub Profile
@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 February 29, 2024 19:52
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
open System
type Settings = {
Capacities : array<float>
MaxRates : array<float>
ValveState : array<int>
Hash: int
} with
static member TrivialButPossiblyOkHash _ _ valueStates =
// This or some other way of combining the values eg. xor etc without copying my be good
// enought. You can test it on your data. With random values for the value states this is
@TheAngryByrd
TheAngryByrd / dotnet-oss-documentation-tools.md
Created October 31, 2021 19:55
.NET OSS documentation tools

.NET OSS Documentation tools

Criteria

  • What dependencies does it require? (npm, netfx, dotnet-core)
  • Does it seem to be maintained?
  • Does it have a good update story?
  • How easy is it to get started? (good tutorial, templating)
  • Can I change the structure easily to fit the divio structure?
  • Does it support search? Is the search useful?