Skip to content

Instantly share code, notes, and snippets.

View Antoinebr's full-sized avatar
:octocat:
🔥

Antoinebr

:octocat:
🔥
  • Fastly
  • Rennes
View GitHub Profile
@Antoinebr
Antoinebr / index.html
Created February 19, 2024 16:29
HubSpot Form with autosuggest + Form API
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Autocompletion Form</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
<style>
#suggestions {
display: none;
@Antoinebr
Antoinebr / hs-API-create-An-Email-Template.js
Created June 23, 2023 08:05
hs-API-create-An-Email-Template.js
const axios = require('axios');
const privateAppToken = "your-private-app-token-here-dqdsqs-qsdsqdsq";
const axiosConfig = {
headers: {
authorization: `Bearer ${privateAppToken}`
@Antoinebr
Antoinebr / hubspot-hubl.html
Created October 11, 2021 20:18 — forked from johnsfuller/hubspot-hubl.html
WordPress/PHP & HubSpot/HubL Comparison Cheat Sheet
<!-- 👇 Scroll down 👇 -->
{# variables #}
{% set my_variable = 'Hello world' %}
{# get variables from somewhere else #}
{% import 'path/to/hubl-variables.html' as site_vars %}
{{ site_vars.my_external_variable }}

GKE

Set up a Redis master

Set up gcloud and kubectl credentials

gcloud container clusters get-credentials antoine-cluster  --zone europe-west4-c
@Antoinebr
Antoinebr / performance.md
Last active June 18, 2020 15:07
use performance object to get insights

Use the performance object to monitor RUM

    const sleep = () => new Promise( (resolve, reject) => setTimeout( () => resolve(), 100 ));

    const init = async () => {
      performance.mark('One');

 await sleep();

A service worker for basic offline

// always check for the most current version of Workbox
// https://github.com/GoogleChrome/workbox/releases
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.1.3/workbox-sw.js');

const OFFLINE_HTML = '/offline/offline.html';
const PRECACHE = [
  { url: OFFLINE_HTML, revision: '70f044fda3e9647a98f084763ae2c32a' }
@Antoinebr
Antoinebr / gist:2f2a0327479850d1077396d4c03a2018
Last active April 26, 2022 21:42 — forked from chrisle/gist:2252209
CURL as GoogleBot 2.1
curl --user-agent "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.1 Mobile Safari/537.36 (compatible);" -v $@

Detect standalone IOS

// Detects if device is on iOS 
const isIos = () => {
  const userAgent = window.navigator.userAgent.toLowerCase();
  return /iphone|ipad|ipod/.test( userAgent );
}
// Detects if device is in standalone mode
@Antoinebr
Antoinebr / wpt-script.md
Last active May 7, 2021 14:12
wpt-script.md

An example of a webPageTest script

setEventName    Go to HomePage

navigate    https://monbraceletnato.fr

setEventName    Display category page

execAndWait document.querySelectorAll('.home-cta a')[1].click();
@Antoinebr
Antoinebr / event.js
Created July 30, 2019 18:37
event.js
gtag('event', 'purchase', {
"transaction_id": "24.031608523954162",
"affiliation": "Google online store",
"value": 23.07,
"currency": "USD",
"tax": 1.24,
"shipping": 0,
"items": [
{
"id": "P12345",