Monthly Archives: May 2012

Easy Screenshot Sharing in OSX

Now that I’m using a Mac, the screenshot uploader I wrote isn’t all that helpful. Shame, I was really enjoying the quick and easy screenshot sharing. Fortunately, OSX has some built-in hotkeys for taking screenshots. What’s more, you can change where they save. What’s even more, you can add scripted actions to folders with Applescript. Mix in a little Dropbox, and BAM, I’m sharing screenshots with the greatest of ease!

The flow goes like this: Capture screenshot (selection, window, screen, whatever), it gets saved to my Dropbox Public folder, the link gets copied in to my clipboard, and I get a Growl notification when it’s all ready to go. Here’s how.
Continue reading

Git Info in your Bash Prompt

I was hanging out with a very cool fellow developer, and while he was showing me something on his computer, I happened to notice that his shell prompt changed when he entered his git repo. The prompt showed what branch was currently loaded, like so:

Pretty boss, right?! He told me it was part of oh-my-zsh and that I needed to install that ASAP. Being a long-time user and fan of bash, and someone who does a fair amount of bash scripting on the shell directly, I was hesitant to switch because it would mean learning a new scripting language. It occurred to me, however, that there was likely a way to get the same thing in bash.

A cursory look revealed bash-it, which claimed to be “shameless ripoff of oh-my-zsh.” Perfect! Unfortunately, not so much. Most of the stuff that it offered I didn’t want, and using it would mean more modifications to my dotfiles. But, the git part did work, and it was easy to copy too.

Here’s how to add it to your own bash shell. Add this code to your .bash_profile or .bashrc (all these years in Linux and I still don’t know the difference) and you’re set.

function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "("${ref#refs/heads/}")"
}

Now, in the PS1, add a call to that function, like so.
export PS1="\u@\h : \w \$(parse_git_branch) $ "

Yours likely looks different than mone, but the important bit is \$(parse_git_branch). If you don’t have a PS1 set, you can copy and paste that one. Now, when you enter a path that is a git repo, it’ll show the branch you’re currently using in the prompt. Sounds quite simple, but it’s really handy, especially if you do your git work on the command line!
Continue reading

My Move to Mac

As I’ve tweeted recently, I sold out earlier this month and bought a Mac. A Macbook Air to be specific.

So why abandon all my years and years of Linux use? Because Apple seems to be the only company making laptops worth buying. I think this is evidenced by the second-hand Macbook market, which is doing quite well. It’s not uncommon to see 2009 model Macbooks being sold with relative ease. The same can’t be said about hardware from other manufacturers; most will leave their users in the dust as soon as they release the next model.

People have this idea that Apple hardware is overpriced, but that’s not true. Yes, it’s expensive compared to the throwaway $500 laptops that line the shelves of all the electronic stores, but Apple’s hardware is on another level. What’s more, it holds its value, so 2-3 years down the road when you’re ready to upgrade, that hardware is still worth something. I’ve got a few old laptops kicking around here that’ll tell you that’s not true of other company’s hardware.

It wasn’t always this way, mind you, but it definitely is today. Even spending the same or more on a laptop from another company doesn’t give you the same level of quality. Continue reading