{
createdAt: DateTime, // ISO 8601
orderId: string,
lineItems: [
{
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get all of the tags and their fontsize, | |
* as well as the breakpoints for a given site | |
*/ | |
function run() { | |
// Tags to check, add any tags you like to the list | |
const tags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'input', 'a']; | |
// An object to store our fontsizes in | |
const dict = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react'; | |
import axios from 'axios'; | |
export default () => { | |
const [image, setImage] = useState(null); | |
const [error, setError] = useState(null); | |
const onSubmit = async (e) => { | |
e.preventDefault(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fastify,{ FastifyInstance } from "fastify"; | |
import cors from "fastify-cors"; | |
import multipart from "fastify-multipart"; | |
import { FastifyInstance } from "fastify"; | |
import cloudinary from "cloudinary"; | |
import { Server, IncomingMessage, ServerResponse } from "http"; | |
const server: FastifyInstance< | |
Server, | |
IncomingMessage, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from "fs"; | |
const readFileToString = (path: string): Promise<string | undefined> => | |
new Promise((res, rej) => | |
fs.readFile(path, (err, data) => { | |
if (err) return rej(err); | |
res(data?.toString()); | |
}), | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from "fs"; | |
const convertNDJSONtoJSON = | |
(ndjsonPath: string, jsonOutputPath: string) => async () => { | |
const data = await new Promise((res, rej) => { | |
const dataNDJSON: any[] = []; | |
const stream = fs.createReadStream(ndjsonPath).pipe(ndjson.parse()); | |
stream.on("data", (obj: any) => dataNDJSON.push(obj)); | |
stream.on("end", () => res(dataNDJSON)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fetch from "node-fetch" | |
import sanityClient from "@sanity/client" | |
import * as fs from "fs" | |
import { fetchAPI } from "./fetchApi" | |
import gql from "graphql-tag" | |
const API_URL = "[add yours here]" | |
export async function fetchAPI(query, { variables = null } = {}) { | |
const QUERY = typeof query === "string" ? query : query?.loc.source.body |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Product Variant Metafields | |
namespace: mayple_inventory | |
key: is_available | |
# Product Page Sample Sold Out Message | |
{%- if product.selected_or_first_available_variant.metafields.mayple_inventory.is_available != true and localization.country.iso_code != 'US' -%} | |
{{ 'products.product.sold_out' | t }} | |
{%- elsif product.selected_or_first_available_variant.available -%} | |
{{ 'products.product.add_to_cart' | t }} | |
{%- else -%} |