Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View phpguru's full-sized avatar

Geoffrey Hoffman phpguru

View GitHub Profile
@phpguru
phpguru / strange-if-then-spacing.php
Last active December 23, 2022 19:25
PHP Old-school formatting in 10-year-old legacy project
<?php
if ($a = 1)
{
$code = 'here';
function('call','there');
alignment('true');
}
else if ($b = 2)
{
@phpguru
phpguru / docker-compose.yml
Created June 22, 2020 04:27
Here is my docker-compose.yml for doing local development with Nginx, PHP-FPM, MySQL, Redis, ElasticSearch & Kibana
version: "3"
services:
db:
container_name: db
image: db:latest
environment:
- MYSQL_ROOT_PASSWORD=REDACTED
- APP=db
ports:
- "3306:3306"
@phpguru
phpguru / docker_shortcuts.sh
Last active June 22, 2020 04:21
Paste or link these into your ~/.bash_profile
######################################################
# Docker Shortcuts
# Maintainer geoffrey.hoffman@gmail.com
######################################################
# Load these into your bash profile, e.g. add
# source ~/.docker_shortcuts.sh
# to ~/.bash_profile
echo "docker shortcuts loaded"
@phpguru
phpguru / salt-call-output.log
Created November 4, 2018 23:12
Output of salt-call state.show_highstate
root@saltmaster:/srv/salt# salt-call state.show_highstate
local:
----------
psmisc:
----------
pkg:
- installed
|_
----------
order:
@phpguru
phpguru / state-apply-terminal-output.log
Last active November 3, 2018 23:15
Strange output from state.apply test=True
root@saltmaster:/srv# salt 'api*' state.apply test=True
dev-server.on-my.network:
----------
ID: /etc/hosts
Function: file.comment
Result: None
Comment: File /etc/hosts is set to be updated
Started: 16:09:10.954681
Duration: 8.716 ms
Changes:
@phpguru
phpguru / duplicate_music_fixer.php
Last active July 6, 2018 18:26
PHP Script to find and delete duplicate mp3 files
<?php
/**
* This script will search in your iTunes Music folder for duplicate
* mp3 and aac files, and print them out for inspection.
*
* HOW TO USE:
* Do a dry run, inspect the output, and if desired, do a delete run.
*
* To do a dry run:
*
@phpguru
phpguru / r10ku.sh
Last active August 29, 2015 14:06
Force update a specific puppet environment using r10k with clearing cache
#!/bin/bash
#
# Update a specific puppet environment, typically a git branch `featurename`
# or one of your deployment environments, typically `development` or `production`
#
# Save the script as r10ku somewhere in your $PATH and chmod +x it
#
# example usage:
#
# > sudo su -
<?php
class Environment {
/**
* Current environment
*
* @var string
*/
static protected $env;
<?php
/**
* TODO: Add support for namespaces... If we ever move to PHP 5.3+
*/
class Autoload {
/**
* Class directories
*
<?php
class Input {
/**
* Protocol (http or https)
*
* @return string
*/
static public function protocol() {