Skip to content

Instantly share code, notes, and snippets.

View mindmergedesign's full-sized avatar

Juan Giraldo mindmergedesign

View GitHub Profile
@bacalj
bacalj / send-email.js
Created April 2, 2022 18:32
Netlify's Example Nodemailer Function, thanks Netlify CLI
// with thanks to https://github.com/Urigo/graphql-modules/blob/8cb2fd7d9938a856f83e4eee2081384533771904/website/lambda/contact.js
const process = require('process')
const { promisify } = require('util')
const sendMailLib = require('sendmail')
const { validateEmail, validateLength } = require('./validations')
const sendMail = promisify(sendMailLib())
@gillkyle
gillkyle / chakra-skeleton-loader.jsx
Created July 31, 2021 22:33
Pass a status prop, if loading, render the skeleton, when loaded, the children.
import * as React from 'react'
import { Skeleton } from '@chakra-ui/react'
export default function SkeletonLoader({ skeletonProps, status, children }) {
if (status === 'loading')
return <Skeleton height="100%" width="100%" {...skeletonProps} />
if (status === 'error') return null
return children
}
@gragland
gragland / stripe-webhook.js
Last active January 18, 2024 22:20
Next.js Stripe Webhook from divjoy.com
const getRawBody = require("raw-body");
const { updateUserByCustomerId } = require("./_db.js");
const stripe = require("stripe")(process.env.STRIPE_SECRET_KEY, {
apiVersion: process.env.STRIPE_API_VERSION,
});
// Disable next.js body parsing (stripe needs the raw body to validate the event)
export const config = {
api: {

Add Authentication with Auth0 to a Gatsby site

All the pieces of authentication are possible in Gatsby. Thanks to Auth0, setting it up doesn't have to be so cumbersome!

This setup comes straight from Auth0's official quick start for React.


The first step is installing the official Auth0 SDK for React from npm.

@bzerangue
bzerangue / videoEmbed.js
Last active November 17, 2021 15:06
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"
}
@kmelve
kmelve / Image.css
Created October 11, 2019 15:07
Lazyload Images from Sanity.io
.root {
display: block;
position: relative;
}
.lqip {
image-rendering: pixelated;
width: 100%;
opacity: 1;
transition: opacity 50ms 100ms ease-out;
@thetrevorharmon
thetrevorharmon / example-form.tsx
Last active April 5, 2021 19:30
Gatsby Mailchimp Signup Form
import addToMailchimp from 'gatsby-plugin-mailchimp';
import React, { useState } from 'react';
import * as styles from './EmailListForm.module.scss';
const EmailListForm: React.FunctionComponent<{}> = () => {
const [email, setEmail] = useState('');
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
@jackmcdade
jackmcdade / utilities.less
Created August 22, 2018 19:48
My Tailwind Utilties
/* Blend Modes
========================================================================== */
.mix-overlay { mix-blend-mode: overlay; }
.mix-multiply { mix-blend-mode: multiply; }
.mix-screen { mix-blend-mode: screen; }
.mix-lighten { mix-blend-mode: lighten; }
.mix-soft-light { mix-blend-mode: soft-light; }
.mix-difference { mix-blend-mode: difference; }
.mix-color { mix-blend-mode: color; }
**Jeff Escalante**
# Dato & Contentful
There are many areas in which I'd consider Dato to be much stronger of a CMS than
contentful, and one in which I'd consider the opposite to be the case. I will try to be as
balanced as possible with this overview, as I am not employed by dato or anything ‐ my
goal is to ensure that my clients and developers get the best possible experience working
with a CMS.
@bgarrant
bgarrant / Automatic-Sitemap-XML-Generator-for-Statamic-CMS-Pages-and-Mounted-Collections.md
Last active July 28, 2020 17:02
Automatic Sitemap XML Generator for Statamic CMS Pages and Mounted Collections

How to automatically generate a Sitemap XML file using Statamic CMS.

This method will work for all Pages and Mounted Collections (just like Pages view in CP).

  1. Create a template called sitemap.html and add it to your theme/layouts/ folder.
  2. Add the following code to the new template
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{{ nav from="/" include_home="true" include_entries="true" exclude="our-team" }}