

Eliminating my trivial inconveniences building Discourse - ppadron
http://samsaffron.com/archive/2013/05/03/eliminating-my-trivial-inconveniences

======
habosa
<http://xkcd.com/1205/>

Obligatory XKCD on this topic.

~~~
jewel
The idea of this comic is that it's not worth spending dozens of hours (say,
over a year) customizing your work environment in order to save just a few
hours during that same time period.

There are other factors at play besides the wall clock time. It should be
easier to maintain focus and stay in the zone. I like having a shortcut for
everything I do on a daily basis so that it can become muscle memory.

Also, consider that sometimes your behavior will change in response to the
optimization, for example you may run your tests a lot more often if they
complete quickly.

Finally, not all of your time has equal worth. I find that I do most of my
work flow tweaking during my downtime.

~~~
sophacles
I think "rezoning time" is the same thing as wasted time. If I have to "zone
up" for a task, and that part takes me 30 mins, while once in the task it
takes me 15 mins, I figure I've wasted 30 mins.

As for different types of time, I fully agree. If I'm in a half hour between
meetings for instance, and I can do some tweaking to simplify actions, I can
claim I spent 30 mins on that, but, I can't claim I traded 30 mins of
"productive" time for it. So if that 30 mins of work allows me to have a less
disruptive action in a workflow, the amount of time that workflow actually
saves is hard to measure, and may overall be well less than 30 mins, but who
cares? Life is smoother, and it would have been 30 wasted minutes otherwise.

------
jaxbot
The "hit refresh to see CSS changes" is a big crime I've noticed on my (and my
dev friends') time. My logic with my recent project is simple: -You have a
computer -Computers automate tasks -Automate all your repetitive tasks

There's obviously no one-size-fits-all here, but think outside of the box for
your workflow. Add macros to your editor, use something like LiveReload or
Brolink.vim (shameless plug) to reload pages, streamline your build process,
heck, even use AutoKey if necessary. Point is, you're the brain, and the
computer is your slave. You don't need to be doing petty work that your
computer can do for you.

------
kayoone
Since i am using a Win8 Workstation as well i am interested in the tools
<http://16154060.r.cdn77.net/images/desktop.jpg>

What terminal client is that ? Could be cygwin ?

Also looks like hes running a local ubuntu VM for dev !? I wonder how he syncs
it to the laptop, if he does at all.

\+ some other Tool icons i cant really make out :)

~~~
sams99
I run a local Ubuntu VM for dev, the terminal you are seeing is gnome-terminal
running tumx. I have a cygwin X Server running on my Windows box (startx). I
then ssh -Y into my Ubuntu machine to get a proper terminal allowing my to
fire off gvim and other X apps.

On my mac laptop its a simpler setup, but same thing works I 'ssh -Y' into my
ubuntu vm. Effectively giving me 3 monitors.

If you are interested in a slightly simpler Windows setup you could look at
<http://mobaxterm.mobatek.net/>

~~~
kayoone
Thanks! Very interesting. Are you running the VM only on the Workstation and
ssh into it from the macbook or do you somehow sync it to be able to work from
home as well ?

~~~
sams99
I work from home so I am cheating :) Stuff lives on the VM but I have a second
identical setup on the Mac just in case I decide to take it out somewhere.

While at home I ssh from the Mac to my Ubuntu VM. A huge advantage of Linux is
that mvim will not run over ssh -Y but gvim will.

~~~
kayoone
Cool, will play around with that on the weekend ;) Could the ubuntu VM run
anywhere in the cloud or do you get latency issues with x11 forwarding over
the net ?

I could also run the VM from the laptop and ssh -Y from the workstation or
laptop locally to have a portable setup. But my Macbook Air is rather slow
compared to the pc.

 _edit_ looks like latency is a major issue with X11 forwarding so i see why
you do it this way...I guess for my purposes its easier to just use a complete
Ubuntu VM to develop in and sync that between machines.

------
DigitalSea
A really good read, however one of the points of waiting for an editor to load
doesn't really make sense to me given the fact I use Sublime Text Editor and
it loads instantly, I've never had to wait for it to load even when there are
30 tabs for it re-open. The liveReload plugin for Sublime eliminates the need
of hitting F5 to refresh a page because as you make changes and save using
this plugin the page refreshes: <https://github.com/dz0ny/LiveReload-
sublimetext2>

Unless you're an old school Vim user, I see it as somewhat pointless to learn
it in 2013 as a new user, considering Sublime can be just as powerful (support
for shortcuts, mapping to compilers and script generators) we've got a better
array of fast and feature-packed editors that offer Vim like power without
requiring a read of a user manual just to edit some files and compile them to
save a few mouse clicks. I can see why people who know Vim would never leave,
it's a powerful and besides the self-satisfaction of mastering a highly
complicated editor, those I know of who use it can code like the wind. It's
amazing seeing them racing about the keyboard doing things I do in mouse
clicks with sometimes long keyboard shortcuts they just know off of the top of
their heads.

The bane of my existence used to be documentation, but through a few simple
self-disciplined changes I ensure that I document every variable, class and
function so I can automatically generate documentation (well most of it)
without wasting hours documenting hundreds of lines of code and files.

The article raises some very good points though. The smaller things like
waiting for a project to compile, waiting for your browser to open, compiling
your LESS stylesheets, refreshing your browser and heck even leaving your desk
to make tea and coffee all add up when you tally the time up times a 5 day
work week and are things we really don't focus on.

~~~
johns
Before Discourse Sam was at Stack Exchange, which is all .NET/Visual Studio. I
assume that's where he's coming from on editor load time.

~~~
DigitalSea
Ah, of course. Well in that case, I can see why Vim is a massive upgrade
compared to what he was used too. Sort of reminds me of a time when I used
Eclipse for a while, horribly slow editor that tonnes of people used to use
(still used widely for Java development, specifically Android).

~~~
Executor
Don't forget Python, C/C++, and PHP!

------
Kequc
It seems like these trivial inconveniences could largely be avoided in non
trivial broader ways. For example what is the need for having so many
javascript and css assets when in Rails we are meant to use the asset pipeline
by default? In this case it seems like it would make the most sense to utilize
the asset pipeline, more so than most applications. Merge all those together,
serving up 80 separate assets is insane. Isn't it?

I don't understand mapping the keyboard shortcut in Vim to reloading all
browsers. Does that reload all tabs in all open browsers? What if I have a
paused youtube video, or am saving my place in a large article that I am
scrolled most of the way down the page. Doesn't that all take longer to fix
than just going to the browser and hitting the keyboard shortcut in the
browser? Since you're going to the browser anyway or else the reloading would
have been meaningless?

The most obvious time sink that I can see from this article is that the tests
are poorly optimised. But that isn't a trivial inconvenience. Having to wait 3
minutes, twice, every time you make a change in the code is a significant
inconvenience. That should give plenty of time to do things such as reload a
page. Designed properly tests are not meant to depend on one another just to
run. Use minitest, use fixtures and fabricators. Test individual classes, test
controllers, avoid full stack tests unless there is something that can't be
tested about it at a lower level.

As others have said also Vim is a powerful tool but there isn't really very
much it can do that a modern graphical text editor like Sublime Text 2
cannot... I'm sorry I am just having trouble making this article resonate with
me. Is it something wrong with me or am I right?

~~~
lookingsideways
> Merge all those together, serving up 80 separate assets is insane. Isn't it?

That's what happens by default when using the asset pipeline when in the
"development" environment, it's supposed to ease debugging and works well when
only including a few JS files. In "production" all the files would be merged
into 1.

There is a flag "config.assets.debug = true" in the "development.rb" file,
switching that to "false" will output just one file.

~~~
purephase
Which, sadly, we've had to do in development as something has been introduced
into Rails or sprockets that makes our development environment so slow it's
unbearable with asset debugging enabled.

It really hurts not having the ability to dive into the separate files.

------
PaulHoule
"Vim is tough editor to pick up, especially late in your career. It is
notoriously difficult to master."

Bull. I started using emacs when I was 18 and switched to vi at the age of 40.

The reason I switched was the I found many difficulties when I was using emacs
on one hand and mouse-based editors on the other. One problem is that you
can't easily cut-and-paste out of an emacs window because of the continuation
characters. Another one is that if you use emacs and Windows editors, you'll
end up confusing ^X^S with ^S and wind up typing the wrong thing into the
wrong window.

You can get started with vi if you know the arrow keys, switching in and out
of INSERT mode, as well as :wq and :q!. If you're using putty, visual cut-and-
paste works great.

Learn how to use / and you're cooking with gas. I keep an old Unicos vi
reference card around so I can gradually learn "dd", "G" and other useful
keystrokes. But I was productive within 10 minutes of switching to vi.

------
unoti
He mentions switching to Share Mouse, after struggling with Synergy. I've been
using Synergy with Mac, Win, and Linux for years. It just stopped working for
me and I've been struggling to make it work. Over the years, it's broken every
around once per year, and clipboard support has often been flakey in some
directions. Anyone have experience with Share Mouse?

------
virtualmic
Excellent article and nice answers to queries, Sam!

I have one question. How were you able to manage a 23.5 ms time in the mini
profiler over Internet? Were there no database queries involved while
rendering that page?

Your website does load fast, no doubt about that.. :)

~~~
sams99
MiniProfiler is actually showing server time

[http://meta.discourse.org/uploads/meta_discourse/833/0abd085...](http://meta.discourse.org/uploads/meta_discourse/833/0abd085b2dd29bc1.png)

First paint is 380ms in which is not too bad considering my ping time to the
Linode is 250ms (even though http keepalive is helping me cheat in this
screenshot)

------
bradly
> Both runners insist on running every single spec in the queue before
> obliging and running the spec you want them to run.

Autotest has a fast start option that stops it from running the entire test
suite on load. --fast-start of -f for short

~~~
sams99
I follow, however, I really want to run all the tests when I kick off the test
suite or recover a failed test. It is critical I have the ability to interrupt
these huge runs at will (and resume the big testing when my urgent testing is
done)

------
purephase
Any concern with running Ruby 2 in development and 1.9 (presumably) in
production? I'm doing it now for the startup time boost in both console and
thin but worried I'll inevitably introduce some code that will not play nice.

~~~
vampirechicken
If you want startup time boost, check out the zeus gem.

Try to keep your environments as consistent as possible, whenever it is
reasonable to do so. In the long run, it's better for your peace of mind.

------
prawn
Is there a Sublime Text option to auto-reload a browser tab to refresh the
site/page you're working on whenever you save a file?

~~~
taude
This issn't Sublime specific, but will work with any text editor on OS X:
<http://livereload.com/>. It works really well. I used to use it before moving
onto PyCharm/WebStorm, which has the feature built in.

~~~
Cyranix
A poster above mentioned that there is a Sublime plugin for livereload, as
well.

------
tawsdsnl
Great read, thanks!

