IMPORTANT: first add docker container capabilities to allow smem exec ptrace and see php-fpm child processes:
# in docker-compose.yml
my_app:
container_name: my_app
cap_add:
- SYS_PTRACE| <?php | |
| function a() { | |
| throw new \LogicException('bad logic in A'); | |
| } | |
| function b() { | |
| try { | |
| a(); | |
| } catch (\LogicException $e) { |
| 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' |
| <?php | |
| $message = 'test'; | |
| if ('ASCII' !== mb_detect_encoding($message, 'ASCII', true)) { | |
| echo 'Unicode' . PHP_EOL; | |
| } else { | |
| echo 'ASCII' . PHP_EOL; | |
| } |
| 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( |
| 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\])') |
| <?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; |
| #!/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/') |
| percona2: | |
| container_name: percona-compose | |
| image: percona:latest | |
| environment: | |
| - MYSQL_ROOT_PASSWORD=12345 | |
| php53: | |
| container_name: php53-compose | |
| image: markfletcher/php5.3-zend | |
| links: |
| import org.apache.commons.io.IOUtils; | |
| try { | |
| // approach 1 | |
| String extractProducts = IOUtils.toString(getClass().getResourceAsStream("/extractProducts.js")); | |
| // approach 2 | |
| byte[] bytes = Files.readAllBytes(Paths.get(getClass().getResource("/extractProducts.js").getPath())); | |
| String js_extractProducts = new String(bytes); | |
| } catch (IOException e) { |