Skip to content

Instantly share code, notes, and snippets.

View freerangeeggs's full-sized avatar
🐕
I have no idea what I'm doing

Brett McKenzie freerangeeggs

🐕
I have no idea what I'm doing
View GitHub Profile
@VivekRajagopal
VivekRajagopal / fsharp-json-union-field-discriminator.fsx
Created October 29, 2021 02:33
FSharp.Json Union Discriminator as Field
#r "nuget: FSharp.Json"
open FSharp.Json
[<JsonUnion(Mode = UnionMode.CaseKeyDiscriminatorField, CaseKeyField="version")>]
type VersionedDto =
| V0 of DtoV0
| V1 of DtoV1
and DtoV0 = {
Prop1: string
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"