Skip to content

Instantly share code, notes, and snippets.

View ajmalafif's full-sized avatar
💻

Ajmal Afif ajmalafif

💻
View GitHub Profile
# Admin API key goes here
KEY="[FIND ME IN THE ADMIN SETTINGS]"
# Split the key into ID and SECRET
TMPIFS=$IFS
IFS=':' read ID SECRET <<< "$KEY"
IFS=$TMPIFS
# Prepare header and payload
NOW=$(date +'%s')
@ajmalafif
ajmalafif / videoEmbed.js
Created November 17, 2021 15:06 — forked from bzerangue/videoEmbed.js
videoEmbed.js contentType - preview component for Sanity.io CMS richText PortableText editor - based off of Knut's YouTube Preview, https://www.youtube.com/watch?v=kLsER_zHiS4
import React from 'react'
const VideoEmbedPreview = ({ value }) => {
const url = value.url
const responsiveVideoContainer = {
padding: "56.25% 0 0 0",
position: "relative"
}
{% if fulfillment.fulfillment_line_items.count == item_count %}
{% capture shipment_name %}Your order is{% endcapture %}
{% elsif fulfillment.item_count > 1 %}
{% if fulfillment_status == 'fulfilled' %}
{% capture shipment_name %}The last items in your order are{% endcapture %}
{% else %}
{% capture shipment_name %}Some items in your order are{% endcapture %}
{% endif %}
{% else %}
{% if fulfillment_status == 'fulfilled' %}
<p>Hello {{ shop_name }},</p>
<p></p>
<p>{% if customer.name %}{{ customer.name }}{% else %}Someone{% endif %} placed a new order with you today, {{ date | date: "%b %d %I:%M%p" }}:</p>
<p></p>
<ul style="list-style-type:none">{% for line in line_items %}<li> <img src="{{ line | img_url: 'thumb' }}" /> {{ line.quantity }}x {{line.title }} (sku: {{ line.sku }})<br>{% for p in line.properties %}{% if p.first == "builder_id" or p.first == "builder_info" or p.first == "master_builder" or p.last == "" or p.first == "_ZapietId" %}{% else %}{{ p.first }}: {% if p.last contains '/uploads/' %}<a class="lightbox" href="{{ p.last }}">{{ p.last | split: '/' | last }}</a><br>{% else %}{{ p.last }}<br>{% endif %}{% endif %}{% endfor %}</li>{% endfor %}</ul>
<a href="{{ shop.url }}/admin/orders/{{ id }}">View order {{order_name}} </a>
{% if fulfillment_aborted %}
<p>The above order was not automatically fulfilled because it was flagged as suspicious.</p>{% endif %}
<p></p><br>
{% capture email_title %}Thank you for your purchase! {% endcapture %}
{% capture email_body %}Hi {{ customer.first_name }}, {% if attributes.Checkout-Method == "pickup" %}we're getting your order ready for collection.{% elsif attributes.Checkout-Method == "delivery" %}we're getting your order ready to be delivered. We will notify you when it has been sent.{% else %}we're getting your order ready to be shipped. We will notify you when it has been sent.{% endif %}{% endcapture %}
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{ email_title }}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" type="text/css" href="/assets/notifications/styles.css">
@ajmalafif
ajmalafif / dialog-script.html
Created January 19, 2020 04:39 — forked from patrikarvidsson/dialog-script.html
Intrusive GDPR-dialog script. Variables are used by Statamic, so you might need to define your own. Uses a11y-dialog, linked at the top.
<script src="https://cdn.jsdelivr.net/npm/[email protected]/a11y-dialog.min.js"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=ADD-ID-HERE"></script>
<script>
'use strict';
var cookieName = 'company-gdpr';
var redirect = '{{ gdpr_cta_decline_url }}'; // Redirect for decline
var expiration = {{ gdpr_expiry_time }}; // Expiration time in days
var animDuration = 200; // Animation duration in milliseconds
var animDelay = 1000; // Animation duration in milliseconds
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
@ajmalafif
ajmalafif / fetti.coffee
Created December 18, 2019 04:02 — forked from arronhunt/fetti.coffee
Confetti module for FramerJS
colors = ["#f23f3f", "#ff7f3b", "#f2c83f", "#3ac95c", "#4a95ff", "#ac59ff", "#ff8aed", "#3bbdca"]
fetti_bag = []
exports.kaboom = () ->
unless fetti_bag.length > 1
for i in [0..100]
fetti = new Layer
width: 20, height: 20
scale: Utils.randomNumber(0.75, 1.25)
#initial setup
#modules
{MapboxJS, CustomMarker, Marker, animateOnRoute} = require "mapbox-js/MapboxJS"
mapboxToken='your api key'
// Framer X Utils.modulate equivalent
function modulate(value, rangeA, rangeB, limit = false) {
const [fromLow, fromHigh] = rangeA;
const [toLow, toHigh] = rangeB;
const result = toLow + ((value - fromLow) / (fromHigh - fromLow)) * (toHigh - toLow);
if (limit === true) {
if (toLow < toHigh) {
if (result < toLow) {
return toLow;
# Getting data from the CoinMarketCap API
coins = JSON.parse Utils.domLoadDataSync 'https://api.coinmarketcap.com/v1/ticker/'
# Create a Scroll componnent, that will wrap all coinRows
list = new ScrollComponent
width: Screen.width
height: Screen.height
# Set the backgrond color for the scroll content
list.content.backgroundColor = '#FFFFFF'