Skip to content

Instantly share code, notes, and snippets.

View madoublet's full-sized avatar

Matthew Smith madoublet

View GitHub Profile
@madoublet
madoublet / gist:ca4220de8ccc56e53555d043129bfac0
Created July 29, 2025 13:49
Wrap GraphAPI Client so you can use it like admin.graphql
import { createAdminApiClient } from '@shopify/admin-api-client';
// wrap graph API client so you can use it like admin.graphql
async function query(operation, options) {
const client = createAdminApiClient({
storeDomain: `${shop}.myshopify.com`,
apiVersion: '2023-04',
accessToken: token,
});
/*
* Get Subscription status
*/
async function getSubscriptionStatus(shop, accessToken) {
// create a new client
const client = new Shopify.Clients.Graphql(shop, accessToken);
try {
// return the products, see https://shopify.dev/docs/api/admin-graphql/2024-01/objects/AppSubscription
/*
* Stages a file for upload
*/
router.post('/file/stage', async (ctx, next) => {
let params = ctx.request.body, obj = {};
// decode jwt
let decoded = jwt.read(ctx.request.header.authorization);
{% comment %}
© Sections Pro. You are free to use this section in your store. You may not redistribute this section in another Shopify app.
{% endcomment %}
{% assign short_id = section.id | slice: -3, 3 %}
<style>
:root {
--sp-clip-{{ short_id }}: {{ section.settings.start_percent }}%;
@madoublet
madoublet / gist:19fa4c8f13363c05abe4f48b0a46bc7b
Created December 3, 2024 00:36
Circle Menu with Lazy Loaded Background Image
{% comment %}
© Sections Pro. You are free to use this section in your store. You may not redistribute this section in another Shopify app.
{% endcomment %}
<style>
{%- capture sp_content -%}
{% if section.settings.override_fonts %}
@madoublet
madoublet / profit-pages.liquid
Last active November 30, 2024 03:48
Profit Pages Long Term Support Section
<style>:root{--pb-section-width:1000px;--pb-table-padding-vertical:7.5px;--pb-table-padding-horizontal:7.5px}:root.pb-dark{--pb-headline-color:#fff;--pb-text-color:#fff;--pb-link-color:#40AADF;--pb-tab-active-color:#fff;--pb-tab-inactive-color:#f0f0f0;--pb-tab-border-color:#f0f0f0;--pb-section-margin-bottom:25px;--pb-element-margin-bottom:15px;--pb-section-background-color:transparent;--pb-section-featured-background-color:#37465B;--pb-divider-color:#fff;--pb-primary-button-border-color:#555;--pb-primary-button-color:#fff;--pb-primary-button-background-color:#111;--pb-secondary-button-color:#111;--pb-secondary-button-background-color:#fff;--pb-secondary-button-border-color:#111;--pb-table-table-head-background-color:#f8f8f8;--pb-table-table-alt-background-color:#f8f8f8;--pb-shadow-color:#333;--pb-shadow-hover-color:#555;--pb-selector-color:#f0f0f0;--pb-sticky-background-color:#888;--pb-card-background-color:#111;--pb-hero-background-color:#111;--pb-featured-background-color:#011B47}body .pagebuilder-hero-bloc
@madoublet
madoublet / full-block.liquid
Created November 29, 2024 16:00
Profit Pages Backwards Compatibility
<style>{{ shop.metafields.pagebuilder.styles }}</style>
<script>document.documentElement.classList.add("{{ shop.metafields.pagebuilder.theme }}");</script>
<!-- profitpages template: {{ template.name }} content source: {{ block.settings.content_source }} -->
{% if block.settings.content_source == "shared" %}
{% if template.name == "page" %}
{{ shop.metafields.pagebuilder.page_content }}
{% endif %}
{% if template.name == "product" %}
import fetch from 'node-fetch';
// prod
var accessToken = ``;
var shop = ``;
var subscriptionId = ``;
console.log(`Removing subscription for ${shop}...`);
(async () => {
@madoublet
madoublet / app-vitals.css
Created October 26, 2024 02:53
Shopify Remix App Vitals
.app-vitals {
position: fixed;
left: calc(50% - 250px);
bottom: 5px;
width: 500px;
background-color: #111;
color: #fff;
padding: 5px;
border-radius: 5px;
font-size: 11px;
@madoublet
madoublet / create-section-docs.mjs
Created August 17, 2024 16:01
An example of how to create 11ty docs using Shopify section liquid code
import OpenAI from "openai";
import Configuration from "openai";
import * as fs from 'node:fs';
/*
* Configs
*/
const configuration = new Configuration({
apiKey: `API_KEY`
});