Skip to content

Instantly share code, notes, and snippets.

View chregon's full-sized avatar

chregon

View GitHub Profile
@chregon
chregon / fzbz.js
Created September 1, 2020 07:14
Fizzbuzz but can i do FP?
[...Array(30).keys()].forEach(x => console.log(((x % 3 === 0) ? (x % 5 === 0 ? "fizzbuzz" : "fizz") : ((x % 5 == 0) ? "buzz" : x))))
@chregon
chregon / fzbz.hs
Last active September 17, 2020 17:17
fzbz.hs
l = (\x y a b -> if mod x y == 0 then a else b)
f = map snd [(i,l i 5 (l i 3 "fizzbuzz" "buzz") (l i 3 "fizz" $ show i)) | i <- [1..]]
@chregon
chregon / not-pipe.sh
Created December 30, 2020 20:27
tiramisu -> herbe through unix named pipe
#!/usr/bin/env bash
pipe=notifications
trap "rm -f $pipe" EXIT
if [[ ! -p $pipe ]]; then
mkfifo $pipe
fi