Updated Fluid App Userscript for Gmail Unread Count

spacer I’ve been enjoying using a Fluid App for my Google Mail account and I bought the Pro version for $5, primarily so I could get a badge in my dock with a count of unread messages. Unfortunately, the script that ships with the app to display this account no longer works, likely due to changes in Gmail itself. The original script parses the very complex markup to get the inbox value. My simplified script just reads the window title to determine the unread count. Here’s how to install the script:

  • Window > Userscripts
  • Create a new script
  • Pattern: “*mail.google.com*”
  • Script:
window.fluid.dockBadge = '';
setTimeout(updateDockBadge, 3000);
setInterval(updateDockBadge, 15000);

function updateDockBadge() {
	var title = document.title;
	var regex = /\s*Inbox\s*\((\d+)\)[^\d]*/;
	var res = title.match(regex);
	if (res && res.length > 1) {
		var newBadge = res[1];
		window.fluid.dockBadge = newBadge;
	}
	else {
		regex = /^Inbox -/;
		if(regex.test(title)){
			window.fluid.dockBadge = '';
		}
	}
}

How it works:

It reads the window title and detects if you’re in the inbox and if there’s a number representing unread messages.

  • If so, it puts that number in the badge
  • If not, but you are in the inbox, it clears the badge
  • If you are viewing a message it does nothing to the badge since the unread count only shows on the inbox

This is obviously less technically clever than a script that reads the inbox count from the page markup directly, but it’s much less likely to break with changes to Google Mail, and much easier to understand and therefore fix if something does break.

As an aside, if you’re looking for a fancy Gmail icon, check out this set in the flick Fluid Icon Pool.

Posted on by Scott Nelle in General

Zeitgeist.css Chrome Extension

I’ve put together a small Google Chrome extension which automatically adds Zeitgeist.css to any page which is unstyled. Install the extension here, or read on for more info. and source.

About Zeitgeist.css

Zeitgeist.css is a fun project started by Ryan Freebern which aims to create a default styling for web pages that reflects the aesthetics of the day, whenever that day may be. In Ryan’s word’s:

zeitgeist.css is a crowdsourced, extendable basic CSS file that imparts a design based on current design aesthetics to any simple HTML file, such as those produced by compiling markdown.

Think of it this way: If you make a web page and add no styles, it looks dated. Zeitgeist.css aims to bring those pages up to date easily. As easy as Ryan makes it, however, it isn’t automatic. That’s where this extension comes in. It checks every page using JavaScript’s querySelectorAll method to determine whether styles have been applied via a link element or a style element. If not, Zeitgeist.css is automatically applied.

  • Install the Zeitgeist.css Chrome extension
  • Download the zipped source
Posted on by Scott Nelle in General

Design Refresh

For the first time in years I’m making not-insignificant changes to the design of this site. The last design even survived a complete rewrite and update of the HTML. Now I’m adding a fresh coat of paint to complete the update. I’ll be iterating on this design for a while–consider it something of a live redesign. There may be a few rough edges, but I’ll try to smooth them out over time. Thanks for sticking around.

Posted on by Scott Nelle in General

Advice for the Geographically Challenged Employee (AKA Working Remotely)

Ryan Irelan of Happy Cog recently posted about the challenges of working remotely as part of a team in the web development industry. I’ve got some experience with that; before moving back to Vermont I spent about a year working from an apartment in Florida, 1400 miles away from the rest of my team. A lot of what Ryan said resonates with my own experience. He touched on keeping a strict schedule for certain tasks and emphasizing certain types of communication to minimize interruptions and protect your time. He also talked about techniques he uses to avoid breakdowns in communication that can occur when you’re never face to face with anyone. He has some great tips that are probably almost as valuable if you do work with your team in an office.

I’ve got a few other tips that I’ll throw out, just for kicks:

Communication

Ryan touched on this. Use as many methods of communication as you need to make sure everyone is on the same page. Then take it a little farther. Know what everyone on the team is up to and let them know what you’re up to. Check in about non-work stuff, too (but only when it’s not going to be an interruption.) It’s tough to keep a good working relationship going via single-sentence emails.

Discipline

You may be working 6 feet from your comfy bed. You may be tempted to oversleep. You may have lots of great stuff to play with at home. You may have cool games on your computer that call to you. You may have friends asking you to hang out (you don’t really work, anyway. Right?) Ignore it all. Don’t fall into these traps. Don’t tell yourself “I can sleep in 10 extra minutes and no one will know.” It’s a slippery slope. You’re a professional and you should act exactly as you would in an office with other professionals. Arrange schedules to keep yourself on task. Always be available at the same time every day. Communicate often. Stay focused. Discipline is absolutely the key to working successfully when separated from your team by geography.

For me, keeping rigid discipline in my workday was the way to make sure I didn’t inadvertently abuse my employer’s trust or let down my team members. And it paid off. I was the most productive I had ever been.

Shoes

Seriously. I don’t remember where I read this tip originally, but it always helped me. Something about wearing shoes always made it feel like I was out of the house and into the office, even though I was working from my bedroom desk. If you’re struggling for focus, slap on a pair of shoes and tie them, tightly. This is not a joke.

Posted on by Scott Nelle in Web

Create a Static Splash Page in WordPress

I know, splash pages are wrong, evil, and will probably bring about the downfall of society. But what if you need one anyway? Say, for example, you are preparing to launch a site based on wordpress but while you’re still putting it all together you don’t want visitors poking around. How can you create a static splash page to tell people that your site is coming soon (whatever that means?)

I found myself in just that situation recently. I looked around for a plugin to let me replace my index with a simple html document for a little while. I may write one yet, but for now a beautifully simple solution is doing the trick. Here’s what to do:

  • Create a blank file in your theme directory and call it something like splash.php.
  • Make it a page template by pasting in the following:
    <?php
    /*
    Template Name: Splash Page
    */
    ?>
    
  • Write your static HTML. If you need to link to images or stylesheets, I suggest putting them in a subdirectory of your theme called something like splash. You can then reference them in your HTML using a bit of code like <img src="/img/spacer.gif"> . Notice the php which finds your theme directory for you so your theme remains portable.
  • spacer Create a blank page and set it to use the custom page template you’ve created. You’ll find it under the Page Attributes menu. As of WordPress 3.1 it’s on the right side of the admin and looks like this image.
  • Under Settings > Reading set the front page to use a static page and select the new page you’ve created. The index of your website will now be your page template with no dynamic content and no other theme files included. Easy-peasy.

Because you never called get_header(), get_sidebar(), or get_footer() you can now have a totally static splash page while you’re tweaking a theme, editing content, and doing your WordPress business in secret behind the scenes. If you still want to pull in some content from WordPress (like the title and page content) you can even grab the loop from your existing page.php and use it in your splash page.

Posted on by Scott Nelle in WordPress

Simple 301 Redirects Version 1.02 (and 1.03) Released

I’ve released a bug fix version of Simple 301 Redirects for WordPress. Version 1.02 fixes a couple of bugs and 1.03 adds PHP4 support, which I carelessly neglected in 1.02. It seems that a lot of people still use PHP4 even though it’s been officially dead (i.e. unsupported and with no security updates) for over 2 years. You can get the latest version of the plugin by updating from your admin system or by visiting the WordPress plugin directory.

Posted on by Scott Nelle in General

TeuxDeux iPhone App Released

spacer TeuxDeux, my favorite simple to use and difficult to spell todo list application, has quietly launched an iPhone app. They’re apparently waiting to announce it later this week, but Tina Roth Eisenberg (the designer behind TeuxDeux) recently talked about it on The Pipeline with Dan Benjamin. The app costs $2.99 and supports all of the features of the free browser-based version plus support for multiple accounts, and it’s always in sync with your accounts on the website. You can buy the TeuxDeux app here (iTunes link.)

Posted on by Scott Nelle in General

Stop Friends From Checking You In With Facebook Places

Facebook Places adds geolocation to Facebook, allowing you to share where you are, what you’re doing, and who you’re with. It differentiates itself from Foursquare or Gowalla, with an interesting additional feature: it allows you to check your friends in with you. This is a cool feature but it is certainly open to abuse; your friends could check you in somewhere embarrassing as a practical joke. Depending on who’s watching, you may find it causing problems for you.

Here’s how to prevent other people from checking you in on Facebook Places:

  1. Click on Privacy Settings
    spacer
  2. Click Customize Settings
    spacer
  3. Under Things Others Share, disable Friends can check me in to Places
    spacer

That’s it. I’d like to see the ability to select certain people or friend lists which are allowed to check you in (or filter out people and lists which are not) but for now it’s an all-or-nothing setting. I’ll update this post if the options around this feature become more robust in the future.

Posted on by Scott Nelle in General

Prefetch Content With HTML5

Cameron Moll recently pointed out that HTML5 allows you to use link elements to preload content–either pages or page assets like images. Cameron rightly points out that Firefox is, for the moment, the only browser that supports this feature, but I imagine it’s only a matter of time before some enterprising individual puts together some JavaScript to extend the functionality to other browsers. Image preload scripts, after all, have been around forever.

You can read more about HTML5 pre-fetching here.

Posted on by Scott Nelle in HTML5

Programming Cheat Sheets At QuicklyCode.com

spacer QuicklyCode.com is a web gallery of cheat sheets related to programming. It’s got rating features bolted on which, with any luck, will help you find the best cheat sheet when there are several available for a given language or technology.

I haven’t owned a printer in something like 8 years, and that makes getting the most of QuicklyCode difficult for me. I may start making routine trips to FedEx Kinkos though, because I do love a good printed sheet of quick documentation.

Posted on by Scott Nelle in Links