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.
{"uuid":{"id":"46","type":"product"},"metadata":{"name":"Zapatos Profesional Luisetti 0101 Negro","reference":"LVC-0101NEGRO","ean":"1296549","upc":"","show_price":true,"link":"https:\/\/lavalencianacalzados.com\/zapatos-camarero\/luisetti-0101.html","url":"https:\/\/lavalencianacalzados.com\/zapatos-camarero\/luisetti-0101.html","img":"https:\/\/lavalencianacalzados.com\/42053-home_default\/luisetti-0101.jpg","old_price":59.95},"indexed_metadata":{"as_version":9031649815,"price":59.95,"categories":["Luisetti","Zapatos trabajo hombre","Zapatos con cord\u00f3n","Zapatos Camarero","Zapatos de Trabajo","Zapatos Hosteler\u00eda"],"available":true,"with_discount":false,"with_variants":true,"brand":"Luisetti","talla":["40","41","42","43","44","45","46","39"],"color":["Negro"],"quantity_sold":12,"sales":12},"searchable_metadata":{"name":"Zapatos Profesional Luisetti 0101 Negro","categories":["Luisetti","Zapatos trabajo hombre","Zapatos con cord\u00f3n","Zapatos Camarero","Zapatos de Trabajo","Zapatos Hosteler\u00eda
This file has been truncated, but you can view the full file.
{"uuid":{"id":"47","type":"product"},"metadata":{"name":"Zapatos Profesional Luisetti 0104 Negro","reference":"LVC-0104NEGRO","ean":"1297065","upc":"","show_price":true,"link":"https:\/\/lavalencianacalzados.com\/zapatos-hombre-sin-cordon\/luisetti-0104.html","url":"https:\/\/lavalencianacalzados.com\/zapatos-hombre-sin-cordon\/luisetti-0104.html","img":"https:\/\/lavalencianacalzados.com\/5-home_default\/luisetti-0104.jpg","old_price":59.95},"indexed_metadata":{"as_version":9031649815,"price":59.95,"categories":["Luisetti","Zapatos trabajo hombre","Zapatos sin cord\u00f3n","Zapatos Camarero","Zapatos de Trabajo","Zapatos Hosteler\u00eda"],"available":true,"with_discount":false,"with_variants":true,"brand":"Luisetti","talla":["40","41","42","43","44","45","46","39"],"color":["Negro"],"quantity_sold":36,"sales":36},"searchable_metadata":{"name":"Zapatos Profesional Luisetti 0104 Negro","categories":["Luisetti","Zapatos trabajo hombre","Zapatos sin cord\u00f3n","Zapatos Camarero","Zapatos de Trabajo","Zapatos
<?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.
{"id":"3","languages":{"es":{"c0":"Perros","c1":"Snacks","c2":"Juguetes y deporte","c3":"De inteligencia e interactivos","c4":"Semi-h\u00famedos","ti":"Relleno Liver Easy Treat","u":"perros\/kong\/stuffn-liver-higado","c":"Semi-h\u00famedos","an":"Perros"},"de":{"c0":"Hunde","c1":"Snacks","c2":"Spielzeug und Sport","c3":"Intelligenzspielzeug","c4":"Halbfeucht","ti":"Liver Easy Treat","u":"hunde\/kong\/stuffn-liver-leber","c":"Halbfeucht","an":"Hunde"},"en":{"c0":"Dogs","c1":"Treats","c2":"Toys & Sport","c3":"Intelligence & Interactive Toys","c4":"Chewy and Softer Treats","ti":"Liver Easy Treat","u":"dogs\/kong\/stuffn","c":"Chewy and Softer Treats","an":"Dogs"},"fr":{"c0":"Chiens","c1":"Snacks et friandises","c2":"Jouets et sport","c3":"Intelligents","c4":"Semi-humides","ti":"Liver Easy Treat","u":"chiens\/kong\/stuffn-liver-foie","c":"Semi-humides","an":"Chiens"},"nl":{"c0":"Honden","c1":"Snacks","c2":"Speelgoed en sport","c3":"Intelligent speelgoed","c4":"Semi-zacht","ti":"Hondensnacks Stuff'N Liver Easy Tr
@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": "*"
}
}