Skip to content

Instantly share code, notes, and snippets.

View collegeman's full-sized avatar

Aaron Collegeman collegeman

View GitHub Profile
collegeman / HttpBinClient.php
Last active January 2, 2020 18:28
Using a trait to add an API client to any PHP class
namespace Tests\Feature;
use App\Concerns\MakesRequests;
class HttpBinClient
use MakesRequests;
protected $config = [
collegeman / TicTacToe.php
Created August 12, 2019 19:52
Games are coming... XOXO. <3
namespace Games;
use Arcade;
use App\User;
use Games\Models\Game;
use Illuminate\Http\Request;
class TicTacToe extends Cabinet {

Database Schema

Keep this simple document up-to-date with any schema changes.


model: User
  • id: bigincrements
  • name: string
collegeman / rest-client.php
Last active November 22, 2017 14:54
Super basic magic method for creating REST API clients in PHP
use Requests;
* Instances of this class can be invoked with any of the HTTP request
* method names (get, post, put, delete, head, etc.), and doing so builds
* and invokes a request using the Requests library.
* @see
abstract RestClient {
collegeman / bootstrap-nudges.css
Last active November 1, 2017 13:27
All of the spacing and some of the text alignment classes from Bootstrap
* Bootstrap v4.0.0-beta (
* Copyright 2011-2017 The Bootstrap Authors
* Copyright 2011-2017 Twitter, Inc.
* Licensed under MIT (
.w-25 {
width: 25% !important;
collegeman /
Last active August 23, 2017 17:32
Running Laravel 5.4 on Cloud9

Beginning with a baseline PHP workspace (LAMP).

Install PHP 7.1

From Cloud9's support forums:

$ sudo add-apt-repository ppa:ondrej/php -y
$ sudo apt-get update -y
$ sudo apt-get install php7.1-curl php7.1-dev php7.1-gd php7.1-intl php7.1-mcrypt php7.1-json php7.1-mysql php7.1-opcache php7.1-bcmath php7.1-mbstring php7.1-soap php7.1-xml
collegeman / php71-memcached.rb
Last active January 11, 2017 18:37
Is this legit?
require "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-php/Abstract/abstract-php-extension.rb"
class Php71Memcached < AbstractPhp71Extension
desc "Memcached via libmemcached library"
homepage ""
head "", :branch => "php7"
option "with-sasl", "Build with sasl support"
collegeman / plugin.php
Created December 2, 2016 22:05
You can't use Laravel Facades in Illuminated WordPress Plugins
namespace YourPlugin;
class YourPlugin extends \FatPanda\Illuminate\WordPress\Plugin
* You can't use the DB Facade, even though this would be syntactically
* valid in Laravel—the reason is that unlike in a Laravel App, in
* WordPress, there's potentially more than one Container per request—
* so the Facades can't know which Container they should ask to get
collegeman / routes.php
Last active December 2, 2016 20:01
What routing looks like in an Illuminated WordPress Plugin
// in your plugin's src/routes.php file
$router->rewrite('/some/arbitrary/url/{slug}', function($slug) {
// you can do anything here
update_option('option_name', $slug);
// if you return false, the request is over
//return false;
// if you return a string, WordPress will try to load a template by that name
return 'my-custom-template';
collegeman / plugin.php
Created December 2, 2016 19:36
A more powerful example of what you can do with an Illuminated WordPress Plugin
namespace YourPlugin;
use YourPlugin\Notifications\PostSaved;
* Your plugin inherits everything that a Laravel container can do.
* Like, sending messages on Slack using Laravel's Notification framework.
class YourPlugin extends \FatPanda\Illuminate\WordPress\Plugin