Protip: Color grep searches in terminal
alias grep='GREP_COLOR="1;37;41" LANG=C grep --color=auto'
Stash this away in your Z Shell (~/.zshenv) or Bash environment (~/.bashrc) and set your preferred ANSI code.
DoubleClick and Define using Apple Dictionary
var selection;
if(window.getSelection)
selection = window.getSelection();
else if(document.selection)
selection = document.selection.createRange();
document.observe("dblclick", function() {
if(navigator.userAgent.include("Macintosh")) {
location.href = "dict://" + selection;
}
});
A quick (and probably dirty) Prototype-based hack allowing Mac users to get the definition of any word by double clicking it.
A strftime for Prototype
Object.extend(Date.prototype, {
strftime: function(format) {
var day = this.getUTCDay(), month = this.getUTCMonth();
var hours = this.getUTCHours(), minutes = this.getUTCMinutes();
function pad(num) { return num.toPaddedString(2); };
return format.gsub(/\%([aAbBcdDHiImMpSwyY])/, function(part) {
switch(part[1]) {
case 'a': return $w("Sun Mon Tue Wed Thu Fri Sat")[day]; break;
case 'A': return $w("Sunday Monday Tuesday Wednesday Thursday Friday Saturday")[day]; break;
case 'b': return $w("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec")[month]; break;
case 'B': return $w("January February March April May June July August September October November December")[month]; break;
case 'c': return this.toString(); break;
case 'd': return this.getUTCDate(); break;
case 'D': return pad(this.getUTCDate()); break;
case 'H': return pad(hours); break;
case 'i': return (hours === 12 || hours === 0) ? 12 : (hours + 12) % 12; break;
case 'I': return pad((hours === 12 || hours === 0) ? 12 : (hours + 12) % 12); break;
case 'm': return pad(month + 1); break;
case 'M': return pad(minutes); break;
case 'p': return hours > 11 ? 'PM' : 'AM'; break;
case 'S': return pad(this.getUTCSeconds()); break;
case 'w': return day; break;
case 'y': return pad(this.getUTCFullYear() % 100); break;
case 'Y': return this.getUTCFullYear().toString(); break;
}
}.bind(this));
}
});
UPDATE: Bugs fixed. Thanks Andrew and Stephen
Also, some of my old and new code has been posted on GitHub. You might find something useful.

