Skip to content

Instantly share code, notes, and snippets.

View dburriss's full-sized avatar

Devon Burriss dburriss

View GitHub Profile
dburriss / proc.fsx
Last active November 2, 2022 12:19
Finding and running a process in F# in a reliable way.
// ========================================================
// String: String module
// Helpers for working with strings
// ========================================================
module String =
let isNotEmpty s = not (String.IsNullOrEmpty s)
let join (ss: string seq) = String.Join("", ss)
let lower (s: string) = s.ToLowerInvariant()
let trim (s: string) = s.Trim()
dburriss / String.fsx
Created November 2, 2022 12:04
Collection of F# string functions
let isNotEmpty s = not (String.IsNullOrEmpty s)
let join (ss: string seq) = String.Join("", ss)
let lower (s: string) = s.ToLowerInvariant()
let trim (s: string) = s.Trim()
let replace (oldValue: string) newValue (s: string) = s.Replace(oldValue,newValue)
let split (by: string) (s: string) = s.Split(by)
let endsWith (tail: string) (s: string) = s.EndsWith(tail)
let startsWith (head: string) (s: string) = s.StartsWith(head)
let contains (search: string) (s: string) = s.Contains(search)
dburriss /
Last active March 1, 2022 17:00
Files with examples of grammar generated in rust-code-analysis project using tree-sitter along with logical lines of code counts
// Program
public class Person {
// ClassDeclaration
// Modifiers
// Public
// Class
// Identifier
// ClassBody
private String name;
dburriss /
Created November 1, 2021 20:55
Can be used to check markdown files in a repository for valid links and will check the description if it looks like it represents a filepath.
# This script checks the markdown links in all markdown files.
# param 1: [optioal] [flag] -v or -vv to enable debugging or tracing
# param 2: [optional] path to a specific file to check. If not present, will search for *.md
# It will match all [desc](https?...) patterns in markdown files.
# 'desc' can be a directory or file and it will check it exists.
# exist code 1 if and files or links not found.
# Examples:
dburriss / Git.fsx
Last active October 17, 2020 08:32
Some files for a proof of concept that makes recommendations based on code and the git history. The original uses code complexity but has a dependency on a SonarQube report. This is completely standalone but uses LoC as a proxy. Not the best but it is a PoC. It also takes things like bus factor into account in the recommendations. See comments f…
#load "StringX.fsx"
#load "Result.fsx"
open System
open System.Diagnostics
type Commit = | Commit of string
type Author = | Author of string
type Lines = string list
// 1.0 Basic queue - hand-rolled
let q = System.Collections.Generic.Queue<string>()
q.Enqueue "Hello"
dburriss / maintainable-unit-tests-1.cs
Created July 17, 2020 11:23
Blog | Maintainable unit tests | Snippet 1
// tests
// test for invalid name omitted...
public void CreatingPerson_WithValidPerson_CallsIsValid()
var name = "Bob";
var people = Substitute.For<IPersonRepository>();
var validator = Substitute.For<IPersonValidator>();
var createPerson = new CreatePerson(people, validator);
dburriss / aResult.fsx
Last active May 7, 2020 12:56
A lossy Result fold
// A lossy Result seq fold
let singleResult<'T,'U> (rs : Result<'T,'U> seq) : Result<'T seq,'U> =
let folder (ts, us) r =
match r with
| Ok t -> (Seq.append ts [|t|], us)
| Error u -> (ts, Seq.append us [|u|])
|> Seq.fold folder (Seq.empty, Seq.empty)
dburriss / Hyde.fsx
Created January 13, 2019 09:58
[WIP] Script to generate a static site/blog
#r "packages/Antlr4.Runtime/lib/net45/Antlr4.Runtime.dll"
#r "packages/Liquid.NET/lib/net452/Liquid.NET.dll"
#r "packages/YamlDotNet/lib/net45/YamlDotNet.dll"
namespace Hyde
type FrontMatter = Map<string,obj>
type ContentItem = {
dburriss / Install-Paket.ps1
Last active April 4, 2022 19:31
A Powershell script to install Paket dependency manager in current folder (sub-folder .paket)
New-Item -ItemType directory -Path ".paket"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$tag = (Invoke-WebRequest -Uri | ConvertFrom-Json)[0].tag_name
$uri = "" + $tag + "/paket.bootstrapper.exe"
Invoke-WebRequest $uri -OutFile .paket/paket.exe