Skip to content

Instantly share code, notes, and snippets.

View ajmalafif's full-sized avatar
💻

Ajmal Afif ajmalafif

💻
View GitHub Profile
@ajmalafif
ajmalafif / wget.sh
Created November 16, 2018 02:55
wget
wget \
--page-requisites \
--html-extension \
--convert-links \
--no-parent \
--no-check-certificate \
--recursive \
https://example.com/
<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>
https://dev.to/amanhimself/setup-macbook-m1-for-web-and-react-native-development-8la
@ajmalafif
ajmalafif / gatsby-config.js
Last active January 12, 2021 09:32
single rss.xml from 2 sources (MDX & Sanity.io)
// 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 January 5, 2021 12:31
Algolia + Sanity.io + Gatsby queries
const escapeStringRegexp = require("escape-string-regexp")
// const pagePath = `content`
// const indexName = `Pages`
const pageQuery = `{
pages: allMdx {
edges {
node {
id
{% 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 / pg.md
Last active March 23, 2020 04:15
[pg] — Fix Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"

Problem

Postgres

Is the server running locally 
and accepting connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

Solution