Skip to content

Instantly share code, notes, and snippets.

View davej's full-sized avatar
💭
Working on @ToDesktop

Dave Jeffery davej

💭
Working on @ToDesktop
View GitHub Profile
@masylum
masylum / s3upload.js
Created December 19, 2010 17:48
Upload files directly to s3
function upload (req, res) {
var Formidable = require('formidable'),
form = new Formidable.IncomingForm();
form.encoding = 'utf-8';
form.onPart = function (part) {
if (!part.filename) {
form.handlePart(part);
} else {
(function () {
@HenrikJoreteg
HenrikJoreteg / JS Util solution using underscore.js
Created October 22, 2010 21:20
Rather than creating some other util global, just extend underscore.js with any additional methods you want.
// If you don't use underscore.js, use it (http://documentcloud.github.com/underscore/)
// Then, use underscore's mixin method to extend it with all your other utility methods
// like so:
_.mixin({
escapeHtml: function () {
return this.replace(/&/g,'&')
.replace(/>/g,'>')
.replace(/</g,'&lt;')
.replace(/"/g,'&quot;')
.replace(/'/g,'&#39;');
@tanepiper
tanepiper / twitter_oauth_getter.js
Created September 11, 2010 16:14
A small command line nodejs script for doing Twitter OAuth.
#!/usr/bin/env node
var argv = require('optimist')
.usage('Usage: --key=[consumer key] -secret=[consumer secret]')
.demand(['key', 'secret'])
.argv
;
var OAuth = require('oauth').OAuth;
var Step = require('step');