Skip to content

Instantly share code, notes, and snippets.

View cliffordp's full-sized avatar

Clifford cliffordp

View GitHub Profile
@cliffordp
cliffordp / gmapsAddressLookup.js
Last active August 17, 2022 12:22
Zoho Flow custom function for Zoho CRM - Lookup full address (USA terminology)
map gmapsSingleAddressLookup(string fullAddress)
{
/**
*
* This snippet: https://gist.github.com/cliffordp/132f1940b6d90a31db60faae0e20dc5f
*
* Get lat/long and other details from Google.
* https://developers.google.com/maps/documentation/geocoding
*
* CRM limits Decimal Fields to 9 digits, which is sufficient:
@cliffordp
cliffordp / appsScript.js
Last active November 6, 2022 11:52
Google Sheets Custom Functions: Get YouTube Channel ID or Channel Title from a YT Video ID
// This code: https://gist.github.com/cliffordp/c953c2e4020935727948afe29bd0f192
// Could use YouTube Service instead: https://developers.google.com/apps-script/advanced/youtube
// https://developers.google.com/youtube/v3/docs
const YouTubeApiKey = '...';
// `=getChannelIdFromVideoId( A1 )`
// Could link if you wish: `="https://www.youtube.com/channel/"&B1`
function getChannelIdFromVideoId( videoId ) {
@cliffordp
cliffordp / functions.php
Last active April 5, 2022 13:19
Gravity Forms Zoho CRM Add-On -- Decode HTML when sending to Zoho CRM so links work, such as link to the entry
<?php
/**
* Gravity Forms Zoho CRM - Decode HTML for Task Description & Lead Description so links work, such as link to the entry.
*
* @link https://gist.github.com/cliffordp/0d45eae807c190fed0a95de66a655224 This snippet.
* @link https://docs.gravityforms.com/gform_merge_tag_filter/#9-decode-modifier Alternative is to use a modifier like {entry_url:decode}
*/
add_filter( 'gform_zohocrm_task', 'cliff_zoho_crm_task_decode_description', 10, 4 );
if(
@cliffordp
cliffordp / style.css
Created June 13, 2021 23:45
Vertical scroll snapping full height container blocks in GeneratePress on WordPress
/* Reference: https://tourkick.com/?p=14005 */
html, body {
scroll-snap-type: y proximity;
}
@media (max-width: 1024px) {
html, body {
scroll-padding: 64px; /* Remove this if your mobile header nav hides upon scroll. */
}
}
@media (min-width: 1025px) {
// put uploaded files into filetype based directories
add_filter('wp_handle_upload_prefilter', 'wpse_25894_handle_upload_prefilter');
add_filter('wp_handle_upload', 'wpse_25894_handle_upload');
function wpse_25894_handle_upload_prefilter( $file )
{
add_filter('upload_dir', 'wpse_25894_custom_upload_dir');
return $file;
}
@cliffordp
cliffordp / functions.php
Last active March 21, 2022 04:16
Disable Divi's Project post type
<?php
add_action( 'init', 'cliff_remove_divi_project_post_type' );
if ( ! function_exists( 'cliff_remove_divi_project_post_type' ) ) {
/**
* Disable Divi's Project post type.
*
* Alternative option for post type (but not taxonomies): Use the 'et_builder_default_post_types' filter.
* wp-content/themes/Divi/includes/builder/core.php
*
@cliffordp
cliffordp / functions.php
Last active November 4, 2020 05:48
Output a single ECP Additional Field's value in TEC's List View after the Venue line. This one is an example of "Owners" field.
<?php
/**
* Output a single ECP Additional Field's value in TEC's List View after the Venue line.
* This one is an example of "Owners" field.
*
* @link https://gist.github.com/cliffordp/a7e40bf92d2ca60a9b5dc6b24301d010 This snippet.
* @link https://share.getcloudapp.com/o0um142w Screenshot.
*
* @param string $file Complete path to include the PHP File.
* @param array $name Template name.
@cliffordp
cliffordp / local-lightning-xdebug-phpstorm.md
Last active November 6, 2020 09:36
Local (Lightning) Xdebug setup with PhpStorm

1) Local Lightning

Local Lightning works differently than the previous version of Local. This guide is for Lightning.

Install and activate the "Xdebug + PhpStorm" Local add-on. You'll need to restart Local app to complete installation.

Whenever a new site is added click its "Utilities" tab, then click "Add Run Configuration to PhpStorm" to insert "Local" with your site's URL as a "PHP Web Page > Server" in the Configurations, then specify its root location via Path Mappings.

2 min video walk-through (requires the following to be completed already... so continue below before trying to trigger an Xdebug breakpoint...)

@cliffordp
cliffordp / functions.php
Last active July 16, 2020 05:40
Disable Divi custom image sizes
<?php
/**
* Disable Divi's custom media image sizes, as added via /wp-content/themes/Divi/post_thumbnails_divi.php
*
* DOES NOT WORK as of July 2020, but https://wordpress.org/plugins/image-sizes/ did work.
*
* @link https://gist.github.com/cliffordp/4efbd9219f427f78b5f2e6101700935f This snippet.
*
* @see __return_empty_array()
*/
// By Tanner Linsley 2020-07-01
// 5min walk-through: https://share.getcloudapp.com/OAuBjlZW
const globalStateContext = React.createContext()
const useGlobalState = () => React.useContext(globalStateContext)
function App() {
const [globalState, setGlobalState] = React.useState({
foo: 'bar',