Posts
Showing posts from February, 2012
JavaScript Test Framewors: more than 30 + 1
- Get link
- X
- Other Apps
After @szafranek hint and suggestion, wru landed almost at the end of this Wikipedia List of unit testing frameworks page. If you use this tweet size hand made imperfect script in the wikipedia page console: a=q="querySelectorAll",[].map.call(document[q](".mw-headline,.wikitable"),function(v,i){i%2?a=v.textContent:o[a]=v[q]("tr").length},o={}),o You gonna see that JavaScript is third when it comes to number of test frameworks ... and not sure that's good, anyway, here a quick description of mine. About wru You can find most info in github page itself but essentially wru is a generic purpose, environment agnostic, JavaScript tests framework compatible with both client and server, where client means every bloody browser, and server means Rhino, node.js, and recently phantom.js too. To be really fair, wru is not exactly a unit test framework since it does not provide by default anything related to mocks or stubs. However, wru is so tiny and unobtru...
If You Don't Get It, Go And Get It!
- Get link
- X
- Other Apps
Oh well, a rant against another one ... how lovely is this? Just trying to make your week end, right? I am talking about this misleading post with indeed 29530+ views and just 1 Favorited entry (right now) that must be the post author itself since I can't even check and click that red link ... anyway ... At the very beginning I thought that was a sarcastic post .. like, the opposite of reality, then I have realized it wasn't ... or was it? V8 is not server-class ? Define "server class programming language" first ... 'cause I have tried to search it in Google (with quotes) and result was like a single entry that indeed pointed to some Java stuff ... This argument is kinda boring in 2012, specially against a general purpose programming language as JS is, you don't say? I mean, doooooode, should I remind you the Java Applet joke early in the Web era? So it was fine for a server-class programming language to do client side stuff? Or it's just a matter of ...
JSON.stringify Recursion + Max Execution Stack Exceeded
- Get link
- X
- Other Apps
I believe this is a common problem, and we had a similar one today while debugging. JSON methods do not support recursion ... which is the only thing I am really missing back to PHP serialize days. Recursion Is Bad Well, I would say cyclic references are never that good but sometimes these may happen and, specially while testing and debugging, it's more than useful to understand what happened there. If you have cyclic/cross references in your code I suggest you to use approaches which aim is to avoid these kind of direct links. Harmony Collections , specially Map and WeakMap, are indeed good helpers to reference indirectly objects without creating, hopefully, first level links and/or recursions. How To Serialize Anyway JSON.stringify() accepts a second argument called replacer . I won't explain more than MDN about its potentials, but it can be really handy to avoid recursions. A simple way to do it is indeed to store in a stack already parsed objects, included the object itse...
Web Workers - Current Status
- Get link
- X
- Other Apps
A quick one about workers after few tests. Mobile Workers are apparently nowhere in Android devices stock browsers. The only one able to bring workers seems to be Chrome in ICS. As alternative, both Opera Mobile and Firefox Beta work without many problems. About iOS , version 4 does not support workers while version 5 does and quite well. Desktop and Data URI Workers are almost fine everywhere except IE9 ( surpriiiiiiiiiise ) but there is one thing not a single browser does except again Firefox and Opera, accepting " data:application/javascript; " with or without base64 encoded code. On mobile side this is supported again by Opera Mobile and Firefox Beta without problems but on desktop, and not only ... Safari works only with external files while inline data uri are supported only via file protocol WebKit nightly does not support inline data uri even through File protocol Chrome does not support inline data uri neither via file protocol nor online Safari Mobile does not ...
JS1K - Markdown
- Get link
- X
- Other Apps
Well, it does not look that good in the js1k page , so here the link to the official demo hosted by my site . Check the source code there, the page is entirely written in Markdown :) I submitted this demo because Markdown is widely used, and I believed loved too, by many developers and specially in github, but I may consider to create the whole thing in less than 1kb using gzip compression if people will like the idea.
Love ALL The Web
- Get link
- X
- Other Apps
update no selection problems anymore ... eat the cake now Maybe 'cause San Valentine is coming, maybe 'cause Chris Williams started it, promoting an end to negativity , or maybe 'cause the web has been recently under attack ... no matter why, the topic of this js1k contest is Love so here I am introducing my proposal, the very first demo submitted this year. Click the link once to see it in action through following iframe: What Is It A simple script able to bring random harts behind the mouse or the finger in any page you want, even Facebook :) In order to do this, you can bookmark the link dragging into your bookmark bar, change the name (i.e. LOVE), and start surfing surrounded by little harts any new page you visit by simply clicking it. I know it's a silly demo, but it was a quick and interesting experiment I could recycle with any sort of different shape since the graphic is directly drawn on every little canvas. Technical Details compatible with all modern mob...