# Welcome to the lab.

## Web Excursions for July 24, 2014

Hermit: a font for programmers, by a programmer
I really dig this monospace font for coding and terminal use. It looks great with my custom version of Twilight in Sublime Text.   : Via Wes Bos. See his post for more options, though notably missing Meslo
Using Tables With Ulysses and Marked
A good introduction to Ulysses 3 and Marked 2 integration.
Together for iPad and iPhone 1.0
I’ve been a fan of Together for a long time, and it’s finally available on your iOS devices. Sync with Mac requires the MAS version of Together.
BestPig/cv
A command line tool for showing the progress of long-running coreutil functions like mv and cp.
ROKODING: Video Encoding for the Roku
Via MacDrifter, this site contains Handbrake tips for encoding video for Plex and Roku, which I’ve just recently started using. A very handy reference.

## A Sublime Text selection primer

Text selection shortcuts make editing code (and even prose) much faster. Learning the selection shortcuts in any editor you choose to work in is paramount to saving time and effort. I currently do most of my coding in Sublime Text 3, so I’ve been practicing some of my lesser-used shortcuts. Here’s a basic cheat sheet.

Forewarning: I customize so many aspects of my editor that I may have forgotten that some of these aren’t defaults. If you run into conflicts or problems, let me know and I’ll either update this post or show how I modified my config to get the shortcuts working.

### Text Selection

• ⌘D: Expand to word

Note that you can define word separators in preferences, so underscores and dots can be included in a “word” selection.

• ⌘L: Expand to line

This is different from doing a ⌘←, ⌘⇧→ in Cocoa text fields. It selects what OS X refers to as the current “paragraph,” meaning the first character to the next line break, instead of just the current screen line.

• ⌘⇧A: Expand to tag

Handy in XML formats such as HTML and PLIST files. It selects the text inside the current tag pair, and pressing again selects the tags (open and closing) surrounding it.

• ⌘⇧J: Expand to indentation

If your code is properly indented, this command is really handy for grabbing everything inside, say, an if block.

• ⌘⇧␣ (Space): Expand to scope

Expand to scope is a great way to create selections, and it can progressively increase the selection with repeated presses. Select the text inside a quoted string, then the next time you press it, it will add the quotes themselves. Press again to select to the nearest surrounding brackets, and again to include the brackets themselves, and so on.

Combine this with other selection commands and you can do things like select the current scope, and then select everything at the same indentation within the current block with just a couple of keystrokes.

• ^⇧M: Select to brackets

This is another extremely handy selection technique. It’s just like “Expand to scope,” but skips directly outward to the nearest square or curly brackets. On the first press it will select inside the nearest brackets, pressing again will select the brackets. Subsequent presses will select the next pair outward, including the brackets themselves.

• BONUS: ⌘U will undo movements and selections, and ⌘⇧U will redo them.

Known as “soft undo,” use this if you accidentally lose a selection and want to get it back.

### Multiple selections

• ⌘-click/drag: add cursor/selection
• ^⇧↑/^⇧↓: add previous/next lines as multiple cursors, then use ⌘←/→ to select sections/lines.
• ⌘⇧L: break a block selection into lines

If you want to edit multiple lines at once, you can select the block of text and hit this shortcut to turn each line into a selection in a multi-selection. Then move the cursor and hold shift as needed to create selections within each line. When you type, you’ll affect all cursor locations and selections.

• ^⌘G to select all instances of the word currently under the cursor
• Search (⌘F or ⌘I), then use ^⌘G to turn results into multiple selections

If you want to act on multiple selections based on a search, use this to turn every instance of the result into a selection. It’s faster than dealing with Search and Replace. You can also grab a package from Package Control that will allow you to quickly do the same with regular expression searches.

### My keybindings

I override a few keybindings, but just want to mention a couple that I think are handy.

• ⌘⌥↑: Expand selection to scope.

I added this because it matches similar commands in some of my other editors.

• ⌘⇧M: Expand selection to brackets

I added this just for continuity with the other selection shortcuts.

Open Package Control and search for “select.” There are a lot of packages available for extending selection options. Some standouts for me:

• SuperSelect makes it easy to add search matches to the current selection one at time, selectively.
• Select Quoted
• Expand selection to function (JavaScript) lets you assign a key combination to select a full JavaScript function(){} definition in various forms.

I’ll probably get around to making a Cheaters sheet and Dash docset for these soon, but right now it’s just a note in nvALT for me.

## A big update to Shawn Blanc’s ‘Delight is in the Details’

Shawn Blanc’s multimedia book, ‘Delight is in the Details,’ has received a major update today. Shawn describes the book as:

Delight is in the Details is packed with practical advice, tips, encouragement, inspiration, and insight to teach you how how best to reach for excellence and resist the prevailing tide of “good enough” work that leads to forgettable products and a dissatisfaction in your work life.

The update includes new chapters, more videos, extra resources and much more. It’s also 25% off right now ($29). Go check it out. Nice promo video, too! ## The Polymo winners [Tweet : ADN : nvALT] The winners of the Polymo giveaway are: • Harshil Shah • Adrian Katz • Loris Kronov • Juan González • Skye Matthews • Marco • Roland Belényesi • Chris Marquardt • Rick Bola • Nuri Karamollaoglu Congratulations to all of you! If you don’t hear from the Giveaway Robot shortly, let me know. For everyone who didn’t win, be sure to check out the Polymo camera app with built-in tagging on the App Store! ## Tower 2 is twice the Git power [Tweet : ADN : nvALT] Git fans are often command line nuts. I know I am. But complex git operations can often be tedious, no matter how experienced you are. I fell in love with the Tower git client some time ago, and it makes using Git easy whether you’re an old pro looking for a fast solution for complex operations, or a total newbie with no command line experience. It makes complex merges, chunking and cherry picking, rolling back changes, etc. a breeze. Tower 2 is out today, and it’s a complete re-imagining of the tool. The visual conflict wizard is a godsend when you run into heavily conflicted merges. That, in combination with the latest version of Kaleidoscope make it (nearly) painless to fix up those merges. If you’ve been using git-flow, that workflow is now built into Tower. It’s a great way to keep a development branch, feature branches and a master “release” branch organized, with shortcuts for the necessary merging and rebasing procedures. Automatic background fetching, service account manager, multiple window support, and direct display of unsynced commits round out a very full new feature set. Check out the Tower website for more info. A single-user license is available for$59 US (and includes all future 2.x upgrades). Owners of a Tower 1 license get an upgrade price of $29 US, and customers who purchased Tower 1 on or after June 1, 2014 can get Tower 2 for free. See the store for purchase details. I’d recommend that any Git user (or anyone interested in getting started with Git) check out Tower 2! ## Custom export options for Marked 2 [Tweet : ADN : nvALT] Here’s a trick for Marked 2 that allows you to keep a custom export format updated every time you save your file and update the Marked preview. I designed it specifically for updating a Lyx file, but you can use it with any secondary processor that doesn’t necessarily output HTML. Marked’s Custom Preprocessor functionality allows you to do some work with the Markdown file after Marked has compiled any includes and custom syntax, but before it runs the Markdown processor (or other Custom Processor). All the preprocessor has to do is return plain text ready for conversion, so anything else that happens between is fair game. If a script returns “NOCUSTOM” on STDOUT (as the one below does), Marked ignores the output entirely, so you don’t even have to echo the original back out. This is especially handy with custom processors as it allows them to check for certain conditions before processing a file, and cancel the operation if it’s not needed. This code will take the open file and determine its directory path and filename, creating a compiled Markdown version and Lyx companion file every time the source file or any included files update. Save it as a script, make it executable, and then put the path to it in the Custom Preprocessor field in Marked’s Behavior settings. You’ll need the latest MultiMarkdown binary installed, so grab it if you don’t, and make sure it ends up in /usr/local/bin/multimarkdown. Here’s the script: If you don’t have Marked 2 yet, it has a lot to offer. I’ll be posting more tips and tricks soon! ## Marked 2.3 on the Mac App Store [Tweet : ADN : nvALT] Marked, my Markdown previewer and writing tool, is now available on the Mac App Store. Both the direct version and the MAS version will be discounted to$9.99 for the first week as an “upgrade” price for anyone using the Marked 1 Mac App Store version.

Important note: Marked 2.3 introduces sandboxing to both the MAS and the direct versions. This may cause documents you’ve opened before to require new permissions, but should be a pretty seamless transition. Also, the app name has changed to “Marked 2” in the Dock, and the bundle ID is now com.brettterpstra.marked2, for those using it in scripting.

Yosemite support is coming soon, but Marked 2 is not yet 10.10-compatible. If you need to download the previous version (which works on 10.10), use this link.

The nvALT “Preview in Marked” function will be broken until the next nvALT update (coming very soon). In the meantime, here’s a tip: Drop your nvALT notes folder onto the Marked 2 icon (assuming you store your notes as text files) and Marked 2 will automatically track changes to any file in that folder, automatically showing the most recently-updated file.

Here are some of the other new features:

• Mini Map navigation with magnifier and fast scrolling
• Bookmark based on proximity to nearest headline
• Preserve bookmarks across refreshes and style changes
• Highlighted word counts
• Count sentences in selection
• Accepts a json array in metadata for custom processor arguments
• Improved PDF export stability
• MathJax improvements
• GitHub nested checkboxes and styling
• Print speed improved

Go take advantage of the intro pricing (and on the Mac App Store) while it lasts (and be kind enough to leave a rating/review if you go the MAS route, please)!

## 36 years in this skin

It’s my 36th birthday today. It sounds cliché, but I can honestly say I never expected to live this long. For the first 24 years of my life, I believed my life expectancy was 24. For a few years after that it felt like I was living on borrowed time. These days I accept that I’m making better choices and look forward to living to a respectable old age, if everything goes well. I’m grateful for every. single. day.

I’ve been more or less clean for over a decade now.1 I’ve learned a lot about myself and the world in that time. I feel like at the age of 36 I can effectively assess the first 22 years of my life.

I started drinking and smoking in Middle School. I wasn’t a popular kid, but I didn’t fit in with the burnouts, either. I was just a nerd with a proclivity for addiction and a need to snuff out my feelings. It was later determined that I was Bi-polar and ADD, among other things. I saw a shrink for depression and suicidal thoughts, but nothing came of it as far as treatment. Self-medication became a way of life. By High School I was always “on” something. By college I was a full-fledged addict.

I was what they call a “highly functional addict.” This was both my salvation and my downfall. I could maintain decent grades, hold down jobs, and even convince a partner that I was fine. All these things while consuming an inhuman amount of narcotics. It made it possible to quiet my inner demons and still smile for the world. It also made it hard to feel like I needed help, even when things got really bad.

When I refer to the amount of drugs I’ve done, it’s not to brag. Far from it. It’s simply to underline that the average person has no concept of what I’ve done to this body. I’ve been checked into hospitals for “unrelated” injuries and accidents, and when blood panels came back I’d receive a visit from a doctor, often in pairs, who would tell me that I should technically be dead2 and that if they could find a way to force me into treatment, they would. They never did.

I eventually checked myself into rehab after watching enough friends decline into “junkiehood,” overdose, and even die.3 It should have been the knowledge of the amount of drugs I required to function normally, but it wasn’t. It was my observations of my friends.

I should mention that my last time through rehab was actually my third trip. The first two times I was high before I left the parking lot. After 15-30 days of rigorous self-examination and horrible feelings of isolation, a relapse just feels like coming home at the end of a long day.

The third time, I called my parents from rehab, dumped the story of the prior eight years on them, and asked them to drive up and meet me outside the door of the hospital in St. Paul, MN.

My parents were saints, in the sense that they showed unconditional love and support despite betrayal and in the face of zero reasons to do so. There were tears, and there was concern, resentment, and questioning of everything. They supported me nonetheless, and for that I am forever grateful. As a kid I had developed my own irrational resentments of my parents, but after coming out of the haze and really considering what they’d done for me, I began to truly love them. The thought of the extent to which they supported me is one of the things that helps keep me clean today.

Love is not an emotion that comes easily to me. My innate understanding of love is that it’s a chemically manufactured construct with the sole purpose of manipulation. I consider loyalty, in most instances, to be a braindead decision-making process. Honesty, though, I consider pure and holy, and had always reserved it for only the most sacred conversations, as well as a last-ditch manipulation tactic. Honesty about myself (and with myself), that is. I always found it all too easy to be honest about other people, usually to their faces, and not to the benefit of my social life.

I’ve learned to love over the last decade. I don’t think it’s the kind of love that other people refer to, but I’m able to rationally assess my feelings toward others and decide whether or not I’m willing to sacrifice for them. It’s not always a reciprocal thing, sometimes my detachment outweighs the sacrifices others have made for me. I don’t love them. I appreciate them. But my wife, my family and a select few friends I truly believe I love. I would risk everything for them.

My tendency to risk it all is another thing I’ve come to understand. I’m a gambler with all things, but the rush of gambling isn’t the core of the quirk. It’s a complete lack of fear of consequences. The kind that gets a person into trouble quickly, especially when their judgement is impaired to begin with.

Even now, with a clear head, I’m prone to make rash decisions and try things in a way that a more rational person never would. Whether it’s a split-second decision about shooting for that opening in a line of traffic on the highway, or a larger choice such as whether to quit my job and try to make it as an independent developer and writer, I lack the fear.4 I can logically weigh the pros and cons, but when it comes to gut instinct, I go for anything that looks gratifying. People often laud me for audacity when, in fact, it’s simply a lack of fear.

Courage is different from the absence of fear. You can’t be courageous if you don’t first internalize the consequences. Courage, to me, means overcoming fear, not ignoring it. If I’m courageous about anything, it’s facing life without chemicals, and that still occasionally scares the shit out of me.

So that’s me. I’m a mess. I hope you don’t think less of me for saying all of this. I accept my past and I’m grateful for where it’s inexplicably left me: alive, well, and able to ponder the reasons I’ve made it here. I’ll relish this birthday as I have every birthday since I was 25, and will continue to do so for as long as I can.

Thank you to my parents, my wife, my family and my friends for helping me be here today to write all of this. I’m grateful for all of you.

1. Experienced addicts will know that the fact that I drink craft beers and fine scotch is not “clean.” I believe I have it under control, but know that it may land me back in “the rooms” someday.

2. 2g of 85% pure china white really should do that to a person.

3. Or perhaps the decision about whether or not to bare my soul on a blog.