Skip to content

Instantly share code, notes, and snippets.


Keybase proof

I hereby claim:

  • I am mcfdn on github.
  • I am jamesmcfdn ( on keybase.
  • I have a public key ASDuqXYR4tjJ4cSKk-CknrYDmG_273tiNuxWGZihMBj5Pwo

To claim this, I am signing this object:

View juicy-custom.icls
<scheme name="Juicy - Custom" version="142" parent_scheme="Default">
<option name="FONT_SCALE" value="1.0" />
<property name="created">2018-05-24T15:35:34</property>
<property name="ide">PhpStorm</property>
<property name="ideVersion">2018.</property>
<property name="modified">2018-05-24T15:35:37</property>
<property name="originalScheme">Juicy - Custom</property>
<option name="LINE_SPACING" value="1.4" />
mcfdn / EventDispatchingCommandTester.php
Created January 4, 2018 09:22 — forked from peterjmit/EventDispatchingCommandTester.php
Console events are not dispatched in Symfony when using the CommandTester class shown in This class fixes that
View EventDispatchingCommandTester.php
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\ConsoleEvents;
use Symfony\Component\Console\Event\ConsoleCommandEvent;
use Symfony\Component\Console\Event\ConsoleExceptionEvent;
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputInterface;
mcfdn /
Last active December 22, 2016 10:59
Recursive PHP linter
if [[ -z $1 ]]
mcfdn / Multiple Deploy Keys in
Last active November 21, 2022 14:02
Using multiple GitHub deploy keys on a single server with a single user
View Multiple Deploy Keys in

Using multiple GitHub deploy keys on a single server with a single user

Within GitHub it is possible to set up two types of SSH key - account level SSH keys and and repository level SSH keys. These repository level SSH keys are known in GitHub as deploy keys.

Deploy keys are useful for deploying code because they do not rely on an individual user account, which is susceptible to change, to “store” the server keys.

There is, however, an ‘issue’ with using deploy keys; each key across all repositories on GitHub must be unique. No one key can be used more than once. This becomes a problem when deploying to repositories to the same server with the same user. If you create two keys, the SSH client will not know which key to use when connecting to GitHub.

One solution is to use an SSH config file to define which key to use in which situation. This isn’t as easy as it seems.. you might try something like this:

mcfdn / EntityManagerServiceProvider.php
Created August 15, 2016 16:37
Doctrine EntityManager Service Provider for Laravel 5.2
View EntityManagerServiceProvider.php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
class EntityManagerServiceProvider extends ServiceProvider
mcfdn / cli-config.php
Last active August 15, 2016 16:38
Doctrine ORM cli-config.php for Laravel 5.2
View cli-config.php
require __DIR__ . '/bootstrap/autoload.php';
$app = require_once __DIR__ . '/bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$entityManager = $app->make(Doctrine\ORM\EntityManager::class);
View gist:3f75fe6e3c6805079791
### Keybase proof
I hereby claim:
* I am jamesmcfadden on github.
* I am jamesmcfdn ( on keybase.
* I have a public key whose fingerprint is 5FF5 AA62 EEE1 B318 F0DB EB9C FE76 D65B 78A1 9EE3
To claim this, I am signing this object:
mcfdn / intervals.php
Last active December 20, 2015 10:18
date intervals for PHP < 5.3
View intervals.php
function intervals($start, $end = 'now')
$unixStart = strtotime($start);
$unixNow = strtotime($end);
$diff = $unixNow - $unixStart;
$days = (int) ($diff / 86400);
$hours = (int) ($diff / 3600);
$minutes = (int) ($diff / 60);
mcfdn / PasswordsMatch.php
Created April 29, 2013 14:39
Simple password confirmation validation using Zend_Validate
View PasswordsMatch.php
class App_Validate_PasswordsMatch extends Zend_Validate_Abstract
const PASSWORD_MISMATCH = 'passwordMismatch';
* The field name of the password
* @var string