Skip to content

Instantly share code, notes, and snippets.

@conroyp
conroyp / func_get_args_with_defaults.php
Created January 6, 2020 11:57
func_get_args extended to include default parameters
if (!function_exists('func_get_args_with_defaults')) {
/**
* Get all function arguments, including defaults.
* An issue with func_get_args is that it doesn't include default
* values. This leads to cases where we'd expect cache re-use, but are
* seeing cache misses, e.g:
* $foo->getStuff('category');
* $foo->getStuff('category', 1, 100);
*
* function getStuff($type, $page = 1, $limit = 100)

Keybase proof

I hereby claim:

  • I am conroyp on github.
  • I am conroyp (https://keybase.io/conroyp) on keybase.
  • I have a public key ASBSclhEQMB0Kt_xETZptJOdvEewMF3uizuuQzRY6KnptQo

To claim this, I am signing this object:

@conroyp
conroyp / Vagrantfile Mailcatcher install
Created August 30, 2014 13:13
Vagrantfile update to install mailcatcher
config.vm.provision "shell", path: "relative/path/to/setup_mailcatcher.sh”
@conroyp
conroyp / Mailcatcher install
Created August 30, 2014 13:12
Install Mailcatcher
#!/bin/bash
# Get Mailcatcher setup commands from gist and apply them
curl https://gist.githubusercontent.com/conroyp/741c30c44f5295f41422/raw/f86ee70bede0748292c3a21d34ab23da1696a0dc/setup_mailcatcher.sh | bash
@conroyp
conroyp / Laravel Mailcatcher config
Last active January 9, 2019 15:21
Laravel mail config for use with Mailcatcher
<?php
return [
‘driver’ => ‘smtp’,
'host' => '127.0.0.1',
'port' => 1025,
'username' => '',
'password' => '',
‘encryption’ => false,
‘from’ => [
‘address’ => ‘testaddress@example.com’,
@conroyp
conroyp / setup_mailcatcher.sh
Created August 23, 2014 17:31
Mailcatcher installation script for Ubuntu 14.04
#!/bin/bash
# Install dependencies
apt-get install libsqlite3-dev ruby1.9.1-dev
# Install the gem
gem install mailcatcher
# Make it start on boot
echo "@reboot $(which mailcatcher) --ip=0.0.0.0" >> /etc/crontab
update-rc.d cron defaults