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
rmoorman / Generators.md
Created Apr 8, 2020 — forked from cqfd/Generators.md
Generators in JavaScript and Haskell
View Generators.md

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
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>
<html>
<head>
<meta charset="UTF-8">
<title>A simple clock</title>
</head>
<body translate="no" >
@rmoorman
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'>
<head>
<meta charset='utf-8'/>
<title>Audio only stream example</title>
<script src='https://cdn.dashjs.org/latest/dash.all.min.js'></script>
<style>
video {
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

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

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 twitter.com/rich_harris.

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.

View git-tag-delete-local-and-remote.sh
# 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
rmoorman / mailhog-mamp.md
Created Apr 26, 2019 — forked from jaredatch/mailhog-mamp.md
Install MailHog with MAMP Pro
View mailhog-mamp.md

Install MailHog with MAMP Pro, using HomeBrew.

MailHog

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

$ brew update
@rmoorman
rmoorman / README.md
Created Mar 29, 2019 — forked from akoppela/README.md
Custom Elements with ES5 syntax
View README.md

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
rmoorman / EventMachines.md
Created Mar 28, 2019 — forked from eulerfx/EventMachines.md
The relationship between state machines and event sourcing
View EventMachines.md

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.