FastMail + Fluid: unread messages badge userscript

Couldn't be easier:

window.fluid.dockBadge = '';
setTimeout(updateDockBadge, 1000);
setTimeout(updateDockBadge, 3000);
setInterval(updateDockBadge, 5000);

function updateDockBadge() {
  var count = document.getElementsByClassName('inbox')[0].childNodes[1].innerText;
  if(count == "0") {
    window.fluid.dockBadge = '';
  } else {
    window.fluid.dockBadge = count;

Props to FastMail for having sensible class names.

Mountain Lion notifications with Guard

If you want to use native Mountain Lion notifications with Guard instead of using Growl notifications, here's what you do:

  • Make sure your version of Guard is up-to-date (v1.3.2 as of now)
  • gem install terminal-notifier-guard
  • Add terminal-notifier-guard to your gemfile in place of growl

cdff - cd to the path of the front-most Finder window

Terminal commands tocd to the front-most Finder window:

function ff { osascript -e 'tell application "Finder"'\
 -e "if (${1-1} <= (count Finder windows)) then"\
 -e "get POSIX path of (target of window ${1-1} as alias)"\
 -e 'else' -e 'get POSIX path of (desktop as alias)'\
 -e 'end if' -e 'end tell'; };\

function cdff { pushd "`ff $@`"; };

Bonus: copy the path of the frontmost finder window to the clipboard:

function pwdff { echo -ne "`ff $@`" | pbcopy; };

Source: Mac OS X Hints forum post

Inserting inline graphics in Pages '09 (Mac)

I spend a lot of time dragging and dropping formulas from Brisk into Pages as PDF objects.

The default when dragging any graphic (image, PDF, etc.) into Pages is to insert a floating object, while I usually want an inline object. It requires three annoying clicks to change the float/wrap preferences for a object :(

You can accomplish this by holding command+shift while dragging and dropping!