Skip to content

Instantly share code, notes, and snippets.

View cadorn's full-sized avatar

Christoph cadorn

View GitHub Profile
@cadorn
cadorn / main.js
Created March 8, 2011 00:17
Simple JSGI app
module.declare([], function(require, exports, module)
{
exports.main = function()
{
}
exports.app = function()
{
var counter = 0;
@cadorn
cadorn / tree.json
Created May 27, 2011 21:41
JSON Tree
{"text":"","path":"","id":"","expanded":true,"children":[{"text":"Users","path":"","id":"","expanded":true,"children":[{"text":"cadorn/pinf/workspaces/github.com/cadorn/com.cadorn.baby/projects/firephp/packages/test-symfony2/public","path":"","id":"","expanded":true,"children":[{"text":"app","path":"","id":"","expanded":false,"children":[{"text":"AppKernel.php","path":"/Users/cadorn/pinf/workspaces/github.com/cadorn/com.cadorn.baby/projects/firephp/packages/test-symfony2/public/app/AppKernel.php","id":"/Users/cadorn/pinf/workspaces/github.com/cadorn/com.cadorn.baby/projects/firephp/packages/test-symfony2/public/app/AppKernel.php","leaf":true},{"text":"autoload.php","path":"/Users/cadorn/pinf/workspaces/github.com/cadorn/com.cadorn.baby/projects/firephp/packages/test-symfony2/public/app/autoload.php","id":"/Users/cadorn/pinf/workspaces/github.com/cadorn/com.cadorn.baby/projects/firephp/packages/test-symfony2/public/app/autoload.php","leaf":true},{"text":"bootstrap.php.cache","path":"/Users/cadorn/pinf/workspac
@cadorn
cadorn / module.js
Created June 15, 2011 16:28
jetpack code snippet
var FILE = require("file"),
URL = require("url"),
BYTE_STREAMS = require("byte-streams"),
UNLOAD = require("unload"),
TIMER = require("timer");
// JSON = provided by jetpack as a global
var Cc = require("chrome").Cc;
var Ci = require("chrome").Ci;
var Cu = require("chrome").Cu;
@cadorn
cadorn / gist:1134921
Created August 9, 2011 19:16
Queue processing with Q promises
function processSequentially()
{
console.log("start queue");
var result = Q.defer();
var done;
[
["1", 2],
["2", 4],
["3", 3],
["4", 9],
@cadorn
cadorn / gist:1258017
Created October 2, 2011 21:49
GPSEE strict warnings
| Running program (equivalent command): commonjs --platform v8cgi /pinf/workspaces/github.com/pinf/test-programs-js/JSLintBenchmark
|--- Program stdout & stderr follows --->
Running JSLint Benchmark by running JSLint against itself ...
... took: 0.364 seconds
macbook-home-cadorn-net:test-programs-js cadorn$ commonjs --platform gpsee ./ JSLintBenchmark/
JS strict warning #157 in gpsee.js at line 164 ch 8 - anonymous function does not always return a value
JS strict warning #157 in gpsee.js at line 171 ch 15 - anonymous function does not always return a value
JS strict warning #127 in gpsee.js at line 328 ch 12 - variable parent redeclares argument
JS strict warning #110 in gpsee.js at line 469 ch 8 - function validate does not always return a value
JS strict warning #157 in gpsee.js at line 548 ch 41 - anonymous function does not always return a value
@cadorn
cadorn / q-throttle.js
Created February 2, 2012 19:39
Q.Throttle()
/**
* Copyright: 2012 Christoph Dorn <[email protected]>
* License: MIT
* Source: https://gist.github.com/1725325
*
* NodeJS Example:
*
* // Requirements: `npm install q`
*
* var Q = require("q");
@cadorn
cadorn / README.md
Created November 14, 2012 16:53
Slow with Q promises, fast with callbacks (NodeJS)

The promises based implementation is much slower than the callback based implementation.

I am wondering why exactly that is the case.

Usage

var Q = require("q");
var SCANNER = require("./promises");

//var SCANNER = require("./callbacks");

@cadorn
cadorn / Invitation.md
Last active April 18, 2018 03:19
Weekly `devcomp.io` meeting

Collaboration on packages is the precursor to an entire new paradigm of collaborative system development.

Join a group of people interested in collaborative realtime distributed system development and associated tooling.

You recognize that it takes many small components to make a large system and that there is no adequate open source tooling to assist with the creative process of modelling complex systems and making them a reality.

Time: Every Wednesday 10am - 11am PST

Where: Google Hangouts on Air (links will be sent to mailing list every week)

@cadorn
cadorn / WorkspaceActivation.md
Last active August 29, 2015 14:01
workspace activation

You activate a workspace by placing environment variables into your shell and modifying the PATH.

Shell environment variables represent the root config layer and all config resolving must happen from this base layer. If any code in your codebase must resolve config info it MUST have access to environment variables directly or indirectly or at the very least to the root path of the workspace so the environment variables may be established by loading and parsing the raw files.

Any config resolution logic must in its entirety be seeded by the environment variables and may then branch out with arbitrary logic. Ideally further config resolution layers follow rules and patterns that me be shared across implementations.

pio conventions

Given a file tree such as: