The new year is upon us. Although I’m not much for resolutions (with the occasional exception), this is a time when many people dedicate themselves to improving their lives over the coming months. If you’re casting about for resolutions that can boost your productivity, I’d like to suggest learning (or brushing up on) four key skills. They all involve working with text and each of them will benefit almost any Mac user (and, for that matter, almost any computer user, period).
Write in Markdown
If your work involves writing of almost any kind—blog posts, articles, books, or even academic papers—a couple of hours spent learning the basics of Markdown will pay huge dividends. Many major publications (including Macworld) and blogging platforms (including WordPress) support this powerful yet lightweight method of text formatting. You mark up plain text files using simple tags (which are much friendlier and more readable than HTML), and then a behind-the-scenes converter can render that text as a fully formatted document in HTML, PDF, EPUB, or other format.
For example, if you wanted to insert a clickable link using raw HTML, you’d have to do it like this:
But in Markdown, it’s much simpler:
In all likelihood you’ll quickly get the gist of Markdown just by looking at Markdown creator John Gruber’s Markdown page, but you may find it more fun to use the interactive Markdown Tutorial website instead.
The beauty of Markdown is that because it’s based on plain text, you can use virtually any word processor or text editor, on any platform, to write and edit—without sacrificing the richness of full formatting in the final product. I generally work in unadorned Markdown using BBEdit or Nisus Writer Pro, but if you want extra bells and whistles—such as a live preview of the formatted output, shortcuts for adding tags, or syntax coloring—you can find innumerable Markdown editors and utilities in the Mac or iOS App Store. A few examples of highly-rated Markdown apps are Brett Terpstra’s Marked 2 (OS X; 5.0 mice, $12), Information Architects’ iA Writer for OS X (4.0 mice, $9) and iOS (3.5 mice, $1), and omz:software’s Editorial (iOS; 5.0 mice, $5).
You’re bound to encounter numerous variants of John Gruber’s original Markdown specification that add features not supported in the original (such as tables, footnotes, and definition lists) or follow stricter interpretation rules. But the core features are pretty much the same in every implementation, and once you know the basics, you can easily adapt to alternative versions if the need arises.
Use regular expressions
On countless occasions you’ve undoubtedly used Spotlight to search for a file on your Mac, or your word processor’s Find and Replace feature to locate or change text. But sometimes a simple search doesn’t cut it, even with the addition of simple wildcards like
? for any single character or
* for multiple characters. For example, what if I want to find every instance of a caption in a book I’m working on—something like “Figure 42: Blah blah blah” and make just the figure number (and the trailing colon) bold—but not touch any references to those figures (like “see Figure 42”) in the body text?
In cases like these, which I encounter on a daily basis, I use a regular expression (or “regex” for short), which is a sort of forumla, based on a flexible system of wildcards, that lets me identify nearly any sort of textual pattern. (A regex for the word Figure, followed by a space, one or more digits, and a colon—but only if it appears at the beginning of a line—is
The best implementation of regex I’ve ever seen is in Nisus Software’s Nisus Writer Pro (4.5 mice, $79) (a less-powerful version is found in Nisus Writer Express (3.5 mice, $45). Other apps that support regex include Bare Bones Software’s TextWrangler (5.0 mice, free) and BBEdit (4.5 mice, $50), Peter Borg’s Smultron (3.5 mice, $5), and Nikolai Krill’s Patterns (3.5 mice, $3). You can also employ regular expressions to find files on your Mac using the
grep command-line utility in Terminal. For details, see Find anything with grep.
For a quick introduction to regular expressions, see Transform HTML with regular expressions. A great way to teach yourself the ins and outs of regex is to use an interactive website that shows you matching text in real time as you change your input. Sites that do this include regexpal, RegexOne, and RegExr.
Use Boolean expressions
Continuing the theme of identifying patterns, sometimes it’s not a sequence of characters or words you’re looking for but rather a logical combination of terms within a file. For example, I might want to find any email message that contains the word “apple” but only if it also has a term that suggests a dessert, such as “pie,” “cobbler,” or “whipped cream.” Whenever you’re looking for a file, message, contact, or other item that contains this or that, this and that, or some other logical combination such as “(this or that) and the other thing but not something else,” you want a Boolean expression.
A Boolean expression uses the logical terms AND, OR, and NOT (often along with parentheses and quotation marks) to come up with a “true” or “false” statement. Search for “sticks OR stones” and you’ll match anything that has either term; search for “sticks AND stones” and you’ll match only items that contain both. For the most part, it’s that simple.
You can use Boolean expressions in Spotlight, Mail rules, Calendar searches, and many third-party apps. Unfortunately, Boolean logic isn’t currently supported in Contacts, iTunes, or the App Store.
Create a secure password
A good password—one that will resist almost any attempt at cracking—should be long and unguessable, with a combination of uppercase and lowercase letters, digits, and punctuation. But when we’re asked to create such passwords, many of us encounter a mental block.
You often hear mnemonic tips like “Make a long sentence, and then your password becomes the first letter of each word (and that can include capitalization and punctuation).” That wouldn’t be terrible advice if you had only one or two passwords to remember. But you probably have dozens, or maybe even hundreds. (I have well over 700 unique passwords.) One of the worst security mistakes you can make is reusing the same password in multiple places—if one password were stolen, leaked, or cracked, an attacker could access all the accounts that use the same password. Keeping every password unique contains the damage.
The sane way to create and remember lots of long, random passwords is to use software that does all the work for you, syncs your passwords securely across all your devices, and automatically fills them in when needed. If you use Safari on OS X and iOS, iCloud Keychain can do all this for you. If you want to use multiple browsers or non-Apple operating systems, if you want longer and stronger passwords, or if you’d like additional features such as storing software licenses and other personal data, you might prefer a third-party app such as AgileBits’ 1Password (5 mice, $50), Dashlane Premium ($39 per year), or LastPass (4.0 mice, free).