This file contains 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
alert("test"); |
This file contains 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 books = ["Ender's Game", "The Hobbit", "The Alliance"]; | |
books.splice(1,1); | |
console.log(books); | |
//["Ender's Game", "The Alliance"] |
This file contains 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 nestCollection(model, attributeName, nestedCollection) { | |
//setup nested references | |
for (var i = 0; i < nestedCollection.length; i++) { | |
model.attributes[attributeName][i] = nestedCollection.at(i).attributes; | |
} | |
//create empty arrays if none | |
nestedCollection.bind('add', function (initiative) { | |
if (!model.get(attributeName)) { | |
model.attributes[attributeName] = []; |
This file contains 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
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
// requestAnimationFrame polyfill by Erik Möller | |
// fixes from Paul Irish and Tino Zijdel | |
(function() { | |
var lastTime = 0; | |
var vendors = ['ms', 'moz', 'webkit', 'o']; | |
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { |
This file contains 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 npm = require('npm'); | |
npmInstall(['http://dl.dropbox.com/u/3098507/sample.tar.gz'], function () { | |
console.log('yay'); | |
}); | |
/* | |
programmatically install some libs with npm | |
working in OSX but not windows | |
*/ | |
function npmInstall(libs, callback){ |
This file contains 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
/* Micro ClearFix Mixin */ | |
.clearfix{ | |
zoom:1; | |
&:before, &:after{ content:""; display:table; } | |
&:after{ clear: both; } | |
} |
This file contains 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
body{ | |
background: orange; | |
} |
This file contains 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
{ | |
"bg" : "purple", | |
"spacing" : 0, | |
"gutter" : "10px", | |
"queries": { | |
"small": "screen and (min-width:1px) and (max-width:400px)", | |
"large": "screen and (min-width:1501px)" | |
}, | |
"animate": { | |
"special": { |
This file contains 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 http = require('http'); | |
var fs = require('fs'); | |
var zlib = require('zlib'); | |
http.createServer(function (req, res) { | |
// var img = fs.readFileSync('./bird.jpg'); | |
var img = fs.createReadStream('./public/bird.jpg'); | |
// res.writeHead(200, {'Content-Type': 'image/jpeg'}); | |
res.writeHead(200, { 'content-encoding': 'gzip' }); |
This file contains 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 express = require('express'); | |
var connect = require('connect'); | |
var zlib = require('zlib'); | |
var fs = require('fs'); | |
var app = express(); | |
var compressOptions = { | |
filter: function(req, res) { | |
return /json|text|xml|javascript/.test(res.getHeader('Content-Type')) | |
} |
OlderNewer