Skip to content

Instantly share code, notes, and snippets.

View NickDeckerDevs's full-sized avatar

nicholas decker NickDeckerDevs

View GitHub Profile
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:
@NickDeckerDevs
NickDeckerDevs / fixLanguage.js
Last active February 14, 2025 14:53
HubSpot Community Script to force langage to your preferred language, has options for language, number of years before expiration, and a debug mode if you want to log stuff to the console. When someone sends you a link and it is forced language from a url param (or you happen to click on one) this will remove that from the url, and automatically…
// This can be added as a boost in Arc Browsers for the community by adding this JS
// Non Arc Users can use a chrome extension TamperMonkey
// I have not ussed this, I only see it show up on stack overflow as solution
// https://chromewebstore.google.com/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo
// this could also be turned into a chrome extension, but my account is not verfied and I don't know how
// to get it to work, so lol if you find this useful and you know how to get a extension account
// figured out, let me know!
(function() {
// set your language code here
I'm going to respond here and talk through some of the issues that make this difficult to do in HubSpot
so, to get today's date we use `{{ local_dt }}` -- and we could just covert that to a timestamp using `{{ local_dt|unixtimestamp }}` and that would give me a unixtimestamp that I can use, but we really need "midnight" because we need the start of the today if we want to know if anything was updated today.
In the code below I'm going to use the `|pprint` filter, which will show us what "types" these variables are as we convert them
```
<p>local_dt|pprint: {{ local_dt|pprint }}</p>
{# output: local_dt|pprint: (PyishDate: 2024-12-19 12:24:03) #}
<p>local_dt|format_date('M/d/yy'): {{ local_dt|format_date('M/d/yy')|pprint }}</p>
{# output: local_dt|format_date('M/d/yy'): (String: 12/19/24) #}
<p>local_dt|format_date('M/d/yy')|strtodate('M/d/yy'): {{ local_dt|format_date('M/d/yy')|strtodate('M/d/yy')|pprint }}</p>
{# output: local_dt|format_date('M/d/yy')|strtodate('M/d/yy'): (PyishDate: 2024-12-19 00:00:00) #}
@NickDeckerDevs
NickDeckerDevs / gist:ce4896cce76fb9e9d473083d68491481
Last active December 19, 2024 18:07
hubspot - crm objects getting products and converting dates to compare for anything updated from midnight until now
{% set products = crm_objects("product", "limit=100") %}
{% set midnight_today = local_dt|format_date('M/d/yy')|strtodate('M/d/yy')|unixtimestamp %}
{% if products_data.total > 0 %}
<div class="products__wrapper">
{% for result in products.results %}
{% set product = crm_object("product", result.id, "name,price,hs_lastmodifieddate,createdate") %}
{% set updated_date = product_details.hs_lastmodifieddate|strtodate('M/d/yy')|unixtimestamp %}
{% set created_date = product_details.createdate|strtodate('M/d/yy')|unixtimestamp %}
@NickDeckerDevs
NickDeckerDevs / workflow-year-month-since-date.js
Last active February 14, 2023 17:06
years months since date in javascript hubspot
// this will export out a 8 years 6 months since date
exports.main = async (event, callback) => {
// you can change these to yr, yrs, mo, mos if you would like
const terms = {
year: 'year',
yearPlural: 'years',
month: 'month',
monthPlural: 'months'
}