December 2011
2 posts
Beginners guide on how to test your code (using...
Introduction Start how you mean to go on The ‘write test first’ process Other aspects of TDD/BDD Using Jasmine An example Review of example Conclusion Introduction Any programmer worth a damn will tell you that you need to test your code. The way this is done is by using ‘unit-tests’. The principle is that you write a test for a piece of your applications code and...
Dec 31st
Host Methods vs Native Methods
This was intended as a short (I failed) and overly simplified (I likely succeeded) post about Host methods and Native methods: What they are? How to detect them? When is it OK to modify them? What they are? Native methods are built-in functions provided by the ECMAScript core specification. So things like Object methods (e.g. Object.create), Array methods (e.g. Array#forEach) etc. Host...
Dec 30th
November 2011
1 post
jQuery Mobile: loading script files
I’m working on a jQuery Mobile web application and I need to load specific JavaScript files for each page. This is a common thing to do and if you check the jQuery Mobile forum you’ll see lots of people are suffering from the same issue that occurs when trying to achieve this, which is that when loading a page using ajax, jQuery is stripping out the <script> tags - I assume for...
Nov 8th
October 2011
1 post
3 tags
Beginners guide to AMD and RequireJs
Here is a short list of what we’ll cover in this post: What is AMD? Why does it matter? How did we get here? How does RequireJs (and alternatives) fit in? Can we use jQuery? Basic Example What now? Links/Reference Material What is AMD? AMD stands for “Asynchronous Module Definition” and is a proposed API for loading modules (i.e. scripts) asynchronously. Why does it matter? A few...
Oct 20th
37 notes
May 2011
1 post
May 28th
February 2011
3 posts
3 tags
How to use Git and GitHub
If you’re having trouble understanding how to get up and running with GitHub, or you just wanted to find a free version-control system and heard about this thing called ‘Git’ then hopefully the following information should help… When I first heard about GitHub I was unsure as to its purpose and why it was such a hit with other developers. I had never heard of...
Feb 27th
4 notes
2 tags
Regex Popup Window
This is a quick post to show you how to open up external website links within a pop-up window (without adding extra non semantic mark-up to your HTML code). In the past I’ve heard a lot of people talk about adding either custom attributes or using existing attributes such as rel as a hook for your JavaScript code to find links that should open in a pop-up window. I disagree, and suggest...
Feb 27th
1 note
4 tags
JavaScript Inheritance
Class based inheritance doesn’t exist in JavaScript. You can replicate its syntax but you’re better off learning how JavaScript implements its own form of inheritance (it’s much more efficient and easier to maintain code shared amongst other JavaScript developers). The basic premise is this: JavaScript functions created using the new keyword work in a similar way to what Class...
Feb 27th
3 notes