Wednesday, April 6, 2011

Remedial JavaScript

Direct from the master :-)
(...)The JavaScript Programming Language suffers from premature standardization. It was rushed to market and then instantly had a huge user base and, soon after, a formal international standard. There was no time during its development to polish the language. As a result, it still has some rough spots. (...)


I specially like

if (!String.prototype.supplant) {
   String.prototype.supplant = function (o) {
      return this.replace(/{([^{}]*)}/g, 
           function (a, b) { var r = o[b]; 
                return typeof r === 'string' 
                    || typeof r === 'number' ? r : a; } );
      }; 
   }

http://javascript.crockford.com/remedial.html

Tuesday, April 5, 2011

Singleton Design Pattern

(...)The intent of the Singleton pattern as defined in Design Patterns is to "ensure a class has only one instance, and provide a global point of access to it".(...)http://www.dhtmlkitchen.com/learn/js/singleton/

Essential JavaScript Design Patterns For Beginners

(...)A pattern is a reusable solution that can be applied to commonly occurring problems in software design - in our case - in writing JavaScript applications. Another way of looking at patterns are as templates for how you solve problems - ones which can be used in quite a few different situations.
(...)

http://www.addyosmani.com/resources/essentialjsdesignpatterns/book/

JavaScript Module Pattern: In-Depth

(...)The module pattern is a common JavaScript coding pattern. It's generally well understood, but there are a number of advanced uses that have not gotten a lot of attention. In this article, I'll review the basics and cover some truly remarkable advanced topics, including one which I think is original.(...)

http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth

Sunday, April 3, 2011

Music mashing with YouTube, YQL and Open Data Tables

(...)Grab the top 20 chart singles from the BBC web site, look up each song on YouTube and get the most popular matching videos. Show them in the chromeless player and set it so that they play automatically and users can skip ones they don’t like.(...)

http://www.bassett-jones.com/music-mashing-with-youtube-yql-and-open-data-tables/

Making a Sleek Feed Widget With YQL, jQuery & CSS3

(...)You will be surprised at how much data is made available on the web through RSS or ATOM feeds – twitter searches, your latest diggs, Google Search alerts, your own blog categories and so much more. You just have to look for that orange icon and you’ll surely find a lot more precious data, just waiting to be put into use.

Today we are making a sleek feed widget, that will fetch any feed and display it in your blog sidebar. You can set it up to show the latest posts from the different categories of your blog, your latest stumbles, or even people mentioning you on twitter.
(...)
http://tutorialzine.com/2010/02/feed-widget-jquery-css-yql/