Skip to content

Instantly share code, notes, and snippets.

View chrisjangl's full-sized avatar

Chris Jangl chrisjangl

  • Wine Enthusiast, Digitally Cultured
  • NY
  • 12:49 (UTC -05:00)
View GitHub Profile
@chrisjangl
chrisjangl / deletePlugins.sh
Created June 21, 2023 17:38
WordPress plugin management
for plugin in $(wp --allow-root plugin list --update=available --status=inactive --field=name);
do
TITLE=$(wp --allow-root plugin get $plugin --field=title)
# look into how we can mark the date here. Maybe also only output final result
rm -r wp-content/plugins/$plugin/* && rmdir wp-content/plugins/$plugin
git add -A wp-content/plugins/$plugin
git commit -m "$(printf "delete plugin: $TITLE")"
echo "$TITLE -> $VERSION" >> ./reports/deleted-plugins.txt
done;
@chrisjangl
chrisjangl / getEnabledIngredients.js
Created June 14, 2023 23:47
[WP Pizza] Lists the enabled ingredients in an ingredient group when on the WP Pizza Ingredients page, Custom Groups tab
// set this to the ID of the group
var group = document.querySelector('#wppizza_addingredients-custom-group-96'),
// setting this as a variable in case it changes in the future
ingredientClass = 'wppizza_addingredients_ingrcg_sortable';
// find the ingredients that are enabled for this group
group.querySelectorAll('input[type="checkbox"]:checked').forEach(function(ingredient) {
// find the label for the ingredient
var label = ingredient.parentElement.innerText;
@chrisjangl
chrisjangl / enableIngredients.js
Created June 14, 2023 23:22
[WP Pizza] Enable all ingredients in a specific meal size when on the WP Pizza Ingredients page, Ingredients tab
// 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){
ingredient.querySelector('input[type="checkbox"]').checked=true;
})
@chrisjangl
chrisjangl / setMealSize.js
Created September 17, 2022 12:23
[WP Pizza] Change all ingredients to a specific meal size when on the WP Pizza Ingredients page, Ingredients tab
// 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 April 11, 2022 19:24
First attempts to create a Stripe invoice using the Stripe CLI
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 January 12, 2022 04:25
List the projects and items worked on today (by default) for a given workspace in Toggl.
<?php
/**
* some config variables
*/
/**
* User Agent value
*
* app name or email address
*
@chrisjangl
chrisjangl / scrape-FSA-deductions.js
Last active December 22, 2022 13:56
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.
// 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 November 24, 2021 12:32
Working from a list of WordPress sites on a shared hosting environment (sites.txt), create a report of each sites WordPress version.
# 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 November 24, 2021 12:30
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.
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 November 24, 2021 12:28
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.
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"