Skip to content

Instantly share code, notes, and snippets.

@alpha1
alpha1 / keymap.cson
Created June 12, 2018 00:43
Atom Custom keymap.cson
'atom-text-editor':
'ctrl-d':'editor:duplicate-lines'
@alpha1
alpha1 / gist:ae633f6bee2b94e45a3ae9dc5fd05d80
Created May 10, 2018 21:00
Email Lists for Software Products
Service Problems/Status
Events
Release Notes / New Release Information
Tips / Newsletter
Special Offers
Feedbacks/Surveys
@alpha1
alpha1 / srv_dir_size.sh
Created March 30, 2018 17:38
Get Size of Directories in /SRV/WWW
du -chs /srv/www/*
@alpha1
alpha1 / delete-all-guest-authors.php
Last active March 22, 2018 19:19
Co-Authors-Plus: Delete All GuestAuthors
<?php
function delete_all_coauthors(){
global $coauthors_plus;
$coauths = get_posts( array( 'post_type' => 'guest-author', 'posts_per_page' => -1, 'post_status' => 'any' ) );
foreach( $coauths as $coauth){
$coauthors_plus->guest_authors->delete( $coauth->ID, false );
}
}
?>
@alpha1
alpha1 / gist:7bbfaabd3a9ca0a024f6a14fcac72026
Last active March 30, 2018 17:36
People to avoid in life
People who believe in healing crystals.
People who sell multi level marketing programs
People who believe 9/11 is in inside job
@alpha1
alpha1 / gist:f29fc92be3932606ab95b61f05a38a66
Created February 25, 2018 00:09
Clone disk with Progress
dd if=/dev/source_disk of=/dev/destination_disk status=progress
@alpha1
alpha1 / gforms_text_field_validation.php
Created January 17, 2018 18:08
Gravity Forms - Disallow characters from fields on many forms
<?php
/*
Use case for this is when you have certain characters like "@" that should be disallowed in certain fields. You can add a list.
This was built for text fields with job titles. Tweak as needed.
*/
add_filter( 'gform_field_validation', 'gravity_forms_validate_job_titles', 10, 4 );
function mgravity_forms_validate_job_titles( $result, $value, $form, $field ){
$forms_fields_to_check = array(
//form_id => array( $field_id, $field_id_1, $field_id_2),
@alpha1
alpha1 / gravity_forms_lowercase_email_value.php
Created December 6, 2017 22:55
Gravity Forms: Lowercase all input email values
<?php
add_filter( 'gform_save_field_value', 'gravity_forms_lowercase_all_emails', 10, 5 );
function gravity_forms_lowercase_all_emails( $value, $entry, $field, $form, $input_id ){
if($field->type == "email" ){
$value = strtolower( $value );
}
return $value;
}
?>
@alpha1
alpha1 / imports.sql
Last active January 16, 2018 01:25
CE This Week Migration
#prior to running these, grab all held emails from delivra and import as suppressions to phplist.
#Server 2 - All active subscribers from MYB
SELECT
phplist_user_user.id,
TRIM(LOWER(phplist_user_user.email)) as 'email',
'1' as 'Business'
FROM phplist_listuser
LEFT JOIN phplist_user_user ON phplist_listuser.userid = phplist_user_user.id
where `listid` = 3
@alpha1
alpha1 / gform_show_key_value_entry_detail.php
Created November 9, 2017 22:38
Gravity Forms Show Entry Key and Value on Entry Detail Page
<?php
add_filter( 'gform_entry_field_value', 'display_key_and_value', 10, 4 );
function display_key_and_value( $value, $field, $entry, $form ){
switch( $field['type'] ){
case "checkbox":
break;
case "select":
case "radio":
$answers = wp_list_pluck( $field['choices'], 'value', 'text' );