Skip to content

Instantly share code, notes, and snippets.

View NickDeckerDevs's full-sized avatar

nicholas decker NickDeckerDevs

View GitHub Profile
@NickDeckerDevs
NickDeckerDevs / code-split.html
Created April 11, 2025 17:05
Code splitting in HubSpot to mimic es6 imports. Video to see demonstration: https://share.cleanshot.com/B5q1CYDk
<!--
this is a macro that will need to do some heavy lifting to continue this
proof of concept into more complex code
-->
{%- macro importjs(module_name) -%}
{{- widget_data.importjs[module_name] -}}
{%- endmacro -%}
<!--
This is a sample output of widget_data.importjs
@NickDeckerDevs
NickDeckerDevs / global-widget.html
Created April 11, 2025 13:57
This is an example of using a global widget to store information on the template, and then calling that global widget from a module (as well as using a macro) to give a bunch of global data to different modules to allow for some really simple way of moving data from a template file to the individual modules in a page. You can also just load this…
<!-- This is the global FAQ module -->
{% module
"global_faq"
path="../../modules/global/global-faq.module",
label="global-faq"
export_to_template_context=True
%}
<!--
this is how it looks in design manager: https://share.cleanshot.com/PxD7wBWK
@NickDeckerDevs
NickDeckerDevs / .gitignore
Created April 9, 2025 21:11
HubSpot Developer Projects / UIE / UI Extension Sample .gitignore files with an explanation
# depending on how you set up your project, having the ** here will make sure
# to cover your entire project
**/node_modules/
# HubSpot config file
**/hubspot.config.yml
**/hubspot.config.yaml
# this is a file that keeps the packages in your project in sync
# if you want to make sure everyone is using the same version of packages it is a
@NickDeckerDevs
NickDeckerDevs / .gitignore
Created April 8, 2025 18:12
hubspot ui extension gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
const canvas = document.createElement("canvas");
const gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
if (gl) {
const debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
if (debugInfo) {
const renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
console.log("WebGL renderer:", renderer);
// If renderer string contains "SwiftShader" or "Software", hardware acceleration may be disabled.
} else {
console.log("WEBGL_debug_renderer_info not available.");
@NickDeckerDevs
NickDeckerDevs / invoiceWorkflow.js
Last active March 19, 2025 17:59
I'm adding some pomp and circumstance to this initial workflow with a bunch of comments in here so that developers of all types can see some different things that are possible in workflows and maybe you learn something. You can also comment and talk about how MY code sucks! https://gist.githubusercontent.com/dennisedson/666742c45701e662075bc44f2…
// I console log all of this stuff in a way that I can easily understand where errors are
// coming from as well as the data this is being passed in. This is super helpful when you are
// trying to debug and figure out what is going wrong. I want into much more detail than I really
// wanted to here. I started this to not use the hubspot sdk, because I see no reason to use it
// if we already have axios installed.
// In my opinion it isn't worth using the hubspot sdk because there is a history of
// different versions of the sdk being available in serverless functions, workflows, and what
// is available for the newest version of the sdk. This can cause MAJOR ISSUES when you are
// trying to debug and figure out what is going wrong only to learn that this version of the sdk
// isn't supported in one of these environments.
@NickDeckerDevs
NickDeckerDevs / indentify.js
Created March 13, 2025 22:36
hubspot identify that will send user details to hubspot if you have the tracking code on
var _hsq = window._hsq = window._hsq || []
_hsq.push(["identify", {
email: "[email protected]",
firstname: "sample",
lastname: "code"
}])
_hsq.push(['trackPageView'])
@NickDeckerDevs
NickDeckerDevs / datemacros.html
Created March 12, 2025 00:07
some fun date javascript functions and hubl macros
{#
This is my new favorite "Days Ago" but converted for partner portals where
action is needed and those "sales people" are out there hunting. They see
a "15 minutes" ago on a date property... whatever
#}
{% macro timeAgoSmart(date) %}
{%- set difference = local_dt|unixtimestamp - date|unixtimestamp -%}
{%- set minutes = (difference / 60000)|round(0, 'floor') -%}
{%- set hours = (difference / 3600000)|round(0, 'floor') -%}
@NickDeckerDevs
NickDeckerDevs / chatgpt 4o.js
Created February 28, 2025 18:36
gpt / claude model comparison for a specific query
//Here’s a function that takes the GraphQL response and calculates the required totals for the company and affiliates:
function processPipelineData(data) {
if (!data || !data.CRM || !data.CRM.contact || !data.CRM.contact.associations) {
return { companyPipeline: {}, affiliatePipeline: {} };
}
const companyData = data.CRM.contact.associations.company?.items[0];
if (!companyData || !companyData.associations) {
import requests
import pandas as pd
import time
def fetch_players(gender):
base_url = "https://drop-api.ea.com/rating/ea-sports-fc?locale=en&limit=100&gender="
offset = 0
all_players = []
while True: