Skip to content

Instantly share code, notes, and snippets.

View fictorial's full-sized avatar

Brian Hammond fictorial

View GitHub Profile
var qmarkRE = /\?/g;
var starRE = /\*/g;
var dotRE = /\./g;
sys=require('sys')
function fnmatch (pattern, test) {
var newPattern = pattern.replace(dotRE, '(\\.)')
.replace(qmarkRE, '(.)')
.replace(starRE, '(.*?)');
⚡ node test.js
The 'tcp' module is now called 'net'. Otherwise it should have a similar interface.
DEBUG:
DEBUG: Testing SETANDGETMULTIBYTE
DEBUG: =========================================
DEBUG: [SEND] *2<CRLF>$6<CRLF>SELECT<CRLF>$2<CRLF>14<CRLF>
DEBUG: [SEND] *1<CRLF>$7<CRLF>FLUSHDB<CRLF>
DEBUG: [SEND] *2<CRLF>$6<CRLF>SELECT<CRLF>$2<CRLF>15<CRLF>
DEBUG: [SEND] *1<CRLF>$7<CRLF>FLUSHDB<CRLF>
DEBUG: [SEND] *3<CRLF>$3<CRLF>SET<CRLF>$3<CRLF>uni<CRLF>$1<CRLF>ö<CRLF>
Buffer=require('buffer').Buffer;
b=new Buffer(1);
b[0] = 0xFF; // What does this call?
// This is a fully interruptable, binary-safe Redis reply parser for Node.js.
// TODO remove debugging statements
var sys = require('sys');
var Buffer = require('buffer').Buffer;
var PLUS = exports.PLUS = 0x2B; // +
var MINUS = exports.MINUS = 0x2D; // -
var DOLLAR = exports.DOLLAR = 0x24; // $
var STAR = exports.STAR = 0x2A; // *
function testSETANDGETMULTIBYTE() {
var testValue = '\u00F6\u65E5\u672C\u8A9E'; // ö日本語
var buffer = new Buffer(32);
var size = buffer.utf8Write(testValue);
client.set('testUtf8Key', buffer.slice(0,size), expectOK("testSETANDGETMULTIBYTE"))
client.get('testUtf8Key', function (err, value) {
if (err) assert.fail(err, "testSETANDGETMULTIBYTE");
sys.debug("size="+size+"; value.length="+value.length+"; testValue.length="+testValue.length);
checkEqual(value.utf8Slice(0, value.length), testValue, "testSETANDGETMULTIBYTE");
bytes written to buffer: 12
AssertionError: "\u00f6\u65e5\u672c\u8a9e" == "\u00f6\u65e5\u672c\u8a9e\u0000"
at Object.<anonymous> (/tmp/utf8slice.js:10:8)
at Module._compile (node.js:704:23)
at node.js:732:20
at fs:51:23
at node.js:813:9
We couldn’t find that file to show.
DEBUG: [TCP] listening 127.0.0.1:8080
DEBUG: [TCP] client connection from 127.0.0.1
IOWatcher.callback (net:329:16)
node.js:814:9
~/projects/node-red(master) ⚡ ./bin/start
OK
(integer) 1
DEBUG: NodeRed version 0.0.7
DEBUG: [CONTROLLER] loading transport: tcp
DEBUG: [CONTROLLER] transport tcp: {"name":"tcp","version":"0.0.1"}
DEBUG: [DISPATCH] loading request handlers
DEBUG: [DISPATCH] handler group 'builtin' supports request WHO
DEBUG: [DISPATCH] handler group 'builtin' supports request INFO
DEBUG: [DISPATCH] handler group 'builtin' supports request SUBSCRIBE
~/projects/node-red(master) ⚡ ack throw
bin/nodered
64- redisClients[0].hset('nr:nodes:' + NODE_NAME, 'version', NODERED_VERSION,
65: throwOnRedisError);
66-
--
68- redisClients[0].hset('nr:nodes:' + NODE_NAME, 'upSince', now,
69: throwOnRedisError);
70-
71- redisClients[0].hset('nr:nodes:' + NODE_NAME, 'clientCount', '0',