Reading List
The most recent articles from a list of feeds I subscribe to.
Cracking a “Developer Tools Killer” script…
Remove falsy values from a Laravel collection or array in PHP
The native array_filter() in PHP and collect()->filter() in Laravel also work without providing a filter callback.
array_filter([0, 1, '', 'a', false, true, []]);// [1, 'a', true] collect([0, 1, '', 'a', false, true, []])->filter();// [1, 'a', true]
If you don't provide a callback, PHP will remove all empty values from the array.
Cosmic Latte
A team of astronomers have calculated the average color of the universe and named it cosmic latte. I'd love to have a cosmiclatte CSS color one day.
Adding stale while revalidate functionality to Laravel's cache
A stale while revalidate cache macro by Rias Van der Veken. With stale while revalidate, expired cache items will still be used when requested, but the data will be revalidated right after. That means the current request will be handled faster than if the cache would have to be revalidated, and the next request will receive fresh data.
Stale while revalidate is often used in web applications, popularized by Vercel's SWR React library.
↗ rias.be