Skip to content

Instantly share code, notes, and snippets.

@tomecko
tomecko / monet.js-tutorial.md
Last active February 9, 2016 19:55
Monads in JavaScript

In theory there is no difference between theory and practice. In practice there is.

Yogu Berra

This article is not real theoretical explanation of monads. It is a simple practical tutorial for JavaScript developers showing how some monads can be used. It's for engineers, not scientists.


All examples are based on monet.js - a tool bag that assists Functional Programming by providing a rich set of Monads and other useful functions. In most examples I'll use arrow functions introduced in ES6 as they are much more readable for one single operation "callbacks". Also in some examples TypeScript like type definitions will be added to enhance overall readability.

@tomecko
tomecko / main.js
Created August 29, 2019 13:09
debounce vs throttle
import { fromEvent, interval, Subject } from 'rxjs';
import {
debounceTime,
distinctUntilChanged,
map,
multicast,
scan,
shareReplay,
startWith,
throttleTime,
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset