View gist:5967554
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 | |
{@html:Template { | |
id: "fareFamilies", | |
type:"div", | |
classpath: "my.path.Template" | |
}/} | |
// aria | |
{@aria:Template { | |
id : "fareFamilies", | |
defaultTemplate : "my.path.Template" |
View InstantTemplate.tpl
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
{macro main()} | |
<h1>Hello Instant Aria Templates !!!!</h1> | |
{/macro} |
View birthday-problem.js
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
// PARADOX ! Inception-style | |
var paradox = function(setSize,p){ | |
Math.sqrt(2*setSize*Math.log(1/(1-p))) | |
}; | |
// So that's the generic formula. | |
// Applied to the usual "over 50% of prob to have 2 people with the same birthday" | |
paradox(365, 0.5); // => 22.49 |
View cheap-partials.js
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
// SUPER CHEAP TEMPLATES ! | |
window.loadCheapPartial = function (event) { | |
var iframe=event.target || event.srcElement, div=document.createElement("div"); | |
// using contentWindow.document instead of contentDocument for ie6/7 compatibility | |
div.innerHTML = iframe.contentWindow.document.body.innerHTML; | |
if (div.children.length == 1) div = div.children[0]; | |
iframe.parentNode.replaceChild(div, iframe); | |
}; |
View DebugMacros.tpl
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
// Log any object in the console | |
{macro _log(obj)} | |
${(function(){console.log(obj)})()} | |
{/macro} | |
// create a section with a one-liner : {call _section("mysection", "boundvalue", "div")/} | |
{macro _section(id, bindings, type, css)} | |
{var _gb = null /} | |
${(function(){_gb=function(b){return {inside:data,to:b}}})()} |
View the-one-bookmarklet.js
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 () { | |
/** | |
* Adapted from http://ted.mielczarek.org/code/mozilla/bookmarklet.html | |
*/ | |
//***************************************************************************** | |
// Do not remove this notice. | |
// | |
// Copyright 2001 by Mike Hall. |
View getpath.js
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
module.exports = function (object, path) { | |
var parts = path.split ? path.split(".") : path; | |
try { | |
var node = object; | |
parts.forEach(function (part) { | |
node = node[part]; | |
}); | |
return node; | |
} catch (e) { |
View gist:a9e9ba1ab8229653109c
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
hg up fx-team | |
hg pull -u fx-team | |
hg up my-feature | |
hg rebase -d fx-team |
View gist:f37cca34f1e1e574a1fd
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
[[1,2],[3,4],[5,6]].reduce(function (previous, n) { | |
return previous.concat(n) | |
}, []) |
View gist:2a27b98ed5ba5d22a392
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://lorempixel.com/640/480/abstract/ |
OlderNewer