Skip to content

Instantly share code, notes, and snippets.

View MikeIbberson's full-sized avatar
🏠
Working from home

Mike Ibberson MikeIbberson

🏠
Working from home
View GitHub Profile
@MikeIbberson
MikeIbberson / email-migration.js
Created April 18, 2023 14:06
How to migrate email templates from the local file system to the database
/**
* @NOTE
* Before v3, all Mailgun email templates belonged to a separate folder in the codebase.
* The templates were then compiled into HTML and uploaded via Mailgun's API. This made version control a pain in production.
* It also made previewing templates difficult.
*
* Later versions of Q3 offer an in-app email editor.
* To use this feature, you'll need to migrate your email templates from the file system to the database.
* You can write a script to accomplish this task.
*
@MikeIbberson
MikeIbberson / polyfill.js
Created April 18, 2023 14:03
Safari date inputs
function getAppRoot() {
return document.getElementById('___gatsby')
}
function withErrorSuppression(fn) {
return function() {
try { fn(); } catch (e) {}
}
}
@MikeIbberson
MikeIbberson / Q3-manifest-default.json
Last active February 6, 2022 16:26
Q3-manifest-default.json
{
"brand": "3merge",
"color": "#49ec1c",
"description": "Sample Q3 setup json",
"favicon": "https://avatars.githubusercontent.com/u/12897090?s=200&v=4",
"lng": "en",
"logo": "https://uploads-ssl.webflow.com/5f620c85bd4f6828cc8f637b/5f620cd411cb5e449a1db5cb_combined_logo_2-p-500.png",
"name": "Q3",
"resources": {
"descriptions": {
@MikeIbberson
MikeIbberson / .prettierrc
Created September 16, 2019 13:02
Prettier config
{
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "always",
"printWidth": 60,
"proseWrap": "always",
"quoteProps": "preserve"
}
@MikeIbberson
MikeIbberson / mongoid-scalar.js
Created March 18, 2019 18:29
GraphQL scalar for converting strings into MongoID objects.
import { GraphQLScalarType } from 'graphql';
import { Kind } from 'graphql/language';
import { ObjectId } from 'mongodb';
export default new GraphQLScalarType({
name: 'ID',
description: 'MongoDB ObjectID string type',
serialize: value => value.toString(),
parseValue: value => ObjectId(value),