View Source in TextMate for Safari
Have you ever had the need to check the source of the current page in Safari, only to discover this ugly little window that doesn’t do any kind of syntax highlighting?

Wouldn’t be neat to open it in TextMate instead? And wouldn’t be even more neat to have it as an item in a Safari menu? Yes? Ok, so let’s create a custom service!1
First start Automator, select the “Service” template and add the “Run Applescript” action. Then copy and paste the following script in the action’s text area.
This script will automatically fetch the URL and title from the frontmost page in Safari, save the page as a temporary file, and open it in TextMate.
Since the script uses Safari’s AppleScript interface to fetch the necessary information, it doesn’t need any prior info from the browser. So let’s tell Automator that:

Save and you’re done. Enjoy it.
Note that with this technique you can create all the custom Services you need, and even assign them keyboard shortcuts.
To do that, head for the Keyboard panel in System Preferences and let the following picture speak for me.

-
if you don’t want to do this work, I have done it for you. Download the service, extract it in
~/Library/Servicesand restart Safari. ↩
Sharing Git repositories with one command
Although it’s often better to use remote Git repositories, in a truly collaborative development environment such as hackfests or conferences1 it’s faster and simpler to share your repositories from your computer.
In those situations you have two ways to share your code without having to fight with user accounts, permissions, ssh keys and passwords.
Git daemon
To fire up a git daemon for the repo you are currently in:
git daemon --reuseaddr --verbose --base-path=. --export-all ./.git
Yes, it’s one command but it’s too long. A better solution is to create a git alias by adding these lines to your ~/.gitconfig:
[alias]
serve = !git daemon --reuseaddr --verbose --base-path=. --export-all ./.git
Now you can give access to your repository at git://localhost/ simply by running git serve. Pretty cool, huh?
HTTP (via user web directories)
Sharing a repository through a web server is particularly handy when you want to share more than one repository at a time. It’s not like running a one liner, but nothing that can’t be automated!
So I wrote this script. Change the variables on top of it if you need to and just run it in the repo you want to share.
-
basically every time you need to give temporary, read-only access to your repositories ↩