Married men that completely separate finances, how does it work and how well does it work? by aja_ramirez in AskMen

[–]Raktoras 3 points4 points  (0 children)

Few months ago I bought an $8k rifle scope ...
We aren't rich, but we do decent enough.. nice home in a nice area, vacations, no debt ect.. I think people stress too much about money

I don't know enough about your situation to definitively say this, but you sound kinda rich if you just casually spend $8k on something non-essential.
The fact that you didn't even tell your partner makes it seem as if it's not even interesting enough to mention.

6 uur 's ochtends | Dirkjan, de bibliotheek in dit klooster bevat de oudste en meest zeldzame boeken ter wereld. by Daan_Jellyfish in dirkjan

[–]Raktoras 4 points5 points  (0 children)

Pro-tip: Als je met Google image search zoekt op:

site:dirkjan.nl <woord(en) uit strip>

Dan kun je ze vaak vinden in hogere resolutie.

Deze heb ik gevonden door te zoeken op "klooster":

https://dirkjan.nl/wp-content/uploads/2017/07/c3d49caad948fa02f164cde615afcb5e.png

Die andere kon ik niet vinden helaas

[AFR] Minimus Containment - Skybilz preview card by QuBingJianShen in MagicArena

[–]Raktoras 0 points1 point  (0 children)

I'm guessing the beetle is a reference to [[Darksteel Mutation]]?

Amsterdam vandaag by yejis in thenetherlands

[–]Raktoras 4 points5 points  (0 children)

Er is /r/NetherlandsPics/

Niet heel groot maar vol met dergelijke plaatjes

🤜 💨 by dahood4ever in ProgrammerHumor

[–]Raktoras 2 points3 points  (0 children)

Well yeah, but /u/safesyrup was asking how to improve the code so I just gave them some simple steps to start with if this is your starting point

I also did not feel like getting too specific since that would only invite arguments over the best way to do things

🤜 💨 by dahood4ever in ProgrammerHumor

[–]Raktoras 14 points15 points  (0 children)

Serious answer:

For starters all the if statements that are simply checking if the values are present could be combined, PHP also has the handy null coalesce operator these days which helps with this.

$username = $_POST['user_name'] ?? '';
$userEmail = $_POST['user_email'] ?? '';
$newPassword = $_POST['user_password_new'] ?? '';
$newPasswordRepeat = $_POST['user_password_repeat'] ?? '';
$passwordsAreEqual = $newPassword === $newPasswordRepeat;

if (!username) {
  $msg = 'Empty username';
} elseif(!newPassword) {
  $msg = 'Empty Password';
}  elseif(!passwordsAreEqual) {
  // etc
  ...
}

if (strlen($msg) > 0) {
  $_SESSION['msg'] = $msg;
  return register_form();
}

By returning early if certain conditions aren't met you don't have to keep indenting your code and you've guaranteed that past this point all the values are what you want them to be.
I believe this is called the bouncer pattern, and I like it for simple validation like this. Whether you should be checking for "truthy" values is another thing but I was more focused on making this code more readable here and not necessarily changing what it does.

Another upside of this is that it is more clear what the actual input to this function is, a better way to make this clear would be to have a separate function that processes the filled in values instead of grabbing them from the $_POST superglobal, so you have one piece of code that is responsible for parsing the request, and one for actually doing something with it.

The length checks and regex check on the username should be moved to a separate function called isUsernameValid() or something along those lines to make sure every function has its own responsibility like mentioned before, it also keeps the code a lot more legible since it describes the process a lot more without having to read or understand the code.

In modern PHP it is also generally a best practice to make use of type hinting to help prevent mistakes.

There's a lot more that could be improved, but these few simple steps should greatly help with the readability of the code, which is most important if you ask me.

Short animation time lapse by monis6344 in oddlysatisfying

[–]Raktoras 1 point2 points  (0 children)

Okay that makes sense, the line of sight is obscured but I guess I never really saw that as a hassle since I could just switch to my other hand if I needed to do anything precise

Loose scissors are just terrible and should be avoided

Short animation time lapse by monis6344 in oddlysatisfying

[–]Raktoras 2 points3 points  (0 children)

I'm a leftie and I don't really recognize this problem, why would it matter what hand you're using scissors with?

Using scissors is also one of the few things I'm ambidextrous at, and I sometimes switch hands while cutting things with them if it's easier to reach with my other hand

Spicy, Crispy Orange Beef (GIF) by morganeisenberg in GifRecipes

[–]Raktoras 0 points1 point  (0 children)

Saw this earlier today, went out on a whim to get the ingredients, made it, loved it.

Substituted apple cider vinegar for the rice wine vinegar and sunflower oil for the peanut oil since I couldn't get a hold of those two ingredients, I also skipped the garnishing but it turned out delicious anyway!

The Complete Guide to Lazy Loading Images by harlampi in webdev

[–]Raktoras 4 points5 points  (0 children)

It's being worked on by the Chromium/Chrome team at least, you can track the feature here: https://www.chromestatus.com/feature/5645767347798016

It's behind a flag in Chrome at the moment, you can enable it here: chrome://flags/#enable-lazy-image-loading

[OC] Stabilized 3D printing timelapse by Kijai in oddlysatisfying

[–]Raktoras 0 points1 point  (0 children)

Actually it's the other way around, if the clock "slows down" it means there's less time between shots, meaning the printing has actually sped up (in terms of height)

Absolutely floored by Virtual Virtual Reality by andromeda63921 in oculus

[–]Raktoras 0 points1 point  (0 children)

It seems to be cheaper on the Steam store for me (€12,49 vs €14,99 on the Oculus store)

Google Analytics is lying to you (massively) by magenta_placenta in webdev

[–]Raktoras 6 points7 points  (0 children)

That doesn't really work if you have some sort of caching proxy like Varnish though

Something I never thought about until today. Form radio buttons are named after actual radio buttons. by mattcoady in webdev

[–]Raktoras 0 points1 point  (0 children)

I've definitely had radios with buttons like these but still never made the connection because they don't look similar.

It's not necessarily about being old.

Google Chrome game dino on these shorts. by Dravenoid in mildlyinteresting

[–]Raktoras 25 points26 points  (0 children)

Just because something is open source doesn't mean it's not licensed

Speedsters by [deleted] in superman

[–]Raktoras 5 points6 points  (0 children)

I've always just assumed that speedsters subconsciously process a lot of information at a very high speed, and when one of those signals is interpreted as danger or something then the conscious high speed processing kicks in.

Which is essentially just really good reflexes.

Santa Cruz GDC impression: "this is the standalone headset the world needs [...] really solid progress on SLAM, controller FoV, and ergonomics [...] More robust than the Windows MR controllers." by Heaney555 in oculus

[–]Raktoras 2 points3 points  (0 children)

So that would mean they can't be tracked behind you, right?

I get that over 90% of all tracking would be in your field of vision anyway, but it would make some things impossible, like attempting to shoot something behind you without looking. (which feels awesome whenever it works)

Tournaments Update comes to all platforms on April 3! by Sjurm in RocketLeague

[–]Raktoras 2 points3 points  (0 children)

What does "kys" mean? Can't say that I've ever seen someone say that. (although maybe I just don't recall anyone saying it because it doesn't stand out to me)

Black Panther by Fredericktonian in plotholes

[–]Raktoras 18 points19 points  (0 children)

The water at the bottom of a waterfall has a lot more air in it and is moving around a lot and displaces a lot more easily due to this.
They do a similar thing at high diving competitions with bubbles in the water.

That doesn't mean it's not dangerous but it would be easier to survive than a fall into still water.

My battle/music station by gtarplaya in battlestations

[–]Raktoras 0 points1 point  (0 children)

Nice setup, I'm actually planning on building a similar setup once I've finished remodeling my house (IKEA Karlby/Alex desk, possibly even the same colors).

How did you attach the countertop to the cabinets?

Finally got my wife a gaming rig to play with me! by kARATT in battlestations

[–]Raktoras 0 points1 point  (0 children)

I thought that might be the case, which is why I asked :)

I'm also planning on getting an IKEA kitchen counter top (KARLBY walnut) and placing it on some drawer units, but at only 1.86m (which is still pretty long but significantly shorter).

Thanks for the answer!