Quicker way to observe events in prototype.js
Here’s a shorter way to listen for events in prototype.js.
Here’s a shorter way to listen for events in prototype.js.
I really like the MissingDrawer plugin for TextMate but it stopped working for me after upgrading to Snow Leopard. I recompiled it for 10.6 and now it works again.
Get the updated versions here (one with blue background and one with the white default).
Update:

We’ve been working on a new service on and off for a few months, called Linkli.st. The service was first launched in May but the last week we added some new (and awesome!) features so you should check it out.
Linklist is based around the very simple concept of creating, sharing and browse lists with links. It can be used for basically everything but I’ve found it very useful for things like:
We’re adding new features and working on it all the time so be sure to follow our Twitter feed (@linkli_st) for updates.
Last week I hacked together a small little project/library called nordea-rb. It’s a Ruby library and a (pretty basic right now) command line tool for getting read-only access to Nordea Bank accounts. I use it for displaying my accounts’ balances so I can see when invoices are paid etc.
Everything you need to know is in the README on GitHub so if you’re interested in this, check it out.

Today we released www.uglycute.com — the result of a two day workshop together with Konst & Teknik, Ola Bergengren, Uglycute and me.

I wanted to display my ToDos from Things on the Desktop using GeekTool so I created a command line tool in Ruby (backed by a library) to access the database.
This way you can see what needs to be done but without switching (or even launching Things)
It’s in a pretty early state right now and probably has bugs but I’ve been using it for some days now without problems. I’m planning to add write-support as well (so you can create tasks from the command line if Things isn’t running) but right now it’s read-only.
For more information, check out the README file and source on GitHub or this thread on the Things’ forum

Just a quick note that RailsTerm, my AppleScript to automatically open the tabs (in OS X 10.5 Terminal) needed for Rails development), is bumped to version 0.3.
Since I use Passenger (mod_rails) and Passenger.prefpane for my local development the script will now auto detect the virtual hosts available on your system (in /etc/apache2/passenger_pane_vhosts/*.vhost.conf). I use the script daily and is a real time-saver for me.
RailsTerm or browse source is on GitHub.
As you might know, we have a feature on CopyPasteCharacter to let the user copy a character to their clipboard by just clicking on the character. An invisible Flash movie would do the copying using the ActionScript function System.setClipboard.
In October, Adobe updated the Flash Player to version 10, which included some security changes, like: “Setting the Clipboard will now have to be invoked through a button, keyboard shortcut, or some other event initiated by the user.”. This broke CopyPasteCharacter (and many other sites) for people running Flash 10. I had some ideas on how to solve
We’re now having a fully working version which, since I couldn’t find any other solutions online, I thought could be useful for others/Google to know about.
The workaround I came up with is to use a hidden Flash movie which will get resized and moved to overlay the element/character where the user’s mouse is. This way, when the user clicks on the character, the Flash movie will receive the mouse event and therefore be allowed to set the system’s clipboard.
Here’s the code for the Flash movie (highlighted version)
import flash.external.*;
var text:String;
button.onRelease = function() {
text = String(ExternalInterface.call("Clipboard.textToCopy", Key.isDown(KEY.ALT))) || ' ';
System.setClipboard(text);
trace('copied [' + text + ']');
}
button.onRollOver = function() {
ExternalInterface.call('Clipboard.onFlashButtonOver');
}
button.onRollOut = function() {
ExternalInterface.call('Clipboard.onFlashButtonOut');
}
The Clipboard class can be found here if you’re interested. It should keep the old behaviour for Flash 9 players but we had some problems with it in some browsers on Windows so right now all players get the updated code.

Pluxemburg.com is the website for Swedish technotronica band Pluxus and the record label Pluxemburg they run together with Jonas Sevenius and us (Martin Strm and Peter Strm).
Pluxemburg has since its launch in 2000 gone from a small independent label with only one artist “Pluxus” to bigger with several artists (and grammy awards!) and then back to again being a quite small label. The 2009 version of Pluxemburg focuses mainly on Pluxus and Pluxus related projects.
A small record label needs to not only work on the websites of their artists and the label itself, but also constantly make sure that the info on the many online forums and communities are up to date and accurate. There needs to be Facebook and Myspace pages, last.fm events, discogs.com entries and so on. Updating these websites as soon as something happens (gigs, releases, parties, videos, etc) is time consuming and unfortunatley often ends up in a copy paste manner (spamming) rather than using the different forums for their different purposes.
When thinking about these conditions in connection to building a new Pluxemburg website, we realized that instead of constantly keeping the Pluxemburg and Pluxus websites updated, we should make a website that mirrors the contents of each community and instead spend our time keeping these communities updated. The information for each part of the new Pluxemburg.com is therefor spread out on the community where it “belongs” the best. The discography is mirrored from Discogs, the events from Last.fm, videos from YouTube, information from Wikipedia, links from Delicious and sounds from SoundCloud. We use the popular tumblelog Tumblr for the newsfeed, adding not only a tool for keeping our website updated but a small community in itself too. All colors used on Pluxemburg.com are based on the “corporate” colors of each community, making also the design a mirror of each community. There is even a Twitter-feed that mirrors everything that goes on on Pluxemburg.com, somehow making the site into a complete loop.
Technically, every day a pretty straight-forward Ruby script will automatically run on our server to update the information from all sources and then sends it (together with a security token to make sure the data isn’t messed with) to a PHP script at pluxemburg.com. The PHP script then processes (cleans and validates) the data and stores it in a file as serialized PHP, which is used by the index page to present the information.
Two weeks ago we (me and Konst & Teknik) launched copypastecharacter.com—a site to make it dead easy to copy those special characters which otherwise can be hard to find. We just pushed an update and I realized I hadn’t mentioned it here.
The character you click will automatically get copied into your clipboard, thanks to the flash technique mentioned here. However, I wrote my own JavaScript class to handle the clipboard and the buffer of clicked characters since you can hold down ‹alt› to copy multiple characters at once.
Here’s the source for the copy buffer class in case anyone’s interested.
This is the script I’m using when I start my local Rails development server. It will automatically detect the next available port starting at the default port 3000 so I can have multiple servers running without remembering what ports that are already busy.
#!/usr/bin/env ruby
DEFAULT_PORT = 3000
puts (`ps aux | grep [r]uby | grep script/server`.split("\n").map { |l|
server = l.split(/\s+/)[11..-1]
(port = server.index('-p')) ? server[port.next].to_i : DEFAULT_PORT
}.max || DEFAULT_PORT - 1).next
I aliased it to ss in .bash_profile like this:
alias ss='./script/server -p `~/bin/available_rails_port`'
(Btw, Happy 2008! I haven’t updated this site for a while)
The other day when working on some small updates on konst-teknik.se I wanted to sort the projects in a multi dimensional way, and take the other factors than the first into account. JavaScript’s Array#sort only supports one dimensional sorting so I wrapped my own sorter.
The results turned up pretty good (at least compared to the first test), or perhaps I just like recursing functions.
var sortOrder = {
'cat-no': ['cat-no', 'name', 'type', 'year'],
'name': ['name', 'type', 'year', 'cat_no'],
'year': ['year', 'name', 'type', 'cat_no'],
'type': ['type', 'name', 'year', 'cat_no']
};
function sort(order) {
var ordering = sortOrder[order], length = ordering.length;
$$('#projects > li').sort(function(left, right) {
left = Project.find(left), right = Project.find(right);
return (function(index) {
var a = left.getSortValue(ordering[index]),
b = right.getSortValue(ordering[index]);
return a < b ? -1 : a > b ? 1 :
index < length ? arguments.callee(++index) : 0;
})(0);
}).each(function(project) {
project.parentNode.appendChild(project);
});
}
Looks like I’m not the only one having problems with my iCal to/from iPhone syncing.
After trying almost every possible solution I found in various forums and google, I finally came up with a fix that works for me. Like many others, I suspected the subscribed calendars were the problem and the iPhone synced fine after removing the subscriptions (including the built-in Birthdays calendar). But I have some subscribed calendars I want to have in iCal and found out that the cannot live in a group. I used to have a calendar group (File → New Calendar Group) for my “noisy” calendars so I could hide them easy with just one click. Looks like iCal/iPhone/Sync/OSX/whatever doesn’t like this and syncing stops working when using the group.
Doesn’t work:

Works:

Seems like Multi-Safari (at least 2.0.4) broke when upgrading to Mac OS X 10.5.1. I get this error:
“You cannot use the application ‘Safari 2.0.4′ with this version of Mac OS X.”
Luckily, I’ve found a workaround. Just launch Safari from the command line (Terminal.app that is) and it should work for you:
/Applications/Safari\ 2.0.4.app/Contents/MacOS/Safari &
Recently I wanted to cache the results (responseText) from a lot of Ajax.Requests since the returning data would not change and made the roundtrip to the server unnecessary. Maybe there are others out there interested so here’s the code. It’s not very well tested except the project where it is in use so there might be some bugs or tweaks needed.
Ajax.CachedRequest = Class.create(Ajax.Request, {
initialize: function($super, url, options) {
options = options || {};
var onSuccess = options.onSuccess || Prototype.K;
if (!Ajax.CachedRequest.cache[url] || options.reload) {
options.onSuccess = function(transport) {
Ajax.CachedRequest.cache[url] = transport.responseText;
onSuccess(transport);
}
$super(url, options);
} else {
eval(Ajax.CachedRequest.cache[url]);
this.dispatch.defer();
[onSuccess, options.onComplete].each(function(m) { m && m() });
}
},
dispatch: function() {
Ajax.Responders.dispatch('onComplete', null);
}
});
Ajax.CachedRequest.cache = {};
Of course this assumes you’re using the brand new Prototype 1.6