This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://git-scm.com/docs/git-remote | |
git remote prune --dry-run origin | |
git remote update origin --prune | |
# get all removed branches on server side | |
git branch -vv | grep -Po '\s(feature\S+)(?=.*\s+gone\])' | |
# so you can remove all "gone" branches: | |
git branch -D $(b -vv | grep -Po '\s(feature\S+)(?=.*\s+gone\])') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in case of conflict with local nginx: | |
# make sure in all *.confs ( | |
# also in default and example to avoid error like | |
# 'nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)' | |
# ) | |
# set for instance "listen 127.0.0.1:80" instead of "listen *:80" | |
# docker & network settings | |
DOCKER_IMAGE_NAME="maxexcloo/nginx-php" # build of nginx-php - for example | |
DOCKER_CONTAINERS_NAME="nginx_bridged" # our container's name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function a() { | |
throw new \LogicException('bad logic in A'); | |
} | |
function b() { | |
try { | |
a(); | |
} catch (\LogicException $e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unamestr=`uname` | |
PHP_INI_PATH=$(php --ini | egrep -o '\S+php.ini$') | |
if [ -z $(php -m | grep xdebug) ]; then | |
if [[ "$unamestr" == 'Linux' ]]; then | |
sudo sed -i "s/^;zend_extension/zend_extension/" $PHP_INI_PATH | |
elif [[ "$unamestr" == 'Darwin' ]]; then | |
sudo sed -i "" "s/^;zend_extension/zend_extension/" $PHP_INI_PATH | |
fi | |
echo 'Xdebug enabled' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$message = 'test'; | |
if ('ASCII' !== mb_detect_encoding($message, 'ASCII', true)) { | |
echo 'Unicode' . PHP_EOL; | |
} else { | |
echo 'ASCII' . PHP_EOL; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Determine csv delimiter | |
* | |
* @param resource $fileHandle - handle of csv file | |
* @return string - correct delimiter of csv file | |
*/ | |
function determineCsvDelimiter($fileHandle) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetch = require('node-fetch'); | |
const cheerio = require('cheerio'); | |
const fs = require('fs'); | |
let url = "http://loveread.ec/read_book.php?id=56443&p="; | |
let requests = []; | |
let startTime = new Date().getTime(); | |
for (let counter = 1; counter < 36; ++counter) { | |
requests.push( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(ticks = 1); | |
pcntl_signal(SIGTERM, 'signalHandler'); // Termination ('kill' was called) | |
pcntl_signal(SIGHUP, 'signalHandler'); // Terminal log-out | |
pcntl_signal(SIGINT, 'signalHandler'); // Interrupted (Ctrl-C is pressed) | |
$seconds = 0; | |
$total = 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Automatically adds branch name and branch description to every commit message. | |
# changes commit message on branch example "feature/SPRINT-123" to message: "#SPRINT-123: commit message" | |
# | |
# INSTALLATION: | |
# - copy to .git/hooks/prepare-commit-msg | |
# - run chmod 555 .git/hooks/prepare-commit-msg | |
# | |
NAME=$(git branch | grep '*' | grep -Po '\w+-\d+' | sed -r 's/(.*)/#\1/') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
percona2: | |
container_name: percona-compose | |
image: percona:latest | |
environment: | |
- MYSQL_ROOT_PASSWORD=12345 | |
php53: | |
container_name: php53-compose | |
image: markfletcher/php5.3-zend | |
links: |
NewerOlder