this post was submitted on 22 Apr 2024
9 points (84.6% liked)

Ruby

527 readers
2 users here now

A community for discussion and news about Ruby programming.

Learning Ruby?

Tools

Documentation

Books

Screencasts

News and updates

founded 1 year ago
MODERATORS
 

The Neonify challenge on Hack The Box is a small Sinatra(a Ruby web framework) app, that generates a glowing text of the submitted value:

you are viewing a single comment's thread
view the rest of the comments
[–] czan@aussie.zone 2 points 6 months ago (1 children)

Another application of Parse, don't validate. The vulnerability isn't really about the single-line regex, it's that the validation doesn't match the use. If the regex extracted (read: parsed) the valid bit with a group, then passed that through, it would be fine.

[–] DaleGribble88@programming.dev 4 points 6 months ago* (last edited 6 months ago) (1 children)

Holy cow! What an absolute slog of a read. I'm not an AI model, but I'll do my best to summarize that link:

[When writing code that works with non-trivial and null-able data types,] use a data structure that makes illegal states unrepresentable. Model your data using the most precise data structure you reasonably can[, ...] as quickly as you can. [W]rite functions on the data representation you wish you had, not the data representation you are given. The design process then becomes an exercise in bridging the gap.

There. Hopefully someone out there learned something cool without having to read a 25-minute striptease before the author rushes through their main idea in the span of two bullet points found in the final 25% of the article.

[–] czan@aussie.zone 1 points 6 months ago (1 children)

I think your summary is less useful than reading the whole article. Teaching well involves more than just stating a refined idea.

I also think the ideas in the article are worth the 25 minutes.

[–] DaleGribble88@programming.dev 3 points 6 months ago (1 children)

Teaching also involves stating an idea - which the author forgot to actually do. If it is your article that I am criticizing, I'm sorry for being crass, but make no mistake, the writing is half-assed. An article whose primary piece of advice is to "focus on the datatypes", shouldn't avoid the word "datatype" until the 2nd to last header.

Truthfully, the article would be better served by removing the first and 2nd to last section and instead be titled "Why I dislike working with monads in languages that support monads."

[–] czan@aussie.zone -1 points 6 months ago

Okay. I don't really want to keep arguing about this. Your negativity seems entirely unwarranted, so I'm not really sure what you're trying to achieve. Given the only thing I wanted to say is "this article is worth reading", I don't think there's a productive line for this conversation to go down.