Scoop
- firacode
- windows-terminal
- starship
- gopass
- pass-winmenu-nogpg
- micro
- nodejs
- jq
[<AutoOpen>] | |
module Helpers = | |
let rec (|NestedHttpRequestException|_|) (e: exn) = | |
match e with | |
| null -> None | |
| :? Net.Http.HttpRequestException as e -> Some e | |
| e -> (|NestedHttpRequestException|_|) e.InnerException | |
[<RequireQualifiedAccess>] | |
module ConsulKv = |
[<RequireQualifiedAccess>] | |
module Notify | |
open System | |
open Elmish | |
open Bolero | |
open Bolero.Html | |
type State = Opened | Closed |
#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 |
// 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 |
open System | |
open Microsoft.AspNetCore.Builder | |
open Microsoft.AspNetCore.Http | |
open Microsoft.AspNetCore.Routing | |
type Item = { Id: int32; Name: string; Price: decimal } | |
let rnd = Random() | |
let getProducts () = | |
[ for _ in 1..3 do { Id = rnd.Next 100; Name = "Blueberry"; Price = 10m } ] |
// ========= Event Sourcing in a nutshell | |
(* | |
FriendlyName: string | |
Aggregate friendly name. | |
Initial: 'State | |
Initial (empty) state we will start with. | |
Decide: 'Command -> 'State -> 'Event list |
Use Onion architecture
Use pipeline model to implement workflows/use-cases/stories
Keep IO at edges
{ | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "Hugo", | |
"type": "shell", | |
"command": "hugo serve", | |
"group": "build", | |
"isBackground": true, | |
"problemMatcher": { |
What is GetHashCode used for?
It is by design useful for only one thing: putting an object in a hash table. Hence the name.
Why do we have this method on Object in the first place?
It makes perfect sense that every object in the type system should provide a GetType method; data's ability to describe itself is a key feature of the CLR type system. And it makes sense that every object should have a ToString, so that it is able to print out a representation of itself as a string, for debugging purposes. It seems plausible that objects should be able to compare themselves to other objects for equality. But why should it be the case that every object should be able to hash itself for insertion into a hash table? Seems like an odd thing to require every object to be able to do.