Skip to content

Instantly share code, notes, and snippets.

View ashenwolf's full-sized avatar

Sergii Gulenok ashenwolf

View GitHub Profile
@ashenwolf
ashenwolf / multimethod.test.ts
Created August 7, 2023 10:02
A minimalistic Multimethod Implementation for TypeScript
import { useMultimethod, __ } from "../../src/utils/multimethod";
describe("simple multimethod implementation", () => {
it("should throw exception when default method is not supplied and no dispatch matches", () => {
const input = { id: "a", value: "test" };
const throwErrorMultimethod = useMultimethod((data: any) => [
data.id,
]).method(["c"], (data) => data.value);
expect(() => throwErrorMultimethod(input)).toThrowError();
@ashenwolf
ashenwolf / minutekey_scrapping.fsx
Last active October 12, 2016 13:14
Minutekey scrapping script F#
// scrape all minutekey kiosks in US (requires csv with a complete list of US zip codes)
#r @"System.Core"
#r @"System.Io"
#r @"..\packages\FSharp.Data.2.0.14\lib\net40\FSharp.Data.dll"
#r @"..\packages\FSharp.Collections.ParallelSeq.1.0\lib\net40\FSharp.Collections.ParallelSeq.dll"
open System.IO
open System.Net
open System.Collections.Specialized
open FSharp.Collections.ParallelSeq