Skip to content

Instantly share code, notes, and snippets.

View tim-smart's full-sized avatar

Tim tim-smart

View GitHub Profile
var events = require('events');
var Queue = function () {
var self = this;
this.array = Array.prototype.slice.call(arguments);
this.offset = 0;
this.lock = false;
this.process = function () {
// Do some processing here...
@tim-smart
tim-smart / go.js
Created October 21, 2010 04:41 — forked from cainiac/go.js
function executeEventQueue() {
eventEmitter.emit(LISTENERS.executeApplicationEvents);
process.nextTick(executeEventQueue);
}
executeEventQueue();
Buffer.prototype.view = Buffer.prototype.slice;
Buffer.prototype.slice = function (start, end) {
var buffer = new Buffer(end - start);
this.copy(buffer, 0, start, end);
return buffer;
};
#include <v8.h>
using namespace v8;
static Handle<Value> Do (const Arguments &args) {
HandleScope scope;
Local<Function> callback = Local<Function>::Cast(args[0]);
callback->Call(Context::GetCurrent()->Global(), 0, NULL);
diff --git a/lib/buffer.js b/lib/buffer.js
index ecb25b7..f4d03bb 100644
--- a/lib/buffer.js
+++ b/lib/buffer.js
@@ -328,3 +328,18 @@ Buffer.prototype.slice = function (start, end) {
return new Buffer(this.parent, end - start, +start + this.offset);
};
+
+// indexOf(code|char, start, end)
#include <v8.h>
#include <string.h>
#include <node_buffer.h>
using namespace v8;
using namespace node;
static Handle<Value> FindDelimiter (const Arguments &args) {
HandleScope scope;
#include <v8.h>
#include <node_buffer.h>
using namespace v8;
using namespace node;
static Handle<Value> FindDelimiter (const Arguments &args) {
HandleScope scope;
Local<Object> buffer_obj = args[0]->ToObject();
#include <v8.h>
#include <node_buffer.h>
#include <string.h>
#include <stdio.h>
using namespace v8;
using namespace node;
static unsigned int pos = 0;
var orm = require('biggie-orm');
orm.connect();
var Deck = orm.model('Deck', {
name: {type: 'string'},
has_many: ['slides'],
indexes: ['name']
});
#!/usr/bin/env node
var stdin = process.openStdin(),
path = require('path'),
code = '';
__dirname = process.cwd();
__filename = 'stdin';
module.filename = path.join(__dirname, __filename);