Skip to content

Instantly share code, notes, and snippets.

@kkreft
kkreft / custom-handler.php
Created May 24, 2022 12:31 — forked from rockoo/custom-handler.php
Custom error handler for stack trace Medium article
<?php
set_exception_handler( function(\Exception $e) {
$rows = "\n ========= \n";
$exception = sprintf(
"Exception: %s \n Origin: %s on line %s \n",
$e->getMessage(),
$e->getFile(),
$e->getLine()
);
@kkreft
kkreft / generatorForEach.php
Created November 8, 2018 08:31 — forked from hollodotme/generatorForEach.php
Comparison of generator with foreach and yield from
<?php declare(strict_types=1);
class Test
{
private $arr = [];
public function __construct()
{
for ( $i = 0; $i < 10000; $i++ )
{
@kkreft
kkreft / php_upgrade_to_71.sh
Created September 21, 2017 16:27 — forked from pixeline/php_upgrade_to_71.sh
Update Mac Os X's php version to php 7.1 using homebrew. Includes curl and mcrypt
# 1. Install brew --> http://brew.sh/
# 2. run the following commands in your Terminal
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew install --with-openssl curl
brew install --with-homebrew-curl --with-apache php71
brew install php71-mcrypt php71-imagick
# 3. Follow these instructions to make Apache and php-cli use the newer php executable and make the change persist after reboot.
brew info php71
@kkreft
kkreft / install.md
Created April 11, 2017 13:57 — forked from xleliberty/install.md
Graylog2 UDP logger setup for symfony2 via monolog

Graylog 2 gelf installation

  • Add composer source: "graylog2/gelf-php": "~1.0"

Services Setup

parameters.yml

graylog.hostname: you.host.name

graylog.port: 12201

@kkreft
kkreft / flashbag.html.twig
Created November 24, 2015 09:29 — forked from hasantayyar/flashbag.html.twig
symfony flashbag bootstrap alert
{% for type, messages in app.session.flashBag.all %}
{% for message in messages %}
{%if type == 'error'%} {% set type = 'danger' %} {%endif%}
<div class="alert alert-{{ type }}">
{{ message|raw }}
</div>
{% endfor %}
{% endfor %}
@kkreft
kkreft / iterm2.zsh
Created August 25, 2014 18:50 — forked from wadey/iterm2.zsh
# Usage:
# source iterm2.zsh
# iTerm2 window/tab color commands
# Requires iTerm2 >= Build 1.0.0.20110804
# http://code.google.com/p/iterm2/wiki/ProprietaryEscapeCodes
tab-color() {
echo -ne "\033]6;1;bg;red;brightness;$1\a"
echo -ne "\033]6;1;bg;green;brightness;$2\a"
echo -ne "\033]6;1;bg;blue;brightness;$3\a"
----- Esc -----
Quick change directory: Esc + c
Quick change directory history: Esc + c and then Esc + h
Quick change directory previous entry: Esc + c and then Esc + p
Command line history: Esc + h
Command line previous command: Esc + p
View change: Esc + t (each time you do this shortcut a new directory view will appear)
Print current working directory in command line: Esc + a
Switch between background command line and MC: Ctrl + o
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name