Skip to content

Instantly share code, notes, and snippets.

@davidmroth
davidmroth / README.txt
Created February 9, 2021 17:25
How to fix Wordpress error: <wp_table>: x clients are using or haven't closed the table properly
# Example error: wp_postmeta: 21 clients are using or haven't closed the table properly
# Login to mysql
$ mysql -u<username> -p <database name>
CHECK TABLE wordpress_postmeta ;
--- ERROR: myisamchk: error: Not enough memory for blob at 94358800 <<< Fix for this error below!!
REPAIR TABLE wordpress_postmeta;
CHECK TABLE wordpress_postmeta ;
# How to fix 'Not enough memory for blob at blah blah blah' on wordpress table: wordpress_postmeta?
@davidmroth
davidmroth / .bash_profile
Last active November 11, 2022 01:04
Homebrew Setup Mac M1
# !!! IMPORTANT
# Must point to the correct director or this entire script breaks
eval $(/opt/homebrew/bin/brew shellenv)
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/usr/local/google-cloud-sdk/path.bash.inc' ]; then . '/usr/local/google-cloud-sdk/path.bash.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/usr/local/google-cloud-sdk/completion.bash.inc' ]; then . '/usr/local/google-cloud-sdk/completion.bash.inc'; fi
@davidmroth
davidmroth / shortcode.php
Created January 11, 2021 03:17
LEARNDASH EMAIL DATE/TIME FIX
#/home/ampcare/htdocs/wp-content/plugins/learndash-notifications/includes/shortcode.php
# Line number: 106
if ( ! empty( $timezone_string = get_option( 'timezone_string' ) ) ) {
date_default_timezone_set( $timezone_string );
}
#$result = date_i18n( $atts['format'], $completed_on );
if ( ! empty( $timezone_string ) ) {
$result = new DateTime( "@$completed_on" );
$result = date_timezone_set($result, timezone_open( $timezone_string ) );
@davidmroth
davidmroth / cmd.txt
Created August 6, 2020 00:19
Bash Commands
<some cmd> | (sed -u 1q; sort -k8) --- Sort by 8th column while skipping header
tput rmam --- Remove line wrap in terminal
tput smam --- Add line wrapping
network is not ready: runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: Kubenet does not have netConfig. This is most likely due to lack of PodCIDR
@davidmroth
davidmroth / Note.txt
Created June 27, 2020 03:57
LearnDash Notification Fix
100 //date_default_timezone_set( get_option( 'timezone_string' ) );
101 //$result = date_i18n( $atts['format'], $completed_on );
102 $timezone = new DateTimeZone( get_option( 'timezone_string' ) );
103 $result = wp_date( $atts['format'], $completed_on, $timezone );
@davidmroth
davidmroth / upgrade_steps.txt
Created February 1, 2020 17:47
Upgrade PHP on Bitnami
# Stop Bitnami LAMP stack
sudo /opt/bitnami/ctlscript.sh stop
# Backup Bitnami stack
sudo cp -ra /opt/bitnami /opt/bitnami_bck
# Move original Bitnami stack
sudo mv /opt/bitnami /opt/bitnami_orig
# Download updated LAMP stack
@davidmroth
davidmroth / SuiteCRM>data>SugarBean.php
Last active January 26, 2020 18:31
SuiteCRM Find by Email
@@ -3389,6 +3390,20 @@ class SugarBean
unset($ret_array['secondary_select']);
}
+ #HACK
+ if ( strpos( $ret_array['where'], "{$this->table_name}.email1" ) !== false ) {
+ $matches = array();
+ preg_match( "/{$this->table_name}.email1\s*=\s*([\S\s]+)\).*/", $ret_array['where'], $matches, PREG_OFFSET_CAPTURE );
+ $email_address = strtoupper( $matches[1][0] );
+
@davidmroth
davidmroth / remove_squarespace_date.js
Created January 13, 2020 04:54
Squarespace - Remove event date if between a specified time
$(document).ready(function() {
var getTimeValue = function(time) {
return Date.parse('01/01/2011 ' + time);
}
var ignoreAfter = '12:00:00 AM';
var ignoreBefore = '05:00:00 AM';
var allEventTimes = $('.eventlist-meta-time');
var test = allEventTimes.filter(function(idx, elm) {
@davidmroth
davidmroth / git-selective-merge.md
Last active February 17, 2019 21:57 — forked from katylava/git-selective-merge.md
git selective merge

Example: You have a branch refactor that is quite different from master. You can't merge all of the commits, or even every hunk in any single commit or master will break, but you have made a lot of improvements there that you would like to bring over to master.

Note: This will not preserve the original change authors. Only use if necessary, or if you don't mind losing that information, or if you are only merging your own work.

On master:

> git co -b [a new branch name]