Skip to content

Instantly share code, notes, and snippets.

@jcmoore
jcmoore / avltext.js
Last active April 22, 2017 04:04
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 February 25, 2017 20:13
managable.js -- primitives for facilitating "reference counted" resources
function managableFactory () {
var _broken = Promise.resolve(null);
function Managable () {
}
Managable.prototype.rref = function () {
@jcmoore
jcmoore / README.md
Last active February 9, 2017 08:30
vscode notes

regarding the build command ./scripts/npm.sh install --arch=x64 environment variables CPATH="/usr/include" LIBRARY_PATH="/usr/lib" may be needed

regarding file watcher limits (for incremental-building/code-reloading) on Arch Linux use echo fs.inotify.max_user_watches=524288 | sudo tee /etc/sysctl.d/40-max-user-watches.conf && sudo sysctl --system

@jcmoore
jcmoore / dsqueue.js
Last active February 7, 2017 08:35
DoubleSpaceQueue: a simple FIFO queue built on top of two re-sizable ring buffers (should only use up to 2*MaxSize -- "double" -- space)
function DoubleSpaceQueue () {
this._upperBack = 0;
this._upperFront = 0;
this._lowerBack = 0;
this._lowerFront = 0;
this._back = [];
this._front = [];
}
@jcmoore
jcmoore / patch.js
Created January 11, 2017 18:57
polymer-2.0-preview patch
function patch()
{
Polymer.Base._createObservedProperty = function _createObservedProperty(property, methodName)
{
this._addPropertyEffect(property, TYPES.OBSERVE,
{
fn: runObserverEffect,
info:
@jcmoore
jcmoore / v8peek.md
Last active November 29, 2016 20:20
v8peek -- exposes hidden class to an electron runtime

Check any obj.junK in the devtools console.


Added V(junK_string, "junK") to #define INTERNALIZED_STRING_LIST(V) in electron-repo/vendor/node/deps/v8/src/heap-symbols.h

Modified electron-repo/vendor/node/deps/v8/src/objects.cc:

MaybeHandle<Object> Object::GetProperty(LookupIterator* it) {
@jcmoore
jcmoore / index.html
Created November 27, 2016 02:54
Space -- basic implementation of poolable double-ended mutable vectors based on hash array mapped tries (HAMTs)
<script>
var CERTIFY_INTERNALLY = 0|false;
var _fleetAssociations = new WeakMap();
function Fleet (space) {
this._space = (space instanceof Space) ? space : spaceAllocator(0);
}
function _fleetMatch (fleet, owner) {
@jcmoore
jcmoore / figurative.js
Last active September 24, 2016 01:53
Simple message-bus implementation to enable faux-microservices
var figurative = (function () {
var writeGuard = {};
var invalidChannel = typeof ShuttleBus !== "undefined" && typeof ShuttleBus.init === "function" ?
ShuttleBus.init(null, null, null, null) : {
init: function () {
return invalidChannel;
},
isInService: function () { return 0|false; },
@jcmoore
jcmoore / bower.json
Created July 20, 2016 23:37
Deps testing 1.0-a
{
"keywords": []
, "name": "ignored"
, "version": "0.0.0"
, "dependencies": {
}
}
@jcmoore
jcmoore / bower.json
Last active July 20, 2016 23:37
Deps testing 1.0
{
"keywords": []
, "name": "ignored"
, "version": "0.0.0"
, "dependencies": {
"alpha": "https://gist.github.com/jcmoore/fdc772f7cb326e9b24daec0a736e44d2.git"
}
}