JavaScript Ninja

Well a book I had been waiting to be released for sometime, Secrets of the JavaScript Ninja (John Resig), was released on the 14th January 2013.

I preordered this book 18 months ago and the other day I just got confirmation my copy is in the mail. I really hope it is worth the wait :)

I’ll put a review up once I have received and read the book.

Advertisement

RELAX, leave backbone alone

I have been playing with backbonejs and CouchDB in my (limited) spare time to see how usable they are together.

Well I have a backbone collection and figured I would fetch a couch view into the collection. Now backbone expects an JSON array and couch gives you a single JSON object that has total and a rows etc.

Image

Hmm…

I started to look around for someone on git that may have done this, not much luck. There were a couple of customisations that have been written but there were a few issues with using the latest backbone release.

I figured I’d start writing my own backbone extension that overrides the sync and fetch functions. I had already done a simple OData JSONP extension for work so I got started.

Then something in the back of my mind said ….list….

I realised you didn’t need to modify backbone, I could use a list function in couch. I even found someone on stackoverflow that had already written one (WIN)

ImageThe more I think about it couch is designed to do things like this, it will add in etags to help cache the list and I can even modify the list to handle different content types.

Hope this helps in some way.

Link

I would have to agree

There are some harsh criticisms in this post about certain aspects of the HTML5 spec.

I would have to agree with Luke Stevens because he mentions that adding in elements like ‘sections’ have created confusion for many people, including me.

I googled ‘purpose of section tag’ and a lot of what is returned is individuals such as my self trying to make light of the the purpose of such a tag. ‘In all honesty why is it there?… isn’t it just a div?…’ These are all the sorts of comments left by individuals. 

When i first saw the new tags at first thought i was dreading all the changes i would have to make to my HTML and CSS, all my navigation areas will now need to be wrapped in nav tags etc…

Again more confusion, but after some more reading i came to the conclusion you don’t need to change anything, in fact most of what we have written will last for years to come. 

 

Beautify JavaScript + JSONP = HappyFamily

If you are using JSONP to do cross domain grabbing of data to show on a page often you will want to see the raw response in your browser. The issue with this is it can get confusing because the browser just dumps the JSONP response to the window.

Enter jsbeautifer

All this website does is format your JavaScript to be more readable. I commonly use this site with JSONP responses and for all the times i have used this page I am glad it’s free.

Have a try, grab some JavaScript, JSON, etc.. and paste it into the window and click beautify. 

Enjoy