Skip to content

Instantly share code, notes, and snippets.

View burzum's full-sized avatar
💭
Enjoying my new job :)

burzum

💭
Enjoying my new job :)
View GitHub Profile
@burzum
burzum / install-phps.sh
Last active January 6, 2021 09:21
Install php versions and modules automatically on Ubuntu
#!/usr/bin/env bash
# https://computingforgeeks.com/how-to-install-php-on-ubuntu/
phpVersions=('7.2' '7.3' '7.4')
modules=('cli' 'fpm' 'bcmath' 'gd' 'xml' 'mbstring' 'xml' 'curl' 'pgsql' 'imagick' 'intl' 'amqp' 'intl' 'imap' 'opcache')
sudo apt-get update
sudo apt -y install software-properties-common
sudo add-apt-repository -y ppa:ondrej/php
@burzum
burzum / Query.php
Created March 19, 2019 11:18
Query.php
public function applyOptions(array $options)
{
$valid = [
'fields' => 'select',
'conditions' => 'where',
'join' => 'join',
'order' => 'order',
'limit' => 'limit',
'offset' => 'offset',
'group' => 'group',
<?php
use GuzzleHttp\Client as GuzzleClient;
use Http\Adapter\Guzzle6\Client;
use Prooph\EventStore\ExpectedVersion;
use Prooph\EventStore\EventData;
use Prooph\EventStore\UserCredentials;
use Prooph\EventStoreHttpClient\ConnectionSettings;
use Prooph\EventStoreHttpClient\EventStoreConnectionFactory;
$userCredentials = new UserCredentials('admin', 'changeit');
@burzum
burzum / test.php
Last active September 17, 2018 21:25
<?php
namespace Authentication\Test\TestCase\Identifier\Resolver;
use Authentication\Identifier\Resolver\EloquentResolver;
use Authentication\Test\TestCase\AuthenticationTestCase;
use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Database\Connection;
use Illuminate\Database\ConnectionResolverInterface;
use Illuminate\Database\Eloquent\Model;
@burzum
burzum / ElasticPaginator.php
Created August 21, 2017 10:56
CakePHP ES Paginator
<?php
declare(strict_types=1);
namespace App\Datasource;
use Cake\Datasource\Paginator;
use Cake\Datasource\RepositoryInterface;
use Cake\ElasticSearch\Query;
use Cake\Network\Exception\NotFoundException;
@burzum
burzum / phpcs.xml
Last active July 17, 2017 12:32
Custom phpcs config for PSR2 without the god damn aweful spaces - enforce tabs!
<?xml version="1.0"?>
<ruleset name="PSR2-Fuck-Spaces">
<rule ref=".\vendor\cakephp\cakephp-codesniffer\CakePHP\ruleset.xml"/>
<file>./src</file>
<file>./tests</file>
<rule ref="PSR2">
<exclude name="PSR2.Classes.ClassDeclaration"></exclude>
<exclude name="Generic.WhiteSpace.DisallowTabIndent"/>
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine" />
</rule>
@burzum
burzum / src\Pdf\Engine\TexToPdfEngine.php
Last active December 10, 2015 15:28
src/Pdf/Engine/TexToPdfEngine.php
<?php
namespace App\Pdf\Engine;
use CakePdf\Pdf\CakePdf;
use CakePdf\Pdf\Engine\AbstractPdfEngine;
use Cake\Core\Exception\Exception;
use Cake\Utility\Text;
/**
* TexToPdfEngine for the CakePdf Plugin
<?php
namespace App\Model\Table;
use Cake\Core\Configure;
/**
* Database Prefix Trait for CakePHP 3.0
*
* @author Florian Krämer
* @license MIT
@burzum
burzum / DbPrefixTrait.php
Created August 7, 2015 13:31
CakePHP 3.0 DB Connection Prefix
<?php
namespace App\Model\Table;
use Cake\Core\Configure;
/**
* Database Prefix Trait for CakePHP 3.0
*
* @author Florian Krämer
* @license MIT