What I Learned Today
Today was some crazy learning. I figured out how to use Facebook Connect, which is cool, but not that interesting to talk about. I used this tutorial about using restful_authentication and Facebooker.
The cool things I learned:
Did you know that crontab has an easy syntax? You can use
@hourly,@daily,@weekly,@monthly, and@yearlyto have tasks run at those intervals. They usually run at when you'd expect - midnight for@daily, for example. Maybe everyone else knows this already.Universal solvent for
z-indexCSS problems in IE: make the element you want on top a direct child ofbody.Awesome jQuery event trick. I've been ripping click events off links when they require login, and making those functions fire on a login event. It's pretty simple, like this:
if ($link.data("events")) {
var clickHandler = $link.data("events").click;
for (var name in clickHandler) {
$link.bind('login', clickHandler[name])
}
$link.unbind('click');
$link.bind('click', function () {
showAccountDialog();
return false;
});
}
This is kind of awesome by itself, but I ran into a problem today: Rails JS helpers love using onclick inline to make stuff happen, which doesn't work with the above. I used my jQuery chainsaw to remove the offending issue:
if ($link.get(0).onclick) {
$link.bind('click', $link.get(0).onclick);
$link.get(0).onclick = undefined;
}
Call the click -> login code after this, and it all works.
Published: