Skip to content

Instantly share code, notes, and snippets.

View thexpand's full-sized avatar

Tsvetomir Lazarov thexpand

View GitHub Profile
@thexpand
thexpand / preview.yml
Last active June 18, 2023 18:49
GitHub Actions - Vercel Workflow
name: Preview Deployment
on:
pull_request:
branches: [ main ]
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
jobs:
@thexpand
thexpand / README.md
Last active January 24, 2023 10:08
Go: Optional parameters

Go: Otional arguments for variadic functions

Check out the optional.go file for more details on the usage.

@thexpand
thexpand / NormalizeQueryParamsMiddleware.php
Last active September 22, 2020 16:38
A PSR-15 middleware class to normalize query parameters (e.g. to turn a "true" or a "false" string from a query parameter to a boolean true or false for the next middlewares/handlers in the pipeline.
<?php
declare(strict_types=1);
namespace Application\Middleware;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
@thexpand
thexpand / MegaMenu.php
Created October 25, 2018 12:38
Menu component
<?php
namespace Navigation\Component;
use Component\AbstractComponent;
use Doctrine\Common\Collections\ArrayCollection;
use Navigation\Model\MenuItem;
use Navigation\Service\ActiveMenuManager;
use ProductCategory\Entity\Repository\ProductCategoryRepository;
@thexpand
thexpand / .phpstorm.meta.php
Created September 17, 2018 07:06
PSR-11 Autocomplete for PhpStorm
<?php
/**
* PhpStorm code completion
*
* Add code completion for PSR-11 Container Interface and more...
*/
namespace PHPSTORM_META {