Skip to content

Instantly share code, notes, and snippets.

domenic /
Last active Apr 21, 2021
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
    // the rest of your code goes here.
Raynos /
Created Jan 23, 2012
Shim status of ES6

ES6 what can be shimmed and what not.

Currently only lists things that can be shimmed or are experimentally implemented

Note that for any kind of decent ES6 support we need an ES6 transpiler. A few projects are attempting this [Reference SO question][3]

  • [traceur][4]
  • [Caja][5]
  • [ES transpiler][6]
lukehoban / gist:3900992
Created Oct 16, 2012
ES6 module syntax alternatives
View gist:3900992
Things I want to be able to do:
a) Bind a name to a remote module
b) Alias a name for a module
c) Alias a name for a member of a remote module
d) Put all names from inside a module in lexical scope
e) Put all names from inside a remote module in lexical scope
f) Put a few names from inside a module in lexical scope
g) Define a local module
h) Export names from lexical scope
i) Re-export names from other modules
mkristian / pom-compass.xml
Last active Aug 2, 2016
using gem-maven-plugin to compass compile or execute sass. sass with gem dependency within plugin and compass with global compile dependency (which is also added to the java-classpath and not so nice)
View pom-compass.xml
<?xml version="1.0"?>

ES6 -> CJS Tranpilation for UMD

ES6 and AMD require paths are raw, you can make them mean whatever you want, but by default mean baseUrl+path. In npm the paths are relative to the file calling require if the path starts with a directory separater, if there is no separator it looks in node_modules. For example:

// looks in node_modules
// we'll call this a "vendor require"
var handlebars = require('handlebars');
// looks relative to this file
ritch / domain-example.js
Created Oct 4, 2012
How to do domains...
View domain-example.js
// based on an example by @mikeal
var http = require('http')
, domain = require('domain')
module.exports = function (handler) {
var server = http.createServer(function (req, resp) {
var d = domain.create()
dominictarr / stream.markdown
Created Jul 15, 2012
Stream tweaks proposal
View stream.markdown

Stream tweaks proposal

The stream is a powerful tool, not just for IO, -- but, in the best Unix tradition -- for composition of modules. I've been connecting streams into quite long chains.

Some streams I have written do not alter the data in the stream, but affect it is some way, such as buffering when the stream is paused. pause-stream

Also, I've been writing high level abstractions that communicate via streams, and do some interesting high level stuff, Such as by replicating data, snob and crdt, or multiplexing mux-demux. Another good example is dnode.

These abstractions expose a stream on their interface, and so can be used over any io channel which supports pipe.

View node-v0.9-todo.txt
1. Port http_parser.c to JS so we can not keep parsers around forever.
This will be a one-month time-boxed experiment. If it's not acceptable, then
we just have to live with it the way it is now.
2. Clean up lib/http.js. Split into http_client.js and http_server.js
API must remain stable, but code should be separated and organized more clearly.
3. process.nextTick semantics change. Clear the queue after every V8 invocation.
See how rough this is for starvation issues, maybe keep track of the depth, and
do a setTimeout(fn,0) if it's > 10000 or something.
View block-lambda-quandry.js
function foo() {
return 10;
function bar(block) {
block(); // we should never get here. how?
View SomeKlass.js
var SomeKlass = (function () {
var privates = Name();
return {
public_method: public_method,
public_prop: 42,
constructor: constructor
function public_method() {