Skip to content

Instantly share code, notes, and snippets.

View cierzniak's full-sized avatar

Paweł Cierzniakowski cierzniak

View GitHub Profile
@cierzniak
cierzniak / src_Controller_SampleController.php
Created December 5, 2018 10:57
Request Handler with Validation for PHP projects
<?php declare(strict_types=1);
namespace Api\Controller;
use Api\Model\User\TokenDTO;
use Api\RequestValidator\RequestHandler;
use Api\RequestValidator\Security\RefreshTokenRequestValidator;
use Api\RequestValidator\ValidationFailed;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
@cierzniak
cierzniak / install-tibia.sh
Last active August 1, 2019 16:13
Tibia Linux Client installer
#!/usr/bin/env bash
GAME_DOWNLOAD_URL=https://static.tibia.com/download/tibia.x64.tar.gz
MAPS_DOWNLOAD_URL=https://tibiamaps.io/downloads/minimap-with-markers
TEMP_DIR=$(mktemp -d)
APP_DIR=/opt/Tibia
USER_DIR=${HOME}/.local/share/CipSoft\ GmbH/Tibia/packages/Tibia
echo "Install Tibia Linux Client with maps"
@cierzniak
cierzniak / Makefile
Last active November 24, 2019 18:46
Monorepo with separate testing suites on pre-commit hook
.PHONY: add-git-hooks test-backend test-frontend
add-git-hooks:
rm -rf .git/hooks
ln -sf ../_misc/hooks .git/hooks
test-backend:
docker rm back_test || true
docker build --file _misc/docker-test/backend/Dockerfile --tag back_test .
docker run --name=back_test back_test
@cierzniak
cierzniak / kody.csv
Last active June 16, 2021 13:23
Rozdane kody mhb
date value
2019-09-02 8
2019-09-03 12
2019-09-04 4
2019-09-05 5
2019-09-06 27
2019-09-09 8
2019-09-10 22
2019-09-11 25
2019-09-12 19
@cierzniak
cierzniak / Button.html
Last active November 11, 2022 11:28
Rainbow button
<button class="btn">Test</button>
<!-- Partially based on https://web.dev/speedy-css-tip-animated-gradient-text/ -->
@cierzniak
cierzniak / sonar-scanner.py
Last active January 12, 2023 22:09
Initialize SonarQube on project with Git history
#!/usr/bin/env python3
import os
import subprocess
# Enter config variables here
start_date = '2023-01-01'
log_dir = '.sonarlogs'
branch = 'main'
# Get all commits (last commit of day) and run sonar-scanner
@cierzniak
cierzniak / JsonResponseBuilder.php
Last active June 22, 2023 11:49
Json Response Builder
<?php
declare(strict_types=1);
namespace App\Http\Response;
use App\Http\Request\ListPageRequest;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
@cierzniak
cierzniak / JsonTransformerEvent.php
Created June 22, 2023 11:57
Symfony custom Argument Resolver
<?php
declare(strict_types=1);
namespace App\Http\Event;
use App\Http\Exception\JsonMalformedException;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\RequestEvent;