Skip to content

Instantly share code, notes, and snippets.

View pelmered's full-sized avatar
🎯
Focusing

Peter Elmered pelmered

🎯
Focusing
View GitHub Profile
@pelmered
pelmered / wp-config.php
Created February 27, 2017 20:56
Fix issues with symlinked wordpress
<?php
/**
* Fixes issues with symlinked wordpress
*/
if ( defined('ABSPATH') ) {
$fixed_abspath = str_replace( 'wordpress', 'public', ABSPATH );
define('WP_CONTENT_DIR', $fixed_abspath . 'wp-content');
define('WP_PLUGIN_DIR', $fixed_abspath . 'wp-content/plugins');
}
@pelmered
pelmered / wp-config.php
Created November 13, 2018 14:47
WordPress debug
<?php
// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );
// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );
// Disable display of errors and warnings
define( 'WP_DEBUG_DISPLAY', false );
#!/bin/sh
echo "committing as $(git config user.name) ($(git config user.email))",
STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php`
#STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep "app/.*\.php"`
PROJECT_PATH=`php -r "echo dirname(dirname(realpath('$0')));"`
VENDOR_BIN_DIR="${PROJECT_PATH}/vendor/bin/";
@pelmered
pelmered / BaseEnum.php
Last active June 16, 2020 12:22
Enum classes
<?php
namespace App\Enums;
use App\Rules\IsValidEnum;
use Illuminate\Support\Str;
abstract class BaseEnum
{
protected $name;
protected $values = array();
<?php
function incrementDeep(&$array, $value) {
$array += $value;
}
$test['foo']['bar']['test'] = 5;
incrementDeep($test['foo']['bar']['test'], 5);
incrementDeep($test['foo']['bar']['test2'], 5);