Skip to content

Instantly share code, notes, and snippets.

jcmoore

Block or report user

Report or block jcmoore

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
@jcmoore
jcmoore / BestTree.js
Last active Nov 13, 2017
BestTree.js -- humble B+Tree with configurable aggregations and search through arbitrary "secondary indexes"
View BestTree.js
// Code formatted (ruthlessly and) automatically with Prettier
// number of $values being used
const NODE_LIMIT = Symbol("BEST_NODE_LIMIT");
// cumulative count of leaf $values (redundant with limit and/or last bound...)
const NODE_SIZE = Symbol("BEST_NODE_SIZE");
// "integral" of "size" for each stem node
const NODE_BOUND = Symbol("BEST_NODE_BOUND");
// left-most of leaf $values for each stem node
const NODE_EDGE = Symbol("BEST_NODE_EDGE");
@jcmoore
jcmoore / degenerate.js
Last active Oct 25, 2017
degenerate.js -- promise fulfilling yield handler for generator functions
View degenerate.js
function degenerate (generator) {
return function () {
var iterator = generator.apply(this, arguments);
return new Promise(function fn (resolve, reject) {
return pass(void 0);
function pass(value) {
coop.call(iterator.next, iterator, value, resolve, reject, pass, fail);
@jcmoore
jcmoore / radixSort.js
Last active Oct 22, 2017
radixSort.js -- recursive bucket sorting on one and two dimensional arrays of integers
View radixSort.js
function _deorderList(skip, to, inverter, list, begin, end) {
return _deorderShadowedList(
skip,
to,
inverter,
list,
begin,
list,
begin,
end
View uidget.js
var Ui = (function (s8) {
var Uidget = s8("Uidget", {
uiml: Error(),
uimlUpdate: Error(),
uimlAssemble: Error(),
uimlProcess: Error(),
@jcmoore
jcmoore / sigilate.js
Created May 31, 2017
sigilate.js -- utilities for symbol-centric packages
View sigilate.js
function sigilate (prefix, nvps) {
return Object.keys(nvps).reduce(function (result, name) {
var err = nvps[name];
var id = err.message || name;
var sigil = Symbol(prefix ? prefix + "." + id : id);
err.message = id;
err.toString = function () {
return sigil;
};
@jcmoore
jcmoore / syntax-guide.js
Last active May 25, 2017
symbolic.js syntax style-guide
View syntax-guide.js
// symbolic.js syntax style-guide
(function () {
function _getPropDefs (value) {
return Object.getOwnPropertyNames(value).concat(
Object.getOwnPropertySymbols(value)
).reduce(function (target, field) {
target[field] = Object.getOwnPropertyDescriptor(value, field);
View es6.ebnf
/* ebnf file for es 6 - MAY CONTAIN ERRORS / DISAMBIGUITY */
Grammer::= Statement
/* Lexical grammer */
SourceCharacter ::= #x0000-#x10FFFF
InputElementDiv ::= WhiteSpace | LineTerminator | Comment | CommonToken | DivPunctuator | RightBracePunctuator
InputElementRegExp ::= WhiteSpace | LineTerminator | Comment | CommonToken | RightBracePunctuator | RegularExpressionLiteral
InputElementRegExpOrTemplateTail ::= WhiteSpace | LineTerminator | Comment | CommonToken | RegularExpressionLiteral | TemplateSubstitutionTail
InputElementTemplateTail ::= WhiteSpace | LineTerminator | Comment | CommonToken | DivPunctuator | TemplateSubstitutionTail
WhiteSpace ::= "<TAB>" | "<VT>" | "<FF>" | "<SP>" | "<NBSP>" | "<ZWNBSP>" | "<USP>"
@jcmoore
jcmoore / travasti-ts.js
Last active Sep 11, 2017
travasti -- AST traversal
View travasti-ts.js
// https://raw.githubusercontent.com/mozilla/source-map/182f4459415de309667845af2b05716fcf9c59ad/dist/source-map.js
var sourceMap;
// https://raw.githubusercontent.com/Microsoft/TypeScript/1a579d929f1d0ee4d45de7cee505970a24a40cc7/lib/typescript.js
var ts;
var tv = {
$: {
handle: Symbol("tv.$.handle"),
@jcmoore
jcmoore / avltext.js
Last active Apr 22, 2017
avltext.js
View avltext.js
(function () {
var _bitDepthOf = (function () {
var _last = 1 + (Number.MAX_SAFE_INTEGER - 1) / 2;
var _inverter = [Number.MAX_SAFE_INTEGER];
do _inverter.push((_last - 1)); while ((_last /= 2) >= 1);
_inverter = _inverter.reverse();
@jcmoore
jcmoore / managable.js
Last active Feb 25, 2017
managable.js -- primitives for facilitating "reference counted" resources
View managable.js
function managableFactory () {
var _broken = Promise.resolve(null);
function Managable () {
}
Managable.prototype.rref = function () {
You can’t perform that action at this time.