Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Jedtek

🏠
Working from home
View GitHub Profile
View gist:6ee7b2e557d498be2bee542a1c186ff8
inside template {{#items}} loop I do this:
<div class="grid--full display-table">
<div class="grid__item">
{{{retNextDiscount itemQty properties }}}
</div>
</div>
helper in Custom Javascript is this:
View is-admin.liquid
{% comment %}
We use the content_for_header and capture it and if it contains certain JS listener for the Shopify preview bar then it will be a staff member whos logged in.
Please only include it once per page, as it takes a little performance hit to search the entire CFH capture.
Test the variable like { % if isAdmin %} and use it to re-direct or whatever you'd like. (Remove the extra space)
There is a default re-direct away to the homepage for these themes for now, this can be changed in a later version to be an argument.
- Jed V. Jan 2020 <root@livingthedream.fun>
@Jedtek
Jedtek / tgwv.js
Last active Feb 13, 2020
TradeGecko Webhook API Verification Node.js/Express.js
View tgwv.js
const express = require('express');
const getRawBody = require('raw-body');
const crypto = require('crypto');
const tradeGeckoSecretKey = '';
async function verifyTradeGeckoWebhook(req, body) {
const hmac = req.get('X-Gecko-Signature');
const hash = crypto
.createHmac('sha256', tradeGeckoSecretKey)
@Jedtek
Jedtek / app.js
Created Feb 15, 2019
D3 example for livingthedream.fun post.
View app.js
document.addEventListener('DOMContentLoaded', function(){ // Just make sure DOM is ready.
// Padding, width & height for SVG element - used to calculate everything else.
var padding = 40;
var width = 700;
var height = 700;
// Setup scales for X, Y position, colour & radius of points.
var yScale = d3.scaleLinear()
.domain(d3.extent(regionData, d => d.subscribersPer100))
.range([height - padding, padding]);