Skip to content

Instantly share code, notes, and snippets.

Corey McMahon coreymcmahon

Block or report user

Report or block coreymcmahon

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
coreymcmahon / logging.php
Created Apr 23, 2019
Example logging configuration for Laravel, going to stdout.
View logging.php
return [
'default' => env('LOG_CHANNEL', 'stack'),
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
coreymcmahon / docker-compose.yml
Created Apr 23, 2019
Example Docker Compose file for a Laravel application.
View docker-compose.yml
version: '3.7'
# foodkit php api
context: ./docker/app
dockerfile: Dockerfile
init: true
coreymcmahon / CleanTempCommand.php
Last active Apr 28, 2019
Demonstration of a Laravel console command.
View CleanTempCommand.php
namespace App;
use Illuminate\Console\Command;
class CleanTempCommand extends Command
protected $signature = "app:clean-temp";
coreymcmahon / CleanTempCommand.php
Created Apr 18, 2019
Demonstration of a Symfony console command.
View CleanTempCommand.php
namespace App;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class CleanTempCommand extends Command
coreymcmahon / product.json
Created Aug 18, 2018
Frontend interviewee technical task - Test data
View product.json
"id": 14557,
"name": "Flat White",
"price": 125,
"before_sale_price": null,
"description": "Freshly-ground beans and steamed milk",
"full_description": "Freshly-ground beans and steamed milk",
"order": 1,
"category": {
"id": 1727,
coreymcmahon /
Created Oct 31, 2017
Colorize Nginx access log
#!/usr/bin/env bash
tail -f /var/log/nginx/access.log | awk '
/" 2/ {print "\033[32m" $0 "\033[39m"; next;}
/" 3/ {print "\033[37m" $0 "\033[39m"; next;}
/" 4/ {print "\033[33m" $0 "\033[39m"; next;}
/" 5/ {print "\033[31m" $0 "\033[39m"}
coreymcmahon / LaravelMeetupLottery.php
Created Sep 21, 2016
Script to randomly select an attendee from the Laravel Bangkok meet up event.
View LaravelMeetupLottery.php
$attendees = [
// insert attendee list here
$winnerIndex = random_int(0, count($attendees)-1);
$winner = $attendees[$winnerIndex];
echo "\n\n";
View debounce.js
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
coreymcmahon / explode_resource.php
Last active Sep 1, 2016
Explode a resource identifier into its component parts
View explode_resource.php
* Parses resource identifiers of the format:
* RESOURCE=s3://username:password@domain/resource
if ($resource = getenv('RESOURCE')) {
// strip off the namespace, assume it's not needed (e.g 's3', 'mysql')
$identifier = explode('://', $resource)[1];
coreymcmahon / index.html
Created May 29, 2015
Typical HTML component of a Single Page App (SPA) -
View index.html
<!doctype html>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>My Web App</title>
<div id="react-app"></div>
<script src="/js/bundle.js"></script>
You can’t perform that action at this time.