Skip to content

Instantly share code, notes, and snippets.

View cliffordp's full-sized avatar

Clifford cliffordp

View GitHub Profile
@cliffordp
cliffordp / ghl-open-chat-widget.js
Created November 21, 2022 01:30
High Level Chat Widget: anything with specified class can open the chat widget -- Demo: https://share.getcloudapp.com/d5uylPyE
// This snippet: https://gist.github.com/cliffordp/927a92f2f2db962673d1deef48a31a0f
jQuery(document).ready( function($) {
// Hide until Chat Widget loads to prevent ineffective clicks.
$( ".open-chat-widget" ).hide();
$(window).one( "LC_chatWidgetLoaded", function() {
const chatWidget = window.leadConnector.chatWidget;
// Show once Chat Widget is loaded.
@cliffordp
cliffordp / functions.php
Created October 30, 2022 18:31 — forked from tripflex/functions.php
WordPress Remove Filter (remove_filter converted to remove_class_filter) to remove Filter/Action without Class Object access. Works with WordPress 1.2+ (4.7+ support added 9-19-2016)
<?php
/**
* Make sure the function does not exist before defining it
*/
if( ! function_exists( 'remove_class_filter' ) ){
/**
* Remove Class Filter Without Access to Class Object
*
* In order to use the core WordPress remove_filter() on a filter added with the callback
@cliffordp
cliffordp / functions.php
Last active September 23, 2022 03:23 — forked from patric-boehner/functions.php
Remove in-post settings for the Genesis Framework, including SEO, layout, and scripts.
<?php
// Remove in-post settings for the Genesis Framework, including SEO, layout, and scripts.
// Relevant Genesis code can be found in theme's lib > admin > inpost-metaboxes.php
if( ! function_exists( 'cliff_genesis_simplify_editing_screens' ) ) {
/**
* Remove in-post Genesis settings by post type.
* @link https://gist.github.com/cliffordp/744a19f00565051924ec7f0d46ac687e This snippet.
*/
function cliff_genesis_simplify_editing_screens() {
@cliffordp
cliffordp / functions.php
Created September 15, 2022 15:43
Hide Genesis Blocks Pro License 'missing' Notification on Admin Screens
<?php
/**
* Hide Genesis Blocks Pro admin notice about missing license key. Only makes sense if you know you didn't and won't enter one.
*
* StudioPress is dumb because they'll give give lifetime account holders access to the .zip but not a license key, making it an unnecessary headache to maintain, ugh, sucky.
* So here's a snippet to annoy you a little less by not seeing the Genesis Blocks Pro License 'missing' Notification on Admin Screens.
* You still need to manually update until StudioPress stops punching us in the face with this nonsense.
*
* @link https://gist.github.com/cliffordp/37cca6c428d946211dcc9a4127853b33 This snippet.
* @link https://developer.wpengine.com/genesis-blocks/changelog/ Genesis Blocks Pro's changelog to watch.
@cliffordp
cliffordp / DelugeMapDealDepositAmountIsValid.js
Last active August 17, 2022 10:48
Zoho CRM Deals - Deposit is positive and not more than Total Amount
entityMap = crmAPIRequest.toMap().get("record");
/*
The example below demonstrates how a field’s value (email) can be obtained from a MAP object. Here, entityMap - Map Object, Email - Field's API name
Sample entityMap= {'Email': 'xxx@xxx.com', 'Last_Name': 'xxx'};
*/
amount = entityMap.get("Amount");
deposit = entityMap.get("Deposit");
sendmail
[
from :zoho.adminuserid
@cliffordp
cliffordp / localwp-no-conflict.sh
Created July 20, 2022 22:37 — forked from nickpelton/localwp-no-conflict.sh
zsh avoid conflicts with localwp shell and custom php, mysql, or other custom binaries
# Don't load custom stuff if LocalWP shell
if [[ -z ${PHPRC+z} ]]
then
echo "Export custom binaries"
# Eg.
# export PATH="/opt/homebrew/opt/php@7.4/bin:$PATH"
# export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH"
fi
@cliffordp
cliffordp / ifStringIsBlankOneElseZero.js
Last active April 9, 2022 16:21
Zoho Flow to check for blank value
int ifStringIsBlankOneElseZero(string toCheck)
{
// This snippet: https://gist.github.com/cliffordp/9245df1dd6605a9f4ea3bda95d117a76
// https://www.zoho.com/deluge/help/functions/common/isnull-isblank-isempty-difference.html
// Unfortunately, isBlank() is not reliable.
if(isNull(toCheck) || isEmpty(toCheck))
{
// empty string, string of just spaces
return 1;
}
@cliffordp
cliffordp / zohoCrmClientScript.js
Last active October 19, 2023 01:29 — forked from jeznag/clientScript.js
Zoho CRM client script address verification via client script
// Demo: https://www.youtube.com/watch?v=oA2EV7Gz5NM
const street = ZDK.Page.getField('Street').getValue();
const city = ZDK.Page.getField('City').getValue();
const zipCode = ZDK.Page.getField('Zip_Code').getValue();
const country = ZDK.Page.getField('Country').getValue();
const state = ZDK.Page.getField('State').getValue();
const address = `${street} ${city} ${state} ${zipCode} ${country}`;
const url = `http://api.positionstack.com/v1/forward`
@cliffordp
cliffordp / zohoCRMUpdateNullEntry.js
Last active April 9, 2022 04:23
Zoho Flow - Zoho CRM - set 1+ Field(s) to an empty string value (within a single CRM Module)
void zohoCRMUpdateNullEntry(string module, string entryId, string fieldNames)
{
// This gist: https://gist.github.com/cliffordp/c4590a50b3c8ad6f7add7220481e0082
// Based on https://help.zoho.com/portal/en/community/topic/how-can-i-clear-out-a-value-in-a-field-or-set-it-to-null-using-zoho-flow
// But this one allows blanking out multiple comma-separated fields at once
// Example module = "Leads" (without quotes in Zoho Flow)
// Example fieldNames = "Street,City,State,Zip_Code" (without quotes in Zoho Flow)
optionalFields = Map();
fields = fieldNames.toList(",");
for each field in fields
@cliffordp
cliffordp / addressToCoordinates.js
Created April 9, 2022 03:08
Zoho Flow custom function to get address from Google Maps geocoding
map addressToCoordinates(string addressString)
{
/**
* This snippet: https://gist.github.com/cliffordp/068b32913ba25d1cd998507398c950c8
*
* Get lat/long from Google.
* https://developers.google.com/maps/documentation/geocoding
*
* CRM limits Decimal Fields to 9 digits, which is sufficient:
* https://rapidlasso.com/2019/05/06/how-many-decimal-digits-for-storing-longitude-latitude/