This is an excerpt from an interview that I had recently.
Just wanted to share.
Volkan
Since how long do you develop for the web ? Front-end or Back-end?
// This... | |
exports.find = function(queue, query, callback) { | |
switch(queue) { | |
case 'today': | |
return callback(null, { | |
query: query, | |
realm: 'today', | |
goals: privates.getTodayGoals(query) | |
}); |
<begin:braindump> | |
http://bonsaiden.github.io/JavaScript-Garden/ | |
http://www.jblotus.com/2013/01/13/common-javascript-gotchas/ | |
http://www.adequatelygood.com/JavaScript-Module-Pattern-In-Depth.html | |
http://singlepageappbook.com/single-page.html | |
http://www.codethinked.com/preparing-yourself-for-modern-javascript-development | |
http://www.html5rocks.com/en/ | |
http://sporto.github.io/blog/2012/12/09/callbacks-listeners-promises/ | |
https://gist.github.com/desandro/4686136 | |
http://msdn.microsoft.com/en-us/magazine/ff852808.aspx |
var methods = ['log', 'warn'], i, len, old; | |
for (i = 0, len = methods.length; i < len; i++){ | |
old = console[methods[i]]; | |
console[methods[i]] = function() { | |
var stack = (new Error()).stack.split(/\n/); | |
if (stack[0].indexOf('Error') === 0) {stack = stack.slice(1);} | |
function maybe(obj, path, defaultValue) { | |
if (obj == null) {return undefined;} | |
var reduced = path.split('.').reduce(function(memo, attr) { | |
if (memo == null) {return undefined;} | |
return memo[attr]; | |
}, obj); | |
return reduced === undefined ? defaultValue : reduced; |
var app = require('express')(), | |
server = require('http').Server(app), | |
io = require('engine.io').attach(server); | |
// Use this middleware to workaround "Access-Control-Allow-Origin" errors on the client. | |
app.use(function (req, res, next) { | |
res.setHeader('Access-Control-Allow-Origin', "http://theWebsiteThatOpensSocketConnection.com"); | |
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE'); | |
res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type'); | |
res.setHeader('Access-Control-Allow-Credentials', 'true'); |
This is an excerpt from an interview that I had recently.
Just wanted to share.
Volkan
Since how long do you develop for the web ? Front-end or Back-end?
" ----------------------------------------------------------------------------- | |
" Almost 99% Based on gruvbox.vim | |
" Description: Retro groove color scheme for Vim | |
" Author: morhetz <morhetz@gmail.com> | |
" Source: https://github.com/morhetz/gruvbox | |
" ----------------------------------------------------------------------------- | |
" Supporting code ------------------------------------------------------------- | |
" Initialisation: {{{ |
Caveat
The tables in this cheatsheet only make sense after you study all thes mentioned data structures and algorithms below.
Do not memorize them, learn how the underlying algorithms work, read the source.
This cheat sheet is just a quick reference to give an broad brush strokes overview of how the most frequently-used data structures and algorithms relate to each other, in terms of time and space complexity.
// ---------------------------------------------------------------------------- | |
// File: PROJECT_ROOT/ ... / servers/app1/app.js | |
// Define this **before** all the `require`s. | |
function initRekuire(baseDir, appDir) { | |
var base = baseDir || '.', | |
app == appDir || '.'; | |
global.rekuire = function(name) { | |
return require( |
// ## Every console needs a WTF prompt. | |
// Method: | |
console.wtf = function() { | |
console.warn.apply(console, | |
['(W)hat a (T)errible (F)ailure »» '].concat( | |
Array.prototoype.slice.call(arguments) | |
) | |
); | |
}; |