Skip to content

Instantly share code, notes, and snippets.

Rico Moorman rmoorman

Block or report user

Report or block rmoorman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
rmoorman /
Created Apr 8, 2020 — forked from cqfd/
Generators in JavaScript and Haskell

ES6. Using yield and yield*.

function* a() {
  var i = yield "first thing from a";
  var j = yield "second thing from a";
  return [i, j];

function* b() {
rmoorman / clock.html
Last active Mar 23, 2020 — forked from sam0737/clock.html
OBS Studio: A HTML page for showing current date and time in the video
View clock.html
<!DOCTYPE html>
<meta charset="UTF-8">
<title>A simple clock</title>
<body translate="no" >
rmoorman / ffmpeg-dash.html
Created Mar 17, 2020 — forked from CharlesHolbrow/ffmpeg-dash.html
Simple example of using live streaming audio video with dash.js and ffmpeg
View ffmpeg-dash.html
<!DOCTYPE html>
<html lang='`en'>
<meta charset='utf-8'/>
<title>Audio only stream example</title>
<script src=''></script>
video {
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:


start new with session name:

tmux new -s myname
rmoorman /
Created Oct 8, 2019 — forked from Rich-Harris/
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
rmoorman /
Created Apr 26, 2019 — forked from jaredatch/
Install MailHog with MAMP Pro

Install MailHog with MAMP Pro, using HomeBrew.


First let's make sure HB is updated. Open up terminal for the following steps.

$ brew update
rmoorman /
Created Mar 29, 2019 — forked from akoppela/
Custom Elements with ES5 syntax

You'll need to include two pollyfils before you include a code with your custom elements:

webcomponents/webcomponentsjs/custom-elements-es5-adapter.js - this is for new browsers in order to understand ES5 syntax

webcomponents/custom-elements/custom-elements.min.js - this is for old browsers without customElements support

You can add them to your index.html file in the following way:

<div id="custom-elements-adapter">
rmoorman /
Created Mar 28, 2019 — forked from eulerfx/
The relationship between state machines and event sourcing

A state machine is defined as follows:

  • Input - a set of inputs
  • Output - a set of outputs
  • State - a set of states
  • S0 ∈ S - an initial state
  • T : Input * State -> Output * State - a transition function

If you model your services (aggregates, projections, process managers, sagas, whatever) as state machines, one issue to address is management of State. There must be a mechanism to provide State to the state machine, and to persist resulting State for subsequent retrieval. One way to address this is by storing State is a key-value store. Another way is to use a SQL database. Yet another way is event sourcing. The benefit of even sourcing is that you never need to store State itself. Instead, you rely on the Output of a service to reconstitute state. In order to do that, the state machine transition function needs to be factored into two functions as follows:

You can’t perform that action at this time.