Lurker News
I recently started integrating tmux and vim into my workflows. Obviously, it was a huge efficiency booster. What are some other tools (custom built or off-the-shelf), hotkeys, workflows that were game-changing for you as a dev? I'm interested in hearing about anything and everything (stuff from ctrl+l to clear the terminal to little-known git commands to larger-scale strategies like CI/CD)

Comments (522) 158 threads

Earlier comments
Groxx1 reply#
Set up a "scratchpad" repo for small experiments / learning, and phrase your learning as tests.

Not only does it get you practice writing code, you have evidence that what you think is actually true. And/or you can demonstrate it's not, when you learn otherwise. And if you push it somewhere, you can link people to it trivially (great for questions / teaching / bug reports).
It's pretty much guaranteed to be faster to hop in / build / run than your day-to-day repository (often by a few orders of magnitude), and testing some things forces you to learn some new tricks (concurrency tests / bug demonstrations are particularly complex). And personally I also recommend setting up an auto-rerun-tests loop (I prefer `entr`), which gets you very nearly repl-level feedback in any language. You can interactively explore to learn basically anything in any language.

kanyethegreat1 reply#
Love this idea! I generally just have scratch files in whatever codebase I'm working on, but I like the idea of having a centralized place to keep these. Any chance yours is public? I'd love to see an example of how you organized the repo, what type of stuff your testing, any boilerplate setup/tooling you used to make it more effective (mocking library to stub out things like network calls or complex objects, test runners, etc)
Groxx#
No, just one internal to work (which I share pretty heavily), though I should set a public one up. I've got a few bad ideas fleshed out enough to realize why they're bad, and a few multi-million-iteration things to test the fairness of go channels / cancellation strategies / etc just because it seemed like fun. But the repo has slowly grown to include things like demonstrating issues in books[1].

Boilerplate setup for me is typically:
- a one-page Makefile for laziness. I try very hard to avoid automating what I don't fully understand, and large / complex makefiles are typically inscrutable for readers. usually I just have "build", "test", and "live tests", little else.
- a small script to use `entr` to run tests in the last directory changed (the /_ arg)
- ... that's about it. maybe a .editorconfig or .envrc? I avoid lang-specific runners because they're all different and tend to have complex relationships - if you can't run your test within a second or three, find a different way. break apart dependencies to benefit from build caches. leverage make. etc.
If I wrote experiments that used networking libs, I might have common stubs, but none currently :) I'd be sorta tempted to write fakes tho (probably multi-process), and try to integrate them into tests, in part because that's often hard for no apparent good reason. Maybe I'd find out why, or maybe I'd end up with a demonstration that there isn't a good reason.
[1]: https://www.oreilly.com/catalog/errataunconfirmed.csp?isbn=0... I'm the sync.Cond.Broadcast one

deeg2 replies#
I consider scripts to be functional documentation, so I write a lot of them, usually shell scripts but Ruby and Python, too. Any task that I might want to perform again, or tasks for someone else, gets a script if possible. All of my repos have a /scripts directory.

It can take some work to write and debug but in the end when it's working you know you have correct "documentation". Text and wiki documentation may look right but you can't be sure. Just today someone on my team was trying to create a particular build on Jenkins but was using the wrong build parameters, which were copied from wiki; the previous owner of the wiki had neglected a few changes. But the script worked!

kinix1 reply#
I've found recently that Makefiles are my best friend for this kind of thing, even if it's just wrapping existing commands with the right arguments and conventions for the project.

Being able to do a simple `make build`, instead of remembering all the right command syntax, repositories etc is so much nicer that having to trawl through a README in a couple of months time for how I was using this thing

bjonnh#
+1 I've been using makefiles more and more. And the nice thing is, if you don't have hidden dependencies you can just do a make -jn and get parallelism.
flukus1 reply#
I also like having a script per project that will get auto loaded when you cd in. An example from a current project:

  #my vimrc knows what to do with this
  export VIM_TAGFILES="$PWD/build/tags,$HOME/.local/var/tags/system,$HOME/.local/var/tags/glib-2.0"
  export CFLAGS=' -g -O0 '

  function autobuild {
    (mkdir -p build
      cd build
      while true; do
        make
        make deploy
        inotifywait -qr -e close_write,delete ../cgi ../test ../Makefile.am ../migrate.sql;
    done)
  }

  function watch {
    tail -f build/app.log build/deploy/app.log
  }
Over time they'll end up with a bunch of other random things. I've tried abstracting a lot of these to their own scripts but every project proves just different enough to make that more complicated. And most of them are personalized enough that they don't go into the project itself.

Another "super power" for shell scripts is writing completion scripts (https://iridakos.com/programming/2018/03/01/bash-programmabl...). I've had some insanely useful one's do things like look up database values to mimic a large complicated third party product, going through it's UI inputting repetitive info, copying files around, etc was reduced to fake-tool.

misev1 reply#
You may find prm useful for this purpose, it lets you create projects with start/stop scripts that get executed when you do `prm start project` or `prm stop project`. I use it to quickly switch to the right directories, open editors, services, etc. needed by a project.

1. https://github.com/EivindArvesen/prm

NateEag#
`direnv` will automatically activate and deactivate a project-specific shell env for you when you change directories.

I like to put scripts for the project in a `bin/` directory then use direnv to put the project's `bin/` on PATH.
I've leaned more and more towards mirroring the *nix directory structure in my projects. `etc/` and `bin/` are two top-level folders in a lot of my projects at work.

lostintangent1 reply#
Whenever I onboard to a new codebase, or try to learn more about an open-source project, I typically create personal notes that outline the structure and high-level “markers” that I want to remember and easily reference later.

Unfortunately those notes are disconnected from the codebase itself, and therefore, not as immersive/rich as I wanted them to be. So I created a tool that allows me to annotate codebases with my own walkthroughs/breadcrumbs/ToCs and then play them back at any time, directly within my editor. This workflow has provided a pretty nice productivity boost for me thus far, and has the benefit of enabling me to share these walkthroughs with others as well: https://github.com/vsls-contrib/codetour.

1f60c#
I was about to ask how you got your own aka.ms link, then I saw you are a product manager at Microsoft, so that shouldn't have been too difficult :-)
letientai2993 replies#
RTFM (as in Read The Fine Manual).

To me, the key for being productivity is understand throughly the "tools" we use: IDE, languages, libraries, framework cli, os, shell,... Read the implementation, the docs, the issue tracker, even the git history if you have time.
When I started to learn vim, I tried many popular distribution without understand each of the plugins they included. And I almost gave up learning vim. It's until I start to read the vim manual, learn the key strokes one by one and then building my own distribution, that's when I really know how to use vim. Even so, I still learn many great things from books like Practical Vim by Drew Neil (on Tmux, there's Tmux 2: Productive Mouse-Free Development)
I think you might already know that, but still shooting here for some quick tips. I don't have any shortcut, just that motto.

DannyB21 reply#
> RTFM (as in Read The Fine Manual).

Some developers use alternate F-words for RTFM.
F-words like:
Fabulous or Fantastic or Friendly

kanyethegreat#
Love this! I found that the more experienced I became as a dev, the more I gravitated toward the less-removed sources of truth (eg. man pages instead of stack overflow, source code instead of blog articles, etc). Haven't started reading issue trackers, but huge fan of traversing a git history (assuming it's clean and atomic).
RMPR#
> I still learn many great things from books like Practical Vim by Drew Neil

You should also check out "Modern Vim: Craft Your Development Environment with Vim 8 and Neovim" from the same author.

Load more comments