Skip to content

Instantly share code, notes, and snippets.

@DavidBruant
DavidBruant / newOperator.js
Created November 28, 2011 13:32 — forked from jed/newOperator.js
an attempt to make the new operator dynamically invokeable
// Requires a native Function.prototype.bind (IE9+, FF4+, Chrome, Opera 12, no Safari)
function newOperator(constructor, args) {
var params = [undefined].concat(args)
var cst = Function.prototype.bind.apply(constructor, params);
return new cst();
}
@DavidBruant
DavidBruant / timerj-review.md
Created November 28, 2012 15:01 — forked from julienw/timerj-review.md
code review de timerjs

j'ai juste regardé l'API pour l'instant, j'ai quelques remarques déjà là-dessus, je regarderai le code plus tard.

  • l'argument à "play" est pas clair. Je pense que tu peux faire une configuration fluide du style :

timer.speed(2).play(); ou même timer.play().speed(2); ou timer.speed(2); timer.play();

@DavidBruant
DavidBruant / rendering_templates_obsolete.md
Created December 5, 2012 11:23 — forked from jed/rendering_templates_obsolete.md
Rendering templates obsolete

(tl;dr DOM builders like [domo][domo] trump HTML templates on the client.)

Like all web developers, I've used a lot of template engines. Like most, I've also written a few of them, some of which even [fit in a tweet][140].

The first open-source code I ever wrote was also one of the the first template engines for node.js, [a port][node-tmpl] of the mother of all JavaScript template engines, [John Resig][jresig]'s [micro-templates][tmpl]. Of course, these days you can't swing a dead cat without hitting a template engine; one in eight packages on npm ([2,220][npm templates] of 16,226 as of 10/19) involve templates.

John's implementation has since evolved and [lives on in Underscore.js][underscore], which means it's the default choice for templating in Backbone.js. And for a while, it's all I would ever use when building a client-side app.

But I can't really see the value in client-side HTML templates anymore.

// ==UserScript==
// @name defer/async for Opera
// @namespace http://d.hatena.ne.jp/edvakf/
// @license Public Domain
// ==/UserScript==
(function(window, document, opera) {
function load_script(script, attr) {
return function() {
var script2 = script.cloneNode(true);
/*
* Copyright (c) 2010 Tobias Schneider
* This script is freely distributable under the terms of the MIT license.
*/
(function(){
var UPC_SET = {
"3211": '0',
"2221": '1',
"2122": '2',