One form of bug in I/O programmer is forgetting to handle an error.
var stream = new Socket(host, port)
// stream.error.input.take().then(function (err) {
// /* handle error here */
int main() { | |
loop = uv_default_loop(); | |
uv_tcp_t server; | |
uv_tcp_init(loop, &server); | |
struct sockaddr_in bind_addr = uv_ip4_addr("0.0.0.0", 7000); | |
uv_tcp_bind(&server, bind_addr); | |
int r = uv_listen((uv_stream_t*) &server, 128, on_new_connection); | |
if (r) { |
module.exports = ComplexChild | |
/* A `ComplexChild` has inputs | |
The argument is a bunch of `geval` inputs that it | |
can read from. It's basically the parent notifying | |
it of stuff having happened | |
You can also pass it a hash of listener functions |
#!/usr/bin/env python | |
from traceback import print_exc | |
import urllib2 | |
import hashlib | |
import os.path | |
import os | |
import json | |
REGISTRY_URL = 'https://registry.npmjs.org' | |
MIRROR_PATH = '/var/lib/mirror/npm' |
For each of { properties, hooks, nested properties, nested hooks }
do {
cd ./{{project}} | |
git init | |
git add . | |
git commit -m 'initial commit' | |
git remote add origin {{uri}}:{{user}}/{{project}} | |
if hash hub 2>/dev/null; then | |
hub create {{user}}/{{project}} | |
fi |
/* usage: | |
var requireMain = require('require-main') | |
// instead of `require.main === module` | |
if (requireMain(require, module)) { | |
doStuff(process.argv) | |
} | |
*/ |
var mercury = require("mercury") | |
var h = mercury.h | |
var delegator = mercury.Delegator() | |
var inputs = mercury.EventSinks(delegator.id, ["clicks"]) | |
var clickCount = mercury.value(0) | |
inputs.events.clicks(function () { | |
clickCount.set(clickCount() + 1) | |
}) |