Skip to content

Instantly share code, notes, and snippets.

View TheAngryByrd's full-sized avatar
🐦
😠 🐦

Jimmy Byrd TheAngryByrd

🐦
😠 🐦
View GitHub Profile
#r "nuget: FSharp.Compiler.Service"
open FSharp.Compiler.Syntax
open FSharp.Compiler.SyntaxTrivia
open FSharp.Compiler.Xml
type Node =
{ Data : Data
Children : Node list }
@baronfel
baronfel / spec.md
Last active March 27, 2024 18:53
.NET SDK Compound Templates

Core Idea

Allow templates to easily orchestrate the invocation of other templates by name/id, making multi-project and multi-item templates easier to keep up to date, and factoring out subsets of currently-giant templates into maintainable chunks.

Motivating Examples

  • A JS API with a corresponding .NET Backend
  • A Library project, a console project, and a test project
@BennieCopeland
BennieCopeland / Generators.fs
Last active September 7, 2023 07:54
FsCheck Generators pattern
#r "nuget:FsCheck.Xunit"
// Domain types from production code
module Types =
open System
type EmailAddress = private EmailAddress of string
module EmailAddress =
let fromString str =
if not <| String.IsNullOrWhiteSpace str
@ProgrammingFire
ProgrammingFire / config.lua
Created August 14, 2023 16:56
My LunarVim config
-- Read the docs: https://www.lunarvim.org/docs/configuration
-- Video Tutorials: https://www.youtube.com/watch?v=sFA9kX-Ud_c&list=PLhoH5vyxr6QqGu0i7tt_XoVK9v-KvZ3m6
-- Forum: https://www.reddit.com/r/lunarvim/
-- Discord: https://discord.com/invite/Xb9B4Ny
local dap = require("dap")
lvim.plugins = {
{
"catppuccin/nvim",
name = "catppuccin"
@karenpayneoregon
karenpayneoregon / someprojectfile.csproj
Last active February 7, 2024 19:33
reduced source path
<PropertyGroup>
<PathMap>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))=./</PathMap>
</PropertyGroup>
@pblasucci
pblasucci / Environment.fs
Last active June 12, 2023 19:21
One possible way to handle dependency management with F# and AvaloniaUI
(*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
@ImaginaryDevelopment
ImaginaryDevelopment / script.fs
Created December 12, 2022 15:42
clone a project structure for repro
// clone project structure/some files
let src = @"C:\projects\YourProject\"
// assuming existing folder
let target = @"C:\projects\ReproFolder"
let wipeTarget = true
if wipeTarget then
// assumes deleting the dir and recreating it won't blow away permissions
if Directory.Exists target then
Directory.Delete(target,true)
Directory.CreateDirectory target |> ignore
using OpenTelemetry;
using OpenTelemetry.Logs;
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
var appResourceBuilder = ResourceBuilder.CreateDefault()
.AddService(serviceName: Telemetry.ServiceName, serviceVersion: Telemetry.ServiceVersion);
@edgarfgp
edgarfgp / ap-pattern.fs
Created July 28, 2022 09:43
Active Patterns. with Pattern matching
let (|IsOneOf|_|) x y = if x = y then Some() else None
type SomeRecord =
{ ExternalEnum: int
SomeStringData: string }
let toProcess =
[ { ExternalEnum = 1
SomeStringData = "I contain xml" }
{ ExternalEnum = 2
open System
let transfers = [| Some 2,1 |]
let FetchInternalTransfers (includeConfirmeds: int) =
task {
let! mapPrioritiesTransfers =
task {
if includeConfirmeds > 1 then