mastodon.ie is one of the many independent Mastodon servers you can use to participate in the fediverse.
Irish Mastodon - run from Ireland, we welcome all who respect the community rules and members.

Administered by:

Server stats:

1.6K
active users

#generators

0 posts0 participants0 posts today

What if your PHP functions could pause, resume, and remember where they left off, like little self-aware scripts? ⏯️

That’s what coroutines are for, and PHP gives you two tools to use them: Generators (since 5.5) and Fibers (in PHP 8.1).

🥔 🔥 I break it all down with real code, plus a hot potato metaphor you won’t forget:
doeken.org/blog/coroutines-in-

doeken.org · Exploring Coroutines in PHPCoroutines are functions that pause and resume with state, allowing flexible, bidirectional control flow in PHP.

I've stopped trying to use #AI #image #generators for anything useful, and now exclusively use them just for fucking around when I'm high on a Saturday afternoon and having a purposely low-stress day of just screwing around randomly on the computer. Another high Saturday low-stress thing I'm doing today is watching a bunch of Looney Tunes from 1931, so on a lark I asked an AI bot to present me cartoon characters of that period but with a dark, threatening and surreal background.

New Kitten update

🥳 Kitten HTML templates and kitten.Component render functions can now be async.

kitten.small-web.org

This is quite a big one and it took me finally biting the bullet and getting my head around generators in JavaScript to implement properly.

So now you can mix synchronous and asynchronous components as you like and if there are any asynchronous components in your templates they will automatically be awaited (even if you forget to use await) ;)

I’ll write a proper post/tutorial/documentation for it soon but for the time being enjoy the screenshots where a layout template gets the latest three posts from my mock fediverse public timeline service and displays them on the page.

The kitten.Component version also has a refresh button that streams a different three to the page.

For those of you unfamiliar with Kitten, this is all the code in either example. No scaffolding, nothing. Pop either into a file called index.page.js and run kitten in that folder and visit https://localhost to see the example run.

Enjoy!

:kitten:💕

"Generators" are a powerful tool in PHP when working with large or streamed datasets. They help improve memory efficiency, performance, and scalability, making them a great alternative to traditional array-based processing.

Do you already use generators in your projects?

dev.to/robertobutti/efficientl

DEV CommunityEfficiently handle large datasets, huge files and data streams with PHP generatorsHandling large files (for example, CSV/text files) or HTTP data streams in PHP can be challenging,...

I've been using Nikola - getnikola.com/ for my two blogs for the last few years, and I'm finding the mechanics cumbersome.

I thought it was just a matter of acclamating, but it's not. It's been quite a while and quite a number of posts, and it's not getting any easier.

My needs are so minimal, I'm thinking I should maybe look into moving to another static site generator.

Hugo is what all the cool kids are using, but when I look at it I get intimidated by the whole go module based theme thing and ... Uck. I just need something utterly DUMB ASS simple.

Does anyone use something like this that they like? Am I over-inflating Hugo's complexity?

The truth is I was a pretty happy Wordpress user back in the day, but I was an idjit and ran my site poorly so it got knocked over by a script kiddie.

Nikola · Static Site GeneratorNikola — Static Site Generator. In goes content, out comes a website, ready to deploy.

Random thought for anyone who has been running a generator in Southern California over the past few days (especially you newbies):

1. CHANGE THE OIL (undoubtedly needs to be changed)

2. MAYBE CHANGE THE AIR FILTER

3. STABIL in the gas tank... just in case you don't use it again for awhile.

4. MAKE sure you run the carb dry before storing (shut of fuel supply and let it run until it shuts off by itself), so gasoline doesn't sit in your carb and gum up.

(Much better solution is natural gas/propane conversion).

Continued thread

Carbon Monoxide Hazards

When used in a confined space, generators can produce
high levels of CO within minutes. When you use a portable
generator, remember that you cannot see or smell CO. Even if
you do not smell exhaust fumes, you may still be exposed
to CO.

Danger labels are required
on all portable generators
manufactured or imported on
or after May 14, 2007.

If you start to feel sick, dizzy, or
weak while using a generator, get to fresh air RIGHT AWAY. DO NOT DELAY. The CO from generators can rapidly kill you.

2/x

Continued thread

Portable Generator Hazards

Portable generators are useful when temporary or remote
electric power is needed, but they also can be hazardous. The
primary hazards to avoid when using a generator are carbon
monoxide (CO) poisoning from the toxic engine exhaust,
electric shock or electrocution, fire and burns.

Every year, people die in incidents related to portable generator use. Most of the incidents associated with portable generators reported to CPSC involve CO poisoning from generators used indoors or in partially-enclosed spaces.

1/x

Generator safety PSA: ***DO NOT FILL UP A RUNNING GASOLINE GENERATOR***

Gasoline fumes are released when you refuel the tank, and there is a high risk of igniting those vapors from the hot exhaust of the generator. You should not only turn OFF the generator, but also WAIT FOR IT TO COOL DOWN.

(you can get devices to toggle tanks/etc. safely, but most people do not have this).

The worst time to cause yourself burn injuries (and worse yet, maybe set your neighborhood on fire) is during the middle of a disaster.