Earlier quoted context omitted.
In what context can you avoid branches?
Maybe something (contrived) like this providing no-op defaults? total = calculateOrderTotal(user.order); if (user.isPremiumMember) { total = total * 0.9; // 10% discount versus total = calculateOrderTotal(user.order); discount = calculateDiscount(user); // Returns 0.9 or 1.0 total = total * discount;
Small programming tricks
71–80 of 192 posts
Re: Small programming tricks
#72Earlier quoted context omitted.
Weird personal attack, thanks. What I'm saying is I am not a jerk and actually do care about my coworkers, however I also don't want a bunch of noise in a chat app I have to use to do my job.
You can mute the channel. Why would you want your teammates to communicate less ?
>I shared a trick on slack every day with the engineering team
Re: Small programming tricks
#73Re: Small programming tricks
#74This reminded me to ask: To what extent are people still coding by hand these days? In my profession (academia), literally no one codes anymore. On one hand, it sucks because the joy and fun of programming has been replaced by constant agent orchestration tasks, but on the other hand, it's hard to go back to the way things were before because the productivity gain is so good. I remember learning a lot of these progra…
Re: Small programming tricks
#75Earlier quoted context omitted.
s/seen as// Annoyance is a clue; not about them, but about you.
Weird personal attack, thanks. What I'm saying is I am not a jerk and actually do care about my coworkers, however I also don't want a bunch of noise in a chat app I have to use to do my job.
Re: Small programming tricks
#76I can recommend https://www.oreilly.com/library/view/unix-power-tools/059600... The "Unix Power Tools" book is an excellent source for Unix and shell usage tricks
Re: Small programming tricks
#77Usually what I do is writing these tricks down to a document that is easily accessible at a place where I know that I will look for when failing to remember them. I have a directory of docs where I write stuff like this down by language/tool/etc., so I can quickly look it up without having to search the internet. But I also have to actively remind myself that these things exist whenever I have a problem, stop me from just doing the inefficient thing.
Re: Small programming tricks
#78Earlier quoted context omitted.
s/seen as// Annoyance is a clue; not about them, but about you.
Weird personal attack, thanks. What I'm saying is I am not a jerk and actually do care about my coworkers, however I also don't want a bunch of noise in a chat app I have to use to do my job.
Sorry for the "personal attack" but my point stands, you may not think of yourself as a jerk, but I saw your comment and thought "this guy imagining himself being annoyed at a coworker for a daily message with a helpful tip might be more of a jerk than he realizes". As a jerk myself I judged myself qualified to make that assessment and commented accordingly.
Re: Small programming tricks
#79Earlier quoted context omitted.
Also in academia but I'm old and my real work is done withy students. I'm coding by hand much less than I used to (boo) but solving more problems with code myself than I used to (yay). Having an llm do things turns out to be similar to having a student do them but with fast turnaround and it's fine to have them work on your home automation system. ;)
Another academic. LLMs are great for opening searches. I state what I would like to get into and let it get some initial paper recommendations. It seems to solves a hard problem: discoverability. Maybe I'm just getting subjected to more subtle bias but it is extremely easy and fast now to get a nice selection of relevant literature to review. Analysis and any artifacts are all handcrafted by me. I mean, that is the w…