Dropbox (raw)
This is a basic Dropbox clone to sync files across multiple remote folders.
Time spent: <Number of hours spent>
This is a basic Dropbox clone to sync files across multiple remote folders.
Time spent: <Number of hours spent>
{ | |
"env": { | |
"node": true, | |
"es6": true | |
}, | |
"parser": "babel-eslint", | |
"rules": { | |
"no-throw-literal": 1, | |
"strict": "never", | |
"semi": [2, "never"], |
// @flow weak | |
/* jshint ignore:start */ | |
declare module 'http' { | |
declare function createServer(callback: (req: httpIncomingMessage, res: httpServerResponse) => void): httpServer | |
} | |
// declare class http { | |
// createServer(callback: (req: httpIncomingMessage, res: httpServerResponse) => void): httpServer | |
// } |
(aka "errback" or "error first callback")
// List all files recursively within a directory with maximum parallelism | |
"use strict"; | |
let path = require('path') | |
let fs = require('fs') | |
let co = require('co') | |
let _ = require('lodash') | |
Function.prototype.partial = function() { | |
var args = Array.prototype.slice.call(arguments) | |
args.unshift(null) |
What: Breakfast for south bay enterprise node.js leaders | |
When: 8-9:30am, Friday, January 24 | |
Where: | |
2029 Stierlin Ct | |
Mountain View, CA 94043 | |
Why: To regularly meet to discuss enterprise node.js concerns and encourage increased community in the south bay. |
function bar() { | |
return function(cb) { | |
throw new Error('asdf') | |
setImmediate(function() { | |
cb() | |
}) | |
} | |
} | |
function* foo() { |
function* foo() { | |
// Parallel calls with no helper lib | |
var paths = ['A.js', 'B.js'] | |
var group = [] | |
for (path in paths) { | |
group.push(fs.readFile(path)) | |
} | |
var files = yield group | |
// Serial calls |
var fs = require('fs') | |
var $$ = require('$$') | |
$$(function*($) { | |
var fileNames = ['A.txt', 'B.txt', 'C.txt', 'D.txt'] | |
for (fileName in fileNames) { | |
$(fs.readFile(fileName)) | |
} | |
var fileDataArray = yield | |
}) |
// Load the http module | |
var http = require('http'); | |
// Setup a HTTP server, listen on port 8080 | |
http.createServer(function (req, res) { | |
res.writeHead(200, { | |
'Content-Type': 'text/plain' | |
}); | |
res.end('Hello World'); | |
}).listen(8080, '127.0.0.1'); |