Skip to content

Instantly share code, notes, and snippets.

View reconbot's full-sized avatar
🏴‍☠️
Building at @github

Francis Gulotta reconbot

🏴‍☠️
Building at @github
View GitHub Profile
@staltz
staltz / introrx.md
Last active April 20, 2024 14:15
The introduction to Reactive Programming you've been missing
@domenic
domenic / event-emitter.js
Last active March 11, 2022 15:25
Revealing constructor pattern event-emitter
// This event emitter emits events, but reserves the right to publish events to
// for its creator. It uses a WeakMap for true encapsulation.
const eesToEventMaps = new WeakMap();
export default class EventEmitter {
constructor(publisher) {
const eventMap = Object.create(null);
eesToEventMaps.set(this, eventMap);
@Zirak
Zirak / gist:1677020
Created January 25, 2012 16:15
Visibility API
//http://www.w3.org/TR/2011/WD-page-visibility-20110602/
(function () {
"use strict";
//no need to shim if it's already there
if ( 'hidden' in document && 'onvisibilitychange' in document ) {
return;
}
//fail silently if the browser sux
@ajfisher
ajfisher / 0x00000.bin
Last active October 10, 2021 00:51
ESP8266 Transparent bridge to J5
@squarism
squarism / project_time.txt
Last active June 2, 2021 20:15
Project Time
"You have time you can control and time you can't,
you can't devote all of the time you can control to
new features otherwise the that time shrinks to 0."
-- reconbot
┌─────────
│ ┌────
│ │
│ │ ▲
@spion
spion / 01-fractal-weird-design.md
Last active November 2, 2019 12:27
Node streams - a fractal of weird design

Node streams - a fractal of weird design

and a potential refactor that could fix that

This is a list of issues and confusions I've encountered with node streams, and things I wish were designed and implemented differently. If promise-streams is ever going to change to a design that doesn't build on top of node streams, this would be a list of mistakes to avoid

  1. enc parameter - Why is encoding always passed together with the data? It should be a separate concern. It doesn't even make sense in objectMode
  2. eventemitter base - This encourages a lot of random events to be "attached" by other authors which doesn't work. Best to have an uniform (typed) interface so that everyone knows what to expect.
  3. relying on nextTick etc for execution order - This is very unreliable and causes all sorts of unpredictable rules for implementers which are not documented anywhere. When you attach listeners determines what will happen.
  4. no error propagation - we need the