Skip to content

Instantly share code, notes, and snippets.

@gunnarlium
gunnarlium / guzzle-retry.php
Created December 17, 2015 16:23
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;
@squarism
squarism / iterm2.md
Last active October 27, 2025 13:29
An iTerm2 Cheatsheet

In the below keyboard shortcuts, I use the capital letters for reading clarity but this does not imply shift, if shift is needed, I will say shift. So + D does not mean hold shift. + Shift + D does of course.

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
@antonymous
antonymous / docker-psysh
Created July 5, 2015 20:57
[email protected] with Manual dockerized (Vi-mode Readline)
FROM php:5.5
# install composer
RUN curl -sS https://getcomposer.org/installer | php && \
mv composer.phar /usr/local/bin/composer
# instoll PsySh
RUN curl -Lo /usr/local/bin/psysh http://psysh.org/psysh && \
chmod +x /usr/local/bin/psysh
@VasekPurchart
VasekPurchart / .gitattributes
Last active April 12, 2019 06:24
composer.lock - disable auto-merging (http://git-scm.com/docs/gitattributes#_performing_a_three_way_merge) #composer #lock #git #merge
/composer.lock -merge
@rob-murray
rob-murray / siege_examples.sh
Last active April 1, 2024 03:48
Siege examples
# Basic example
siege -t60s -c20 -d10 'http://robertomurray.co.uk/'
# Basic auth;
auth=$(echo -n 'username:password' | openssl base64)
siege -t60s -c20 -d10 --header="Authorization:Basic $auth" 'https://staging.a-hostname.co.uk/'
@unbracketed
unbracketed / branch-fu.md
Created April 7, 2015 17:49
Moving commits between branches

Example: Moving up to a few commits to another branch

Branch A has commits (X,Y) that also need to be in Branch B. The cherry-pick operations should be done in the same chronological order that the commits appear in Branch A.

cherry-pick does support a range of commits, but if you have merge commits in that range, it gets really complicated

git checkout branch-B
git cherry-pick X
git cherry-pick Y
@barryvdh
barryvdh / .phpstorm.meta.php
Last active February 10, 2025 15:07
Laravel PhpStorm Meta file
<?php
namespace PHPSTORM_META {
/**
* PhpStorm Meta file, to provide autocomplete information for PhpStorm
* Generated on 2017-09-28.
*
* @author Barry vd. Heuvel <[email protected]>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
@amochohan
amochohan / 01_Laravel 5 Simple ACL manager_Readme.md
Last active March 21, 2025 14:47
Laravel 5 Simple ACL - Protect routes by an account / role type

#Laravel 5 Simple ACL manager

Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.

If the user has a 'Root' role, then they can perform any actions.

Installation

Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php

@Chapabu
Chapabu / Laravel 5 env providers
Created January 23, 2015 22:00
Binding environment specific providers in Laravel 5
<?php namespace Farm\Providers;
use Illuminate\Support\ServiceProvider;
/**
* Class LocalServiceProviderProvider
*
* Service provider to allow us to register local environment specific providers (i.e. development dependencies).
*
* @package Farm\Providers
@johnhout
johnhout / setup_laravel.sh
Last active September 4, 2015 16:32
Laravel 5 quick install bash!
#!/bin/sh
# Laravel 5 new project setup bash script.
# Inspired by Mitchell van Wijngaarden
# Extended by John in 't Hout
projectname=$1
git clone -o laravel -b develop https://github.com/laravel/laravel.git ${projectname} >/dev/null
cd ${projectname}
git checkout --orphan master