summaryrefslogtreecommitdiff
path: root/cmd/read-docs.txt
blob: a0c4cd33f4396bbf99d2d0bb20773019a78de203 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
It is impossible to over-emphasize the importance of Reading The Fucking Manual. There are two ways to get better at stuff, reading and doing. The more you do the first the better you get at the second. And of course the better you get at doing the better you get.

RTFM can be a little bit if a confusing notion for web developers though. Unlike programmers who have the Python documentation or RubyDoc files they can read through, HTML and CSS, the primary tools of our trade do not really have a manual, at least not in the traditional sense. There's the specification, and while reading specs is both as boring as you would expect and far more useful than you might expect (I encourage you to do it), it's not a place you'd normal turn to to answer a quick question.

At the same time typing "how to use css transform" into Google is a crap shoot. You might get something useful, but it might be outdated, browsers might have changed things, the spec might have been re-written for some reason. 

The best docs I know of and what I use for HTML is the [Mozilla Developer Network](https://developer.mozilla.org), though it's rare that I visit the actual site. I do my development work in Vim and on the command line, switching to the browser, opening a new tab and then typing the URL followed by whatever I want to look up... fuck that. Sure, it doesn't sound like much, it's not much from a pure time perspective, but it's a huge context switch, it pulls my brain out of what I'm doing and directs it somewhere else from which it may not return immediately.

Perhaps I just have some sort of attention deficit disorder, but I can't tell you how many times I have tabbed over to Chromium to find the answer to some question and found myself browsing 1969 Yellowstone trailer images (I'm restoring one if you must know) on obscure forums half an hour later. Context switching kills your ability to concentration.

That's where Dash for OS X and Zeal for Windows/Linux come in. Both applications are offline browsers for documentation. You can download the MDN docs for HTML and CSS, as well as more traditional documentation sources like JavaScript, Ruby, Python or hundreds of others.

This way I can minimize the potential distractions. It's still a context switch -- another app opens, though using Dash's HUD view my full screen terminal stays where it is in the background  -- but there's no internet there to disappear into for hours. 

As an added bonus I can get answers even when I'm working somewhere I don't have access to wifi. This is especially useful since I like to block my time and actually work for half, sometimes a whole day without allowing myself access to the web. I sit down and write, just me the command line and the task at hand. No distractions.

In fact Dash/Zeal may be the most effective focus/productivity tools I use and yet I never really think of them that way. Still, they can save you from yourself so go grab whichever one you need, follow the installation instructions, download some "docsets" (Dash/Zeal's name for documentation) and then come back and I'll tell you how I use them.

Here's a little secret, I don't actually even have to open Dash or Zeal (I work on both an OS X machine and an Linux machines so I use both). Open an app? How primitive. I've got plugins for my text editor of choice (Vim), all I do is position my cursor over a word, hit the two-key shortcut combo and Dash/Zeal opens an overlay window with the results.

That's great when you're in the editor, but sometimes my cursor is just there on the command line, no editor or anything else, I want an easy way to search Dash/Zeal right where I am. To make it easy to search Dash/Zeal straight from the command line I wrote a very simple shell function that will looking things up directly from the command line.

Here's what that function looks like with Dash on OS X:

~~~.
function lu() {
	open "dash://$*"
}
~~~

Here's the Zeal version for Linux/Windows with Cygwin looks like:

~~~.
function lu() {
tk
}
~~~

I call it "lu", which is short for "look up", because it doesn't conflict with any existing tools I'm aware of (at least nothing I've ever used). With these functions I can do this:

~~~.
lu html:picture
~~~

And instantly get a window with the MDN article on the HTML5 Picture element. If I want to look up the CSS transition article it would look like this:

~~~.
lu css:transition
~~~

And here's what it looks like when I do that, note that this chapter is still there in the background:

![tk pic ]

When I'm done I just hit Esc twice and that pop up window goes away and I'm back to writing this sentence. Thanks to my function and Dash's keyboard shortcuts I never had to take my fingers off the keys and I never got distracted by anything shiny. I got in, got educated and got out.