Skip to content

Instantly share code, notes, and snippets.

View piscisaureus's full-sized avatar
🦕

Bert Belder piscisaureus

🦕
View GitHub Profile
@piscisaureus
piscisaureus / gist:9077207
Last active August 29, 2015 13:56
domenic.txt
// Stream type: tcp
* fundamental unit: byte
* list representation: buffer
readOne() -> yields a byte (represented as a number)
read() -> yields a Buffer containing a 1..N bytes, implementation decides
// Stream type: text lines (e.g. after splitting a text files into lines)
* fundamental unit: line (string)
* list representation: array
readOne() -> yields a line (a string)
var contents = yield fs.readFile('bla');
yield zone.create(() => {
http.get('google.com/bla').pipe(fs.createWriteStream('cache/file1'))
http.get('google.com/bl2').pipe(fs.createWriteStream('cache/file2'))
http.get('google.com/bl3').pipe(fs.createWriteStream('cache/file3'))
});
console.log('all done!')
http.createServer(function(conn) {
zone.data.start = Date.now();
doThis(conn);
doThat(conn);
new Zone(function() {
zone.data.bar = 49;
output = renterTemplate()

Introducing zones.

Before we get started: 'zone' is a library that makes programming with node much easier. It's work in progress, but you can try it out now.

You get goodies like:

  • Automatic exception handling
  • Long stack traces
  • Detect and handle common pitfalls with callbacks
@piscisaureus
piscisaureus / nni.cpp
Last active August 29, 2015 14:03
nni
#include <functional>
#include <iostream>
class JSAny {
void* substance;
};
class JSBool : public JSAny {
public:
d:\a\node_modules\strong-agent\src\compat.h(71): error C2061: syntax error : id
entifier 'FunctionCallback' [D:\a\node_modules\strong-agent\build\strong-agent.
vcxproj]
d:\a\node_modules\strong-agent\src\compat.h(139): error C4430: missing type spe
cifier - int assumed. Note: C++ does not support default-int [D:\a\node_modules
\strong-agent\build\strong-agent.vcxproj]
d:\a\node_modules\strong-agent\src\compat.h(139): error C2143: syntax error : m
issing ',' before '&' [D:\a\node_modules\strong-agent\build\strong-agent.vcxpro
j]
d:\a\node_modules\strong-agent\src\compat.h(140): error C2146: syntax error : m
D:\iojs>git config --system -l
core.symlinks=false
core.autocrlf=input
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=/bin/curl-ca-bundle.crt
@echo off
Setlocal
set P=%~dp0
set S=%~f1
set PATH=%P%bin\;%PATH%
IF NOT "%S%"=="" GOTO :Script
"%P%node\bin\node.exe"
From f9f06c17236b783f2b8c9d6531180f68c9acf8cd Mon Sep 17 00:00:00 2001
From: Bert Belder <bertbelder@gmail.com>
Date: Thu, 12 Aug 2010 01:38:42 +0200
Subject: [PATCH] Fix http and net tests failing due to race condition
Plus some minor cosmetic corrections
---
test/simple/test-http-1.0.js | 28 +++---
test/simple/test-http-chunked.js | 18 ++--
test/simple/test-http-client-race-2.js | 94 ++++++++++----------
From 33f60624e24d66d7bc601c0e51ae361beb88a4e6 Mon Sep 17 00:00:00 2001
From: Bert Belder <bertbelder@gmail.com>
Date: Fri, 13 Aug 2010 03:45:51 +0200
Subject: [PATCH] Implement process.title for cygwin
---
src/platform_cygwin.cc | 136 ++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 133 insertions(+), 3 deletions(-)
diff --git a/src/platform_cygwin.cc b/src/platform_cygwin.cc