This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
open System.Xml.Linq | |
let targetVersion = fsi.CommandLineArgs |> Array.tryItem 1 |> Option.defaultValue "net6.0" | |
let xsproj = fsi.CommandLineArgs |> Array.tryItem 2 | |
let isProjFile (filename: string) = | |
match (IO.Path.GetExtension(filename)).ToLower() with | |
| ".csproj" | ".fsproj" | ".vbproj" -> true | |
| _ -> false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ======================================================== | |
// 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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Program | |
public class Person { | |
// ClassDeclaration | |
// Modifiers | |
// Public | |
// Class | |
// Identifier | |
// ClassBody | |
// LBRACE | |
private String name; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* QUEUES | |
https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.queue-1 | |
*) | |
// 1.0 Basic queue - hand-rolled | |
let q = System.Collections.Generic.Queue<string>() | |
q.Enqueue "Hello" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// tests | |
// test for invalid name omitted... | |
[Fact] | |
public void CreatingPerson_WithValidPerson_CallsIsValid() | |
{ | |
var name = "Bob"; | |
var people = Substitute.For<IPersonRepository>(); | |
var validator = Substitute.For<IPersonValidator>(); | |
var createPerson = new CreatePerson(people, validator); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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|]) | |
rs | |
|> Seq.fold folder (Seq.empty, Seq.empty) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 = { | |
FrontMatter:FrontMatter | |
ContentText:string | |
} |
NewerOlder