Skip to content

Instantly share code, notes, and snippets.

View morganestes's full-sized avatar

Morgan Estes morganestes

View GitHub Profile
@morganestes
morganestes / proof.md
Created February 19, 2024 13:59
Keyoxide proof

$argon2id$v=19$m=8192,t=2,p=4$slDRAy6SRi2oLOxmGNd0Ag$YAo/C4HiBEjuJGbK0GB4vAkDSaE3WMF0

@morganestes
morganestes / wp-config-lando.php
Last active November 27, 2023 17:35
Sets WP constants in Lando sites
<?php
/**
* Sets WP_HOME and WP_SITEURL based on environment settings.
*
* @return void
*/
/**
* Sets WP_HOME and WP_SITEURL based on environment settings.
*
* @return void
@morganestes
morganestes / .lando.dist.yml
Last active March 6, 2023 16:11
Bash script to update a local user's password for local development with Lando.
---
# Separate from .env.local and .env.pantheon used by Roots, these are added to the lando containers.
# See https://docs.lando.dev/core/v3/env.html#environment-files
env_file:
- .env.lando
tooling:
update-user:
description: Adds/updates a local WP user account used for local administration.
service: appserver
@morganestes
morganestes / panrestore.sh
Last active April 19, 2022 21:42
Restore all backups on Pantheon
#!/usr/bin/env bash
##
# Generates the site.env from a Pantheon site URL.
##
function getPantheonSiteEnv() {
if [[ "${1}" == *"pantheonsite.io"* ]]; then
./pantheon-sitename.sh "${1}"
else
printf "Could not convert %s to a site.env" "${1}"
@morganestes
morganestes / link_docker_completions.sh
Last active December 2, 2020 18:26
Enable Docker.app completions in zsh, bash, or fish shells on macOS.
@morganestes
morganestes / download_slack_files.sh
Last active June 3, 2022 21:24
Download files uploaded to a Slack instance using data from a Slack JSON export file.
#!/bin/bash
#
# Parses Slack JSON exports for files and downloads them.
#
# Requires 'jq' (https://stedolan.github.io/jq/) and 'httpie' (https://httpie.org/).
#
##
# Checks for a single dependency.
#
@morganestes
morganestes / new_shell_script.sh
Created August 28, 2020 00:16
bash script to create a new shell script or library
#!/bin/bash
# Creates a new shell script or library
#
# Libraries should have a .sh file extension and ARE NOT executable.
# Commands should have no file extension and ARE executable by default.
function new_shell_script() {
local file="${1:-"my_new_script"}"
local filename
local extension
@morganestes
morganestes / search-toggle.js
Created August 18, 2020 15:44
Example of toggling visibility and focus on a search element
/**
* This script adds the jquery effects to the Navigation Pro Theme.
*
* @package Navigation\JS
* @author StudioPress
* @license GPL-2.0-or-later
*/
( function( $ ) {
// Cache DOM selectors.
@morganestes
morganestes / filter-editor-plugin-settings.js
Last active August 12, 2020 20:39
Exmple of how to extend Gutenberg with JS hooks
import { applyFilters, addFilter } from "@wordpress/hooks";
addFilter('plugins.registerPlugin', 'bigwing/editor-sidebar', (settings, name) => {
console.log(settings, name);
if ('bigwing-editor-sidebar' !== name) {
return settings;
}
console.log(settings);
if (settings.hasOwnProperty('icon')) {
@morganestes
morganestes / post-compare.sql
Created July 16, 2020 15:53
Compare post content in WordPress with MySQL
# Using the "Bind parameters" option gives you two input fields to enter the post IDs.
SET @p1 = (SELECT `post_content` FROM `wp_posts` WHERE `ID`=:post_id1);
SET @p2 = (SELECT `post_content` FROM `wp_posts` WHERE `ID`=:post_id2);
# https://dev.mysql.com/doc/refman/5.7/en/string-comparison-functions.html
SELECT STRCMP(@p1,@p2);