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
/*------------------------ | |
Libraries | |
------------------------*/ | |
const axios = require("axios"); | |
const fs = require("fs"); | |
const FormData = require("form-data"); | |
/*------------------------ | |
Download the file. | |
Good article on how to download a file and send with form data - https://maximorlov.com/send-a-file-with-axios-in-nodejs/ |
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
const BRAND_NAME = 'Lorem Ipsum' | |
export function gtmProduct(product, variant) { | |
return { | |
name: product.title, | |
id: variant.sku, | |
price: parseFloat(variant.price), | |
variant: variant.title, | |
brand: BRAND_NAME, | |
category: 'All', |
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
<template> | |
<div class="m:fix m:fill m:f aic whiskey__wrap"> | |
<div class="scroll-element m:nowrap wct m:f aic pt130 m:pt0" ref="scrollElement"> | |
<ul class="whiskey l y m:f aic"> | |
<li | |
v-for="(item, i) in page.whiskey_listing" | |
:key="`${item.uid}-${i}`" | |
class="rel y mb90 m:mb0" | |
> | |
<n-link |
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
// just the shortcodes you'll need in eleventy config | |
const cx = require('nanoclass') | |
const imageUrlBuilder = require('@sanity/image-url') | |
const sanityClient = require('./util/sanityClient') | |
const builder = imageUrlBuilder(sanityClient) | |
function urlFor(image, width, height) { | |
if (width) { | |
if (height) { | |
return builder |
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 12 most recent instagram thumbnails from a public account | |
* resolution = 0 - 4 | |
* 0 => 150 | |
* 1 => 240 | |
* 2 => 320 | |
* 3 => 480 | |
* 4 => 640 | |
*/ | |
export default function(username, resolution = 4) { | |
return fetch(`https://www.instagram.com/${username}/?__a=1`) |
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, useEffect, useContext } from "react"; | |
import { Checkout } from "shopify-storefront-api-typings"; | |
import Client from "shopify-buy"; | |
const SHOPIFY_CHECKOUT_STORAGE_KEY = "shopify_checkout_id"; | |
const storefrontAccessToken = process.env.GASTBY_SHOPIFY_ACCESS_TOKEN as string; | |
const client = Client.buildClient({ | |
storefrontAccessToken, |
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 from "react"; | |
import PropTypes from "prop-types"; | |
import { has } from "lodash"; | |
import PatchEvent, { set, unset } from "part:@sanity/form-builder/patch-event"; | |
import ReferenceInput from "@sanity/form-builder/lib/inputs/ReferenceInput"; | |
import { withDocument } from "part:@sanity/form-builder"; | |
import { map } from "rxjs/operators"; | |
import client from "part:@sanity/base/client"; | |
import { createWeightedSearch } from "../../utils/search"; | |
import { observeForPreview } from "part:@sanity/base/preview"; |
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, { Component, Fragment } from 'react' | |
import { BlockEditor } from 'part:@sanity/form-builder' | |
import Switch from 'part:@sanity/components/toggles/switch' | |
import css from './BlockEditor.module.css' | |
import { handlePaste } from './handlePaste' | |
export default class CustomEditor extends Component { | |
state = { | |
customPaste: false | |
} |
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
/* | |
home.js | |
-- | |
This script takes the JSON data from the home page for posts and tweets and | |
randomly displays them into a randomly selected template which is then | |
Variables from Home HTML: |
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
const sanity = require('@sanity/client') | |
const fs = require('fs') | |
const EOL = require('os').EOL | |
const flatMap = require('lodash.flatmap') | |
const { subDays, isBefore } = require('date-fns') | |
const sanityExport = require('@sanity/export') | |
/** | |
* @param context {WebtaskContext} | |
*/ |
NewerOlder