Skip to content

Instantly share code, notes, and snippets.

View akondas's full-sized avatar

Arkadiusz Kondas akondas

View GitHub Profile
@akondas
akondas / .php_cs
Created November 5, 2019 10:41
Sample PHP-CS-Fixer config file
<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
;
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
@akondas
akondas / tips.md
Created June 7, 2019 09:36
JetBrains IDE tips&trick

Shortcuts

Ctrl + Shift + A -> Action Ctrl + ~ then 4 1 -> Presentation Mode Ctrl + E -> Recent Files Alt + Enter on string -> Inject Language Ctrl + Alt + Shift + J -> Many carrets 🔥 Alt + M -> to came case Ctrl + Shift + T -> Go to class test Ctrl + Shift + Up/Down -> Move lines

@akondas
akondas / KMeans.php
Created March 11, 2019 15:01
php-ml k-means centronoids
<?php
declare(strict_types=1);
namespace Phpml\Clustering;
use Phpml\Clustering\KMeans\Space;
use Phpml\Exception\InvalidArgumentException;
class KMeans implements Clusterer
@akondas
akondas / serverlessPolicy.json
Created February 20, 2019 07:28
Complete IAM policy for run PHP on AWS Lambda using Bref
{
"Statement": [
{
"Action": [
"apigateway:*",
"cloudformation:CancelUpdateStack",
"cloudformation:ContinueUpdateRollback",
"cloudformation:CreateChangeSet",
"cloudformation:CreateStack",
"cloudformation:CreateUploadBucket",
@akondas
akondas / init-tmux.sh
Created July 13, 2016 06:48
Start tmux with 4 pane
tmux new-session -d
tmux split-window -v
tmux split-window -h
tmux select-pane -t 0
tmux split-window -h
tmux -2 attach-session -d
@akondas
akondas / migration_diff.sh
Created April 25, 2016 18:26
Doctrine Migrations for multiple Entity Managers
#!/bin/bash
php app/console d:m:d --em=first --configuration=app/config/migration/first.yml
php app/console d:m:d --em=second --configuration=app/config/migration/second.yml
php app/console d:m:d --em=third --configuration=app/config/migration/third.yml
### Keybase proof
I hereby claim:
* I am itcraftsmanpl on github.
* I am itcraftsman (https://keybase.io/itcraftsman) on keybase.
* I have a public key whose fingerprint is 53E6 8D72 15B9 9234 6FF8 4454 4932 1DD3 01F4 C9E3
To claim this, I am signing this object:
@akondas
akondas / Handler.php
Created August 14, 2015 17:43
Laravel 5.0 Exception Handler
<?php
namespace App\Exceptions;
use Exception;
use Slack;
use Whoops;
use Symfony\Component\Debug\Exception\FatalErrorException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
@akondas
akondas / command.php
Created June 20, 2015 17:15
Get data from command in CQRS
<?php
// example 1
class ProductController
{
public function createProductAction(Request $request)
{
$responder = new CreateProductResponder();
<?php
// do PHP 5.6
use Framework\Component\ClassA;
use Framework\Component\ClassB as ClassC;
use Framework\Component\OtherComponent\ClassD;
// od PHP 7
use Framework\Component\{
ClassA,
ClassB as ClassC,