Skip to content

Instantly share code, notes, and snippets.

View paulredmond's full-sized avatar
🏴‍☠️

Paul Redmond paulredmond

🏴‍☠️
View GitHub Profile
@paulredmond
paulredmond / linux-setup.sh
Created May 29, 2024 02:35 — forked from dhh/linux-setup.sh
linux-setup.sh
# Libraries and infrastructure
sudo apt update -y
sudo apt install -y \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev mupdf mupdf-tools \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils
function itemsSort(items) {
// Write your code here
const countObj = items.reduce((rlt, val) => {
if (val in rlt) {
rlt[val]++
} else {
rlt[val] = 1
}
return rlt;
}, {})
@paulredmond
paulredmond / .zshrc
Last active July 12, 2021 17:22
Aliases to clear Laravel logs
# 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 March 8, 2020 00:35
My PHP CS Fixer setup for Laravel
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'phpdoc_indent' => true,
'binary_operator_spaces' => [
'operators' => ['=>' => null]
],
@paulredmond
paulredmond / .prettierrc.js
Created January 26, 2020 02:12
My prettier setup
module.exports = {
semi: false,
singleQuote: true,
trailingComma: "es5",
tabWidth: 2,
}
@paulredmond
paulredmond / partial-mock-live-template.php
Created January 22, 2020 17:53
Laravel partialMock() live template for PhpStorm
$this->partialMock($ABSTRACT$, function ($mock) {
/* @var \Mockery\MockInterface|\Mockery\LegacyMockInterface $mock */
$END$
});
@paulredmond
paulredmond / Dockerfile
Created November 26, 2019 17:17
Example of a Laravel multi-stage build
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 November 19, 2019 20:27 — forked from tomazzaman/README.md
Kill supervisor on Docker when any of the services fail

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 May 6, 2024 15:38
Example www pool for PHP-FPM with dynamic Environment variables
; 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

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: