Skip to content

Instantly share code, notes, and snippets.

View mmoreram's full-sized avatar
🤑
Working on Apisearch

Marc Morera mmoreram

🤑
Working on Apisearch
View GitHub Profile
@mmoreram
mmoreram / StreamedFile.php
Last active April 27, 2023 16:07
First view on local storage middleware based ReactPHP stream download
<?php
namespace App;
use Psr\Http\Message\ResponseInterface;
use React\EventLoop\Loop;
use React\EventLoop\TimerInterface;
use React\Filesystem\AdapterInterface;
use React\Http\Browser;
use React\Stream\ReadableStreamInterface;
This file has been truncated, but you can view the full file.
This file has been truncated, but you can view the full file.
<?php
class X {
private int $a = 0;
public function incr() {
$this->a++;
}
public function a() {
[{
"id": "4",
"ti": "Curso de Escaparatismo y Decoración de Espacios Comerciales",
"b": "Implika",
"p": "3041",
"op": "3041",
"p_c": "3041€",
"op_c": "3041€",
"sku": "Sku",
"u": "https://implika.elabsconsulting.com/escaparatismo-y-decoracion-de-espacios-comerciales.html",

This is the Apisearch item structure.

{
    "id": "ID",
    "ti": "Title",
    "d": "Description",
    "b": "Brand",
    "p": "Price, 9.34 (float)",
 "op": "Old price, 13.47 (float)",
This file has been truncated, but you can view the full file.
@mmoreram
mmoreram / datetime-diff.php
Last active December 16, 2021 11:41
Datetime days between difference between php8.0 and php8.1
<?php
/**
* Two datetimes with microseconds
*/
$from = new DateTime('2021-12-01 11:23:38.975080');
$to = new DateTime('2021-12-15 11:23:38.975066');
$daysBetween = \intval((clone $to)->diff($from)->days));
var_dump($daysBetween);
uid|type|title|link|image|categories|attributes
mw0000270036|album|Julie & Carol at Lincoln Center|http://www.allmusic.com/album/julie-carol-at-lincoln-center-mw0000270036|http://cdn-s3.allmusic.com/release-covers/500/0001/149/0001149773.jpg|id##MA0000004432~~name##Stage & Screen~~slug##MA0000004432 && id##MA0000011877~~name##Vocal~~slug##MA0000011877|[in]rating=3 %% [in]year=1989 %% [i]author=id##julie-andrews-mn0000314113~~name##Julie Andrews~~slug##julie-andrews-mn0000314113~~img##http://cps-static.rovicorp.com/3/JPG_400/MI0001/400/MI0001400285.jpg?partner=allrovi.com
mw0000974288|album|Greatest Hits [Tristar]|http://www.allmusic.com/album/greatest-hits-tristar-mw0000974288|http://cps-static.rovicorp.com/3/JPG_500/MI0002/032/MI0002032433.jpg?partner=allrovi.com|id##MA0000002674~~name##Jazz~~slug##MA0000002674 && id##MA0000011877~~name##Vocal~~slug##MA0000011877|[in]rating= %% [in]year=1989 %% [i]author=id##louis-armstrong-mn0000234518~~name##Louis Armstrong~~slug##louis-armstrong-mn0000234518~~img##http://
{
"require": {
"react/http": "*",
"symfony/process": "*",
"react/child-process": "*",
"drift/react-functions": "*"
}
}