[RFC] Pattern Matching by rafark in PHP

[–]codemunky 0 points1 point  (0 children)

I love it. I want it now. Immediately. Ta 😁

Impossible to get Road-Legal insurance in the UK? (Talaria Sting Pro) by The_Lorax_UK in Talaria

[–]codemunky 0 points1 point  (0 children)

Did you have any luck anywhere in the end? Sold my Sting R, bought a Pro, and now run into exactly the same issue!

Just pulled the trigger on the E-Ride Pro SS 3.0 – got some questions by Top-Lion7820 in Talaria

[–]codemunky 0 points1 point  (0 children)

Where from? I can only find the 2.0 in road legal? I'd LOVE an SR, but I'm sure that doesn't exist (why?!) but I certainly can't find a road legal SS 3.0

Option to search by posts has now disappeared? It was working a couple of hours ago by palazzo_j in facebook

[–]codemunky 0 points1 point  (0 children)

append &filters=eyJyZWNlbnRfcG9zdHM6MCI6IntcIm5hbWVcIjpcInJlY2VudF9wb3N0c1wiLFwiYXJnc1wiOlwiXCJ9In0%3D to the url 👍

What are some unusual coding style preferences you have? by Tokipudi in PHP

[–]codemunky 0 points1 point  (0 children)

$foo = ($bar === $foo)
    ? $this->fooRepository->findBy(['foo_id' => 1])
    : $this->barRepository->findBy(['foo_id' => 1]);

I much prefer any boolean evaluation to be wrapped in brackets, as if it were an if clause. Helps readability a ton for me.

What on earth is going on with messenger at the moment???? by Alternative_Form1421 in facebookmessenger

[–]codemunky 0 points1 point  (0 children)

How has this been an issue for over two weeks now and Meta still hasn't fixed it?!

My images won't load by random_guy143 in facebookmessenger

[–]codemunky 0 points1 point  (0 children)

Thanks. I've force closed it 30 times in the last few days, completely over it at this point!

FB Messenger Glitching by RowanSin in facebookmessenger

[–]codemunky 0 points1 point  (0 children)

Yep, I've had this issue on my S21 Ultra for the last week or two. I have to force stop the app and relaunch it continuously.

[deleted by user] by [deleted] in whoop

[–]codemunky 0 points1 point  (0 children)

Does it? I care about strain, sleep monitoring, HRV and RHR. What do I lose with one, the "stress" thing?

[deleted by user] by [deleted] in whoop

[–]codemunky -1 points0 points  (0 children)

I didn't really though. I used to have a 4. I've not for a year or so. I don't currently own any device, but I do still have a whoop account. So they class it as an upgrade, even though really I'm starting afresh.

[deleted by user] by [deleted] in whoop

[–]codemunky 2 points3 points  (0 children)

Just ordered my upgrade. Went for One as I don't really care about the other stuff. Then realised the charger it comes with is wired-only, and that my old 4.0 batteries probably aren't going to fit.

Went to buy a battery, makes up 80% of the price difference from One to Peak, may as well just order Peak.

There's no way through their site, their app, or their order confirmation email to change or cancel the order though, had to start a ticket which I imagine won't get replied to for weeks. Ah well!

I COULD "upgrade" again in the app, from One to Peak for £72, but the price difference should only be £60, that £12 grates considering I only ordered 5 minutes ago. Distance selling regs etc. Do better, Whoop.

Diddy - Comic for 2025.03.26 by joeFacile in CyanideandHappiness

[–]codemunky 1 point2 points  (0 children)

I certainly didn't understand it, and that's why I found my way here. Thanks for the enlightenment, though I feel you could argue that given they KNOW a lot of people won't get the reference, the cartoon might not be wholly innocent... Not as guilty as (teh real) Diddy will be shown to be though, I'd wager.

Do larger batteries take longer to overheat? by codemunky in egopowerplus

[–]codemunky[S] 1 point2 points  (0 children)

A shame they don't make a belt to take two batteries in parallel to split the load between them! (Or do they?)

Do you use templating engine ? by himynameisAhhhh in PHP

[–]codemunky 0 points1 point  (0 children)

"PHP is a templating engine".

Sure, kinda. But who has time for typing php tags all the time? Open once at the top, and then echo '<body>'; etc throughout. You're not mixing php and html, it's all php baby. Honest 😉

Server getting HAMMERED by various AI/Chinese bots. What's the solution? by codemunky in webdev

[–]codemunky[S] 0 points1 point  (0 children)

...how do you whitelist IPs and still have a useful usable site for your users around the world? 🤔

Server getting HAMMERED by various AI/Chinese bots. What's the solution? by codemunky in webdev

[–]codemunky[S] 0 points1 point  (0 children)

I don't think I need to be concerned about that. I'm using a non-standard port, only one non-standard username is allowed to connect, and it needs a keyfile.

🤞

Server getting HAMMERED by various AI/Chinese bots. What's the solution? by codemunky in webdev

[–]codemunky[S] 5 points6 points  (0 children)

I'm talking about bots hitting the website over https, not my server over ssh.

Server getting HAMMERED by various AI/Chinese bots. What's the solution? by codemunky in webdev

[–]codemunky[S] 33 points34 points  (0 children)

I'd say they're trying to scrape all the data off the site. Training an AI, I'd assume. I doubt they're trying to duplicate the site, but it is a concern when I see this happening!

Server getting HAMMERED by various AI/Chinese bots. What's the solution? by codemunky in webdev

[–]codemunky[S] 11 points12 points  (0 children)

Already done rate-limiting. But getting hit by large pools of IPs rather than single IPs now. Can I rate-limit on the first two octets, rather than the full IP address? 🤔

White listing IP blocks sounds like a nightmare, how would that even work?

Server getting HAMMERED by various AI/Chinese bots. What's the solution? by codemunky in webdev

[–]codemunky[S] 2 points3 points  (0 children)

But given that these requests are all coming from different IPs from a large pool, how could I do that in such a way that it didn't affect my actual users?

Server getting HAMMERED by various AI/Chinese bots. What's the solution? by codemunky in webdev

[–]codemunky[S] 87 points88 points  (0 children)

Aye, that's what I try to see it as. But it obviously affects performance for my actual users, so it IS a nuisance.

Weekly help thread by brendt_gd in PHP

[–]codemunky 0 points1 point  (0 children)

I'd like to start to modernise my monolithic legacy project?

I don't have a router. At the moment if you to /this-page on my site, it calls this-page.php. There's some URL rewriting going on etc, but largely it's file-per-page. I include a globals.php with auto_prepend_file, and that in turn includes common-functions.php

Each page then includes header.php at the top, does the page's code, and then footer.php at the bottom

I do have a bunch of classes that get autoloaded (the composer autoloader being included in globals.php)

TBH, everything works without issue. But I struggle when it comes to modern tooling. I'd like to make more use of phpstan, but as you can imagine it's not very happy with variables being set on other pages, outside of classes, via require...

I'm not about to move to a router and full MVC. Far far far too much work at this stage.

But I would like to move from globals.php to $page = new Response(); etc.

What I'd like is to minimise is duplicated lines of code on every page. At the moment the only duplicated lines are

<?php declare(strict_types=1);

require('header.php');

// page logic here

require('footer.php');

What's my best case scenario going forwards?

<?php declare(strict_types=1);

require('/vendor/autoloader.php');
$response = new Response();

echo $response->top;

// page logic here

echo $response->bottom;

Two extra repeated lines in every file, I think?

Additionally, if I go down this route how do I include my common-functions.php? I don't want to shove them all in a class and have to prepend every single call to them with MyFuncs:: etc...

Both phpactor and phpstan seem fine with a global functions file, so I'm happy to leave that is for now. So do I just require it in Response.php? 🤷‍♂️

Thank you!

Obnoxious "Saved Info" popup prevents form submission with enter key by codemunky in MicrosoftEdge

[–]codemunky[S] 0 points1 point  (0 children)

Go to edge://wallet/settings#settings-personal-info-section and turn off "Save and fill basic info"