Skip to content

Instantly share code, notes, and snippets.

/*
A tiny little hacked-together class to overload Serial.write to output hex to serial monitor, useful for debugging binary data e.g. protobufs
Usage, e.g. for debugging a nanopb stream wrapped by PacketIO:
packetio::COBSPrint cobs_out(hex_print);
pb_ostream_s pb_out = as_pb_ostream(cobs_out);
or for raw nanopb:
// first copy the uploaders and insert them into the table without their existing id, and with the new shop_id
oldshopify = new Shopify({
shopName: oldshop.get('myshopify_name'),
accessToken: oldshop.get('shopify_token'),
autoLimit: true
})
shopify = new Shopify({
shopName: newshop.get('myshopify_name'),
.lum-lightbox-position-helper:before {
content: '\00d7';
color: white;
position: absolute;
top: 0;
right: 0;
z-index: 100;
font-size: 50px;
line-height: 32px;
font-weight: bold;
@tobymarsden
tobymarsden / gist:96dc6d98b0d877c085a1b139709056ca
Created July 12, 2020 22:12
Hypervisual find in-stock variant in embed
window.HYPERVISUAL_CALLBACKS = window.HYPERVISUAL_CALLBACKS || {}
window.HYPERVISUAL_CALLBACKS.afterProductEmbed = function() {
var foundInStock = false
var variant
var data = JSON.parse(this.dataset.productJson)
for(var i = 0; i < data.variants.length; i++) {
variant = data.variants[i]
if(variant.available && !foundInStock) {
var option1 = this.querySelector('.hypervisual__embed_product-option-select[data-option-handle=option1')
if(option1) {
@tobymarsden
tobymarsden / gist:b157bb5c7033f93de9403d51bab1bc19
Last active June 9, 2021 14:13
product.hypervisual-data.liquid
{% layout none %}
{ "product": {
{% if product != blank %}
"active_currency": "{{cart.currency.iso_code }}",
"id": {{product.id | json}},
"title": {{product.title | json}},
"vendor": {{product.vendor | json}},
"handle": {{product.handle | json}},
"featured_image": {{product.featured_image | json }},
"variants": [{% for variant in product.variants %}{
@tobymarsden
tobymarsden / gist:19a12f1d719ef5b4fd573a064baafca3
Created June 11, 2020 20:55
collection/hypervisual-data.liquid
{% layout none %}
{% paginate collection.products by 50 %}
{ "products": [{% for product in collection.products %}
{
{% if product != blank %}
"active_currency": "{{cart.currency.iso_code }}",
"id": {{product.id | json}},
"title": {{product.title | json}},
"vendor": {{product.vendor | json}},
"handle": {{product.handle | json}},
const Dropbox = require('dropbox').Dropbox
const fetch = require('isomorphic-fetch')
// var filePath = ...
// var sourceUrl = ...
var api = new Dropbox({
fetch,
accessToken: shop.get('dropbox_access_token')
})
<!-- Winter Breeze -->
<!-- Common Base Styling -->
{% assign primary_font = "Work Sans"%}
{% assign primary_font_color = "#000000" %} <!-- Black text color -->
{% assign primary_font_size = "13px"%}
{% assign secondary_font = "Work Sans"%}
{% assign secondary_font_color = "#333333" %} <!-- Grey text color -->
{% assign theme_color = "#4b3775"%}
<script type="text/javascript">
var font1Id = 'font-{{ primary_font | replace: " ", "-" }}';
This file has been truncated, but you can view the full file.
/pages/brain-participant-resource-page
==========
<div class="hypervisual__version hypervisual__version-original" id="hypervisual__version-original" style="visibility: visible;">
<div style="color: #365577; background-color: #ffffff; text-align: left;" class="hypervisual__content-block hypervisual__content-block--text hypervisual__devices-mobile-only hypervisual__text-middle hypervisual__text-align-left no-underline a" id="">
<!----> <div class="hypervisual__text-wrapper" style="max-width: 1200px; padding-top: 10px; padding-bottom: 10px;">
<!----><!----><h3 class="hypervisual__text_line_one hypervisual__text-xlarge" style="color: #365577;"> <div><strong>Live Clinicals™</strong></div>
</h3><!----><!----><!---->
<!----><!----><!----><!----><!----><div class="hypervisual__text_line_two hypervisual__text-medium" style="color: #365577;"> <div><a href="https://nutrientfoods.com/pages/abstracts"><strong>Scientific Outcomes</strong></a><strong><br></strong><a href="https://nutrientfoods.com/pages/o
@tobymarsden
tobymarsden / routes.js
Created May 8, 2020 12:42
widgets/routes.js
const router = require('koa-router')();
const knex = require('config/db').knex;
const Widget = require('widgets/model');
const actions = require('actions');
const requireCurrentShop = require('middleware/require-current-shop');
const setupShopifyApi = require('middleware/setup-shopify-api');
const JSONAPISerializer = require('jsonapi-serializer').Serializer;
const serializeErrors = require('actions/errors').serializeErrors;
/**