Skip to content

Instantly share code, notes, and snippets.

View JanMikes's full-sized avatar
🚀
Love to build awesome apps

Jan Mikeš JanMikes

🚀
Love to build awesome apps
View GitHub Profile
@JanMikes
JanMikes / MessageBusExceptionExtension.php
Created May 5, 2021 14:24
PHPStan MessageBusExceptionExtension
<?php
declare(strict_types=1);
namespace EAG\Packages\PHPStanRules;
use EAG\Packages\MessageBus\Command\CommandBus;
use Pepakriz\PHPStanExceptionRules\DynamicMethodThrowTypeExtension;
use Pepakriz\PHPStanExceptionRules\UnsupportedClassException;
use Pepakriz\PHPStanExceptionRules\UnsupportedFunctionException;
@JanMikes
JanMikes / keybase.md
Created February 28, 2021 17:00
keybase.md

Keybase proof

I hereby claim:

  • I am janmikes on github.
  • I am janmikes (https://keybase.io/janmikes) on keybase.
  • I have a public key ASC3H-CPKz-07SgWuDC0OCidB7cPoS5t9z4BiuGyGPA1yQo

To claim this, I am signing this object:

@JanMikes
JanMikes / .env
Created August 11, 2020 09:37
Docker compose example - Postgres + adminer
DATABASE_USER=postgres
DATABASE_PASSWORD=root
DATABASE_DBNAME=test
@JanMikes
JanMikes / script.php
Created May 17, 2019 12:36
PHP - Replace all classes as strings usages in project
#!/usr/bin/php
<?php declare(strict_types=1);
use Nette\Loaders\RobotLoader;
use Nette\Utils\FileSystem as NetteFileSystem;
use Nette\Utils\Finder;
use Nette\Utils\Strings;
require __DIR__ . '/../vendor/autoload.php';
@JanMikes
JanMikes / Dockerfile
Created September 15, 2018 16:59
Multi-stage dockerfile with xdebug for local development
####
## Production build
####
FROM php:7.1-apache as production
MAINTAINER Jan Mikeš [email protected]
## Install composer globally
RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/composer
@JanMikes
JanMikes / CreateTicketPresenter.php
Created December 3, 2017 17:00
Creating DTO from request body (dumb way!)
<?php declare (strict_types=1);
namespace OdbavTo\App\Presenters;
use Nette\Application\IResponse;
use Nette\Application\Request;
use OdbavTo\App\HttpRequest\RequestBodyHelper;
use OdbavTo\App\Responses\CreatedResponse;
use OdbavTo\Application\CreateTicket\CreateTicketRequest;
use OdbavTo\Application\CreateTicket\CreateTicketUseCase;
<?xml version="1.0" encoding="UTF-8"?>
<project name="OdbavTo" default="createLocalConfig" basedir=".">
<property environment="env" />
<property name="configFile" value="app/config/config.local.neon" />
<target name="createLocalConfig" description="Creates local config file">
<available file="${configFile}" property="configExists" />
<if>
<isset property="configExists" />
<then>
@JanMikes
JanMikes / DB.txt
Last active January 4, 2023 09:23
Example of simple and stupid value object
Vygenerovat migrations, ktera smaze z commentu typu `(DC2Type:identity_uid)`
@JanMikes
JanMikes / run-rabbit-consumers.php
Created September 7, 2017 00:31
Multiple rabbit consumers in single command
<?php declare(ticks=1, strict_types=1);
require_once __DIR__ . '/../vendor/autoload.php';
use Arara\Process\Action\Command;
use Arara\Process\Child;
use Arara\Process\Control;
use Kdyby\RabbitMq\DI\RabbitMqExtension;
use Nette\DI\Container;
@JanMikes
JanMikes / build.xml
Last active July 12, 2017 23:05
First Phing build script
<?xml version="1.0" encoding="UTF-8"?>
<project name="OdbavTo" default="production" basedir=".">
<property environment="env" />
<property name="configFile" value="app/config/config.testttt.neon" />
<target name="production" description="Creates local config file">
<available file="${configFile}" property="configExists" />
<echo msg="Config file: ${configFile}" />
<echo msg="Config exists: ${configExists}" />
<if>