Skip to content

Instantly share code, notes, and snippets.

View ijrussell's full-sized avatar

Ian Russell ijrussell

View GitHub Profile
// Based on original at https://gist.github.com/houstonhaynes/fcc26d0265d1572fbdb093af88da926a
#r "nuget: CoordinateSharp"
open System
open CoordinateSharp
let find_Closest_TimeUnit =
let el = EagerLoad(EagerLoadType.Celestial)
@ijrussell
ijrussell / LoanApplication.fsx
Created August 31, 2023 16:49
F# version of the core processing part of https://github.com/ijrussell/LendingPlatform
#r "nuget: FsToolkit.ErrorHandling"
open System
open FsToolkit.ErrorHandling
type LoanAmount = LoanAmount of int
type AssetValue = AssetValue of int
type CreditScore = CreditScore of int16
type LoanToValueRate = LoanToValueRate of byte
@ijrussell
ijrussell / BehaviourTest.cs
Created August 13, 2023 14:38
Simple BDD {Based on a 2009 blog post from Garry Shutler]
namespace TestsXunit.Framework;
public abstract class BehaviourTest
{
protected void Setup()
{
Given();
When();
}
open System.IO
type Connection = {
Start: string
Finish: string
Distance: int
}
type Waypoint = {
Location: string
package main
import (
"bufio"
"fmt"
"os"
"reflect"
"strconv"
"strings"
)
type Result = Win | Lose | Draw
type TableRow = { Id:string; Wins:int; Draws:int; Losses:int; Points:int }
let results = [
"A,B,win"
"C,D,lose"
"B,D,draw"
"C,A,win"
"B,C,lose"
"D,A,win"
open System.IO
type Tree<'T> =
|Branch of 'T * Tree<'T> seq
|Leaf of 'T
type Waypoint = { Location:string; Route:(string * decimal) list; Duration:decimal }
type Connection = { From:string; To:string; Distance:int; Speed:int }
open System.IO
type Tree<'T> =
|Branch of 'T * Tree<'T> seq
|Leaf of 'T
type Waypoint = { Location:string; Route:string list; Distance:int }
type Connection = { From:string; To:string; Distance:int }
open System
open System.IO
open System.IO.Compression
open System.Text
type CompressionValue = {
Value: string
Size: int
}