This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _hsq = window._hsq = window._hsq || [] | |
_hsq.push(["identify", { | |
email: "[email protected]", | |
firstname: "sample", | |
lastname: "code" | |
}]) | |
_hsq.push(['trackPageView']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# | |
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') -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) #} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% 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 %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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' | |
} |
NewerOlder