Skip to content

Instantly share code, notes, and snippets.

@webstrand
webstrand / nginx.conf
Last active July 31, 2022 03:24
Run NGINX in the current directory
#!/usr/bin/env -S nginx -e /dev/stderr -p . -c
# Run an NGINX instance serving the current directory on ports 8080 and 8443
# (when configured). Execute one of the following commands in the terminal.
# - start-nodaemon: ./nginx.conf -g 'daemon off;'
# - start: ./nginx.conf
# - stop: ./nginx.conf -s stop
# - reload: ./nginx.conf -s reload
pid .nginx/nginx.pid;
events {}
@fatcerberus
fatcerberus / monads4all.md
Last active February 24, 2024 07:58
Monads for the Rest of Us

Monads for the Rest of Us

by Bruce Pascoe - 1 May, 2019

"A monad is just a monoid in the category of endofunctors. What's the problem?" ~James Iry[^1]

The problem... is that there are several problems.

It's been said that monads bear a dreadful curse. Once you finally understand what they are, you begin to see them everywhere--but somehow become completely incapable of explaining them to anyone else. Many tutorial writers have tried to break the Great Curse--the Web is lousy with bold attempts and half successes that attest to this--and just as many have failed. Well, I'm here to address the elephant in the room[^2] and tell you that I intend to break the Great Curse once and for all.

There are basically two ways a monad tutorial tends to go. One is a paragraph or two of minimal descriptions of one or two common monads (Haskell's Maybe in particular is very popular), followed by a lot of intimidating Haskell syntax trying to explain--precisely--how it all fits together. This is well

@zhirzh
zhirzh / multiple-inheritance.js
Created February 8, 2018 15:59
Multiple Inheritance in JS
function inheritsObject(baseObject, superObject) {
Object.setPrototypeOf(baseObject, superObject);
}
function inheritsMultipleObjects(baseObject, superObjects) {
inheritsObject(
baseObject,
new Proxy({}, {
get(target, key, rec) {