Skip to content

Instantly share code, notes, and snippets.

View stephensabatini's full-sized avatar
🏔️
“Even the smallest person can change the course of the future.” – Galadriel

Stephen Sabatini stephensabatini

🏔️
“Even the smallest person can change the course of the future.” – Galadriel
View GitHub Profile
@stephensabatini
stephensabatini / filter-post-type.php
Created November 10, 2020 00:04
Filter by post type.
<?php
/**
* Add post type filter support for search.
*
* @param array $query
*
* @since 1.0.0
*/
public function filter_post_type( $query ) {
@stephensabatini
stephensabatini / Folder alias in Windows Powershell
Created November 11, 2021 18:24
Creates a folder alias in Windows for codebases that don't follow normal architecture practices.
cmd /c mklink /J .\app\public\ .\code\wordpress\
@stephensabatini
stephensabatini / sshkey.sh
Created January 28, 2022 02:35
Macro for copying SSH key to clipboard and outputting to console for those who don't support pbcopy. Add to your .bashrc or .zshrc.
sshkey () {
local file="$HOME/.ssh/id_rsa.pub"
if [ -n "$file" ] ; then # If the file exists.
cat "$file"
if pbcopy < "$file" ; then # If the text successfully copied to the clipboard.
tput setaf 2 # Set text color to green.
echo "SSH key copied to clipboard."
else
tput setaf 1 # Set text color to red.
echo "SSH key failed to copy to clipboard but you can manually copy it above."
@stephensabatini
stephensabatini / Error logging and viewing in PHP for MAMP.md
Last active March 16, 2023 15:46
Error logging and viewing in PHP for MAMP

PHP Example:

<?php error_log( print_r( $thing, true ) ); ?>

CLI Example:

tail -f /Applications/MAMP/logs/php_error.log