Skip to content

Instantly share code, notes, and snippets.

Aaron Collegeman collegeman

Block or report user

Report or block collegeman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@collegeman
collegeman / TicTacToe.php
Created Aug 12, 2019
Games are coming... XOXO. <3
View TicTacToe.php
<?php
namespace Games;
use Arcade;
use App\User;
use Games\Models\Game;
use Illuminate\Http\Request;
class TicTacToe extends Cabinet {
View schema-example.md

Database Schema

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

users

model: User
  • id: bigincrements
  • name: string
@collegeman
collegeman / rest-client.php
Last active Nov 22, 2017
Super basic magic method for creating REST API clients in PHP
View rest-client.php
<?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 https://github.com/rmccue/Requests
*/
abstract RestClient {
@collegeman
collegeman / bootstrap-nudges.css
Last active Nov 1, 2017
All of the spacing and some of the text alignment classes from Bootstrap
View bootstrap-nudges.css
/*!
* Bootstrap v4.0.0-beta (https://getbootstrap.com)
* Copyright 2011-2017 The Bootstrap Authors
* Copyright 2011-2017 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
.w-25 {
width: 25% !important;
}
@collegeman
collegeman / guide.md
Last active Aug 23, 2017
Running Laravel 5.4 on Cloud9
View guide.md

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
View php71-memcached.rb
require "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-php/Abstract/abstract-php-extension.rb"
class Php71Memcached < AbstractPhp71Extension
init
desc "Memcached via libmemcached library"
homepage "https://pecl.php.net/package/memcached"
head "https://github.com/php-memcached-dev/php-memcached.git", :branch => "php7"
option "with-sasl", "Build with sasl support"
@collegeman
collegeman / plugin.php
Created Dec 2, 2016
You can't use Laravel Facades in Illuminated WordPress Plugins
View plugin.php
<?php
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
collegeman / routes.php
Last active Dec 2, 2016
What routing looks like in an Illuminated WordPress Plugin
View routes.php
<?php
// 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
collegeman / plugin.php
Created Dec 2, 2016
A more powerful example of what you can do with an Illuminated WordPress Plugin
View plugin.php
<?php
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
{
/**
@collegeman
collegeman / plugin.php
Created Dec 2, 2016
A useless but illustrative example of what an Illuminated WordPress Plugin looks like
View plugin.php
<?php
namespace YourPlugin;
/**
* Your plugin inherits everything that a Laravel container can do.
* Like, querying a database, which is useless, but illustrative.
*/
class YourPlugin extends \FatPanda\Illuminate\WordPress\Plugin
{
/**
* This function is automatically discovered and hooked
You can’t perform that action at this time.