Skip to content

Instantly share code, notes, and snippets.

@cjameshill
cjameshill / calculations.js
Created February 8, 2024 09:18
7thHole-ShoppingCartCalculations
// Function to calculate the subtotal from an array of items
function calculateSubtotal(items) {
return items.reduce((total, item) => total + item.price * item.quantity, 0);
}
// Function to calculate sales tax
function calculateSalesTax(subtotal, taxRate = 0.07) {
return subtotal * taxRate;
}
@cjameshill
cjameshill / gtag.html
Created January 19, 2024 15:23
7thhole-gtag Analytics
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-LN1GP2529N"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-LN1GP2529N');
</script>
@cjameshill
cjameshill / gtag.html
Created December 22, 2023 16:12
nodnod Google Analytics
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-C3KDP7G1NR"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-C3KDP7G1NR');
</script>
@cjameshill
cjameshill / index.html
Created October 24, 2023 10:07
nodnod - Branch IO Header code
<script>
// load Branch
(function(b,r,a,n,c,h,_,s,d,k){if(!b[n]||!b[n]._q){for(;s<_.length;)c(h,_[s++]);d=r.createElement(a);d.async=1;d.src="https://cdn.branch.io/branch-latest.min.js";k=r.getElementsByTagName(a)[0];k.parentNode.insertBefore(d,k);b[n]=h}})(window,document,"script","branch",function(b,r){b[r]=function(){b._q.push([r,arguments])}},{_q:[],_v:1},"addListener applyCode autoAppIndex banner closeBanner closeJourney creditHistory credits data deepview deepviewCta first getCode init link logout redeem referrals removeListener sendSMS setBranchViewData setIdentity track validateCode trackCommerceEvent logEvent disableTracking".split(" "), 0);
// init Branch
branch.init('key_live_aumuCjVdnH2jeCxR6tL0wlcpECmXDybW');
</script>
@cjameshill
cjameshill / auth.guard.ts
Created August 2, 2023 11:12
Firebase App Check
import { Injectable, CanActivate, ExecutionContext } from "@nestjs/common";
import { ConfigService } from "@nestjs/config";
import { applicationDefault, initializeApp } from "firebase-admin/app";
import { getAuth } from "firebase-admin/auth";
import { getAppCheck } from "firebase-admin/app-check";
@Injectable()
export class AuthGuard implements CanActivate {
private app: any;
private auth: any;
@cjameshill
cjameshill / thelookout-gatag-dev.html
Created September 14, 2022 11:45
TheLookout - GA Tag - Development
<!-- HEAD -->
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-5LZR3Z9');</script>
<!-- End Google Tag Manager -->
<!-- END OF BODY -->
@cjameshill
cjameshill / thelookout-gatag-production.html
Created September 14, 2022 11:43
TheLookout - GA Tag - Production
<!-- HEAD -->
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-N7JKHSG');</script>
<!-- End Google Tag Manager -->
@cjameshill
cjameshill / sa-tracker-customermanager-header-code-prod.html
Last active September 7, 2023 14:12
StarAcademy - Customer Manager - Header Tracker Code - Prod
<script type="text/javascript">
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","https://engage.nolaedu.net/_t-cdn/aug2022/general/js/sp.js?v=3","snowplow"));
function ct(t){var a=document.head,n=document.createElement("script");n.type="text/javascript",n.src="https://engage.nolaedu.net/_t-cdn/aug2022/general/js/ct.js?v="+new Date().valueOf(),n.onreadystatechange=t,n.onload=t,a.appendChild(n)}
ct(function(){window._ce=new ClickEvent({aid: "customermanager-dashboard", a: "s6ZWr9ZwaB"});window._ce.t(function(c,n){console.table(n);console.log(String.fromCodePoint(0x1F525))
})});
</script>
@cjameshill
cjameshill / sa-tracker-customermanager-header-code-dev.html
Created September 13, 2022 13:24
StarAcademy - Customer Manager - Header Tracker Code - Dev
<script type="text/javascript">
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","https://devproxy.staracademyapp.com/_t-cdn/aug2022/general/js/sp.js?v=3","snowplow"));
function ct(t){var a=document.head,n=document.createElement("script");n.type="text/javascript",n.src="https://devproxy.staracademyapp.com/_t-cdn/aug2022/general/js/ct.js?v="+new Date().valueOf(),n.onreadystatechange=t,n.onload=t,a.appendChild(n)}
ct(function(){window._ce=new ClickEvent({aid: "nolaedv2-cmdashboard", a: "AQpiuG"});window._ce.t(function(c,n){console.table(n);console.log(String.fromCodePoint(0x1F525))
})});
</script>
@cjameshill
cjameshill / sa-tracker-header-code-prod.html
Created September 12, 2022 13:33
StarAcademy - Header Tracker Code - Prod
<script type="text/javascript">
;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","https://engage.nolaedu.net/_t-cdn/aug2022/general/js/sp.js?v=3","snowplow"));
function ct(t){var a=document.head,n=document.createElement("script");n.type="text/javascript",n.src="https://engage.nolaedu.net/_t-cdn/aug2022/general/js/ct.js?v="+new Date().valueOf(),n.onreadystatechange=t,n.onload=t,a.appendChild(n)}
ct(function(){window._ce=new ClickEvent({aid: "nolaedv2-webdashboard", a: "s6ZWr9ZwaB"});window._ce.t(function(c,n){console.table(n);console.log(String.fromCodePoint(0x1F525))
})});
</script>