Here’s a Tip: Qtip is Awesome

Qtip is an awesome solution for displaying context clues on websites using some incredibly simple javascript. We first started using it on Jokels to display a help tip to explain the daily inspiration:

The HTML (well, erb) and JavaScript here is incredibly simple. We put the daily word inside a span, give that span a title that describes its content and then call the “qtip” function on the selected content. The target attribute specifies the page component hovering over which causes the tool-tip shows up. The “position” object determines where the tool-tip points to on the target content and where the caption arrow is on the tool-tip itself. The style object, as you’d expect, is used to style the tool-tip itself.

Qtip’s biggest issue is that it simply isn’t documented very well. We use Qtip to do a variety of slick things at Jokels, but figuring out how to do them took a significant amount of time of digging through the qtip documentation and Googling qtip examples. To save you some time, here are some the slicker features of Qtip and how to use them:

Ajax Qtips

One of the slicker uses of Qtips on Jokels is to display extra Jokel and user information when a user hovers over a user avatar, a joke link or the info tag on each Jokel’s info bar. To accomplish this, we just embed the ID for the joke or the user in a “data-id” attribute for the area in question, then we use the following JavaScript snippet on page load:

The meat of the code is in the “content” object. The “text” attribute is displayed until the “ajax” object can be loaded. The “/qtip/joke/” page is a very simple view which has some simple joke information and takes a query parameter of ‘id’ for the joke. Once this page is loaded it’s displayed in the Qtip.

Specifying More Complicated Content

Another cool use of Qtip is that it can take a jquery element and use that as it’s element. This isn’t used on Jokels, but I have used this in a side project as a way to have a generalized way of grabbing a form element that was hidden and display it to the user when certain conditions are met (e.g. a validation condition comes up that requires additional information from the user):

One issue to be aware of is that Qtip will actually take that DOM content and move it to the bottom of the page in some qtip specific DIV tags, which means that if you have form fields they will no longer be inside the form tag and they will not be included with form submission. There are two approaches to this issue: one is to immediately move the Qtip div back into the form, but there’s a reason Qtip moves its content to the bottom of the page — in earlier versions of IE z-order is not respected so this content may not be visible. A solution that’s more compatible with IE is to call .clone() on content handed to Qtip, then keep matching form fields in sync using a little bit of simple JavaScript (although it is a bit of a hack):

The only change for the Qtip section from the previous gist that is that we add a .clone() to make a copy of the content so Qtip will leave the original section alone. The meat of this gist is the second section: we’re using the live function on page load so that any form field that’s created inside of a qtip div will automatically have a change event handler attached that finds the matching field in the form and updates it to match its own value.

Displaying Validation Messages

Another really slick use of Qtips that I came across recently is to show validation messages on forms. Here, we get the error message and pop it up in a qtip on the form field:

There’s nothing terribly exotic about this example, except for some of the options that after content. By adding the “ready: true” attribute to the show object, we’re telling Qtip to pop up the tip on page load. By giving a null target we’re telling Qtip to never show the message again after the initial page load. The “hide” object tells qtip to hide the message on the “blur” event (focus lost event) for the form field. So the validation message will stay on the form field until the user focuses in and exits the given form field (at which point we can assume they’ve at least had the opportunity to address the issue).

Viewport and Effect

I mentioned before that Qtip isn’t documented well, and hopefully this blog post has shown some cool uses of Qtip that maybe wouldn’t immediately jump out of the tutorials and doc available on the project website, but I wanted to quickly show two options that are critical to a sucessful use of Qtip in your project. Viewport just tells Qtip what to consider the bounds of where it can show a Qtip. So by specifying $(window), Qtip won’t show any pop-ups that will be outside of the browser’s current view. Effect is documented well on Qtip’s site, but the thing most people are going to want to use for effect isn’t, which is simply to turn off all of Qtip’s effects and just show the pop-up, which can just be accomplished by setting the attribute to “false”.

Almost assuredly you’ll find Qtip a fantastic tool for your website or latest project. It’s documentation may leave a little to be desired in terms of organization and comprehensiveness, but that’s only because it’s such a fantastic, versatile tool that it’s difficult to document all of its features.

Jokel Embed Development

Two months later, I’m finally writing the blog post I promised in my original blog post showing off Jokel embeds Part of the reason it took me so long to write this post was that it was so remarkably easy to do that I had a hard time outlining a substantial post. Even if the actual development was simple, figuring out the implementation details took us about 30 minutes and there were a few gotchas that popped up after, so those are outlined below as well.

The idea, as many of our inspirations for Jokels, came from Github: we really like to use Github’s “Gist” snippets on our blog. It’s really slick how easy it is to embed code samples with syntax highlighting, update the snippets without touching the post and to comment on or even fork code snippets. So we thought it’d be fantastic if we could offer the ability to embed Jokels. It would be a slick way to embed a joke in a blog post or your website, drive traffic to the site and as people add alternate punchlines those could show up as well, so we would get some of the cool dynamic update elements of Github’s embeds.

So, continuing our history of liberally stealing from Github, we looked at Github’s embed tag, and then inspected the Javascript file that it was referencing. It turned out to be remarkably simple. It used document.write to embed link tags to stylesheet and javascript files it needed, then wrote an escaped HTML / javascript snippet containing all of the Gist in a single line. It seemed clear that Github was probably just using <%= escape_javascript %>, so it was relatively simple to do the same:

The only tweaks we had to do were to change the existing Joke partial to accept a new “min” parameter which turned off everything except for the simple joke functions (no sharing, voting, new random joke, etc) and to move the necessary CSS and Javascript out into independent files so that we weren’t sending irrelevant code in our embeds – we want our embeds to function as quickly as possible so people will use them!

Of course, no commit is ever perfect (at least none of mine ever are) and a couple of issues popped up along the way, some of which surprised me, others of which I just forgot about during the process:

  • Style for the page in which the embed was being placed would break our layout, if we didn’t have fine-grained CSS selectors for the given elements. The example we found was that a page had a margin specified for all spans, but we wanted out spans to have a 0 margin, which was applied at a general class level, so the more specific selector one out. We tried to combat this with more specific selectors for important layout attributes, as well as “!important” flags for attributes.
  • We use mobile-fu on all our requests to catch incoming mobile devices and route them to our mobile site – but with embeds we clearly didn’t want this to happen: we have no control over whether the embed site is a mobile version or not, so we should always just display the normal version – so we had to add exclude clauses for these request handlers. It was an easy fix, but it caused several airbrake errors when someone tried to view our blog on a mobile device.

All-in-all, adding embeds was a remarkably easy thing to do in Ruby on Rails by leveraging the power of existing code and partials. It’s a great example of a low-cost but high-value and high-visibility feature that most sites could use. Just to show it off one more time, and to give my favorite joke some love, here’s an embed to send you on your way:

Movie Review: The Avengers

Warning: This review will be spoiler-ridden. And really, this is a pretty big summer blockbuster movie, if you haven’t seen it by opening weekend – you’re not American enough.

Another Warning: I’ve never really read many comic books, so a lot of the “in jokes” and references that are made throughout the movie, I’m probably not going to get.

The Avengers is good, just not great

The Avengers begins the summer movie season for 2012: the end of the world fire sale of blockbuster seasons, where everything is a sequel or part of a franchise of some kind. It’s a fairly good start though, so that’s saying something, especially given that it suffers from a lot of problems that plague several other films.

The movie runs on the assumption that you’ve seen Iron Man 1 & 2, Captain America, Thor, and Hulk. At some point, I really do have to hope, that people are going to feel massively burned out on comic book movies. It’s not to say that they aren’t good but it often feels like the “mythos” of each picture focuses on the same origin storyline and churns out a trilogy in a matter of 7-9 years. Then it’s remake time (looking at you Amazing Spider-Man)!

Maybe that’s why Avengers works for the most part. Throughout the two-and-a-half hour runtime it’s an absolute ensemble – so it doesn’t have to spend too much time on why all of these characters are so emotionally broken. Everyone seems to have an integral part in the cast and everyone, for the most part, seems fairly developed. Hawkeye could use some more scenes, but what movie doesn’t need more Jeremy Renner?

We begin the story with Loki, Thor’s brother, who has sided with an evil alien race, coming to earth to steal the Tesseract, which is basically a powerful energy device. When he comes to retrieve it, he brainwashes Clint Barton (Hawkeye) and brings him along for some more fun. By stealing him he learns about the Avengers Initiative and its members. So, Nick Fury assembles them – there’s Tony Stark (Iron Man) who works closely with Bruce Banner (Hulk) since they’re both smart. Steve Rogers (Captain America) has post-traumatic stress and hates his life, Natasha Romanoff (Black Widow) feels bad Hawkeye was kidnapped and Thor’s pissed at his adopted brother, Loki. It sounds like a lot, but it’s an ensemble and it fits together pretty well and it’s actually pretty well layered – everyone seems to have at the very least been fleshed out.

That’s where the movie really succeeds. It’s well structured with a good pace. At two-and-a-half hours, it only really begins to feel sluggish during some of the incessant action scenes. At least there’s some fun to be had there with rather unique perspective shots of destruction instead of the standard fare that’s often regurgitated time and time again (looking at you Michael Bay).

But the action is just nonstop. There came a time when people decided that all summer blockbusters had to be two-and-a-half hours long and they all had to have action for 95% of it. There’s never any time to breathe or to let things simmer or to have any actual connection with these characters because we just keep things trucking along until the next big action sequence. For all the QUIRKY and FUN Whedonesque one-liners, there’s no actual connection to anyone here. The emotional gravitas and pull is totally missing – why is everyone so moved by Agent Caulson’s death? We know Tony Stark isn’t going to die (especially since Iron Man 3 is in the works) so…why should I care about him “sacrificing himself” for mankind. Speaking of caring – why do any of them care? There is no motivation for any of the characters to want to do any of this. The alien race that comes to earth to destroy us all are all one-note. Why earth? Why does Loki want earth anyway? It seems like a plot for plot’s sake. I mean it works but it’s more like a gelatinous square peg that kind of does fit in the round hole but you have this mess from where the gelatin was smushed out.

My biggest complaint with the movie is the obvious bloated department of defense budget. It just seems unnecessary to have a flying, camouflaging, submersible destroyer ship. You know why else it is unnecessary? Because it was practically fucking destroyed in a pre-climax action scene.

The best part is the ensemble. Most people would single out Hulk – which when played by Mark Ruffalo is the best Bruce Banner has ever been – but maybe Hulk is only good in small doses. It really is fun to see a large cast of characters working together in a cohesive manner. I just wish the movie focused more on that.

**½ /****

[The Avengers is Rated PG-13 for intense sequences of sci-fi violence and action THROUGHOUT, and a mild drug reference. It stars Robert Downey Jr., Samuel L. Jackson, Scarlett Johansson, Mark Ruffalo, Chris Hemsworth, Chris Evans, Tom Hiddleston, and Jeremy Renner. Directed by Joss Whedon and written by Joss Whedon and Zak Penn.]

Movie Review: The Lincoln Lawyer

Every once in a while, an actor will star in a movie (typically produce it on their own) where they basically try to win an Oscar. Pollock by Ed Harris, Moneyball for Brad Pitt – and while sometimes it’s genuinely deserved a lot of the times it’s more of a stark reminder as to how insulated people in Hollywood are to the realities of their own stardom. And with that, let’s start talking about the last Matthew McConaghuey movie I saw: The Lincoln Lawyer.

Immediately, delving into the plot would be like giving away the whole thing because it’s essentially given away at the beginning of the movie. At least, I guessed “who dun it” almost as soon as the character was introduced. It shouldn’t really be that hard. Look for the sweetest person on the “bad guy” side and there’s your head honcho. Everything in this movie is so obvious; every observation with characters is forced with all cards facing the audience. It’s just absurd to share memories of your daughter with your ex-wife like you just met the bitch. It just doesn’t make sense that old friends would rehash their entire lives within the first 5 minutes of hanging out on a regular day. Things don’t work that way and for a movie to try and be this gritty depiction of seedy lawyer underhandedness is just laughable. But it’s really not that realistic of a depiction, it’s really just a showcase for Matthew McConaughey to look a little sweaty and hot as he’s chauffeured around in a Lincoln towncar (hence the title – no fucking joke). So let’s get on with it.

Ignoring the racial implications that one of the only black (and minority) characters in the film is, after all, the chauffeur, the movie sticks with what everyone knows. Rich kids are punks. Unrepentant rich white kids are the devil. And their parents are worse. Essentially, the Cadillac lawyer is hired by a rich family because the son (Ryan Phillippe) might have raped a hooker. Might have. It’s basically given away in his introduction that he probably did rape her. Oh Ryan Phillippe. You have had the largest fall from grace from your auspicious ass debut in Cruel Intentions. I would almost hope that you’re better than this (as Marisa Tomei has proved time and time again) but are you?

Right off the bat, and confirmed through to the end of the movie, the best part about this movie is, of course, Marisa Tomei. She plays the Buick lawyer’s wife and (gasp) she’s a prosecutor. He’s a defense attorney. OMG DO YOU GET IT?! I SMELL A SITCOM. This is also why they got divorced. She couldn’t reconcile that he defended criminals as his day job. Who wrote this? Who thought this was a good justification for a divorce? I know we don’t live in the most enlightened of times and people have quickie weddings and divorces – but for a couple to seem truly in love (surprise surprise they end up back together) and for them to get divorced over something so…trivial and trite seems to be untrue to their characters.

But there are no characters. Everything is as obvious as the orange fake tan glow on Matthew McConaughey’s skin. The majority of the movie is littered with just a hodge podge of blatant caricatures masquerading as characters. There’s a gay guy, the homophobe, the evil mom, the crazy monster, the victimized minority, the righteous defender. It’s all very been there, done that.

The film climaxes in court (of course – lawyer is in the title – where else could it climax) in what is probably the tackiest courtroom in history. Oldsmobile gives an impassioned speech about client/lawyer privilege. That is essentially all this movie is about. Client. Attorney. Privilege. It’s like Primal Fear without any mystery or nuance. I’m not really expecting much from a Matthew McConaughey movie but sometimes you just want to say something nice. His teeth were very white in the movie.


[The Lincoln Lawyer is Rated R for some violence, sexual content, and language. It stars Matthew McConaughey, Marisa Tomei, Ryan Phillipe, and William H. Macy. Directed by Brad Furman and written by John Romano based off the novel(!!) by Michael Connelly.]

Movie Review: Wolf – Throwback Tuesday Edition

First, why the fuck would I watch a cheese-tastic movie from the 90s starring Michelle Pfieffer and Jack Nicholson? I think you just answered your own question. Also all morphing into and out of wolves is strangely reminiscent of the “Thriller” video – so, that should also your question. Don’t you ever get a feeling like the only thing your night needs is a movie “made for adults” in the 90s? Think dumber than 9 ½ Weeks and lacking any of the joie de vivre inanity of Coppola’s Dracula and you have Wolf.

This movie was directed by Mike Nichols so right off the bat you should know everything’s going to look ridiculously theatrical even when it shouldn’t. Only Closer feels like a Mike Nichols’ movie and not a stage-to-screen literalization like everything else even when it’s not even based on anything (pass to The Graduate and Angels in America for sheer brilliance). It’s not that he’s a bad director, he makes beautiful movies with amazing performances, he just doesn’t make good horror movies. Wolf is something that probably should have never been made. It’s never really scary, sexy, or alluring but it’s always cheesy, ridiculous, and laughably stupid without any laughs.

We follow Will Randall (Jack Nicholson), a calm and mild-mannered man, who accidentally hits a wolf during a snow storm. The wolf ends up biting him and sure enough, he starts turning into one. This, naturally, has repercussions in his personal life. Resigned to the fact that he was going to lose his job to his protégé (James Spader – always slimy), he soon discovers that said protégé has also been fucking his wife so he wants revenge by getting his old job back…in publishing. But this was the 90s. Also, isn’t it great when Hollywood makes the heroes and villains so easy to root for and against? Here Spader plays someone who not only stole an old man’s job he also fucked his old-ass wife. Awful. The moment they have the slightest nuanced characterization of any villain or hero, people usually root for the villain. Ponderous. Anyways, he starts turning into a wolf, gets back at his protégé, and fucks his boss’ daughter while leaving his wife. All in all, pretty good for a late 50s man. But of course, all is not well, and soon other people he’s come into contact with also turn into wolves. This leads to the only good part of the movie – the closing Lisa Frank sequence complete with muppet wolf.

Pfieffer channels her inner wolf bitch

Pfieffer morphs into an animatronic puppet wolf? Or she communicates with one? Something.

Wolf is terrible. It is a truly awful movie with not much going for it (no humor, no horror, no good action scenes) except that the pace is quick as we hurtle along. The only marginally not terrible things about it are James Spader as a remnant of the 80s yuppie douche bag (even though this movie came out in 1994), except now he’s passive aggressive and sniveling too (there’s the 90s charm)! And of course, the incomparable Michelle Pfieffer, who plays the role of the boss’ daughter. She brings an assured, recovering yet slightly vulnerable, coke-whore delight to a movie that clearly has no use for its female characters. Watch how she interacts with the cops – total druggie. Oh La Pfieffer – why are you in so many truly fucking disdainfully bad movies unworthy of your talents.

This movie proves a lot of things. Good directors and good actors don’t always make a good movie. I will always see movies starring Michelle Pfieffer for the occasional Batman Returns/Fabulous Baker Boys gem. I regret most of the movies with Michelle Pfieffer I’ve seen. James Spader will always play creepy because that’s all I can ever imagine him as. Maybe CGI isn’t so bad – and here, based solely off Jurassic Park – I thought puppeteering was the best way to achieve special effects.


[Wolf is Rated R for language and werewolf attacks. It stars Jack Nicholson, Michelle Pfieffer, and James Spader. Directed by Mike Nichols and written by Jim Harrison and Wesley Strick.]

Joke Embeds

I fully intend to come back and write a blog post on this, because it was the most exciting two hours of Ruby coding in my life, but for the meantime here’s a demonstration of embedding a joke from

Movie Review: The Cabin in the Woods

Is there such a thing as too clever? I would typically say, no. But then, I typically would say anything with Joss Whedon involved would suffer from being “too clever” or better yet, “too far up its own ass”.

Cabin in the Woods wolf makeout

The whore makes out with a stuffed wolf head. She's such a slut, she's into bestiality! Oh Joss Whedon!

Cabin in the Woods basically presents two movies at once. Rather, one movie within a movie that you’re watching. And given that Scream milked slasher horror movie tropes dry, it only seemed necessary to have another movie that did the exact same thing, except this time with the whole genre and the Wayans Brothers aren’t involved! At the end of the day, it’s all the same thing, horny white teenagers get hacked up.

So movie #1 starts with two ordinary businessmen (the always amazing Richard Jenkins and Bradley Whitford) setting up five teenagers to be offered up as part of a sacrifice (the story of the five teenagers is movie #2). Basically, they’ve set up a horror movie with the usual recurring cast of characters – the “virgin” (she’s not really a virgin though! Aw, shucks!), whore (typical and blonde), brains (he wears glasses), jock (this one is Thor! or Chris Hemsworth), and burnout/fool/freak (he smokes weed! Hilarity!). These people are basically being set up by the two aforementioned old dudes to be murdered in a cabin in the woods. It’s all part of a ritualistic sacrifice dating from prehistory. Other countries do it too (the “international” focus is namely Japan, sending up the most common Japanese horror movie staple: ghost of murdered Japanese girl who has hair in her face) but it’s all part of the greater good. Quell the spirits below. It’s basically similar to the plot of The Harvest, The Wicker Man; there was even a South Park episode about it. Except here, the “harvest” in question are the horror movie universes we love? It’s hard to say – the movie doesn’t spend a lot of time explaining things (or anything really). The people they chose turned out to be smarter than they hoped and chaos ensues and Sigourney Weaver makes a cameo. Wa-hoo – so now the tables have turned and the plot continues.

It can be funny. Sure, there’s no doubt about that. It can even be clever and rather ingenious about its whole presentation (despite it being all presentation and no actual explanation. I don’t need an explanation per se, but I’d prefer something more than what I’ve been given here – complete with giant Titan/Greek God hand emerging from Hell at the very end). It’s just not very scary and much like how Studio 60 was supposed to give us the backstage details on SNL but wasn’t very funny, the same thing is happening here. The thrills and suspense ebbs more toward action than true horror. Just because zombies are chasing you doesn’t give the chase any gravitas. Just because a man has razor blades flying out of his face doesn’t make the fact that he’s just standing there scary. There’s no weight behind any of it – it’s all pulling from horror movie clichés that we’ve come to expect (or have been told as such) rather than ones that truly exist. Good horror movies don’t subscribe to the usual – but then I guess this isn’t sending up good horror movies.

My problem is that this is where horror is going – to this place where being the most ironic, self-referential asshole of a script means the better horror movie you are. There’s no thrill to any of these scenes. There’s no chase. There’s no suspense. There’s no horror in gore, there’s no horror in mocking a trope – so what’s the point? The same can be said for Scream 4 – sure you made some good points about the current state of the genre and sequels and trilogies and whatnot, but the movie just wasn’t very scary. So what’s to make of a genre that when it’s good it’s damn good and when it’s bad it’s as hackneyed and clichéd as a Christina Aguilera song? Cabin in the Woods seems to think it’s the former (like most Joss Whedon ventures, it rests assuredly on the fact that it’s better than everything you’ve ever seen, deserved or not…usually not) when it’s really more of the latter. Maybe I just want my horror movies to actually scare the shit out of me.


[Cabin in the Woods is Rated R for strong bloody horror violence and gore, language, drug use and some sexuality/nudity. It stars Richard Jenkins, Bradley Whitford, and Chris Hemsworth. Directed by Drew Goddard and written by Joss Whedon and Drew Goddard.]

JQuery Mobile and Ruby on Rails

When we added a mobile site to, I decided to go with JQuery Mobile. I had recently seen a presentation on it at DevNexus by Raymond Camden and was pleasantly surprised at how easy it was to create a slick, dynamic site for mobile browsers without much coding or design work. In practice, integrating JQuery Mobile into a Rails site proved incredibly easy.  We use Mobile Fu to detect mobile browsers and redirect them to our mobile layouts (.mobile.erb) and have a new mobile-only application layout containing links to the Jquery Mobile stylesheet and javascript file.

For a full explanation of using JQuery Mobile, check out their documentation; it’s astoundingly easy to create rich UIs.  For example: adding a link that looks like a native button is as easy as adding the HTML5 tag ‘data-role=”button”‘.  The strange thing about JQuery Mobile is that it takes over your navigation model and substitutes its own.  It uses this to allow you to do things like put multiple mobile “pages” into a single page and substitute native browser page navigation with an AJAX load of only the target page’s content.  This allows the browser to skip loading most of the DOM or reloading the Javascript engine when navigating between pages.  The effect of this is that JQuery Mobile sites feel much more snappy, almost like a native app.  (Phonegap, an installed mobile platform, supports using JQuery Mobile to create native sites.)

The disadvantage of this is that you lose a lot of your control over your navigation model; there are concerns to note when executing javascript on DOM elements and AJAX loading your own content has some small issues to keep in mind.

I learned the hard way JQuery Mobile works best when you stop fighting its static nature and allow it to provide a dynamic feel as much as possible.  For the full version of Jokels, whenever you click the “random joke” button, a new joke’s HTML is dynamic loaded and inserted into the main page to replace the old one, so my first attempt at the mobile site did the same: 

Here we use JQuery Mobile’s showPageLoadingMsg() and hidePageLoadingMsg() along with JQuery’s fadeIn and FadeOut to hide the page while a new Joke’s DOM is pulled in and the JQuery Mobile effects are applied manually.  Not only is this more likely to break than JQuery Mobile’s navigation but it also means we can’t use certain JQuery Mobile effects which don’t support manual creation, like button groups.

The second pass at this is was much simpler and robust.  Instead of trying to do our own AJAX loading we let JQuery Mobile do the work for us by dynamically creating a link to a random joke each time the mobile page is loaded: 

We don’t include the random joke link in the page creation since JQuery Mobile caches pages already visited: this means including the static link in the page HTML would create a cycle if we managed to loop around to a previously visited joke in a given user’s session.

Page caching brings up another big gotcha with JQuery Mobile: old page DOMs stick around after navigation.  This means that when you’re trying to use a JQuery selector to get a given element that may be on past pages, you need to make sure to select the current “page”‘s element instead of a cached one.  We do this by looking for the class “ui-page-active.” This is how we set the upvote button to a pressed state and update the vote score, for example: 

The final big issue with JQuery Mobile is that it doesn’t support query params.  Ostensibly this is to support page caching: the theory being that “pageA.html?a=1” wouldn’t differ dramatically from “pageA.html?a=2”, so JQuery Mobile strips out query params and treats both links as identical.  Obviously, this isn’t necessary true.  For example, our leaderboards use query parameters to change whether Users or Jokes are being shown, by what criteria they’re sorted and for what time frame they’re being considered.  This means that the same page with different query params can be dramatically different, so we need some way to support query parameters.  One way to get around this is to add the ‘data-ajax=”false”‘ attribute to any links with query parameters, but this loses the beautiful AJAX navigation model.  For the leaderboards we found a really simple solution: embed query parameters in the path using Rails’s dynamic segments routing.  So for our leaderboard links, we just use this snippet in our routes.rb:

Then, in our Leaderboard_helper class we have this small function to get a link to a given leaderboard: 

This allows us to still have static leaderboard pages using our query parameters, but use distinct paths so Jquery Mobile treats them as independent pages and loads them using its Ajax model.

JQuery Mobile has a few minor hang-ups.  But combined with mobile-fu, it allowed us to get a functional mobile version of much quicker than anyone with our mobile experience has the right to do so.