Skip to content

Instantly share code, notes, and snippets.

View Jedtek's full-sized avatar
🏠
Working from home

Jeddle Jedtek

🏠
Working from home
  • Me
  • Bristol, UK
View GitHub Profile
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:
{% 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 February 13, 2020 18:28
TradeGecko Webhook API Verification Node.js/Express.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 February 15, 2019 14:29
D3 example for livingthedream.fun post.
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]);