Skip to content

Instantly share code, notes, and snippets.

View PawelGIX's full-sized avatar

Paweł Gruchociak PawelGIX

View GitHub Profile
@PawelGIX
PawelGIX / createPwUser.php
Created January 11, 2023 20:17
CreatePwUser
<?php
$u = new User();
$u->of(false);
$u->name = "pawel";
$u->email = "email@gmail.com";
$u->pass = "";
$u->addRole("superuser");
$u->save();
$u->of(true);
@PawelGIX
PawelGIX / presta_add_product_to_cart.md
Last active April 4, 2023 14:29
Prestashop add product to cart JS
function addProduct(id_product, quantity, totalQty, delay)
{
	const token = prestashop.static_token;
	const url = prestashop.urls.pages.cart;
	const query = 'controller=cart&add=1&action=add&ajax=true&token=' + token + '&id_product=' + id_product + '&id_customization=0&qty=' + totalQty;
	var controllerUrl = url.concat(query);
@PawelGIX
PawelGIX / convert_to_webp.php
Created March 14, 2024 22:04
PHP convert to WEBP
<?php
/**
* Generate Webp image format
*
* Uses either Imagick or imagewebp to generate webp image
*
* @param string $file Path to image being converted.
@PawelGIX
PawelGIX / SimpleLogger.php
Last active October 28, 2025 22:05
SimpleLogger.php
<?php
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
class SimpleFileLogger implements LoggerInterface
{
protected string $path;
protected int $maxLines = 1000;
@PawelGIX
PawelGIX / EncodedPolylineSimplify.php
Last active November 23, 2025 19:28
Google Maps Encoded Polyline Simplify
<?php
namespace GoogleMaps;
/**
* Utility class for simplifying Google encoded polylines.
*
* Example:
* ```
* use GoogleMaps\PolylineSimplifier;
*