This helped today. https://gist.github.com/benkeen/339af429dbac2c026c3d
This script catches any client-side errors that occur in any modern browser and pass the information – line number, URL, stack trace – to the server for logging. It can provide significant insight into problems occurring on your web sites and applications that otherwise would go missed.
I came across this marvellous little script yesterday by Nick Stakenburg which creates a loading icon spinner using Canvas, letting you avoid having to use animated gifs. Very nice!
It was almost perfect for my needs, except I needed a few small tweaks. So here’s my fork of the script, with fadeOutSpeed, pauseColor and pauseOpacity options.
You can download it from github here:
This afternoon I revisited some old code I wrote to address the problem where sometimes you want to do the following:
Even though that’s perfectly acceptable within JS, it takes time for the browser rendering engine to do the job of actually inserting the DOM, so it may not be ready for the second line to actually find the content it just inserted. I outlined the whole problem in an old post here.
Very interesting article on the latest revision of the Object.observe() spec. That thing has tremendous potential if it becomes an implemented standard.
A Smarty syntax highlighter for CodeMirror has long been needed for my Form Tools script, so this weekend I finally took a few hours to put one together. It’s not been reviewed by the CodeMirror developer yet (Marijn Haverbeke), but will hopefully find its way into the main script at some point. I also plan on developing a HTML-JS-CSS-Smarty mixed mode, which will be useful in many places.
[UPDATE: Marijn accepted my changes and it's now part of the CodeMirror repository].
[UPDATE 2: I added in Smarty 3 support in May, 2013].
Another excellent article by Peter Paul Koch (PPK):
Blur and focus don’t bubble. Today this has been the bane of my existence – pursuing a daft solution when I should have spent more time thinking.
The article explains a workaround.
Personally I’ve always used what he calls direct assignment. But his objection that the namespace label is hardcoded is quite legitimate. Doing a search and replace on the file isn’t the problem – it’s catching all the calls to the namespaced functions that are scattered around the code. That’s bit me a number of times (today, as a matter of fact!). But what I like most is that it’s extremely simple: even a noob can understand it.
That said, his favourite – #5 Using this as a namespace proxy – is excellent. Very inventive indeed.
Check out his post for the details.