Skip to content

Instantly share code, notes, and snippets.

View topdown's full-sized avatar
🎯
Focusing

Jeff Behnke topdown

🎯
Focusing
View GitHub Profile
@topdown
topdown / php-dyld.md
Created March 7, 2019 15:04 — forked from hgrimelid/php-dyld.md
php: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.61.dylib

After upgrading to Node v.10.9.0 via Homebrew the following error message was thrown from PHP:

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.61.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found

Reinstall PHP to fix, for me that's:

@topdown
topdown / Git push deployment in 7 easy steps.md
Created February 22, 2017 00:51 — forked from thomasfr/Git push deployment in 7 easy steps.md
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@topdown
topdown / WP_DEBUG.php
Created January 7, 2017 16:06
For public debugging logs to file in wp_content
//For public debugging logs to file in wp_content
//add the following to your wp-config.php by the bottom of the file where is says /* That's all, stop editing! Happy blogging. */
define('WP_DEBUG', true);
define('WP_DEBUG_DISPLAY', false);
define('WP_DEBUG_LOG', true);
define('SCRIPT_DEBUG', true);
define('JETPACK_DEV_DEBUG', true);
define( 'SAVEQUERIES', true );
@topdown
topdown / contact-form-7-url-filter.php
Last active December 25, 2016 20:52
Using contact form 7 action url filter
<?php
add_filter('wpcf7_form_action_url', 'wpcf7_custom_form_action_url');
function wpcf7_custom_form_action_url($url) {
global $post;
// Change the value of $id_to_change to the post id where the form is
$id_to_change = 1;
@topdown
topdown / display-rewrites.php
Created October 25, 2016 23:38
For debugging WP rewrite rules
<?php
function jb_show_rewrite_rules() {
$rules = get_option('rewrite_rules');
$n = 0;
$html = '<table><tr><th style="width: 5%;">#</th><th style="width: 35%;">Key</th><th style="width: 60%;">Rule</th></tr>';
foreach ( $rules as $key => $value ) {
$html .= '<tr><td>' . ++$n . '</td><td>' . $key . '</td><td>' . $value . '</td></tr>';
} // end foreach
@topdown
topdown / disable-heartbeat.php
Created September 17, 2016 03:56
Disable WP heartbeat
<?php
// Also available in a plugin
// https://wordpress.org/plugins/heartbeat-control/
add_action( 'init', 'stop_heartbeat', 1 );
function stop_heartbeat() {
wp_deregister_script('heartbeat');
}
@topdown
topdown / provision-custom.sh
Created August 5, 2016 18:56
This file is a custom provision script for VVV that skips all updates and update checks
#!/bin/bash
#
# provision.sh
#
# Customized by Jeff Behnke @topdown on GitHub
#
# This file is a custom provision script for VVV that skips all updates and update checks
# It only does the absolute tasks that I know are needed for vagrant up, vagrant reload, vagrant provision and vv create
# It currently runs vagrant provision tasks in roughly 8 secs.
# You should be using VV for creating sites, then replace its custom-provision.sh with this one once you have a working VVV system.
@topdown
topdown / wp-bin-example.php
Last active July 10, 2016 18:38
Load WordPress hooks, filters and APIs in a bin file for processing forms and other data
<?php
// Don't load theme data IE css and other features
define( 'WP_USE_THEMES', false );
/*
* Loads the WordPress Environment and Template
* Change PATH_TO_WP to the path of the following file
*/
require( 'PATH_TO_WP/wp-blog-header.php' );
@topdown
topdown / cron.php
Last active July 1, 2016 16:33
Custom cron script for WP
<?php
// This code can go anywhere as long as its loaded by a plugin or theme
// setup the schedual
if ( ! wp_next_scheduled( 'my_task_hook' ) ) {
wp_schedule_event( time(), 'hourly', 'my_task_hook' );
}
add_action( 'my_task_hook', 'my_task_function' );
@topdown
topdown / fix-commands.sh
Last active June 6, 2016 14:47
VVV Issues
# Not saying this is a fix all, but this is what I had to do to get VVV running properly on my system.
# It failed to install properly do to script errors
# Branch master
# head 7f5411455573bba88d8ce232db957c62b11977f5
# VVV Update issues
vagrant ssh
su
#pass