Skip to content

Instantly share code, notes, and snippets.

View coulterpeterson's full-sized avatar
🤓
Always learning

Coulter Peterson coulterpeterson

🤓
Always learning
View GitHub Profile
@coulterpeterson
coulterpeterson / snippet.sh
Created June 20, 2023 16:32
WP CLI Add Local Admin Account to Site
wp user create admin [email protected] --user_pass=admin --role=administrator --porcelain
@coulterpeterson
coulterpeterson / how-i-work-template.md
Last active June 19, 2023 23:56 — forked from spivurno/how-i-work-template.md
Template for How I Like to Work posts

How I work

This is my own interpretation of how I like to work, feedback welcome! Especially if my own view of how I think I like to work doesn't match your experience of how it seems I like to work!

When I work

  • Timezone: EST
  • Times/hours you work: ~8am-4pm EST on a regular day
  • How many hours you work in a typical day: 8
  • Weekends y/n? N
  • After hours availability? N
@coulterpeterson
coulterpeterson / snippet.ps1
Last active August 15, 2023 15:03
Install SSH Key in Windows and WSL
# Credit: https://stackoverflow.com/a/63473832/8143105
# Make sure you're running PowerShell as an Administrator
Set-Service ssh-agent -StartupType Automatic
Start-Service ssh-agent
Get-Service ssh-agent
ssh-add
# Enter password
code # Or open regularly - should now have your SSH key pre-loaded into env as expected
@coulterpeterson
coulterpeterson / snippet.css
Created June 14, 2023 15:24
Gravity Forms | Make Field Look Required Without Being Required
/* Instructions: add a "look-required" class to the field you want to look required */
.look-required label:after {
content: ' (Required)';
color: red;
}
@coulterpeterson
coulterpeterson / gw-auto-submit-on-x-characters-entered-into-field.js
Last active June 13, 2023 14:46
Gravity Forms | Automatically Submit After X Number of Characters Entered Into Field
/**
* Gravity Wiz // Gravity Forms // Automatically Submit After X Number of Characters Entered Into Field
* https://gravitywiz.com/
*
* Instructions:
*
* 1. Install this snippet with our free Custom JavaScript plugin.
* https://gravitywiz.com/gravity-forms-custom-javascript/
* 2. Replace "1" with the ID of your field, and "4" with the number of characters you want to limit it to.
*
@coulterpeterson
coulterpeterson / functions.php
Created June 13, 2023 14:07
Delete All Subscribers in WordPress Site
function delete_all_subscribers() {
require_once(dirname( ABSPATH ) . '/public_html/wp-admin/includes/user.php');
$args = array(
'role' => 'subscriber',
);
$users = get_users( $args );
foreach ( $users as $user ) {
wp_delete_user($user->id);
}
@coulterpeterson
coulterpeterson / gw-disable-field-or-subfieldy.js
Last active June 12, 2023 21:08
Gravity Forms | Disable Field or Sub-Field
/**
* Gravity Wiz // Gravity Forms // Disable Field or Subfield
* https://gravitywiz.com/
*
* Instructions:
*
* 1. Install this snippet with our free Custom JavaScript plugin.
* https://gravitywiz.com/gravity-forms-custom-javascript/
* 2. Replace "1_2" with the ID of your field and the sub-field ID (in the case of an address field, for example),
* or replace the "1_2" with your field id only, if it's a single field.
@coulterpeterson
coulterpeterson / snippet.js
Created June 7, 2023 15:08
Bookmarklet to Save Dynamic HelpScout Report Links, Such As a "This Week" Date Range
/*
* Instructions: adjust the URL of the report based on your needs, then copy/paste this code into the "URL" field of a
* fresh browser bookmark. Whenever you click it, it will automatically ensure the date range is set to "this week".
*/
javascript: (() => {
let currentDate = new Date();
currentDateIso = currentDate.toISOString().split('T')[0];
/* Get the Monday of this week; credit: https://stackoverflow.com/a/4156516 */
@coulterpeterson
coulterpeterson / snippet.js
Last active June 2, 2023 18:32
Gravity Forms | Restrict Number Field to X Number of Characters
/**
* Gravity Wiz // Gravity Forms // Restrict Number Field to X Number of Characters
* https://gravitywiz.com/
*
* Instructions:
*
* 1. Install this snippet with our free Custom JavaScript plugin.
* https://gravitywiz.com/gravity-forms-custom-javascript/
* 2. Replace "1" with the ID of your number field, and "4" with the number of characters you want to limit it to.
*
@coulterpeterson
coulterpeterson / gw-check-for-duplicate-values-between-a-set-of-fields.php
Created June 1, 2023 18:28
Gravity Forms | Check For Duplicate Values Between a Set of Fields
<?php
/**
* Gravity Wiz // Gravity Forms // Check For Duplicate Values Between a Set of Fields
* https://gravitywiz.com/
*
* Checks for duplicate values between a set of fields. Can be used to create a manual "rank these" setup
* using dropdown fields.
*
* Instructions:
* Update "123" to your form ID, "4" to the field ID of the last field that you want to check for duplicate values,