Skip to content

Instantly share code, notes, and snippets.

View alexbosworth's full-sized avatar

Alex Bosworth alexbosworth

View GitHub Profile
@alexbosworth
alexbosworth / amazon-sdb.js
Created October 13, 2010 10:14
An AWS SimpleDb library
/*
* Alex Bosworth
*
* A straightforward S3 library
*
* USE: var s3 = new S3(AWS_KEY, AWS_SECRET, {defaultBucket : MY_BUCKET});
* s3.put(KEY, {data:{},headers:{}}, [bucket]);
* s3.get(KEY, [bucket]).on('success', function(data) { console.log(data); });
* (more operations: buckets, info, list)
*
@alexbosworth
alexbosworth / end_script_timer.js
Created October 7, 2010 06:21
a runtime calculator for scripts
// for node-jquery.js (http://gist.github.com/599831)
// add this to a script to show how long it took to complete
process.on('exit', $.proxy(function () {
var sec = Math.round((new Date().getTime() - this.start.getTime()) / 1000);
console.log('completed', 'in ' + sec + ' seconds');
}, {start:new Date()}));
@alexbosworth
alexbosworth / amazon-s3.js
Created September 27, 2010 21:21
A straightforward S3 library
/*
* Alex Bosworth
*
* A straightforward S3 library
*
* USE: var s3 = new S3(AWS_KEY, AWS_SECRET, {defaultBucket : MY_BUCKET});
* s3.put(KEY, DATA);
* s3.get(KEY).on('success', function(data) { console.log(data); });
* (more operations: buckets, info, list)
*
@alexbosworth
alexbosworth / node-jquery.js
Created September 27, 2010 21:05
A port of jQuery to Node.js (required for all my other scripts)
// node-jquery - port of jquery 1.4.2 (http://jquery.com/)to node.js by alex bosworth (http://alexbosworth.net/)
function now() {
return (new Date).getTime();
}
var window = {},
jsc = now(),
rscript = /<script(.|\s)*?\/script>/gi,
rselectTextarea = /select|textarea/i,