Dropbox (raw)
This is a basic Dropbox clone to sync files across multiple remote folders.
Time spent: <Number of hours spent>
// 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) |
// @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 | |
// } |
This is a basic Dropbox clone to sync files across multiple remote folders.
Time spent: <Number of hours spent>
async()=>{ | |
// Pointless calling await because crypto.pbkdf2 returns nothing | |
await crypto.pbkdf2('asdf', 'salt', 4096, 512, 'sha256', function(err, key) { | |
if (err) throw err | |
user.password = key.toString('hex') | |
console.log(user.password) | |
// return key.toString('hex') // 'c5e478d...1469e50' | |
}) | |
This is a Proxy Server for Node.js submitted as the pre-work requirement for CodePath.
Time spent: [Write the number of hours you spend here]
Completed:
8000
are echoed back with the same HTTP headers and body// NOT AN APPLICATION, I JUST WANTED TO TAKE YOUR TEST. =) | |
// 1: how could you rewrite the following to make it shorter? | |
if (foo) { | |
bar.doSomething(el); | |
} else { | |
bar.doSomethingElse(el); | |
} | |
// ANSWER |
// Class.extend takes a function that returns the options object | |
// it is passed the accessor function generated in the Pvt.js example above | |
var Person = Class.extend(function(pvt) { | |
// private static member | |
var species = "Homo sapien"; | |
return { | |
init: function(isDancing) { | |
// pvt(this).invisible === undefined |
// Utilize a closure to keep the private members private | |
var Person = (function() { | |
// Generate a private instance member accessor function "pvt" | |
var pvt = Pvt(), | |
// private static member | |
species = "Homo sapien"; | |
var Self = function(isDancing) { |
// Public | |
function Constructor(...) { | |
this.membername = value; | |
} | |
Constructor.prototype.membername = value; | |
// Private | |
function Constructor(...) { | |
var that = this; | |
var membername = value; |