This is a result of a process I call experience distillation. I notice what code I write often but tend to either forget (bash) or outthink much faster than I can type (common syntax, libs, boilerplate), and routinely add it to snippets in hope that it sticks. Then I learn to actually use it. Once in a while I delete the unused or reshape it for second attempt with the understanding why it failed the first time.
Ask HN: Does anyone still use code snippets?
41–50 of 61 posts
Re: Ask HN: Does anyone still use code snippets?
#42Re: Ask HN: Does anyone still use code snippets?
#43For scaffolding? I still use snippets (with tooling ofc). Around 85% of the time, it seems like it takes me more time to write what I want to code in natural language to an AI prompt (and then correct it) than it would to actually code what I want. The 15% of the time when I want something like "Write test cases to cover this module" is something a snippet couldn't do anyway.
> Around 85% of the time, it seems like it takes me more time to write what I want to code in natural language to an AI prompt (and then correct it) than it would to actually code what I want. That's how it should be, actually 100%. If you need scaffolding (and snippets) it means your language doesn't have (or worse, can't have) the right abstractions in its library.
Eg. most languages would enable you to build a custom library, but then it becomes non-obvious what's exactly happening to someone diving into the project, a most engineers never bother fixing/improving the original library, and you end up with crap on top to "work-around" the poorly understood behaviour.
Eg. recently, I've fixed an internal library holding multiple locks around one tiny block of async code, rendering the entire thing synchronous, which was being worked around by devs using multiprocessing or multithreading for a couple years. I've reduced that library code to basically a couple of functions, but my preference would be to actually copy-paste those 200 lines into every component using it — while you have the problem when you want to update it everywhere, your average engineer focused on solving a different business problem will be better equipped to handle it.
My personal gripe is with the abuse of @decorators in Python, which are side-effect pits of hell (yes, the code can look really nice).
I personally don't use snippets, but I do copy-paste some of that scaffolding between projects (though I am mostly a manager these days and hardly get any time to code, so take that with a huge grain of salt) — snippets as such never added much value to me.
Re: Ask HN: Does anyone still use code snippets?
#44I still use snippets and, since I wholly reject generative AI from my life, I don't see it changing anytime soon.
Re: Ask HN: Does anyone still use code snippets?
#45yes i do we dont use AI at my work
Re: Ask HN: Does anyone still use code snippets?
#46Earlier quoted context omitted.
> which is for creating a empty arrow function you have a snippet for four characters? `()=>`?
There's also brackets. More importantly, it is easier for me to type `afn` than `shift + 9`.
Re: Ask HN: Does anyone still use code snippets?
#47`af` expands to `() => `
`naf` expands to `export const foobar = () => {};`
The expanded snippets can be tabbed through as well
It feels like a big timesaver
Re: Ask HN: Does anyone still use code snippets?
#48Re: Ask HN: Does anyone still use code snippets?
#49note - gh:
> [!NOTE] > Highlights information that users should take into account, even when skimming.
ruby - html:
WORD(CAPTION)
Re: Ask HN: Does anyone still use code snippets?
#50If I ever do use llms it's for searching for something like "what kind of expression is this called: (i = 0; I < x; i++)" so that I can do better research myself.