Skip to content

Instantly share code, notes, and snippets.

View Great-Antique's full-sized avatar

Denys Hirnyk Great-Antique

View GitHub Profile
@Great-Antique
Great-Antique / phperrorreporting
Created November 19, 2020 11:05
PHP error reporting decoder
#!/usr/bin/env php
<?php
// Found: https://stackoverflow.com/a/4678125
if (!isset($argv[1])) {
echo <<<EXAMPLE
@Great-Antique
Great-Antique / template.bash
Last active March 26, 2020 07:54
Bash script template
#!/usr/bin/env bash
# https://kvz.io/bash-best-practices.html
set -o errexit
set -o pipefail
set -o nounset
# DEBUG
#set -o xtrace
@Great-Antique
Great-Antique / php-no-xdebug.sh
Created December 2, 2019 09:53
PHP without Xdebug
#!/usr/bin/env sh
temporaryPath="$(mktemp -t php.XXXXXXXXXX).ini"
# Using awk to ensure that files ending without newlines do not lead to configuration error
php -i \
| grep "\.ini" \
| grep -v COMPOSER_ORIGINAL_INIS \
| grep -v XDEBUG_HANDLER_SETTINGS \
| grep -o -e '\(/[a-z0-9._-]\+\)\+\.ini' \

Keybase proof

I hereby claim:

  • I am Great-Antique on github.
  • I am greatantique (https://keybase.io/greatantique) on keybase.
  • I have a public key whose fingerprint is 0711 7D9D 9289 7DF3 7778 36E3 6EE1 544F 5615 4137

To claim this, I am signing this object:

@Great-Antique
Great-Antique / immutable_object_and_cqs.php
Last active July 16, 2018 19:47
Immutable object and CQS
<?php
class SomeImmutableObject {
private $a;
private $b;
public function __construct($a, $b) {
$this->a = $a;
$this->b = $b;
<?php
class Controller {
public function handle(Request $request) {
$event = new TryToRegisterUserEvent($request->get('email'));
$this->dispatcher->dispatch($event);
}
}
@Great-Antique
Great-Antique / service_locator.php
Last active October 27, 2017 18:15
What is the difference between Service Locator and class with 2+ methods?
<?php
/*
*
* What is the difference between Service Locator and class with 2+ methods?
*
*/
// We have class with two methods
class InvoiceService implements InvoiceServiceInterface
@Great-Antique
Great-Antique / link_shared.bash
Created May 2, 2016 20:15
Script for link shared folders to home dir on new ubuntu installing
@Great-Antique
Great-Antique / install-pecl_http.sh
Created January 26, 2016 14:56
Bash script for installing pecl_http package in Ubuntu
#!/usr/bin/env bash
echo 'Start installing pecl_http...'
test $EUID -eq 0 || { echo 'Please run script as root' && exit 1; }
type pecl > /dev/null 2>&1 || (
echo 'Install PEAR and PECL...' && apt-get install -y php-pear
cat <<-"PHPCODE" >> /usr/share/php/Archive/Tar.php
<?php