Adding the current Git branch to your terminal prompt

Tips and tricks / Jan. 29, 2015

Screen Shot 2016-01-29 at 1.52.15 PM

Martin Fitzpatrick has a great tip that helps me keep my sanity when working with Git branches. Googling will give you lots of ways of accomplishing this, but this one is simple, straight-forward, and works well for me. I won’t repeat his post, but basically you add a short bit of code to the .bash_profile file that lives in your home folder. Note that if this is your first time altering Bash, .bash_profile may not exist, so you’ll have to create it using Sublime Text or whatever text editor you like.

I like having color in Terminal, but I find a colored prompt distracts from the other colored content, which is usually for colored for more important or informational reasons. This post on OSXDaily has a good rundown of adding color to Terminal.

Here’s my .bash_profile which puts the Git branch in light gray.

# Enable colors
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad

# Get current Git branch
parse_git_branch() {
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'

# Prompt appearance
export PS1="\h:\W\[\033[37m\]\$(parse_git_branch)\[\033[00m\]$ "

How to change InDesign’s default screen resolution

Tips and tricks / Feb. 11, 2014

Once upon a time, back in the days of InDesign CS4 and earlier, viewing an image at 100% meant that each pixel in an image took up one pixel on your monitor. So a 50 pixel square viewed at 100% would appear the exact same size in InDesign as it did in Photoshop. It was fancy! But those days are gone. Go to InDesign, create a new document using their 800 x 600 pixel default, take a screenshot and measure. On my 27″ iMac, that 800 x 600 document is actually 1210 x 908 pixels when viewed at 100%. So what gives?

What size is it

Adobe changed the default screen resolution from a strict 72 ppi because monitor resolutions were getting higher as technology improved. If you were working on a print project, an object that was 1 inch wide in your document used to physically measure around 1 inch on your old CRT screen. But as resolutions increased and the world switched to LCDs, that inch kept getting optically smaller. I’m guessing this made some print designers unhappy, though it never bothered me. If you still work solely on print projects you probably don’t care about any of this. In fact maybe you love what Adobe has done.

But turns out InDesign is kinda awesome for creating web wireframes, especially if you’ve spent the last 10 years becoming an InDesign wizard. For years I’ve stuck with InDesign CS4 so 100% could be 100%, but I’ve discovered you can upgrade and eat your cake too! Here’s what you do:

  1. Paste these two lines into your favorite plain text editor:
    app.generalPreferences.customMonitorPpi = 72;
    app.generalPreferences.useCustomMonitorResolution = true;
  2. Save the file with a name something like ‘Monitor resolution – web.js’
  3. Put that file here: Macintosh HD > Applications > Adobe InDesign CC > Scripts > Scripts Panel
  4. Launch InDesign, create a new document, and open the scripts panel (Window > Utilities > Scripts)
  5. Double-click on that new script you added and BAM! … nothing happens. Ok, just wait a sec.
  6. Now double click on the zoom tool in the tools panel (you know, the magnifying glass under the hand) … and now BAM! The document should have just gotten smaller because now a pixel is a pixel — just like the days of yore!
  7. If you need to switch back and forth, create another script file with this single line of code:
    app.generalPreferences.useCustomMonitorResolution = false;

    Call that one something like ‘Monitor resolution – default.js’. Now you can switch back and forth using the scripts panel.