Skip to content

Instantly share code, notes, and snippets.

View Garconis's full-sized avatar
🐞
Debugging

Jon Fuller Garconis

🐞
Debugging
View GitHub Profile
@Garconis
Garconis / attributer-tidio-chat-properties.js
Created January 13, 2025 19:48
Attributer.io + Tidio | Testing to push data collected from Attributer cookie into Tidio chat contact properties.
// get desired param (gclid), specify the form field id to add it to, add it to local storage, and set the value in the form field
function addGclid() {
var gclidParam = getParam('gclid'); // what param to get
var gclidFormFields = ['input_6_16']; // all possible gclid form field ids here, e.g., ['gclid_field', 'foobar']
var gclidRecord = null;
var currGclidFormField;
var gclsrcParam = getParam('gclsrc'); //gclsrc param indicates the source of the click ID, but can also be empty
var isGclsrcValid = !gclsrcParam || gclsrcParam.indexOf('aw') !== -1;
@Garconis
Garconis / find-most-recent-deal-or-lead-by-contact-person-id-pipedrive.js
Created January 9, 2025 16:15
Pipedrive API + Zapier | Find the most recent open Deal ID or unarchived Lead ID of a given contact person's ID
// Convert the personId from input data to a number (needed for comparison later)
// inputData.personId is a value passed into this step from a previous step in the Zap
const personId = parseInt(inputData.personId, 10);
// Check if personId is provided; if not, stop the process with an error
if (!personId) {
callback('Error: personId is required but not provided in inputData.');
return;
}
@Garconis
Garconis / gravity-forms-send-certain-email-entries-to-spam.php
Created July 15, 2024 16:25
Gravity Forms | Create email address blacklist to send to spam
<?php
add_filter( 'gform_entry_is_spam_6', 'filter_gform_email_is_blacklist', 11, 3 );
function filter_gform_email_is_blacklist( $is_spam, $form, $entry ) {
if ( $is_spam ) {
return $is_spam;
}
$field_id = '2'; // The ID of the field containing the email address to be checked.
$email = rgar( $entry, $field_id );
@Garconis
Garconis / gravity-forms-change-required-field-status-based-on-page.php
Created April 8, 2024 16:08
Gravity Forms | Conditionally require certain form fields based on the page its on
<?php
// Conditionally requiring (or un-requiring) certain Contact Form fields based on the page its on
// https://gist.github.com/spivurno/8481177
function fs_conditional_requirement( $form ) {
// homepage
if ( is_page(15) ) {
foreach( $form['fields'] as &$field ) {
@Garconis
Garconis / gravity-forms-fill-input-based-on-dropdown-value.js
Created February 13, 2024 18:15
Gravity Forms | Get selected dropdown choice text and value, then pull out first name and prefill into hidden field input
// Get dropdown info from Gravity Form PM selections
// After the Gravity validates the fields, the Gravity form will re-render all the fields, so the script code you write will not be bind to the new element.
// So you need to bind it again (after validation) or use this hook gform_post_render.
jQuery(document).on('gform_post_render', function( ){
// and especially whenever it's changed
jQuery('.pm-dropdown select').on('change', function() {
var pmValueEmail = jQuery(this).val();
var pmTextFullname = jQuery(this).find('option:selected').text();
var pmFirstName = pmTextFullname.split(' ').slice(0, -1).join(' ');
// set the hidden text input field value
@Garconis
Garconis / zapier-asana-assign-subtask-of-parent-based-on-subtask-name.js
Last active June 21, 2024 20:38
Asana API + Zapier | find specific subtasks of a parent and then assign them
const res = await fetch('https://app.asana.com/api/1.0/tasks/' + inputData.parentTaskID + '/subtasks', {
headers: {
'Authorization': 'Bearer 1/1234'
}
});
// Sends a JSON response composed of the specified data
const body = await res.json();
// Grabs the "data" content of the response
const data = body.data;
@Garconis
Garconis / zapier-asana-find-all-subtasks.js
Created August 21, 2023 21:58
Asana API + Zapier | output all subtasks of a given task
// this is wrapped in an `async` function
// you can use await throughout the function
var parentTaskID = inputData.parentTaskID ; // get the variable from the parentTaskID
// get the subtasks based on the parentTaskID
const res = await fetch('https://app.asana.com/api/1.0/tasks/' + parentTaskID + '/subtasks', {
method: 'GET',
headers: {
'Authorization': 'Bearer 1/2345'
}
@Garconis
Garconis / gravity-forms-hidden-field-prepend-append-value.php
Created May 25, 2023 20:21
Gravity Forms | Add a hidden field that pulls in value of another field and then prepends or appends additional text to it
<?php
// Change 6 on the following to your form id number.
add_action( 'gform_pre_submission_6', 'pre_submission_handler' );
function pre_submission_handler( $form ) {
// Change 145 to be the Hidden Field id number and 114_6 to the Last Name id number
// which you can get while inspecting the fields in the backend of the Gravity Form while editing it
$_POST['input_145'] = rgpost( 'input_114_6' ) . ' - Household';
}
@Garconis
Garconis / wordpress-impreza-accordion-shortcode-acf-repeater-field.php
Last active May 10, 2023 16:39
WordPress + Impreza | Create shortcode to output accordions based on ACF repeater fields
<?php
/* ACF Case Study Key Features accordion shortcode recreation, used within the Case Study page template */
// [fs_key_features_accordion]
function fs_sc_key_features_accordion( $atts ){
// begin output buffering
ob_start();
if( have_rows('cs_key_website_features') ) {
@Garconis
Garconis / zapier-asana-search-tasks.js
Created April 28, 2023 17:07
Asana API + Zapier | search for a task with criteria and return GID
const res = await fetch('https://app.asana.com/api/1.0/workspaces/9876543/tasks/search?projects.all=1204442834902858&sections.any=1204442834902861,1204442834902862&completed=false&text=' + inputData.foundText + '&opt_fields=gid', {
headers: {
'Authorization': 'Bearer 0/1234567'
}
});
// Sends a JSON response composed of the specified data
const body = await res.json();
// Grabs the "data" content of the response
const data = body.data;