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
/** | |
* by default __defineGetter__ support only one function. Same for __defineSetter | |
* This is a annoying limitation. This little library declares 2 functions | |
* Object.__defineQGetter__ and Object.__defineQGetter__. | |
* They behave the same as their native sibling but support multiple functions. | |
* Those functions are called in the same order they got registered. | |
* | |
* (I have no idea of the reasoning behind this limitation to one function. It seems | |
* useless to me. This remind me of onclick of the DOM instead of a proper .addEventListener) | |
*/ |
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
/** | |
* A console.assert which actually stop the exectution. | |
* default console.assert() is a plain display, such as console.log() or console.error(); | |
* It doesnt stop the execution like assert() is meant to do. This is a little code to | |
* "workaround this limitation" :) thanks @jensarp | |
* | |
* Usage: | |
* console.assert(foo === bar); // Will throw if not equal | |
* console.assert(foo === bar, 'Dude, foo does not equal bar'); // Will throw with custom error message | |
* |
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
<!-- formatting fun #1: tables! --> | |
<!-- use whitespace to mimic the layout you want. leave off optional end tags for readability --> | |
<table> | |
<caption>Selector engines, parse direction</caption> | |
<thead> | |
<tr><th>Left to right <th>Right to left | |
<tbody> | |
<tr><td>Mootools <td>Sizzle |
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
<!DOCTYPE HTML> | |
<html lang="en"> | |
<head> | |
<title>three.js canvas - geometry - cube</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/> | |
<style type="text/css"> | |
body { | |
background-color: #f0f0f0; | |
margin: 0px; |
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(exports){ | |
/** | |
* Insert http://jsconsole.org in the page | |
*/ | |
exports.jsconsoleInsert = function(id){ | |
if( !!navigator.userAgent.match(/iPod/) || !!navigator.userAgent.match(/iPad/) ){ | |
document.write(unescape("%3Cscript src='http://jsconsole.com/remote.js?"+id+"' type='text/javascript'%3E%3C/script%3E")); | |
} | |
} | |
})(this); |
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
// attempts to get flash/session accessible in any template | |
// - this middleware function fails and keep producing 'Error: req.flash() requires sessions' | |
// - this middleware has been place *after* session middleware in the stack | |
app.use(function(req,res, next){ | |
console.log("flash middleware") | |
res.locals({ | |
session : req.session, | |
flash : req.flash() | |
}); | |
}); |
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
// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
// shim layer with setTimeout fallback | |
(function(){ | |
window.requestAnimFrame = (function(){ | |
return window.requestAnimationFrame || | |
window.webkitRequestAnimationFrame || | |
window.mozRequestAnimationFrame || |
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
/** | |
* Provides requestAnimationFrame in a cross browser way. | |
* http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
*/ | |
if ( !window.requestAnimationFrame ) { | |
window.requestAnimationFrame = ( function() { | |
return window.webkitRequestAnimationFrame || |
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
<html> | |
<body> | |
<p> | |
sdfsdf | |
</p> | |
</body> | |
</html> |
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
try { | |
var webGlSupport = !!window.WebGLRenderingContext && !!document.createElement('canvas').getContext('experimental-webgl'); | |
}catch(e){ | |
var webGlSupport = false; | |
} | |
console.log("webglSupport", webGlSupport); |