Skip to content

Instantly share code, notes, and snippets.

View bmeck's full-sized avatar

Bradley Farias bmeck

View GitHub Profile

original:

let i = 0;
export let decrement = () => i--;
export let increment = () => i++;

sharded:

> Using some sort of identifier in the code or using package.json, the combination approach. Why wouldn't it work for all?
bmeck> Implementing it starts to have bad side effects
consider this: make a file `my-first-script.js`
run it as ESM
thats an over simplification
to clarify, why is package.json needed at all when it currently is not?
you can npm install entire dep trees then remove all package.json files
or lets look at a different problem in the impl of modules.root
not in complexity, but in the effect it leaks
@bmeck
bmeck / x.json
Last active May 15, 2017 08:24
{
false: true
}
class Emitter {
constructor() {
this.watchers = new WeakMap;
this.routes = new Map;
}
unwatch(thenable) {
if (this.watchers.has(thenable)) {
const {key} = this.watchers.get(thenable);
this.watchers.delete(thenable);
this.routes.delete(key);

Discovery of CoordinationServer

Every time the pipeline is started up a few things happen:

  1. The client sends a dns-sd PTR request for $toolname.local. In the case of IPv6 ff01:b0:1d%lo0 should be preferred where lo0 is the loopback interface for the node. This is a check to see if a BuildServer is on the local machine.
  2. Sequentially for each SRV,{A,AAAA} response that is recieved promptly. TXT records of protocol=$ can be used to specify WS, or WSS with WS being the default.
  3. Connect to the server, perform any verification checks
@bmeck
bmeck / ?:.log
Last active April 14, 2017 18:27
printf "\n$SRC" | d8 --print_code --code_comments --predictable --single_threaded
d8> --- Raw source ---
var someDefault;this.foo = this.foo === void 0 ? someDefault : this.foo
--- Code ---
source_position = 0
kind = FUNCTION
compiler = full-codegen
Instructions (size = 444)
[ function compiled by full code generator
0x9a8bf686c20 0 488b4c2408 REX.W movq rcx,[rsp+0x8]
var x = 1;
{
  "type":"Program",
  "scope": {
    "dynamic": false,
 "variables": [
@bmeck
bmeck / chatting.js
Last active April 1, 2017 00:48
a chat server using generators to manage connection state.
'use strict';
/*::
type Client = Object;
type Channel = string;
*/
const channels/*: Map<Channel, Set<Client>> */ = new Map;
const clients/*: Map<Client, Set<Channel>> */ = new WeakMap;
const join = (name, client) => {
if (!channels.has(name)) {
// Hooks for current package are only importable from that package
//
// package boundaries:
// * dir up to but excluding node_modules/ or ./package.json
// * dirs inside current but excluding node_modules
//
// package wishing to add hooks can use
//
// consumer-pkg/index.js
// import {package as packageHooks} from 'js:context/loader/hooks';
function* tictactoe() {
const board = [
[null, null, null,],
[null, null, null,],
[null, null, null,],
];
let winner = null;
const turn = 'x';
let res = {type: 'new_game'};
game: