Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
hack for living

Milan Felix Šulc f3l1x

:octocat:
hack for living
View GitHub Profile
@dg
dg / composing.presenters.php
Created May 31, 2018
Composing presenters without inheritance
View composing.presenters.php
<?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
Converts @param & @return to native PHP typehints
View typehints.php
<?php
declare(strict_types=1);
require '/nette.phar';
class TypeHints
{
public $php71 = true;
@Mikulas
Mikulas / Dockerfile
Last active Nov 3, 2020
Docker image PHP 7.1 alpine with extensions
View Dockerfile
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 Dec 16, 2016
Node.js Async/Await delay
View delay.js
'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
PHPMAILER for dev server
View phpmailer
#!/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 Sep 28, 2020
Docker - installation, tips, commands, aliases
View 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 Oct 28, 2020
Debug PHP in Docker with PHPStorm and Xdebug
View README.md

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 \
    && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
View Sublime Text 3 cheating.md

Ref: https://gist.github.com/vertexclique/9839383

Important Note

Please use built-in Terminal.app (of Mac OS X) to type and rune the command, do not use another tool (like iTerm2).

Common step after enter run the patch command:

  • After run the commands, start new Sublime Text app, go to Main Menu > Help > Enter License. On the popup type in any text (example "a") and click Use Licence .
View dynamicReturnTypeMeta.json
{
"methodCalls": [
{
"class": "\\Mockery",
"method": "mock",
"position": 0,
"mask": "%s|\\Mockery\\MockInterface"
},
{
"class": "\\Nette\\DI\\Container",
You can’t perform that action at this time.