Skip to content

Instantly share code, notes, and snippets.

View panoply's full-sized avatar
🥛
Rich in the hood

ΝΙΚΟΛΑΣ panoply

🥛
Rich in the hood
View GitHub Profile
@panoply
panoply / component.ts
Last active September 6, 2023 09:16
Shopify Size Charts
import { LiteralUnion } from 'type-fest';
import { Controller } from '@hotwired/stimulus';
import * as customer from 'application/customer';
export class Sizing extends Controller {
/**
* Stimulus Values
*/
static values = {
export interface BrowserContextSuggestions {
detected_values: {
/**
* An object informing of the the visitors country and 2 letter country code
*/
country: {
/**
* The 2 letter country code
*/
export interface IEndpoints {
/**
* Returns Ajax Cart
*/
get: '/cart.json',
/**
* Add a product to cart
*/
add: '/cart/add.js',
/**
@panoply
panoply / collection_carousel.liquid
Created May 7, 2021 15:46
Stimulus Shopify Sections Example
@panoply
panoply / zip.ts
Created April 26, 2023 13:47
Country Code to Accurate ZIP code (postcode) maps.
export default {
AD: 'AD501',
AE: '32222',
AF: '1001',
AG: '00000',
AI: '2640',
AL: '1001',
AM: '0001',
AO: '1001',
AR: '1010',
@panoply
panoply / auth.js
Last active April 12, 2023 15:04
Lambda Shopify OAUTH
import { config } from 'dotenv'
import Shopify from 'shopify-api-node'
import cryptographer from '@brixtol/cryptographer'
config()
export const crypto = cryptographer(process.env.SHOPIFY_AUTH_SECRET)
/**
* Request Headers
{% if type == 'heading' %}
<div class="col-12 mt-{{ block.mt }} mb-{{ block.mb }} tc">
<h1 class="mb-4">
{{ block.title }}
</h1>
<h4 class="my-3 fc-dark-gray italic uncase">
{{ block.subtitle }}
</h4>
<div class="{{ block.fs }} {{ block.ta }}">
import { LiteralUnion, AnyCase } from '@brixtol/tsutils';
import { CountryCodes } from '@brixtol/country-names';
export interface ICurrencies {
/** Andorra (Euro) */
AD: 'EUR',
/** United Arab Emirates (UAE Dirham) */
AE: 'AED',
/** Afghanistan (Afghani) */
AF: 'AFN',
var f=(e,t,r)=>new Promise((o,i)=>{var s=R=>{try{H(r.next(R))}catch(ge){i(ge)}},y=R=>{try{H(r.throw(R))}catch(ge){i(ge)}},H=R=>R.done?o(R.value):Promise.resolve(R.value).then(s,y);H((r=r.apply(e,t)).next())});var T=window.history,z=window.location.origin,He=Object.getOwnPropertyNames,E=Object.assign,c=Object.create,te=Array.isArray,S=Array.from,G="";function qe(e){let t=c(e);return t.targets=["body"],t.timeout=3e4,t.poll=15,t.schema="pjax",t.async=!0,t.cache=!0,t.reverse=!0,t.limit=50,t.preload=null,t.persist=!1,t.hover=c(null),t.hover.trigger="attribute",t.hover.threshold=250,t.intersect=c(null),t.intersect.rootMargin="0px 0px 0px 0px",t.intersect.threshold=0,t.proximity=c(null),t.proximity.distance=75,t.proximity.threshold=250,t.proximity.throttle=500,t.progress=c(null),t.progress.background="#111",t.progress.height="3px",t.progress.minimum=.8,t.progress.easing="linear",t.progress.speed=300,t.progress.trickle=!0,t.progress.threshold=350,t.progress.trickleSpeed=300,t}var n=qe(null),a=c(null),p=c(null),l=c(nu