occasionally useful ruby, ubuntu, etc


Debugging unobtrusive javascript in jQuery

So if you work for a large enterprise website like I do, where each page loads dozens or hundreds of kilobytes of javascript, it can be hard to figure out exactly what happens when you click that div and something magically happens, due to the wonders of unobtrusive javascript.

Or, to rephrase the question, "I know how to add event handlers to an object -- how do I enumerate what's already been attached?"

And it's pretty easy, but unfortunately it doesn't use a public API. Anyway, try this in Firebug:


If there are any events on that element, they'll be displayed. The only drawback is...you have to know exactly which element the events are attached to, or guess around a bit.



Accessing GM_xmlhttprequest from event handlers bound by jQuery

So I like jQuery. And I like Greasemonkey. I especially like the ability of Greasemonkey's ajax calls to go cross-domain. But how do I get access to this functionality in my event handlers? Calling GM_xmlhttprequest in a method that doesn't execute while the Greasemonkey sandbox is still alive doesn't work. At first I didn't think it was possible, but I discovered a way...using setInterval.


DEPRECATED: Announcing: jQuery optimization races

Note...this site is down for now...

You don't have to understand it to see that it's at least a bit interesting, so check it out:


It documents a bunch of different ways of doing similar things, and compares them in terms of performance. How much are you really losing by using the jQuery convenience method?


Google Visualization API + jQuery

TODO: bring animations to charts in the Google Visualization API via jQuery to illustrate performance described in previous post.

Relevant link.

Filed under: google, jquery, web 2.0 No Comments

jQuery performance

TODO: write a series of test cases that illustrate ways to write high-performance jQuery.

Filed under: jquery No Comments

Projects in progress

I have many projects in progress...

1) "Anybody can program" book, have half of the outline for the first draft done
2) Stylometry web app, have some of the backend services done that calculate stylometry stats
a) Dictionary looker upper, reasonably complete for Merriam-Webster only
3) Blog application, just a few thoughts on paper and a few lines of code
4) Notepad, a note-keeping application, could pass for done
5) Merb Google RSS feed sample application, could pass for done
6) jQuery_merb, a javascript library bridging the gap between jQuery/javascript and merb. limited scope, but could pass for done
7) merb_solitary_part, a merb slice for hitting parts outside of "regular" requests. Needs some renaming/refactoring and some docs, but could pass for done
8 ) Kollaba, a site for finding collaborators to work on...anything. fair bit of progress on it, but probably dead.
9) merb-rails upload benchmark application, basically creating the same simple application in both versions. done enough to be used for benchmarks, at least (and yes, merb's faster).

Phew. I need to finish some stuff! But new ideas are so much more exciting...

Filed under: jquery, merb, web 2.0 1 Comment

jquery_merb continued

So...I think, for now, I'm done with jquery_merb.


introducing…jquery_merb (sort of)

I love jQuery. I love Merb. I thought, so why not work on both? I tried this previously from the merb side with the now gone merb_multi_js plugin, which I had made a substantial amount of progress on before I killed it. It was designed to mimic rails and generate handy JavaScript for you not using Prototype.js, but whatever web framework you wanted (I of course had jQuery, Prototype.js, and I think YUI). Alas, I realized that because of some of its design principles, it would never be performance-friendly.

Enter jquery_merb, or jquery.merb.js.



I'm writing a plugin right now to add some built-in JS functionality to Merb. It's coming along pretty well, but is still pretty raw and not specced, though it does have SOME documentation. It's available at http://github.com/nanodeath/merb_multi_js/wikis/home. If you have questions, you're encouraged to send me a message at Freenode#merb.


jQuery :(

I wish Rails wasn't so intimately tied with Prototype+scriptaculous. It makes jQuery that much harder to use. Even so, using page << and jQuery is much easier than trying to use Prototype to achieve the same end. Not to be a fanboy or anything, but is there any other library out there that can remove a specific option from a dropdown select box in one short line of code?