Beginners guide on how to test your code (using Jasmine BDD)
- 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
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?
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 security reasons to help protect the user, but then if they were doing that then they should be providing the user with a way to disable that feature as in my case I know the scripts I’m loading are safe.
So far on the jQuery Mobile Forums I’ve only really seen the same ‘solution’ proposed over and over which is to have all your JavaScript in a single script file that you include on every page of your application. In my opinion: that stinks!
I potentially will have LOTS of JavaScript code (in total) to load by the time my application is finished and the only solution proposed so far has been “hey, just load it all together on every page”.
My solution: have a single script file that yes is included on every page of your application but acts as nothing more than a ‘bootstrapper’ file which detects the current page and then inserts the JavaScript file(s) into the DOM.
Example is as follows…
Beginners guide to AMD and RequireJs
Here is a short list of what we’ll cover in this post:
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…
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 using Regular Expressions (regexes) along with some procedural code to help figure this out for you (it will save you the time and hassle of adding this extra mark-up yourself).
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).
