docker-machine config
docker \
-H=tcp://192.168.1.1:2376 \
--tlsverify \
# For production no filters will be applied | |
WP_ENV=development | |
WP_HOME=http://example.com | |
WP_SITEURL=${WP_HOME}/wp | |
# Should be defined for staging and development, has no effect for production | |
UPLOADS_URL='http://example.com/app/uploads' | |
# Should be defined for development, maybe skipped for staging if Bedrock used | |
UPLOADS_URL_STAGING='//stage.example.com/app/uploads' |
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider | |
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | |
# User-specific stuff | |
.idea/**/workspace.xml | |
.idea/**/tasks.xml | |
.idea/**/usage.statistics.xml | |
.idea/**/dictionaries | |
.idea/**/shelf |
<?php | |
class Custom_WP_Image_Editor_GD extends WP_Image_Editor_GD { | |
/** | |
* @param array $rgb | |
* | |
* @return false|resource | |
*/ | |
public function fill_background( $rgb ) { | |
$width = $this->size['width']; | |
$height = $this->size['height']; |
declare module 'react-load-script' { | |
import {Component} from 'react' | |
export interface ILoadScriptProps { | |
url: string | |
onCreate?: () => void | |
onError?: () => void | |
onLoad?: () => void | |
} |
document.addEventListener('click', function (e) { | |
if (e.target.hasAttribute('data-ga')) { | |
catchGaEvent(e) | |
} | |
}) | |
function catchGaEvent(e) { | |
var el = e.target | |
var event = el.getAttribute('data-ga'), |
<?php | |
// Found on https://wpforthewin.com/remove-hook-from-class-based-wp-plugin/ | |
/** | |
* Make sure the function does not exist before defining it | |
*/ | |
if (!function_exists('remove_class_filter')) { | |
/** | |
* Remove Class Filter Without Access to Class Object | |
* |
<?php | |
add_filter('woocommerce_shipping_chosen_method', function ($default, $rates = [], $chosen_method = null) { | |
$rates = $rates ? (array)$rates : []; | |
if ($chosen_method and isset($rates[(string)$chosen_method])) { | |
return $chosen_method; | |
} | |
return $default; | |
}, 10, 3); |
<?php | |
$file_path = $argv[1] ?? null; | |
$file_path_abs = ''; | |
if (!$file_path) { | |
throw new \Error('No file Path arg provided'); | |
} | |
if (is_readable($file_path)) { | |
$file_path_abs = $file_path; |
<?php | |
/** | |
* Usage | |
* bem-block-rename.php ./templates/ .renaming-block-name .destination-block-name # will change every `.blade.php` in directory | |
* bem-block-rename.php .renaming-block--with-mod .dest-block--with-renamed-mode # will change every `.blade.php` in CWD directory | |
* bem-block-rename.php specified-file.php .renaming-block-name__child .destination-block-name__renamed-child # will change only `specified-file.php` | |
*/ | |
namespace BemClassesTools; |