jQuery UI Bootstrap

jQuery UI Bootstrap is an open-source effort by @addyosmani to introduce the Bootstrap styling into the standard jQuery UI widgets.  It covers many of the widgets available on the jQuery UI website including:

  • Accordion
  • Tabs
  • Buttons and Button Sets
  • Horizontal slider
  • Progress Bar
  • Dialogs
  • Icons
  • Date Picker


Whilst it’s still a work in process, what’s available already is fantastic and I’d love to see where this project goes.  It’s the next logical step for the Bootstrap framework; we have the standard web elements and layouts, now it’s about making those pages interactive using one of the most popular widget libraries available, jQuery UI, and making that look like the rest of the site…well it just makes good sense.


Here’s a quick introduction to Bootstrap for those that haven’t yet heard of it, or aren’t sure what it does.

Bootstrap is a prototyping framework introduced by Twitter in mid-2011.  It’s aimed at making more consistent browsing experience for users as they browse various sites and applications on the web.  It’s free, open-source, and uses LessCSS making it a breeze to modify to suit your own needs.

Since it’s launch, it has been very well received by the developer community, and I’ve noticed it being adopted by many popular websites and open-source software including:

I’ve even used it on the Cube Websites website for the form elements and as a grid system.

Get Started

jQuery UI Bootstrap seems like a great idea, and has a lot of potential for making Bootstrap even better.  I’ll definitely be trying it on my next project involving UI widgets.  Whilst it looks fantastic already, I’d love to see where it goes from here.  One of the things I’d like to see is the stylesheets done in Less so that the widgets can be customised to look exactly how the web designer wants.


When working with databases, you may want a table structure which allows your record to have a parent record (heirachical recordset).  In simple scenarios it’s easy enough to simply have a parent_id column. However, for displaying the entire tree you’ll need a lot of recursion to go through all the top level nodes, test for children, and then test the children for children etc.  It soon proves to be very long-winded and inefficient.

Instead of using the standard parent_id approach, there’s a database structure known as the Nested Set Model.  The nested set model uses an algorithm which basically uses tree traversal to number each node, and once the numbering is complete it becomes very easy to query the tree and search, whether its for root nodes (base node), leaf nodes (nodes with no children) or branches (the path from the root node to a particular node).


As the tree traversal for numbering the nodes is required, the Nested Set Model requires slightly more overhead when updating the table (each node needs to be renumbered when a change is made), but as mentioned earlier, is very efficient when it comes to actually querying the table.

Example Usage Scenario

A simple use for Nested Set Model would be a category table for a website, where categories can have subcategories.  And even subcategories can have subcategories.  Categories are generally setup in the admin on most sites, and even then are rarely updated so the fact that updating a Nested Set can be a bit slow isn’t actually a issue.  On the frontend the visitors and customers will simply be viewing categories, so they’ll be reaping the benefits of the efficiency and great performance of the Nested Set Model.

Introducing Baobab

Baobab is a free PHP/MySQL implementation of the Nested Set Model.  It can be modified to work with other database systems too.  Baobab uses the Nested Set Model, but also the offers the advantage of supporting multiple trees in the same table, or alternatively you can setup different trees in individual tables, depending on your requirements.

It takes an Object-Oriented approach (OOP) and provides you with an entire API of useful methods including:

  • getRoot()
  • appendChild()
  • getTreeHeight()
  • deleteNode()

Just take a look at the documentation page to see how much Baobab has to offer.

Download and Install

Getting started with Baobab is dead simple.  It’s an open-source project hosted on GitHub which you can download here.  Once you’ve got the code it’s a simple case of placing the classes wherever you need them, include them in your PHP and use the Simple Tree Example to get started.  If you’re more confident then you can have a look at the Multiple Tree Example.

Baobab on GitHub


I’ve found Baobab particularly useful in my projects and have extended it to tie in with my own PHP library.  It offers you the power of using nested sets, without requiring you to code your own implementation of nested.  There’s a lot of useful functions in there, plus the default SQL structure can easily be extended to contain your own table fields too.

It’s great, it’s free and if you need to hold data in a tree structure then it’s certainly worth checking out.

Less CSS is a great way to develop your stylesheets for websites.  It lets you create nested rules, specify variables, functions and so much more.

To use Less on a website you have 2 options:

  1. Use JavaScript to compile on-the-fly.  This isn’t really recommended as you’re now relying on JavaScript for your website to look the way it should.  It also creates additional overhead as your page needs to load in the JS file, load your less stylesheet and finally render your stylesheet by parsing it through the Less Javascript library.
  2. Compile your Less stylesheet into CSS, and include is as a normal stylesheet.

The compilation method is obviously the best option as you get the benefits of using Less, and then using it as any other CSS stylesheet.

Whilst the compiled method might be great for when you’ve finished developing, during development you’d still have to use the Less JS method or compile your Less file into CSS each time you make modifications, which can easily become tedious.

This is where SimpLESS comes in.  SimpLess is real-time Less compiler.  You simply drag and drop your less file(s) into the app, and it recompiles your Less file into a CSS file every time you save it.

This app is totally free, open-source and available on Windows, Mac and Linux. As well as doing the compilation, it minifies your CSS too saving you precious bytes during HTTP requests.

Download SimpLESS
Fork SimpLESS on Github

One the most common things I’m required to do on any website build is to use a custom font.  This post discusses the various libraries that I’ve tried and tested, and which library I prefer the most.


Cufon was the first library I was recommended and blindy started using without researching into other options.  It was dead simple to use – just include the Cufon library, convert the font file to a Cufon Script and include that too, call Cufon on the web page and away we go.

However, Cufon has a number of drawbacks, and the biggest issues for me were:

  1. Links in Internet Explorer.  As Cufon replaces text with images, instead of an entire block of text within a hyperlink being clickable, only the actual letters were clickable, and clicking anywhere inbetween wouldn’t trigger the click.
  2. Hover states.  Cufon supports hover states via an additional option in the configuration.  However, there’s a slight delay when you hover as Cufon has to load in the hover states images whenever you hover.
  3. Dynamic text.  If you’re loading in content via AJAX, and need Cufon applied to certain elements, then you need to reload Cufon whenever new content is loaded in.
  4. Text-decoration.  I noticed in Internet Explorer that

    on hyperlinks wouldn’t work and the underline would never show.  The workaround was applying a bottom border instead.

Due to all these issues, I set off on a hunt for an alternative to Cufon which wouldn’t cause me any of these issues.


I stumbled across TypeKit and did some research into after seeing a lot of popular sites using it.  However, I didn’t like the idea of having my fonts hosted externally and having to configure them on the TypeKit site rather than on my own.  Not to mention that TypeKit costs money, not much, but still it’s not free.  To be honest I didn’t give TypeKit much of a chance, but I really was looking for something JavaScript-free, something I could run on my own site and something that was free!

Google Web Font API

There’s Google Web Fonts API, which was launched early 2010.  I was really excited when I first heard the news about this, however, it turned out that it didn’t really have many fonts on offer at the time.  It seems that they’ve added a lot more fonts in the meantime, but once again I encountered font cross-browser compatibility issues on some fonts; Internet Explorer simply wouldn’t render it, or the line spacing would be wrong, the characters overlapped each other and various other issues which I just didn’t have the patience to fix.

The good thing about this library was that it didn’t rely on JavaScript.  You’d simple call in an additional stylesheet, which is hosted on Googles server.  This stylesheet returns the font, in different formats based on your browser.  In your CSS file you’d then use the font as any other font.

Font Squirrel

As was about to rebuild the Cube Websites site this summer (2011) I decided to search again to see if a new font library had appeared, and it was then that I stumbled across Font Squirrel.

The first thing I spotted was the logo saying “100% free for commercial use”, and I was already off to a good start.  On their homepage, there was also a long list of fonts, all of which looked pretty impressive.

Next, I investigated their integration method; it was something called Font-Face Kits.  Basically you download a Kit for the font you want to use (or generate a kit for a font not on their website).  Each kit contains sample HTML code, the CSS you need and your font in various formats (each specific to a different browser).  Out of curiousity I downloaded a Font Kit and inspected the contents.  It contained 4 variations of my font file, a stylesheet and a sample HTML page to preview the font.

I ran the preview in all my browsers, and to my surprise the font rendered perfectly in all of them.  To use it on a website I just copied the font files into my site, copied across their CSS and I was good to go.

Font Squirrel is an absolute winner for me.  You have your own fonts, hosted on your own site.  It’s free to use.  It doesn’t rely on JavaScript, and can be used on hyperlinks without any issues with underlines, hover states and re-rendering delays.

If you’ve not tried Font Squirrel yet, I’d definitely recommend that you give it a shot

Most web developers are familiar with the default dummy text generator, lipsum.  However, today I discovered an alternative text generator which creates more unique content using Twitter.

How It Works

Twipsum allows you to enter a keyword, then it finds Tweets on Twitter based on that word and combines them into paragraphed text which you can copy and paste into wherever you need it.

It’s a nice little spin on the default lorem ipsum text which we’re all probably sick of seeing.  However, bear in mind that some of the content may be a little inappropriate so it’s probably not the best idea to use it for populating a client website.

Visit Twipsum

YouTube Console

A couple of days ago I discovered Intercom.  An open-source JavaScript framework allowing anyone to create their own command-line application.

I decided to try it out by creating a command line interface (CLI) for YouTube.  What does this mean you ask yourself?  Well, using this plugin you can browse YouTube but instead of using the website, you do it via a series of commands.  There’s no real advantage to it, it’s more just about doing it to prove that it can be done.

YouTube Console

You can play around with it on the live demo page here

Features include:

  • YouTube search
  • Search by username
  • Top Rated videos
  • Recently Featured videos
  • Most Viewed videos
  • Paginated results
  • Caching for great performance

This application is free and open-source, so if you’re interested in making your own Command Line Application, then feel free to Fork it on GitHub.