Skip to content

Instantly share code, notes, and snippets.

View NickDeckerDevs's full-sized avatar

nicholas decker NickDeckerDevs

View GitHub Profile
@NickDeckerDevs
NickDeckerDevs / workflow.js
Last active September 4, 2022 15:06
bare minimum for hubspot custom object creation
const hubspot = require('@hubspot/api-client')
const hubspotClient = new hubspot.Client({
"accessToken": process.env.PRIVATE_APP_TOKEN
})
const labels = {
"singular": "Property",
"plural": "Properites"
};
@NickDeckerDevs
NickDeckerDevs / hubspot-gdpr-api.js
Created August 23, 2022 14:58
hubspot gdpr acceptance api using all of the module options -- easy to implement. This sends a message to google tag manager where you set up a custom event ot read, thent trigger other tags. You can also use this to fire off your own script tags in hubspot
var _hsp = window._hsp = window._hsp || []
window.dataLayer = window.dataLayer || []
_hsp.push(['addPrivacyConsentListener', function(consent) {
// console.log('-------- [HubSpot website logging start] --------')
// console.log('analytics: ' + consent.categories.analytics)
// console.log('advertisement: ' + consent.categories.advertisement)
// console.log('functionality: ' + consent.categories.functionality)
// console.log('-------- [HubSpot website logging start] --------')
if(consent.categories.analytics) {
@NickDeckerDevs
NickDeckerDevs / lazy-load-form-husbpot.html
Last active July 13, 2022 18:33
lazy load hubspot form
<div class="form-module__form ll"></div>
<script id="form-module__script" charset="utf-8" type="text/javascript" data-src="//js.hsforms.net/forms/v2.js" data-targetclass="form-module__form" data-portal="{{ portalId }}" data-form="{{ module.module_content.form_field.form_id }}" defer></script>
<script>
function getFormData(formScript) {
return {
id: formScript.dataset.form,
portal: formScript.dataset.portal,
targetClass: "." + formScript.dataset.targetclass
@NickDeckerDevs
NickDeckerDevs / form-observer.js
Last active June 29, 2022 13:53
hubspot form observer message emit
window.addEventListener('message', function (event) {
if (event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormReady') {
// hubspot form is Loaded
}
})
@NickDeckerDevs
NickDeckerDevs / ef-blog-css-updates.scss
Created May 3, 2022 16:55
ef blog updates for EF (scss)
.blog .blog-content table tr td {
padding: 8px!important;
}
.blog .blog-content table,
.blog .blog-content table tr,
.blog .blog-content table tr td {
height: auto!important;
text-align: left!important;
vertical-align: top!important;
@NickDeckerDevs
NickDeckerDevs / engag
Created April 28, 2022 01:26
hubspot engagements api
const axiosDefault = require("axios");
const CSVtoJSON = (strData, strDelimiter) => {
strDelimiter = strDelimiter || ",";
if (strData.substr(-1) !== "\n") strData += "\n";
let objPattern = new RegExp(
"(\\" + strDelimiter + "|\\r?\\n|\\r|^)" + '(?:"([^"]*(?:""[^"]*)*)"|' + '([^"\\' + strDelimiter + "\\r\\n]*))",
"gi"
);
@NickDeckerDevs
NickDeckerDevs / send-form-to-hubspotl.html
Last active February 1, 2024 15:10
ajax example to send html form data to hubspot
<form>
<~-- form html here -->
</form>
<script>
function onSubmit() {
@NickDeckerDevs
NickDeckerDevs / custom-object.html
Created March 22, 2022 09:43
hubl to query custom object and display results as a drop down in a form
{% set objects = crm_objects("condo_project") %}
<label for="condo-projects">Choose a project:</label>
<select name="condo-projects" id="condo-project">
{% for item in objects.results %}
<option value="{{ item.id }}">{{ item.name }}</option>
{% endfor %}
</select>
@NickDeckerDevs
NickDeckerDevs / fb-conversion-api.php
Created March 18, 2022 18:57
facebook conversion api php
<?php
// to be added at top of implementation page
require './vendor/autoload.php';
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
use FacebookAds\Object\ServerSide\ActionSource;
use FacebookAds\Object\ServerSide\Content;
use FacebookAds\Object\ServerSide\CustomData;
use FacebookAds\Object\ServerSide\DeliveryCategory;
use FacebookAds\Object\ServerSide\Event;
@NickDeckerDevs
NickDeckerDevs / three-column.scss
Created March 1, 2022 15:38
I think this is a better way of centering columns when using flexbox and borders between them. nth child the 1st item and the last item with no padding. This also repeats down the line if more than 3 columns are used
.multi-column {
.multi-column__col {
flex-basis: 33%;
margin: 0;
padding-left: 20px;
padding-right: 20px;
&:nth-child(3n+1) {
padding-left: 0;
}
&:nth-child(3n+3) {