Live data from Hacker News

Ask HN: What are your favorite developer-efficiency tips?

news.ycombinator.com

321–330 of 532 posts

Re: Ask HN: What are your favorite developer-efficiency tips?

#321
post #284

Don't use single-letter variable names like i, j, k. At least double them, like ii, jj, kk. If you do that then they're easy to grep for.

..or just do not use variable names smaller than 3 characters if they do not mean anything, period. There is no difference in coding time and no good reason whatsoever.

I generally agree, but I think ii, jj, kk are fine for those iterator ints in loops, or the throwaway var in a list comprehension in Python.

The only other situation single-letter variable names make any sense is if you have a short function that implements a mathematical formula, like distance or something.

Re: Ask HN: What are your favorite developer-efficiency tips?

#322

The single biggest productivity boost is when I realized over 90% of my time is spent in Firefox+Terminal+Emacs. Alt-tab drove me nuts so I bind F2/F3/F4 to a script that will cycle through instances of these 3 programs. F2 is terminal, F2 again is next terminal, etc.

That's what I've adopted a tiling window manager (i3wm) for. I always use the same workspaces for the same things and have them open automatically on those workspaces, so most of the time, I just need one button-press to get to the terminal-instance I want.

Re: Ask HN: What are your favorite developer-efficiency tips?

#323

Programming in VR Desktop: https://github.com/SimulaVR/Simula (see the README for a link to a video of it in action). This allows you to (i) distribute your work tasks intuitively across space; (ii) completely zap out all distractions within a VR headset; (iii) completely eliminate the mouse and work 100% on a keyboard (VR Desktop allows you to click and browse with eye gaze). It takes a bit of practice to learn the…

I have to admit.. I love this. Can you really _use_ it though? For long periods of work, day after day? Or is it just a gimmick?

Re: Ask HN: What are your favorite developer-efficiency tips?

#324
post #81

Obs studio. I record myself while coding anything. I pretend to be a bigshot coding streaming sensation (even if its just for me). Its fun as well as very helpful in so many ways. 1. It helps me stay focus on the task at hand. One recording for each task 2. It lets me practice how to articulate stuffs. Its like blogging but ephemeral (because i wont upload this) 3. It helps me get motivated. Cant let my "thousands" o…

Such a good idea.

Re: Ask HN: What are your favorite developer-efficiency tips?

#325

Learn to touch-type properly. I'm not a shit hot typist or anything, but it does make hours on a keyboard more pleasant. And (hate me) I do judge other devs on it. If someone can't be bothered to invest a few tens of hours on such a key productivity enhancement then what does that say?

I'm so grateful for my mom signing me up for typing classes when I was young, I rarely look at my keyboard when typing these days.

And I secretly judge people on their typing skills as well, especially programmers.

Re: Ask HN: What are your favorite developer-efficiency tips?

#326

Earlier quoted context omitted.

> The investment you have to make to really grok static typing is quite large. It took about 2 years for me to be really comfortable in TS. That sounds a bit exaggerated from my experience. If anyone interested in TS got discouraged reading your comment, it took between like 2 days and 2 weeks for my team to be really comfortable in TS. If you already know JavaScript and if you already have some experience with stati…

To be fair, TypeScript's typing is very overloaded with stuff, and is much more complicated than Java or C#'s.

Hence my love for ReasonML / OCaml with the Bucklescript compiler.

Re: Ask HN: What are your favorite developer-efficiency tips?

#327
Ctrl + space (browser)

Alt + space (terminal)

On Firefox:

Spacebar (pagedown) | Shift + spacebar (pageup) | Ctrl + tab (cycle between last recent opened tabs) | Cmd + number (go to tab of number) | Cmd + K (go to search box) | Cmd + L (go to address bar)

Use Vim and forget the mouse

Re: Ask HN: What are your favorite developer-efficiency tips?

#328
post #27

A couple others have mentioned shell tricks. One of my favorites is using Alt-. (in Bash and Zsh) to insert the last argument of the previous command. Press it multiple times and it will cycle through the last argument of all previous commands. It's great for when you want to, say, `ls thing` and then `vim thing`. Yesterday I went looking for a similar key that would insert a copy of the last argument on the current…

For `cp some/long/path/to/foo.txt some/long/path/to/foo2.txt` I always liked brace expansion, for example `cp some/long/path/to/{foo,foo2}.txt` (Though foo{,2}.txt is even shorter)

Gonna have to try doing this, I usually cd to the source/target directory in these situations, then copy it and use cd - to get back quickly.

Re: Ask HN: What are your favorite developer-efficiency tips?

#329
Great thread, thank you. Already seen a few things that I will look into.

For me, the transition from Bash to Zsh has been a huge efficiency boost. Mainly because of some great plugins for Zsh, such as z, zsh-peco-history (better history search), zsh-autosuggestions, and zsh-syntax-highlighting.

My blog post about setting up a Linux workstation describes this in detail: https://tkainrad.dev/posts/setting-up-linux-workstation/#swi...

The best thing is, there is no initial productivity hit. You don't miss out on any shell features that you are accustomed to.

If you work a lot with ssh, it is also worth the effort to create a proper .ssh/config that contains the most used hosts.

Re: Ask HN: What are your favorite developer-efficiency tips?

#330
post #164

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…

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.

Post reply on HN