Posts

Showing posts from March, 2012

yo

hey, we're back from tour.... and we're going out again real soon. check the side for new dates matador 7" comes out in may we're starting a new full length before that happens see you out there, mark

TONIGHT IN AUSTIN

Image

On Obtrusive Polyfills

Image
I'll try to make the point short and simple, starting with the tl;dr version: if you create a polyfill and during features detection you realize this cannot work, drop it and let other libs deal with it. Broken Object.defineProperty This is just one case really annoying. Bear in mind I am not talking about " making perfect polyfills ", this is almost impossible most of the case, I am talking about broken runtime even if you did not really do anything that special. It was the case of Object.defineProperty shimmed through es5-shim code ... this library is good but that method, as many others, are simply broken. I was trying to add a setter/getter in IE < 9 and shit happened, more specifically a thrown exception happened ... the repository itself explains that this method and others should fail silently ... so it's OK for the developer to know about it and avoid trusting these methods ... This Is Not OK If I check if Object.defineProperty is there and this is al

A Tweet Sized Queue System

The Code This is the 138 bytes version: function Queue(args, f) { setTimeout(args.next = function next() { return (f = args.shift()) ? !!f(args) || !0 : !1; }, 0); return args; } While this is the 96 one: function Queue(a,b){setTimeout(a.next=function(){return(b=a.shift())?!!b(a)||!0:!1},0);return a} The Why In almost every QCon London talk I have heard the word asynchronous . Well, the aim of the tweet sized function I have just written above is to make things easier. After I have implemented builder/JSBuilder.js for wru , so that Python is not needed anymore to build the tiny library, I needed to make builder/build.js usable in a way that asynchronous calls through node won't bother, at least visually, the normal flow of the script. After that I have thought: " why not making a generic Queue function with Promises like approach " ? The What It's quite straight forward, you create a queue, you use the queue. You might eventually pollute the queue or chang

I Heard You Like To Write Less

Update apparently this proposal is being considered in es-discuss ... not the implicit return so far but the " redundant " function keyword. This is last draft from Brendan Eich: FunctionDeclaration: function Identifier ( FormalParameterList_opt ) { FunctionBody } Identifier ( FormalParameterList_opt ) [no LineTerminator here] { FunctionBody } ShortFunctionExpression: Identifier_opt ( FormalParameterList_opt ) [no LineTerminator here] { FunctionBody } Identifier_opt ( FormalParameterList_opt ) => InitialValue I'm @qconlondon waiting for the next talk so I decided to take a couple of minutes to blog about this little experiment. In ES-Discuss developers are still talking about function keyword, if it's needed or not. I believe the fact CoffeeScript has no explicit function is one of the major reasons devs have been attracted so I made it even simpler. Just Drop The Function With current ES 3, 5, or 5.1 syntax I can't really see problems or ambigui

What's localStorage About

I've read even too many articles recently talking about storing anything you want in the localStorage ... and I believe this is wrong in so many levels. First of all, localStorage is not a database , 'cause if you consider it a database you should have considered a database document.cookie before ... As Simple As That document.cookie has been there, problematic as it is, since ever.The limit of this technique has always been the 2Mb on average across different browsers. Have you ever asked yourself what the hell is document.cookie doing and how comes it's instantly available? Well, it's about storing some stuff in your hard disk or your browser (SQLite) database, so that every single request will send this file loads of key/values pairs through the HTTP request. The side effect of this technique is that more you pollute cookies in your site to remember stuff, the more the interaction will be slower, specially on mobile, since all these info have to be sent to the se