Skip to content

Instantly share code, notes, and snippets.

@eareese
eareese / notes-serviceworker.md
Last active March 6, 2017 15:35
Notes on ServiceWorker demo first pass

I got stuck for a while on an annoying error caused by my editing code and messing up promise syntax/parens. I eventually diagnosed it after finding this blog post, which motivated me to write up my own notes, however spare.

My experience was not as intricate as the blog post author's, except for this part:

At one point I accidentally wrote event.waitUntil(...).then(...). (The 'then' should go inside the brackets, not outside.) Firefox reported the error event.waitUntil(...) is undefined which is totally misleading and had me looking up the spec for waitUntil. Chrome had a better error: "cannot read property 'then' of undefined".

So that was a frustrating typo. Aside from dealing with promises, simple adding/registering of a service worker is quite simple and I like it -- all SW stuff self-contained in serviceworker.js which is referenced only from the app js, since the SW is just JavaScript that runs separately from the DOM.

This

@eareese
eareese / sed-pokemon-data-cleanup.md
Last active March 7, 2017 16:31
How to `sed` demo: inconsistent Pokémon data
sed -E '/[[:space:]]*("id"|"height")/!s/"([[:digit:]]+\.*[[:digit:]]*)"/\1/'

Keybase proof

I hereby claim:

  • I am eareese on github.
  • I am ear (https://keybase.io/ear) on keybase.
  • I have a public key whose fingerprint is 080C B721 069F 3093 F89D AAFF 7696 54DC B363 5A2D

To claim this, I am signing this object: