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
[core] | |
excludesFile = ~/.gitignore | |
[user] | |
name = My Name | |
[includeIf "gitdir:~/git/"] | |
path = ~/.gitconfig-work | |
[includeIf "gitdir:~/github/"] | |
path = ~/.gitconfig-home |
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
type Pins = int | |
let [<Literal>] MaxPins : Pins = 10 | |
type Frame = | |
| Strike of Pins | |
| Spare of Pins * Pins | |
| Open of Pins * Pins | |
| Pending of Pins | |
| Final of Pins * Pins option * Pins option |
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 "nuget: Flurl.Http" | |
module HttpApi = | |
open System | |
open System.Net | |
open System.Text.Json | |
open Flurl.Http | |
type Serializer (opt) = | |
interface Configuration.ISerializer with |
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 "nuget: Microsoft.Extensions.Http, 6.0.0" | |
let factory = | |
ServiceCollection() | |
.AddHttpClient("dummy") | |
.ConfigureHttpClient(fun c -> | |
printfn "dummy configured" | |
c.BaseAddress <- Uri "https://dummyjson.com" | |
c.Timeout <- TimeSpan.FromMinutes 2.) | |
.Services |
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
// ========= Event Sourcing in a nutshell | |
(* | |
FriendlyName: string | |
Aggregate friendly name. | |
Initial: 'State | |
Initial (empty) state we will start with. | |
Decide: 'Command -> 'State -> 'Event 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
// 1. pure, don't think about IO at all | |
module Domain = | |
let add x y = x + y | |
// 2. think about IO but not its implementation | |
module App = | |
let add (getX: unit -> Async<int32>) y = | |
async { | |
let! x = getX () | |
return Domain.add x y |
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
{ | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "Hugo", | |
"type": "shell", | |
"command": "hugo serve", | |
"group": "build", | |
"isBackground": true, | |
"problemMatcher": { |
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
module NinetyNineBottles.SongTests | |
open Xunit | |
[<Fact>] | |
let ``Verse 99`` () = | |
let expected = "99 bottles of beer on the wall, 99 bottles of beer. | |
Take one down and pass it around, 98 bottles of beer on the wall." | |
let verse = Song.One 99 |> Song.verses | |
Assert.Equal(expected, verse) |
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
using System; | |
using System.Globalization; | |
using System.Linq; | |
using System.Text; | |
EqualsIgnoreCaseAndDiacritics("héLloṩ", "hellos"); // true | |
static string RemoveDiacritics(string str) => | |
str is null ? null : | |
string.Concat(str |
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
public string Hash(string str) | |
{ | |
return string.Join("", System.Security.Cryptography.SHA256.Create() | |
.ComputeHash(System.Text.Encoding.UTF8.GetBytes(str)).Select(s => s.ToString("x2"))); | |
} |