Skip to content

Instantly share code, notes, and snippets.

View A1rPun's full-sized avatar
🌊
Fractalicious

Thom Bakker A1rPun

🌊
Fractalicious
  • The Netherlands
View GitHub Profile
@A1rPun
A1rPun / f.js
Last active April 15, 2019 14:55 — forked from renanpvaz/f.js
JavaScript function pattern matching inspired by F#'s & renanpvaz gist
fun = (variations, matchIndex = 0) => (...appliedArgs) => (variations[appliedArgs[matchIndex]] || variations._)(...appliedArgs)
luck = fun({
7: () => "LUCKY NUMBER SEVEN",
_: () => "Sorry, you're out of luck, pal!",
})
luck(7)
// "LUCKY NUMBER SEVEN"
@A1rPun
A1rPun / scrollspy.js
Last active November 16, 2015 23:02 — forked from pascaldevink/scrollspy.js
/*
Copyright (C) 2021 Pascal de Vink (Tweakers.net)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of