This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$cache_key = 'my_api_call_response'; | |
$response = get_transient( $cache_key ); | |
if ( ! $response ) { | |
$response = wp_remote_get('https://example.com/api/v1/endpoint'); | |
$status_code = (int) wp_remote_retrieve_response_code( $response ); | |
$body = wp_remote_retrieve_body( $response ); | |
$data = json_decode( $body, true ); | |
if ( 200 === $status_code && $data ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Post Content Shortcode | |
* | |
* @package PostContentShortcode | |
* @author Micah Wood | |
* @copyright Copyright 2020 by Micah Wood - All rights reserved. | |
* @license GPL2.0-or-later | |
* | |
* @wordpress-plugin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( | |
'site_transient_update_plugins', | |
function ( $transient ) { | |
$plugins = array( | |
'wordpress-seo/wp-seo.php', | |
); | |
foreach ( $plugins as $plugin ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$place = Stellar_Places::get_place_object( get_post() ); | |
$nearby = Stellar_Places::get_places( | |
array( | |
'post__not_in' => array( get_the_ID() ), | |
'geo_query' => array( | |
'lat' => $place->latitude, | |
'lng' => $place->longitude, | |
'distance' => 1, | |
), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use homebrew to switch PHP versions, run this command for each version as needed: | |
pecl install xdebug |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Output the access log | |
cat access.log | |
# Run the results through grep to find any 500 status codes | |
cat access.log | grep "[: ]500[: ]" | |
# Find any non 200 status codes | |
cat access.log | grep -v "[: ]200[: ]" | |
# Find multiple status codes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew services stop [email protected] | |
brew services start [email protected] | |
valet restart |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DATABASE <name>; | |
GRANT ALL PRIVILEGES ON <name>.* TO "<user>"@"localhost"; | |
FLUSH PRIVILEGES; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew install mysql | |
brew services start mysql | |
# Set password to be 'root' for the root user | |
$(brew --prefix mysql)/bin/mysqladmin -u root password root |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// *********************************************** | |
// This example commands.js shows you how to | |
// create various custom commands and overwrite | |
// existing commands. | |
// | |
// For more comprehensive examples of custom | |
// commands please read more here: | |
// https://on.cypress.io/custom-commands | |
// *********************************************** | |
// |