Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Jangl chrisjangl

  • Wine Enthusiast, Digitally Cultured
  • NY
View GitHub Profile
@chrisjangl
chrisjangl / setMealSize.js
Created Sep 17, 2022
[WP Pizza] Change all ingredients to a specific meal size when on the WP Pizza Ingredients page, Ingredients tab
View setMealSize.js
// set this to the ID of the meal size
var mealSize = "";
// get a node list of all the ingredients on the page
var ingredients = document.querySelectorAll('.wppizza_ingr_option.wppizza_option');
// and then loop through each one, setting the meal size
ingredients.forEach(function(ingredient){
let dropdown = ingredient.querySelector('select.ingredients');
dropdown.value = mealSize;
@chrisjangl
chrisjangl / createStripeInvoice.sh
Created Apr 11, 2022
First attempts to create a Stripe invoice using the Stripe CLI
View createStripeInvoice.sh
INVOICE_ID=""
CUSTOMER_ID=""
FOOTER=""
DESCRIPTION=""
stripe invoices create --customer=${CUSTOMER_ID} --days-until-due=1 --footer=\"${FOOTER}\" --collection-method=\"send_invoice\" -d \"metadata[invoice]\"=${ID} --description="${DESCRIPTION}"
@chrisjangl
chrisjangl / toggl_daily_report.php
Created Jan 12, 2022
List the projects and items worked on today (by default) for a given workspace in Toggl.
View toggl_daily_report.php
<?php
/**
* some config variables
*/
/**
* User Agent value
*
* app name or email address
*
@chrisjangl
chrisjangl / scrape-FSA-deductions.js
Last active Jan 3, 2022
Scrape the FSA contributions deducted from each paycheck in a given year. Must be on the pay stubs list and have selected a year. Custom built for pay stubs in PayCom.
View scrape-FSA-deductions.js
// get all rows that we're interested in (each represent 1 paycheck)
let rows = document.getElementById('check-listings-table').querySelectorAll('tbody tr[role="row"]');
// instantiate the array we'll use for all contributions
var contributions = [];
// loop over each row
for (var i = 0; i < rows.length; i++) {
// we never actually use this...
let row = rows[i];
@chrisjangl
chrisjangl / wp_version_report.sh
Created Nov 24, 2021
Working from a list of WordPress sites on a shared hosting environment (sites.txt), create a report of each sites WordPress version.
View wp_version_report.sh
# prints a report of the WP version
i=1
touch version.txt
COUNT=$(wc -l sites.txt)
for SITE in $(cat sites.txt)
do
cd $SITE
echo "Working on $SITE ($i of $COUNT)..."
echo "## $SITE" >> ../version.txt
url=$(wp option get siteurl)
@chrisjangl
chrisjangl / admin_email_report.sh
Created Nov 24, 2021
Working from a list of WordPress sites on a shared hosting environment (sites.txt), create a report of the admin email for each. Includes a link to the settings page to update the value.
View admin_email_report.sh
i=1
touch admin-email.txt
COUNT=$(wc -l sites.txt)
for SITE in $(cat sites.txt)
do
cd $SITE
echo "Working on $SITE ($i of $COUNT)..."
echo "## $SITE" >> ../admin-email.txt
url=$(wp option get siteurl)
postURL="/wp-admin/options-general.php"
@chrisjangl
chrisjangl / DB_report.sh
Created Nov 24, 2021
Working from a list of WordPress sites on a shared hosting environment (sites.txt), this script will print the DB name and login URL for each site.
View DB_report.sh
i=1
touch urls.txt
COUNT=$(wc -l sites.txt)
for SITE in $(cat sites.txt)
do
cd $SITE
echo "Working on $SITE ($i of $COUNT)..."
echo "## $SITE" >> ../urls.txt
url=$(wp option get siteurl)
postURL="/wp-login.php"
@chrisjangl
chrisjangl / reset_admin_password.sh
Last active Nov 24, 2021
Working from a list of WordPress sites on a shared hosting environment (sites.txt), reset the password for a given user account on each of them. It also creates a report of the admin users on each site
View reset_admin_password.sh
i=1
touch users.txt
COUNT=$(wc -l sites.txt)
for SITE in $(cat sites.txt)
do
cd $SITE
echo "Working on $SITE ($i of $COUNT)..."
echo "## $SITE" >> ../users.txt
wp user list --role=administrator --fields=user_login,user_email >> ../users.txt
echo "----------------" >> ../users.txt
@chrisjangl
chrisjangl / mail-test.php
Created Jun 14, 2021
Test whether PHP mail is working on a server
View mail-test.php
<!DOCTYPE html>
<html>
<head>
<title>Test mail services</title>
</head>
<body>
<h1>Test out the mail functionality on a server</h1>
<?php
$timestamp = "today";
// $timestamp = new DateTime('Y-m-d H:i:s');
@chrisjangl
chrisjangl / remove_custom_post_type_slug.php
Last active Jul 10, 2020
removes the slug from a custom post type
View remove_custom_post_type_slug.php
/**
* credit to: https://wordpress.stackexchange.com/q/291735
*
*/
/**
* remove the slug from published gallery permalinks.
*
* Makes sure to only touch our CPT
*