UTF8 in Crowbar

Crowbar is an awesome scraping tool, but it messes up if the page contains non ascii characters. After snooping around crowbar's source, the following is a "fix" I came up with.

var converter = Components.classes[";1"].
converter.init(outstream, "UTF-8", 0, 0);
//outstream.write(response, response.length); //<-----original

URI Encoding an image

I've known for some time that it's possible to embed an image into CSS (useful for greasemonkey scripts), using a format like so:


...where [mimetype] is the mime type of your data (eg, image/png).

It's eluded me until now how exactly to get at the [data] bit of this equation. This is simply the base64 encoded string of the actual bytes of the file, which you can get like so:

cat foo.png | base64

This will spit a bunch of garbage to your screen, which you copy and paste into the [data] placeholder.

Firefox caches form values

Firefox caches form values. Most noticeably, it caches the selected position on select boxes. I less often run into cached checkbox and radio button values... even the occasional cached text box value. If you're a developer, you will be familiar with this and its work-around -- clicking into the url box and hitting enter rather than refreshing while debugging.

Resolved: Logging to Firebug console breaks IE

The firebug console is great for debugging javascript -- but it's really annoying when you want to quickly check something in IE and can't without first removing all your debug statements to avoid a bunch of javascript errors.

Here's a handy log function which checks first that firebug is in use before trying to log to the console. The function is a no-op in IE.

log_debug = function() {
  if(window.console && window.console.firebug) console.log.apply(this, arguments)

log_debug('foo', 'bar', 'bash')

Tab switching keybindings

For some reason, I always forget this exists.

Switching tabs left-to-right: Ctrl+Tab
Switch tabs right-to-left: Shift+Ctrl+Tab

More shortcut keys here:

They claim that you can switch between tabs 1-9 with Ctrl+[1-9], but on firefox/linux that functionality is actually Alt+[1-9].

Turning on firefox emacs keybindings

  • Run gconf-editor from the command line
  • Change the key /desktop/gnome/interface/gtk_key_theme from "Default" to "Emacs"
  • Restart Firefox

Open certain tabs by default in firefox

Open the tabs you'd like to have opened on startup.

Go to Edit > Preferences > Main > and in the Startup section, click on the "Use Current Pages" button.

Go to Tools > Options > Main > and in the Startup section, click on the "Use Current Pages" button.

Hit OK and those tabs will open up each time you start Firefox.

Syndicate content