This file contains 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 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 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 php@7.3 | |
brew services start php@7.4 | |
valet restart |
This file contains 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 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 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 | |
// *********************************************** | |
// |
This file contains 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( 'auth_cookie_expiration', function() { | |
return 31556926; // 1 year in seconds | |
} ); |
This file contains 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 | |
/* | |
* Plugin Name: Auto-Redirect Root-Level Posts | |
* Plugin URI: https://gist.github.com/wpscholar/d37736b1b9c2439acf2289364e210bc5 | |
* Description: Automatically redirects root level posts (e.g. /my-blog-post) to the new location (e.g. /blog/my-blog-post). Use anytime you update your post permalink structure from root-level to use a subdirectory prefix. | |
* Version: 1.0 | |
* Author: Micah Wood | |
* Author URI: https://wpscholar.com | |
* License: GPL2 |
This file contains 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
/** | |
* Convert a buffer to a stream | |
* | |
* @param binary Buffer | |
* @returns Readable | |
*/ | |
function bufferToStream(binary) { | |
return new Readable({ | |
read() { | |
this.push(binary); |
This file contains 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
/** | |
* Take a file and convert to a base64 encoded string. | |
* | |
* @param buffer A Buffer instance. | |
* @returns {string} A base64 encoded string. | |
*/ | |
function base64Encode(buffer) { | |
return new Buffer.from(buffer).toString('base64'); | |
} |