Skip to content

Instantly share code, notes, and snippets.

View NickDeckerDevs's full-sized avatar

nicholas decker NickDeckerDevs

View GitHub Profile
@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) {
@NickDeckerDevs
NickDeckerDevs / temp.js
Created February 26, 2022 16:06
some comment/psuedo code for companies api to hubdb with google geocode location update
const hubspot = require('@hubspot/api-client');
exports.main = (event, callback) => {
const hubspotClient = new hubspot.Client({
apiKey: process.env.HAPIKEY
});
hubspotClient.crm.companies.basicApi.getById(event.object.objectId, ['name', 'address', 'zip', 'etc'])
.then(results => {
const data = fitlerType == 'ContentTypes' ? '[data-type="' + clickedItem + '"]' : '[data-topic="' + clickedItem + '"]'
const data = fitlerType == 'ContentTypes' ? `[data-type="${clickedItem}"]` : `[data-topic="${clickedItem}"]`
let data = `[data-topic="${clickedItem}"]`
if(filterType == 'ContentTypes') {
data = `[data-type="${clickedItem}"]`
}
@NickDeckerDevs
NickDeckerDevs / gist:9f7b212c0d6b54139af0e967823f6648
Created December 8, 2020 23:01
husbpot cta embed shortcode for wordpress
function embed_hubspot_cta( $atts ) {
// to use this embed code follow this:
// [embed_cta portal=”{{ portalID tierpoitn is: 135870 }}″ cta=”{{ ctaId }}”]
// [embed_cta portal="135870" cta="8b879891-fb4c-4961-9cbf-87adb9e827a7" centered="true"]
$a = shortcode_atts( array(
'portal' => '135870',
'cta' => '',
'centered' => 'false',
), $atts );
@NickDeckerDevs
NickDeckerDevs / replaceCtas.js
Created December 3, 2020 21:58
regex for replacing cta in hubspot hubl stuff to a wordpress shortcode example
// example goes over three diffferent items. The regex matches for a cta in a p tag as well as a normal cta. it ignores justify center alignment stuff
let body = `<p>{{cta('784c4ec9-c3b6-4080-9d59-2bc6dafc4122','justifycenter')}}</p>",https://f.hubspotusercontent20.net/hubfs/135870/BIT2020-1120x630-NutanixFiresideChat_multicloud.jpg,Matt Pacheco,"Cloud Computing,BraveIT,remote workforce"
BraveIT Session: How Can Businesses Thrive in a Multicloud World?,{{cta('784c4ec9-c3b6-1111-1111-2bc6dafc4122','justifycenter')}}braveit-session-how-can-businesses-thrive{{cta('784c4ec9-c3b6-3333-333-2bc6dafc4122')}}-in-a-multicloud-world,"TierPoint and Dell Technologies discuss multicloud challenges, the public cloud, managing apps & workloads in the cloud, and more.",04/20/52859 08:06:27,"<p>Over the past couple of years, conversations that were once about “the cloud” have shifted to conversations about multicloud. As IT departments moved their enterprise applications to the cloud, they discovered that different applicat
{ "id": "1", "name": "Pre Maturity", "intake": "lei", "intakeId": "1", "category": "preintake" },
{ "id": "2", "name": "Maturity Notification", "intake": "lei", "intakeId": "1", "category": "preintake" },
{ "id": "3", "name": "Lease End Inspection", "intake": "lei", "intakeId": "1", "category": "preintake" },
{ "id": "4", "name": "Service Quote", "intake": "lei", "intakeId": "1", "category": "preintake" },
{ "id": "5", "name": "Send Service Quote To Customer", "intake": "lei", "intakeId": "1", "category": "preintake" },
{ "id": "6", "name": "Waiting For Service Quote Approval", "intake": "lei", "intakeId": "1", "category": "approval" },
{ "id": "7", "name": "Waiting For Service Quote Approval [APPROVED]", "intake": "lei", "intakeId": "1", "category": "approval" },
{ "id": "8", "name": "Waiting For Service Quote Approval [DENIED]", "intake": "lei", "intakeId": "1", "category": "denied" },
{ "id": "9", "name": "Send Acquisition", "intake": "lei", "intakeId": "1", "category": "approval" },
{ "id": "10", "name":