Skip to content

Instantly share code, notes, and snippets.

View natevw's full-sized avatar

Nathan Vander Wilt natevw

View GitHub Profile
@creationix
creationix / jsonparse.js
Created February 13, 2012 23:20
event-only version of jsonparse
// Named constants with unique integer values
var C = {};
// Tokenizer States
var START = C.START = 0x11;
var TRUE1 = C.TRUE1 = 0x21;
var TRUE2 = C.TRUE2 = 0x22;
var TRUE3 = C.TRUE3 = 0x23;
var FALSE1 = C.FALSE1 = 0x31;
var FALSE2 = C.FALSE2 = 0x32;
var FALSE3 = C.FALSE3 = 0x33;
@stolsma
stolsma / example.js
Created September 20, 2011 14:47
Downgrade process after connecting to port 80
app.listen(process.env.NODE_ENV === 'production' ? 80 : 8000, function() {
console.log('Ready');
// if run as root, downgrade to the owner of this file
if (process.getuid() === 0)
require('fs').stat(__filename, function(err, stats) {
if (err) return console.log(err)
process.setuid(stats.uid);
});
});
@kabturek
kabturek / pins_arduino.c
Created July 14, 2011 10:37
Arduino port mapping with additional pins PB6 & PB7
const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
PD, /* 0 */
PD,
PD,
PD,
PD,
PD,
PD,
PD,
PB, /* 8 */