Skip to content

Instantly share code, notes, and snippets.

Avatar

Corey Ballou cballou

View GitHub Profile
View blockstack-verification
Verifying my Blockstack ID is secured with the address 1fo4sVGAUxsB22mMK1xFAFQCdb7YUcSvh https://explorer.blockstack.org/address/1fo4sVGAUxsB22mMK1xFAFQCdb7YUcSvh
View keybase.md

Keybase proof

I hereby claim:

  • I am cballou on github.
  • I am coreyballou (https://keybase.io/coreyballou) on keybase.
  • I have a public key ASBMvS6f_1MLwT-AgL2aCt9z2y7BS-TyRw6z9AHwOvd24Ao

To claim this, I am signing this object:

View corey.id
Verifying that "corey.id" is my Blockstack ID. https://onename.com/corey
@cballou
cballou / laravel-global-exception-handler.php
Last active Sep 12, 2021
Global handling of Laravel exceptions to better support AJAX requests.
View laravel-global-exception-handler.php
<?php namespace App\Exceptions;
use Log;
use Mail;
use Config;
use Exception;
use Illuminate\Auth\Access\UnauthorizedException;
use Illuminate\Session\TokenMismatchException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
@cballou
cballou / mcrypt-pad-aes.php
Created Jun 5, 2017
Mcrypt helper function for padding AES encryption keys to ensure PHP 5.6-7.1 is backwards compatible with PHP <= 5.5.
View mcrypt-pad-aes.php
<?php
/**
* Pad an AES encrypted key to ensure it's of valid size according
* to specification. This function is backwards compatible with
* PHP <= 5.5 and is intended for usage with PHP 5.6+.
*/
function pad_aes($str) {
$c = strlen($str);
$validLengths = array(16, 24, 32);
foreach ($validLengths as $l) {
@cballou
cballou / example-config.php
Created Mar 9, 2017
Watchdog is a PHP library using inotify to watch for file changes.
View example-config.php
<?php
return array(
'types' => array('sass', 'scss', 'less', 'styl', 'jade', 'haml'),
'watch' => array(
'/path/to/public/css',
'/path/to/alternate/css'
),
'minify' => true,
'ignore' => array()
@cballou
cballou / config-template-example.php
Last active Mar 9, 2017
Example of using Winston, a PHP AB/split testing library which utilizes machine learning and Redis.
View config-template-example.php
<?php
$config = array(
'tests' => array(
'signup-submit-button-test' => array(
'description' => 'A sample test',
'variations' => array(
array(
'id' => 'submit-default',
'text' => '<button type="submit" {{click}}>Submit</button>'
),
@cballou
cballou / client-usage.php
Last active Mar 8, 2017
Documentation regarding GoogleAuthenticatorRedux. Official documentation of the library can be found at https://www.craftblue.com/projects/php/google-authenticator-2fa
View client-usage.php
<?php
// if you are using composer, which is the preferred method of autoloading
require_once('./vendor/autoload.php');
// create a new secret for a user wishing to enable 2FA
// you will need to store this securely
$secret = $ga->createSecret();
// example of generating a QR code to display to the end user
View mongosession-advanced-usage.php
<?php
require_once('MongoSession.php');
// the config array for loading MongoDB servers
$config = array(
// cookie related vars
'cookie_path' => '/',
'cookie_domain' => '.mydomain.com', // .mydomain.com
// session related vars
@cballou
cballou / jQuery-Double-Rainbow-Plugin-default-configuration-options.js
Created May 18, 2016
An example of using the jQuery Double Rainbow plugin.
View jQuery-Double-Rainbow-Plugin-default-configuration-options.js
$.fn.doubleRainbow.defaults = {
startDistance: 500,
steps: 20,
startBgColor: '#333333',
endBgColor: '#999999',
startColor: '#CCCCCC',
endColor: '#FFFFFF'
};