Just a quick snippet I’m using to open a new tab in Terminal. It accepts a single, optional argument which will override cd’ing to the working directory.
#!/usr/bin/env bash
if [[ $# -eq 0 ]]; then
dir=`pwd`
else
dir=$1
fi
/usr/bin/osascript \
-e "tell app \"System Events\" to tell process \"Terminal\" to keystroke \"t\" using command down" \
-e "tell app \"Terminal\" to do script \"cd $dir\" in front window" \
-e "tell app \"System Events\" to tell process \"Terminal\" to keystroke \"l\" using control down"
I’ve put the shell script in “/usr/local/bin” as this is in my $PATH. I’ve named the script “tab” so whenever in Terminal I can enter “tab” to open a new tab with the current working directory ready and waiting. Very useful when working with Rails and multiple shells.
I think everyone has seen a form on a web page that has text fields that automatically empty when they receive focus. I’ve added this functionality to countless fields over the years and the behaviour I used to to this has evolved more and more. Using Prototype and the following script you can have fields intelligently empty themselves. MORE »
If you’re running an Apache web server and you want to speed up your visitor’s browsing you can enable mod_deflate, which has replaced mod_gzip in Apache 2.
You’ll probably find your mod_default module is already installed and available with just a couple of lines of configuration. MORE »
I’m currently working on tweaking Apple’s lazy GUI design by alphabetising VPN connections in both System Preferences and the VPN Connection menu. This is definitely only intended for Leopard and I wont be testing it in Tiger or supporting it. It’s just for my own personal use as I have 40 odd VPN connections. The initial proof of concept code is below. I still need to work on getting things to work reliably and smoothly. MORE »
I recently decided to install Git on my (dv) 3.5 and found an article written by the guys at MediaTemple, my hosts, with instructions on how to do it (isn’t it nice when someone else does the hard graft for you?!) Unfortunately, the article was old and inaccurate. Luckily, with a bit of digging around I managed to get yum installed, updated and ready for Git. MORE »
If you use TextMate when you’re coding for the web you’ll probably have at least tried out Jim Jeffer’s CSS Bundle, which was inspired by an article by Jina Bolton. If not check it out!
When I first downloaded it I was impressed but not exactly blown away as the snippets don’t really leverage the true power of TextMate’s bundle system. I had to get to work to make things a lot smoother. MORE »
Recent Comments