Skip to content

Instantly share code, notes, and snippets.

Avatar
💻

Ajmal Afif ajmalafif

💻
View GitHub Profile
@ajmalafif
ajmalafif / tokens.json
Last active Feb 7, 2022
Figma Tokens for Tailwind v3.0.18 by Luis Falcon
View tokens.json
{
"black": {
"value": "#000000",
"type": "color"
},
"white": {
"value": "#ffffff",
"type": "color"
},
"slate": {
@ajmalafif
ajmalafif / videoEmbed.js
Created Nov 17, 2021 — 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
View videoEmbed.js
import React from 'react'
const VideoEmbedPreview = ({ value }) => {
const url = value.url
const responsiveVideoContainer = {
padding: "56.25% 0 0 0",
position: "relative"
}
@ajmalafif
ajmalafif / gatsby-node.js
Last active Oct 16, 2021
Related Reviews/Posts with Sanity.io and GatsbyJS 3.0
View gatsby-node.js
//Hook into the createSchemaCustomization API
//This hook runs after all our nodes have been created
exports.createSchemaCustomization = ({ actions, schema }) => {
//The createTypes action allows us to create custom types
//and modify existing ones
const { createTypes } = actions
// Create our schema customizations
const typeDefs = [
// Replace "SanityReview" with your _typename of your post type
View gist:436a449406a45919ae8a46fb5b36847a
<div tw="md:w-full">
<div
tw="md:mx-8 md:mx-auto md:grid md:grid-cols-1 md:grid-cols-2 md:font-serif md:border-b"
css={{
width: 'min(100ch, calc(100% - 64px))',
gridRowGap: 8,
}}
>
</div>
</div>
View gist:3b9a53b68d619be9b77b7b32be8758c1
https://dev.to/amanhimself/setup-macbook-m1-for-web-and-react-native-development-8la
@ajmalafif
ajmalafif / gatsby-config.js
Last active Jan 12, 2021
single rss.xml from 2 sources (MDX & Sanity.io)
View gatsby-config.js
// Load variables from `.env` as soon as possible
require('dotenv').config({
path: `.env.${process.env.NODE_ENV || 'development'}`
})
const clientConfig = require('./client-config')
const isProd = process.env.NODE_ENV === 'production'
// Portable Text Serialization
const PortableText = require("@sanity/block-content-to-html")
@ajmalafif
ajmalafif / algolia-queries.js
Created Jan 5, 2021
Algolia + Sanity.io + Gatsby queries
View algolia-queries.js
const escapeStringRegexp = require("escape-string-regexp")
// const pagePath = `content`
// const indexName = `Pages`
const pageQuery = `{
pages: allMdx {
edges {
node {
id
View shipping-confirmation-template.liquid
{% 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' %}
View new-order-template.liquid
<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>