Skip to content

Instantly share code, notes, and snippets.

View f3l1x's full-sized avatar
:octocat:
hack for living

Milan Felix Šulc f3l1x

:octocat:
hack for living
View GitHub Profile
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active April 23, 2024 11:47
set -e, -u, -o, -x pipefail explanation
@tmsnvd
tmsnvd / ruleset.md
Last active February 28, 2024 07:27
phpcs PHP_CodeSniffer rules list
Rule Namespace Description
Arrays.ArrayBracketSpacing /Squiz.Arrays.ArrayBracketSpacing Ensure that there are no spaces around square brackets.
Arrays.ArrayDeclaration /Squiz.Arrays.ArrayDeclaration Ensures that arrays conform to the array coding standard.
Arrays.DisallowLongArraySyntax /Generic.Arrays.DisallowLongArraySyntax Bans the use of the PHP long array syntax.
Arrays.DisallowShortArraySyntax /Generic.Arrays.DisallowShortArraySyntax Bans the use of the PHP short array syntax.
CSS.BrowserSpecificStyles /MySource.CSS.BrowserSpecificStyles Ensure that browser-specific styles are not used.
CSS.ClassDefinitionClosingBraceSpace /Squiz.CSS.ClassDefinitionClosingBraceSpace Ensure there is a single blank line after the closing brace of a class definition.
CSS.ClassDefinitionNameSpacing /Squiz.CSS.ClassDefinitionNameSpacing Ensure there are no blank lines between the names of classes/IDs.
CSS.ClassDefinitionOpeningBrace
@dg
dg / composing.presenters.php
Created May 31, 2018 14:00
Composing presenters without inheritance
<?php
// composing presenters without inheritance
// (requires nette/application 2.4.11)
trait RequireLoggedUser
{
public function injectRequireLoggedUser()
{
@dg
dg / typehints.php
Last active May 31, 2018 15:21
Converts @param & @return to native PHP typehints
<?php
declare(strict_types=1);
require '/nette.phar';
class TypeHints
{
public $php71 = true;
@Mikulas
Mikulas / Dockerfile
Last active March 11, 2022 12:34
Docker image PHP 7.1 alpine with extensions
FROM php:7.1-fpm-alpine
RUN apk add --update \
autoconf \
g++ \
libtool \
make \
&& docker-php-ext-install mbstring \
&& docker-php-ext-install mysqli \
@daliborgogic
daliborgogic / delay.js
Created December 16, 2016 15:26
Node.js Async/Await delay
'use strict'
const timeout = ms => new Promise(res => setTimeout(res, ms))
function convinceMe (convince) {
let unixTime = Math.round(+new Date() / 1000)
console.log(`Delay ${convince} at ${unixTime}`)
}
async function delay () {
@f3l1x
f3l1x / phpmailer
Last active May 16, 2016 11:45
PHPMAILER for dev server
#!/usr/bin/php
<?php
$input = file_get_contents('php://stdin');
preg_match('|^To: (.*)|', $input, $matches);
$filename = tempnam('/var/log/mail', $matches[1] . '.');
file_put_contents($filename, $input);
@f3l1x
f3l1x / aliases
Last active January 29, 2024 19:21
Docker - installation, tips, commands, aliases
# ------------------------------------
# Docker alias and function
# ------------------------------------
# Get latest container ID
alias dl="docker ps -l -q"
# Get container process
alias dps="docker ps"
@chadrien
chadrien / README.md
Last active September 1, 2023 12:43
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
&amp;&amp; echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" &gt; /usr/local/etc/php/conf.d/xdebug.ini \