Skip to content

Instantly share code, notes, and snippets.

View TheAngryByrd's full-sized avatar
🐦
😠 🐦

Jimmy Byrd TheAngryByrd

🐦
😠 🐦
View GitHub Profile
@JohSand
JohSand / Gen.fsx
Last active April 14, 2025 19:39
Avoid permutation explosion
namespace Gist
type Ctx<'a, 'b>(a: 'a, b: 'b) =
member _.A = a
member _.B = b
type Ctx<'a>(a: 'a) =
member _.Create<'t>(t: 't) = Ctx<'a, 't>(a, t)
[<Struct>]
@houstonhaynes
houstonhaynes / GHIssueExtractor.fsx
Last active February 14, 2025 13:52
An F# script to extract open GitHub issues from a repo as Markdown
#r "nuget: Octokit"
open Octokit
open System
open System.IO
open System.Text.RegularExpressions
// Configuration
type Config = {
Token: string
RepoUrl: string
@Savelenko
Savelenko / ErrorMerging.fs
Created January 9, 2025 17:35
F# Result error merging with IWSAMs
module ErrorMerging
open FsToolkit.ErrorHandling
(* Regular approach with two distinct error types *)
type SensorReadings = int
type EngineError =
| Overheated
@isaacabraham
isaacabraham / gist:3314300b3758cfca23df30e8dc3ca814
Last active December 23, 2024 16:51
Experimenting with Paul Blasucci's ideas around Faults and Reports for F#, using the existing F# Result type.
#if INTERACTIVE
#r "nuget: FsToolkit.ErrorHandling"
#endif
open System.Text.Json
open FsToolkit.ErrorHandling
/// All Error DUs should implement this to "take part" in generalised fault reporting.
[<Interface>]
type IFault =
@jonsagara
jonsagara / BundleConfigJsonChecker.fsx
Created December 5, 2024 01:12
bundleconfig.json checker
//
// For users of Bundler & Minifier 2022+
// https://marketplace.visualstudio.com/items?itemName=Failwyn.BundlerMinifier64
//
// Check to see if output and input files in bundleconfig.json exist.
//
open System
open System.IO
open System.Text
@1eyewonder
1eyewonder / safestring.fsx
Last active April 9, 2025 19:14
F# String Active Patterns
open System
open System.Text.RegularExpressions
let (|Lower|) (s: string) = s.ToLower()
let (|LowerInvariant|) (s: string) = s.ToLowerInvariant()
let (|Upper|) (s: string) = s.ToUpper()
let (|UpperInvariant|) (s: string) = s.ToUpperInvariant()
let (|Trim|) (s: string) = s.Trim()
let (|TrimChars|) (chars: char array) (s: string) = s.Trim(chars)
@pblasucci
pblasucci / BareMinimum.fs
Last active January 14, 2025 22:35
F# FaultReport
namespace pblasucci.FaultReport
/// Minimal contract provided by any failure.
[<Interface>]
type IFault =
/// An unstructured human-readable summary of the current failure.
abstract Message : string
/// An optional reference to the failure which triggered the current failure
/// (n.b. most failure do NOT have a cause).
#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