hello
- 2 Posts
- 208 Comments
darcy@sh.itjust.worksto Programmer Humor@lemmy.ml•A week of fprintfs has me wanting to code rust next week269·1 year agosure, but thats just outsourcing the problem.
almost forced to for web front end. why you would use it anywhere else, however, i will never know
darcy@sh.itjust.worksto Programmer Humor@programming.dev•JavaScript's days are numbered25·2 years agothere goes my plans to build a time machine in javascript
i love how well this joke works
:) no problem! i would assume resizing the image might be a little slower, because it creates a clone of the image, but if you use FilterType::NearestNeighbor, the speed is negligable in my opinion
i read through the code, and i have some tips, which you may find helpful (or not):
- argument parsing: if
--color
is not the first argument, it will try to open a file named--color
, which i assume is unintended. i would suggest checking out theclap
crate to easily parse args - i’m quite sure why you used ‘clusters’ instead of resizing the image to the terminal width? if it is purely as a programming exercise, or for performance reasons, then that’s great! but otherwise, calling
image.resize()
is easier .len()
on a string returns length in bytes, not characters, so could break with non-ascii text. in the context of this program, the text will always be ascii, so it is of course not a problem, but it’s worth to keep in mind. to get character length, use.chars().count()
- in my testing, the width of the image is always affected by the width of the terminal, always being less than the maximum possible width, causing the image to be stretched vertically. i’m not sure why this is happening
- in
get_brightness_of_cluster
, pushing to aVec
and then calling.sum()
can be replaced with a loop which increments a mutableu32
variable. this is a nitpick, but it can avoid unnecessary memory allocation
check out this example. sorry if this comes off as rude or a nitpick, i’m just trying to provide some advice :)
- argument parsing: if
darcy@sh.itjust.worksto Programmer Humor@lemmy.ml•Naming is the most challenging part of programming3·2 years agodestroying america!!!
just have a tub of water rigged above the server
darcy@sh.itjust.worksto Programmer Humor@lemmy.ml•Naming is the most challenging part of programming3·2 years agowhy would you be against 4th of July and children?
darcy@sh.itjust.worksto Programmer Humor@lemmy.ml•If programming languages were weapons. Old but gold.3·2 years agohaskell is an intricately designed laser gun that you cant shoot it without a learning group theory and lambda calculus
darcy@sh.itjust.worksto Programmer Humor@lemmy.ml•If programming languages were weapons. Old but gold.1·2 years agohowever, it is still used and endorsed by every army
if your desktop environment uses alt+f4 to quit 💀
should have used Rust instead. that way you never talk to a friend in the first place
A knife is reusable