Tag Code Example

Async Task without Queue or E-loop PHP

Most react-PHP code I've seen in the open that is not extension-based (doesn't extend the PHP core language) uses some kind Event-Loop, something similar to how many technologies or languages(I.e. JavaScript) implement concurrency that doesn't support threads.

And historically on single-core CPU's threads practically transformed into loops underneath. But the main idea is that in many languages, an async behavior is very easily achieved, maybe you need a keyword, maybe you need a special class,...

View full article

The new native-lazy load Vue Component

So since April 2020 we have a browser native support to do lazy loading of images which is great, so i decided to write a quick Vue component that uses that functionality.

One problem with the lazy native loading is that it won't display any loading indicator when the image loads.

At the moment only Firefox and Chromium(also Android) based browsers are supporting this feature but it behaves very differently, in Chromium-based browsers it loads far from the end of the viewpoint (a very eager l...

View full article

Puppeteer tricks to write a bot/scrapper

I wrote a bot recently that does some actions after it authenticates with an account using puppeteer and it was incredibly easy.
In case you don't know what puppeteer does, well, it is simply a Node library to control Chromium or Chrome programmatically, now such a library can have many uses but I'll focus on what you need to know when writing a scrapper/bot.

The first thing to know is what kind of website you are dealing with, it is a traditional website or is more like a SPA type of website? A...

View full article

Simplest way to reduce the page number links in Laravel

Recently and currently(Laravel 5.6) Laravel is using Bootstrap-4 and they've updated all their views accordingly, and when you want to use Laravel's pagination feature you may have a bit of a problem in the mobile world as there are too many page links to be shown in an esthetic way on a mobile screen.

So you can do a lot of things to resolve this problem but the simplest way available is to change the view which defines the links listening.
First, we need to publish that view, this will force L...

View full article