Skip to content

Instantly share code, notes, and snippets.

@JerrySievert
JerrySievert / gist:973725
Created May 16, 2011 00:38
test for jsdom src attribute
env_with_src : function() {
var
html = "<html><body><p>hello world!</p></body></html>",
src = "window.attachedHere = 123";
jsdom.env({
html : html,
src : src,
done : function(errors, window) {
assertNull("error should not be null", errors);
@JerrySievert
JerrySievert / bug.css
Created May 20, 2011 21:55
stylus bug
table {
width: 600px;
}
table thead tr th {
text-align: center;
font-weight: bold;
}
table tbody tr:nth-child(odd) {
background-color: #fff;
}
@JerrySievert
JerrySievert / gist:1003522
Created June 1, 2011 22:32
buffer conversion node.js
node::Buffer *slowBuffer = node::Buffer::New(len);
memcpy(node::Buffer::Data(slowBuffer), get, len);
v8::Local<v8::Object> globalObj = v8::Context::GetCurrent()->Global();
v8::Local<v8::Function> bufferConstructor = v8::Local<v8::Function>::Cast(globalObj->Get(v8::String::New("Buffer")));
v8::Handle<v8::Value> constructorArgs[3] = { slowBuffer->handle_, v8::Integer::New(len), v8::Integer::New(0) };
v8::Local<v8::Object> actualBuffer = bufferConstructor->NewInstance(3, constructorArgs);
return scope.Close(actualBuffer);
@JerrySievert
JerrySievert / gist:1015588
Created June 8, 2011 22:24
simple node.js router
var url = require('url');
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
var parsed = url.parse(req.url, true);
var pathname = parsed.pathname;
res.end('Hello World, you asked for: ' + pathname + '\n');
}).listen(1337, "127.0.0.1");
@JerrySievert
JerrySievert / gist:1153126
Created August 18, 2011 02:06
coverage.json

coverage.json

Meta Data

Meta-data identifies the specifics of the coverage information, as well as the file versioning information.

{
  meta: {
    generator:       'vowsjs',

generated: 'Fri Aug 05 2011 22:45:56 GMT-0700 (PDT)',

@JerrySievert
JerrySievert / Makefile
Created September 23, 2011 16:56 — forked from utaal/Makefile
webserver using libuv
webserver: webserver.c libuv/uv.a http-parser/http_parser.o
gcc -I libuv/include \
-lrt -lm -lpthread -o \
webserver webserver.c \
libuv/uv.a http-parser/http_parser.o
libuv/uv.a:
$(MAKE) -C libuv
http-parser/http_parser.o:
@JerrySievert
JerrySievert / gist:1487512
Created December 16, 2011 19:21
testing eventreactor
jerry@Jerrys-MacBook-Air:~/work/node/eventreactor$ make test
✓ exports version number
✓ has event
✓ subscribe to every given event
✓ capture non listening events
✓ multiple event listeners
✓ idle fires callback
@JerrySievert
JerrySievert / jquery.partialReady.js
Created June 5, 2012 14:09 — forked from munro/jquery.partialReady.js
jquery.partialReady.js
/*jslint browser: true, nomen: true */
/*global jQuery, console */
(function ($) {
'use strict';
var timer, timer_delay = 250, next_id = 0, selectors = {};
/**
* Keep checking the DOM for new selectors
*/
@JerrySievert
JerrySievert / vows.js
Created July 4, 2012 18:05
vows alternative syntax
// vows requires access to the module in order to create exports
vows(module, {
'vows/subject test 1': {
'Should add and execute the first test': {
topic: function() {
return true;
},
'Validate the first time': function (testValue) {
assert.ok(testValue);
},
@JerrySievert
JerrySievert / gist:3119325
Created July 16, 2012 00:08
Working Node.js on Raspberry Pi
These instructions should be deprecated at this point.
Start following https://github.com/TooTallNate/node/tree/pi for a more straightforward node installation on the pi.
----
These instructions work for the Raspberry Pi running Raspbian (hard float), and include a working NPM:
1. Install Raspbian - http://www.raspbian.org/PiscesImages