Skip to content

Instantly share code, notes, and snippets.

@loren138
loren138 / guzzle-retry.php
Last active August 16, 2016 13:26 — forked from gunnarlium/guzzle-retry.php
Example of how to create a retry subscriber for Guzzle 6
<?php
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Handler\CurlHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Request as Psr7Request;
use GuzzleHttp\Psr7\Response as Psr7Response;
use Psr\Log\LoggerInterface;
const MAX_RETRIES = 2;
@loren138
loren138 / post-merge
Last active August 27, 2015 11:56 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `composer install` if `composer.lock` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@loren138
loren138 / pf.md
Last active August 29, 2015 14:07 — forked from ryanzhou/pf.md

Getting Apache Port Forwarding to work in OS X Yosemite

Former code: http://echo.co/blog/os-x-109-local-development-environment-apache-php-and-mysql-homebrew

Some parts taken from: https://gist.github.com/kujohn/7209628

ipfw is officially deprecated and removed in OS X Yosemite. Pow requires another program pf to handle the port forwarding.

Note: While this does forward port 80, I haven't figured out how to get apache to see the incoming domain to make things like project.dev work correctly. If anyone gets that to work, please let me know how. (So visiting http://localhost/ or http://localhost/~username/ works as expected. Visiting http://project.dev does not.) I ended up starting apache as root and running it as _www for now.