- this
- bind
- Hoisting
- Operator Precedence
- Lambda
- Object literals
- Prototypical inheritance vs. classical inheritance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This template works for both image and non-image files. Image thumbnails are given respective step-name prefixes. | |
Original files are stored with the "original" prefix without the standard, annoying colon. | |
*/ | |
{ | |
"steps": { | |
"32x32": { | |
"use": ":original", | |
"robot": "/image/resize", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.when( | |
Products.recent(), | |
Sites.find() | |
).done(function(products,sites) { | |
res.render('products/index', { | |
title: 'Products', | |
products: products, | |
sites: sites | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Products = { | |
recent: function() { | |
var deferred = $.Deferred(); | |
config.mongo.connection.collection('products',function(error, collection) { | |
collection.find().sort({'modified':-1}).limit(20).toArray(function(err, products) { | |
if(err) | |
deferred.fail(err); | |
else | |
deferred.resolve(products); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var recursivePrune = function (obj,keyToRemove) { | |
if(typeof obj === "object" && obj instanceof Array) { | |
for(x = 0;x < obj.length;x++) { | |
obj[x] = this.recursivePrune(obj[x],keyToRemove); | |
} | |
} else if(typeof obj === "object") { | |
delete obj[keyToRemove]; | |
Object.getOwnPropertyNames(obj).forEach(function(property) { | |
obj[property] = recursivePrune(obj[property],keyToRemove); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getIDBSignature(name,callback) { | |
var request = window.indexedDB.open(name); | |
request.onsuccess = function(event) { | |
var x,db = event.target.result; | |
var objectStore,objectStores = []; | |
for(x = 0;x < db.objectStoreNames.length;x++) { | |
objectStores.push(db.objectStoreNames.item(x)); | |
} | |
var transaction = db.transaction(objectStores, "readonly"); | |
objectStores = objectStores.map(function(objectStoreName) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
grunt.initConfig({ | |
clean: ['public/js/'], | |
type: { | |
'default': { | |
files: [ | |
{ | |
src: 'public/ts/app.ts', | |
dest: 'public/js/app.js' | |
} |
- Sublime Text
- MadEye (Remote pair programming)
- JSHint
- Grunt
- uglify
- clean
- ccsmin
- concat
- Server as seed and broker
- Routes, web components
- One MVC? Nah.
- Model synchronization
- Peer synchronization
- Trusted peers
- IndexedDB