Skip to content

Instantly share code, notes, and snippets.

Avatar

Clifford cliffordp

View GitHub Profile
@cliffordp
cliffordp / addressToCoordinates.js
Last active Apr 7, 2021
Zoho Flow custom function to get address from Google Maps geocoding
View addressToCoordinates.js
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/
@cliffordp
cliffordp / functions.php
Last active Nov 4, 2020
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.
View functions.php
<?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 Nov 6, 2020
Local (Lightning) Xdebug setup with PhpStorm
View local-lightning-xdebug-phpstorm.md

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 Jul 16, 2020
Disable Divi custom image sizes
View functions.php
<?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()
*/
View react-global-state-no-redux-demo.jsx
// 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',
@cliffordp
cliffordp / functions.php
Last active May 22, 2020
The Events Calendar: Include Legacy (v1) List View at the end of each post's output unless it's a TEC post or archive.
View functions.php
/**
* The Events Calendar: Include Legacy (v1) List View at the end of each post's output unless it's a TEC post or archive.
*
* Tested working with TEC v5.1.1.
*
* @link https://gist.github.com/cliffordp/98d438e52a1a95a9fea3e862c426b399 This snippet.
*
* @see \tribe_include_view_list() The same function used by Organizer and Venue archives in Events Calendar Pro (v1 views).
*
* @param string $content
@cliffordp
cliffordp / functions.php
Last active May 22, 2020
The Events Calendar: v2 Views: Include the next 3 upcoming events after each post unless it's a TEC post or archive.
View functions.php
<?php
/**
* The Events Calendar: v2 Views: Include the next 3 upcoming events after each post unless it's a TEC post or archive.
*
* Tested working with TEC v5.1.1.
* Outputs a portion of v2's List View's HTML rendering without full styles/scripts.
* But this isn't the best way to use v2's views. For a lot of scenarios, it's better to just create your own new view.
*
* @link https://gist.github.com/cliffordp/9994cf05f6475922f451eaeacef2cd3c This snippet.
@cliffordp
cliffordp / functions.php
Created May 20, 2020
GeneratePress: Remove all Google Fonts loading and options.
View functions.php
<?php
/**
* GeneratePress: Remove all Google Fonts loading and options.
*
* @link https://gist.github.com/cliffordp/640ff4586c9a7c9ffe6656ff65326a5e This snippet.
* @link https://share.getcloudapp.com/NQuDXKJm 1min demo that this code works.
* @link https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/?aid=5336&affiliate_key=Lsvk04DjJOhq I'm using Toolset to add custom snippets.
*/
toolset_snippet_security_check() or die( 'Direct access is not allowed' );
View AutoBillNumber.deluge.js
/**
* Insert the Bill's Date as the Bill Number, since we usually don't care what the Bill Number is but Zoho Books needs it, yet when a bill is created via recurring profile, it doesn't generate one.
*
* If it's already set, it won't be modified.
* Example result if Bill Date is December 10, 2019 (DueDate is disregarded): "Auto: 2019-12-10"
*
* Created 2019-12-10. Confirmed still working 2020-04-30.
* Will NOT work on VOID bills.
* WARNING: The user that CREATES the custom button is the only user that can EDIT the custom button.
*
@cliffordp
cliffordp / functions-old.php
Last active Mar 20, 2020
The Events Calendar: Change the Event Website plain text link to a button, including shortening the anchor text to avoid a really long button.
View functions-old.php
<?php
/**
* The Events Calendar: Change the Event Website plain text link to a button, including shortening the anchor text to
* avoid a really long button.
*
* @link https://gist.github.com/cliffordp/e19775ce3eb7a66fb72ba38a24959546 This snippet.
* @link https://theeventscalendar.com/knowledgebase/k/make-the-event-website-url-a-linked-word-or-button/ KB article with this and other snippets.
* Screenshots with Twenty Twenty theme:
* @link https://share.getcloudapp.com/X6uz7NNZ without this snippet (before).
* @link https://share.getcloudapp.com/geu2PzzE with this snippet (after).