Top
Best
New

Posted by signa11 20 hours ago

Small programming tricks(will-keleher.com)
533 points | 241 commentspage 4
forty 16 hours ago|
> In NodeJS, you can keep a connection open to an external resource by creating an https.Agent and then providing it to your http requests: fetch(url, {method, agent}). This can have a dramatic impact on latency.

Is it true that you can pass a nodejs agent to fetch ? I don't think so

nulltrace 12 hours ago|
No. Node's built-in fetch uses Undici. The custom hook is dispatcher, with an Undici-compatible dispatcher: fetch(url, { dispatcher })
thih9 17 hours ago||
> git log -S pattern (”git pickaxe”)

Another option is to do a ‘git log -p’ followed by a string search ‘/‘. It can give more context and let you browse more easily, especially if the project has small commits. It won’t work well for every project or search though.

VCFundedGenYer 20 hours ago||
I would probably retitle this less as "programming tricks" rather instead make it "bash/zsh CLI tricks" as this only really tangentially refers to programming.
jwpapi 14 hours ago||
In Jetbrains I do secondary shortcuts and I name them as what they are in my hand:

Alt M + V = Move Alt E + C = Extract Component Alt S + E = Search Everywhere _ many more.

Or just vim combos.. with ideavim

backend_dev82 11 hours ago||
My main trick is to use fish and enable vi key bindings. Especially on mac where there is no Home And End functionality.
hiAndrewQuinn 3 hours ago|
Can't say enough good things about fish from a UI/UX experience. There's a reason Shell Bling Ubuntu [0] swaps out your underlying shell to fish. Unless you need a terminal up ASAP for scripting purposes or shelling out (in which case dash is still much faster than bash) it's just such a better experience.

[0]: https://hiandrewquinn.github.io/shell-bling-ubuntu/

computermadeofc 12 hours ago||
It’s sad, I used to love little tricks like this: optimizing my workflow, learning the keyboard shortcuts, reading the manual. But now I just prompt codex or cc. The appeal of “sharpening the axe” is greatly diminished. I fear much of this type of knowledge will soon be lost to time.
embedding-shape 12 hours ago|
I prompt a lot, but I also still run a lot of commands and do quick edits with vim myself, not gonna prompt "increase X to Y" when it takes ~3 seconds to do myself vs ~30 seconds for even a fast model to do it.
lucasoshiro 15 hours ago||
> You probably don’t need find

I think for most cases `git ls-files` does this job quite well. If you provide pathspecs, this can be very powerful!

ahmedhossamdev 19 hours ago||
+1 for git log -S. Two I use daily: rg --hidden -g '!*.lock' to skip noise, and python3 -m json.tool to pretty-print API responses.
lucasoshiro 15 hours ago|
I wrote this about git log -S and other Git tools for code archaeology and debugging: https://lucasoshiro.github.io/posts-en/2023-02-13-git-debug/

You can see the discussion about it here: https://news.ycombinator.com/item?id=39877637

okinternets 19 hours ago||
Another one I use often is <command returning output > | pbcopy on macOS. Pipes the the result directly into your clipboard
bitwize 4 hours ago|
Programming? You mean that clever trick people do to make progress on a code base slowly while Claude is down?
More comments...