Instantly share code, notes, and snippets.


After is the setTimeout I always wanted!

after(60 * 1000, () => console.log("Its' been a minute, where've ya been?")

It's also an Observable, so if you're using it without Antares, it looks like:

after(60 * 1000, () => console.log("Its' been a minute, where've ya been?").subscribe()

The return value of the function you pass is emitted as the value of the Observable so:

View index.js
#!/usr/bin/env node
const say = require("say")
say.speak("Happy Friday, " + process.argv[2], null, null, () => {})

Introduction to Antares

Problem statement: For sites that focus on real-time collaborative experiences, guidance on how to architect them is lacking. The React approach is that all data input and output from your app is in component state, or "hooks" like useEffect. The Redux approach is that data I/O happens in middleware, inside the store.

But Anatares sees that these layers - Network I/O, and User Interface should be driven by the data management layer, not the other way around. And I've seen tremendous benefits since switching to this data-centric, or protocol-centric way of thinking.

Introducing the Antares Protocol. It's a kind of opinion about how app architecture should be. It uses principles laid out

View index.html
<!DOCTYPE html>
<meta name="description" content="OboeJS incremental loading">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src=""></script>
<script src=""></script>

Case Study 1: Less Testable - Padded Bounding Box calculation (3rd party dep)

I have some code that determines a bounding box from some point coordinates. It's required that there be some padding in the resulting numbers, above and beyond what the geospatial library calculatess.

Currently there's a lot of thrash around getting this feature just right. Coincidentally (not), there is also an impoverished test suite (fault: me).. But since the geospatial library requires a browser, our unit test runner jest can't run it in the fast test suite. We haven't done any integration tests yet, unless our data-only e2e tests count. So, this feature is currently undertested, and it acts weird in that way that makes it feel 'hard to pin down'. There's been some churn on this.

To remedy this, we could completely refactor this to use a library for calculation that doesn't have a dependency on window.H. Or I could limit what I test to the padding-adding calculation, trusting that the geospatial library has its ow

View YouTubeEventHandling.js
let player
let onYouTubeIframeAPIReady
const youTubeReady = new Promise(resolve => {
var tag = document.createElement('script');
tag.src = "//";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

TimeHop Your Inbox Cares About Privacy!!

TimeHop Your Inbox only sees email information related to playing music!

When you visit TimeHop Your Inbox, your browser makes a direct connection to Gmail. You grant Gmail permission to share your data with the running web page, then the code can display info and play audio from your files.

At no point does the app look at the body of emails, nor does it send your info anywhere!

Architecture and Security

View background.js
//oauth2 auth
{'interactive': true},
//load Google's javascript client libraries
window.gapi_onload = authorize;
~src $ aws
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: too few arguments
~src $ aws help
~src $ mkdir haas
# Because of my current status, I dont have Haas credentials, and so a clone will fial
~haas $ ssh -T
logged in as deanius.
You can use git or hg to connect to Bitbucket. Shell access is disabled.
~haas $ git clone
Cloning into 'haasapi'...
repository access denied.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights