Skip to content

Instantly share code, notes, and snippets.

View morganestes's full-sized avatar

Morgan Estes morganestes

View GitHub Profile
@jeffersonmartin
jeffersonmartin / composer-private-package-github-token.md
Last active September 18, 2025 14:41
Generate a GitHub Personal Access Token for Private Composer Packages

Generate a GitHub Personal Access Token for Private Composer Packages

If you're trying to load a private repository with Composer/Laravel, we'll need to generate a GitHub Personal Access Token (similar to OAuth token) to access the repository during a composer install without entering credentials.

If you have used other Github packages from {my-org} before, you may be able to skip this step.

  1. Visit https://github.com/settings/tokens.

  2. Click Generate new token.

@mihow
mihow / load_dotenv.sh
Last active November 21, 2025 08:36
Load environment variables from dotenv / .env file in Bash
# The initial version
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi
# My favorite from the comments. Thanks @richarddewit & others!
set -a && source .env && set +a
@ashleyfae
ashleyfae / olark-in-wp.php
Created April 27, 2016 17:19
Integrates Olark with WordPress and Easy Digital Downloads by displaying user information.
<?php
/*
* Plugin Name: Olark In WP
* Plugin URI: https://www.nosegraze.com
* Description: Integrates Olark with WordPress and Easy Digital Downloads by displaying user information.
* Version: 1.0
* Author: Nose Graze
* Author URI: https://www.nosegraze.com
* License: GPL2
*
@danielbachhuber
danielbachhuber / cache-purge.php
Created February 22, 2016 17:34
Trigger Varnish cache purge on deploy to WP Engine
<?php
add_action( 'init', function(){
// Replace '901bcc678021c0e12f1583085cafda1d' with a secret of your own.
if ( ! empty( $_GET['purge-cache'] ) && '901bcc678021c0e12f1583085cafda1d' === $_GET['purge-cache'] ) {
WpeCommon::purge_varnish_cache_all();
echo 'Cache purged';
exit;
}
});
// paste in your console
speechSynthesis.onvoiceschanged = function() {
var msg = new SpeechSynthesisUtterance();
msg.voice = this.getVoices().filter(v => v.name == 'Cellos')[0];
msg.text = Object.keys(window).join(' ');
this.speak(msg);
};
@rtvenge
rtvenge / createSSHKey.sh
Created September 2, 2015 17:46
Create an SSH shortcut and key shell script.
#!/bin/bash
echo "Please enter username on server: "
read USER
echo "Please enter server host or IP address (ex: opticllc.com)"
read SERVER_HOST
echo "Please enter server name (aka ssh shortcut)"
read SERVER_NAME
@joshlevinson
joshlevinson / .bash_profile
Last active April 21, 2023 12:04
WP CLI + Xdebug
# Add this to /config/bash_profile
function wpd {
export XDEBUG_CONFIG="idekey=VVVDEBUG remote_connect_back=1"
wp "$@"
unset XDEBUG_CONFIG
};
# Run these commands:
# vagrant ssh
# sudo cp /srv/config/bash_profile /home/vagrant/.bash_profile
# source ~/.bash_profile
@tammyhart
tammyhart / traverse_results.php
Last active September 5, 2024 01:51
Traverse WordPress Search Results
<?php
/**
* Return search array
*/
function loopconf_search_array( $search_hash ) {
// check for existence of unique transient
if ( false === ( $search_array = get_transient( 'loopconf_search_' . $search_hash ) ) ) {
global $wpdb;
@TheHiddenHaku
TheHiddenHaku / console_log.php
Last active August 29, 2015 14:06
PHP - Function to log data in javascript console
<?php
//UTILITY TO CONSOLE LOG DEBUG OUTPUT
function console_log($data, $table = 0) {
$verb = $table ? 'table' : 'log';
if(is_array($data) || is_object($data)) {
echo "<script>console.".$verb."(".json_encode($data).");</script>" ;
} else {
echo "<script>console.".$verb."(".$data.");</script>" ;
}
}