Skip to content

Instantly share code, notes, and snippets.

var azure = require ('azure')
, http = require ('http')
, conf = require ('/conf');
var blobService = azure.createBlobService(conf.azure.storageAccount, conf.azure.storageAccessKey);
http.get( 'http://1800hocking.files.wordpress.com/2011/07/hi-ohio-logo.jpg', function( response ) {
var contentLength = Number(response.headers['content-length']);
@svmehta
svmehta / gist:3835969
Created October 4, 2012 19:50
mongoose atomicity question
// add comment function
function addComment(req, res) {
PostModel.findById(req.params.postId, function (err, foundPost) {
if(err) {
return handleError(err)
}
var commentObj = {
user: req.session.userId,
@svmehta
svmehta / gist:3112810
Created July 14, 2012 19:12
file walk
def list(path: String): Future[Seq[File]] = {
val files = new java.io.File(path).listFiles.filter(a => !a.isHidden())
Future.value(files.toSeq)
}
def walk(path: String): Future[Seq[File]] = {
list(path) flatMap { entries =>
val children: Seq[Future[Seq[File]]] = entries map { entry => {
if (entry.isDirectory)