Skip to content

Instantly share code, notes, and snippets.

@MrLuje
MrLuje / gist:90264db02f99672de05686a6cb08c4f3
Created April 17, 2024 10:12
for loop in custom operation CE
open System
open System.Diagnostics
type PageConfig =
{ Text: string }
static member Default = { Text = "" }
type PageConfigOutput = PageConfigOutput of string
@MrLuje
MrLuje / gist:62590aaf68757a2b45ac8261ca3e32b9
Last active April 15, 2024 10:34
F# CE quotation printer
// based on awesome https://www.fssnip.net/7OG/title/Quotation-Printer
module QuotationPrinter =
open System
open Microsoft.FSharp.Quotations
let private indent = 1
let rec print depth (expr:Expr) =
match expr with
@MrLuje
MrLuje / 19_07_40_save_2nd_time.json
Last active January 4, 2024 18:29
FSAC linting opentelemetry
This file has been truncated, but you can view the full file.
{"data":[{"traceID":"4a083e01f38c07f44b13012340e7f83a","spans":[{"traceID":"4a083e01f38c07f44b13012340e7f83a","spanID":"207e37a0c8824798","duration":22446,"references":[{"refType":"CHILD_OF","spanID":"d7157f07558b442f","traceID":"4a083e01f38c07f44b13012340e7f83a"}],"flags":0,"logs":[],"operationName":"FsAutoComplete.Lsp.AdaptiveState.parseAndCheckFile","processID":"p1","startTime":1704391550355951,"tags":[{"key":"otel.library.name","type":"string","value":"FsAutoComplete"},{"key":"otel.library.version","type":"string","value":"0.68.0"},{"key":"code.filepath","type":"string","value":"/home/vince/src/github/mrluje/FsAutoComplete/src/FsAutoComplete/LspServers/AdaptiveServerState.fs"},{"key":"code.lineno","type":"int64","value":1262},{"key":"code.namespace","type":"string","value":"FsAutoComplete.Lsp.AdaptiveState"},{"key":"code.function","type":"string","value":"parseAndCheckFile"},{"key":"fsac.sourceCodePath","type":"string","value":"/home/vince/src/github/mrluje/FsAutoComplete/src/FsAutoComplete.Core/Commands.
@MrLuje
MrLuje / test.fsx
Created August 28, 2022 18:08
Why is extension method usage at L9 isn't working ?
#r "nuget: Spectre.Console"
open Spectre.Console
let f = SelectionPrompt<string>()
SelectionPromptExtensions.Title(f, "hello") // works fine by using the non-extension syntax
// extension defined at https://github.com/spectreconsole/spectre.console/blob/0d19ccd8a6236d464f1cb397df7f55554d30e0d7/src/Spectre.Console/Prompts/SelectionPromptExtensions.cs#L130
f.Title("hello") // fails with error FS0003: This value is not a function and cannot be applied.
@MrLuje
MrLuje / azacc
Created May 7, 2019 14:27
Easily switch between az accounts (heavily inspired from https://github.com/ahmetb/kubectx)
#!/usr/bin/env bash
[[ -n $DEBUG ]] && set -x
set -eou pipefail
IFS=$'\n\t'
SELF_CMD="$0"
AZACC_DIR="${XDG_CACHE_HOME:-$HOME/.azure}/azacc"
AZ="$(which az)"
@MrLuje
MrLuje / setup-win-defender-exclusions.ps1
Last active March 6, 2024 15:06
Script to exclude folders & processes from Windows Defender to be more developper-friendly
# Setup Windows Defender common exclusion
Write-Host "Excluding paths..."
Add-MpPreference -ExclusionPath "$env:appdata\npm"
Add-MpPreference -ExclusionPath "$env:appdata\nvm"
# These folders contains most of my repo, you may want to change it to your owns
Add-MpPreference -ExclusionPath "C:\Temp"
Add-MpPreference -ExclusionPath "C:\Vincent"
@MrLuje
MrLuje / test.fsx
Created August 28, 2018 08:25
ionide-vscode-fsharp intellisense complete issue
let createTimerAndObservable timerInterval =
// setup a timer
let timer = new System.Timers.Timer(float timerInterval)
timer.AutoReset <- true
// events are automatically IObservable
let observable = timer.Elapsed
// return an async task
let task = async {
npx prettier --config .\.prettierrc --write src/**/*.js*