Skip to content

Instantly share code, notes, and snippets.

View blixxurd's full-sized avatar
🔋
Loading...

Aaron Bartholomew blixxurd

🔋
Loading...
View GitHub Profile
@blixxurd
blixxurd / RedisController.js
Created February 7, 2022 20:22
Redis Controller for keeping track of URLs. Converts methods to promises.
const redis = require('redis');
class RedisController {
constructor(set, redisConfig = {}) {
this.set = set;
this.client = redis.createClient(redisConfig);
}
keyExists(url) {
@blixxurd
blixxurd / ApplicationStore.js
Last active January 21, 2021 18:23
Vue3 Store
import { reactive } from 'vue';
function ApplicationStore(app) {
const store = {
state: reactive({
// Add new store fields here
totalCents: 100,
}),
// Methods to act on the store
@blixxurd
blixxurd / vitals-snippet.html
Last active February 8, 2021 18:38
Implementation of PolyVitals
<!-- Add right before </body> -->
<!-- PolyVitals Start -->
<script src="https://d1y9rhsa9a8h4o.cloudfront.net/polyvitals-1.0.5.min.js"></script>
<script>
if(typeof window.PolyVitals !== 'undefined') {
window.PolyVitals.init();
window.addEventListener('DOMContentLoaded', function() {
try {
window.PolyVitals.report();
} catch(e) {
// Our original Code
var variant = {{ current_variant | json }};
if (variant){
var fields = JSON.parse('{{ product.metafields.decify | json }}');
if(typeof fields[variant.id] !== 'undefined') {
console.log("Variant found, using custom URL.");
document.getElementById("customize-btn").href = fields[variant.id];
}
}