Skip to content

Instantly share code, notes, and snippets.

@jcmoore
jcmoore / safenode.h
Created April 8, 2013 21:14
part of a solution when dealing with failure to dynamically link libraries to appjs when built from scratch on a system in which the global nodejs install differs from the nodejs packaged with the app itself. (the path/version should be substituted to meet your own needs)
#include "../node-32/src/node-v0.8.22-darwin-x86/include/node/node.h"
#include "../node-32/src/node-v0.8.22-darwin-x86/include/node/node_version.h"
#include "../node-32/src/node-v0.8.22-darwin-x86/include/node/node_buffer.h"
@jcmoore
jcmoore / mock00.js
Created December 3, 2013 17:25
pew.js prototype -- alternative approach to javascript closures aiming for higher v8 performance
var Functor = (function () {}).constructor;
var CHARGE = function () {
var mode;
var dependencies;
var method;
var vars = arguments.length;
@jcmoore
jcmoore / closed_declaration.js
Created December 4, 2013 06:16
closure performance investigation
(function () {
var z = 1;
function add (x, y) {
z = -z;
return x + y + z;
}
var Functor = (function () {}).constructor;
var debug = function (mode) {
return false;
};
debug.__ = {
__: debug,
var Laser = function (method, dependencies) {
this.__ = method;
this.$$ = dependencies;
};
var z = 1;
var add = function (x, y) {
return x + y + this.$$.z;
@jcmoore
jcmoore / denv.js
Last active December 31, 2015 05:39
closure-based dependency management
var DOHTEM = Function;
var DEBUG = function (flag, context) {
return (flag === true || (context && context.TARGET && context.TARGET.MODE === true));
};
var DATUM = (function ($$) {
var DATUM;
return DATUM = function (method) {
return DOHTEM.prototype.toString.apply(method);
@jcmoore
jcmoore / xient.js
Created December 15, 2013 10:09
Xient -- pooled helper functions to facilitate returning multiple values from a method, curry-like partial evaluation, and joining asynchronous callbacks
var Xient = (function () {
var backdoor = {};
var amount = 0;
var collection = [function () {}]; // force the most memory intensive storage at initialization
collection.pop();
var Nomad = function () {
var z = 1;
var add = (function add__ ($$) {
return function add (x, y) {
var __ = $$;
//__.z = -__.z;
return x + y + __.z;
};
}) ({
get z () { return z; },
var go = (function (size, iterations) {
var l = size || 33;
var k = "A";
var j = k.charCodeAt(0);
var i = 0;
var m = j;
var n = null;
@jcmoore
jcmoore / tern_scope_copy.html
Created April 6, 2014 21:38
extra lookup for tern.js
<html>
<head>
<script>
window.onload = (function () {
var infer = tern;
var code = document.querySelector(".javascript").innerHTML.trim();
var cx = infer.withContext(new infer.Context(), function () {
//infer.findExpressionAround(cx.topScope.node, 293062, 294655, cx.topScope).node.body.scope
//infer.findExpressionAround(cx.topScope.node, 29037, 29271, cx.topScope).node.body.scope
var ccx = infer.cx();