Skip to content

Instantly share code, notes, and snippets.

@paulredmond
paulredmond / .zshrc
Last active Jul 12, 2021
Aliases to clear Laravel logs
View .zshrc
# Must run from the root of a Laravel app
alias clearlog="truncate -s 0 $PWD/storage/logs/laravel.log"
alias clearlogs="truncate -s 0 $PWD/storage/logs/*.log"
# Or using git rev-parse
alias clearlog="truncate -s 0 $(git rev-parse --show-toplevel)/storage/logs/laravel.log"
alias clearlogs="truncate -s 0 $(git rev-parse --show-toplevel)/storage/logs/*.log"
@paulredmond
paulredmond / .php_cs
Last active Mar 8, 2020
My PHP CS Fixer setup for Laravel
View .php_cs
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'phpdoc_indent' => true,
'binary_operator_spaces' => [
'operators' => ['=>' => null]
],
View .prettierrc.js
module.exports = {
semi: false,
singleQuote: true,
trailingComma: "es5",
tabWidth: 2,
}
@paulredmond
paulredmond / partial-mock-live-template.php
Created Jan 22, 2020
Laravel partialMock() live template for PhpStorm
View partial-mock-live-template.php
$this->partialMock($ABSTRACT$, function ($mock) {
/* @var \Mockery\MockInterface|\Mockery\LegacyMockInterface $mock */
$END$
});
@paulredmond
paulredmond / Dockerfile
Created Nov 26, 2019
Example of a Laravel multi-stage build
View Dockerfile
FROM composer:1.7 as vendor
COPY database/ database/
COPY composer.json composer.json
COPY composer.lock composer.lock
RUN composer install \
--ignore-platform-reqs \
--no-interaction \
@paulredmond
paulredmond / README.md
Created Nov 19, 2019 — forked from tomazzaman/README.md
Kill supervisor on Docker when any of the services fail
View README.md

Killing supervisor if any of it's child processes fail

The trick is to only register the listener for events that indicate failure, namely

  • PROCESS_STATE_STOPPED
  • PROCESS_STATE_EXITED
  • PROCESS_STATE_FATAL

Once they do, we should send a SIGQUIT to Supervisor.

@paulredmond
paulredmond / docker.conf
Last active Jun 9, 2021
Example www pool for PHP-FPM with dynamic Environment variables
View docker.conf
; if you're using the starter bundle file `docker/php/php-fpm.d/docker.conf`
[global]
daemonize = no
pid = run/php-fpm.pid
[www]
listen = /usr/local/var/run/php-fpm.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
View keybase.md

Keybase proof

I hereby claim:

  • I am paulredmond on github.
  • I am predmond (https://keybase.io/predmond) on keybase.
  • I have a public key ASB3-pszs0G8t6ewAOIPFlPHB2fAngS9jXWCk36UD3KoNAo

To claim this, I am signing this object:

@paulredmond
paulredmond / .php_cs.laravel.php
Created Jun 21, 2019 — forked from laravel-shift/.php_cs.laravel.php
PHP CS Fixer - Laravel Ruleset
View .php_cs.laravel.php
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'phpdoc_indent' => true,
'binary_operator_spaces' => [
'operators' => ['=>' => null]
],
@paulredmond
paulredmond / sublime-merge-cli.sh
Last active Sep 30, 2018
Put smerge in your path on OS X - Sublime Merge CLI
View sublime-merge-cli.sh
#!/usr/bin/env bash
ln -s /Applications/Sublime\ Merge.app/Contents/SharedSupport/bin/smerge /usr/local/bin/smerge