Skip to content

Instantly share code, notes, and snippets.

View JMayfield's full-sized avatar

Jeff Mayfield JMayfield

View GitHub Profile
@JMayfield
JMayfield / es6-element-ready.js
Last active October 21, 2020 20:50 — forked from jwilson8767/es6-element-ready.js
Wait for an element to exist. ES6, Promise, MutationObserver
// MIT Licensed
// Author: jwilson8767
/**
* Waits for an element satisfying selector to exist, then resolves promise with the element.
* Useful for resolving race conditions.
*
* @param selector
* @returns {Promise}
*/

Slatify Shopify Theme Guide

A quick and dirty setup guide for "Slatifying" a Shopify theme for local development. Because I never remember this 💩.

Setup

  1. Create config.yml in the project root.
  2. Edit the config.yml by adding your store’s credentials to the development and production environments.
  3. For Slate v0 use Node Version Manager to install and use Node v8.11.1 in your project root. This may be the last version of Node compatible with Slate migrate? See issue here.

password: the password generated via a private app on this store. Access this information on your Shopify admin/apps/private page. theme_id: the unique id for the theme you want to write to when deploying to this store. You can find this information in the URL of the theme’s online editor at Shopify admin/themes. Alternatively, you can use "live" as shor

@JMayfield
JMayfield / wrapinsuperscript.js
Last active October 21, 2020 17:57
Wrap Registered Trademark Symbols in Superscript
var regexp = /[\xAE]/;
$('body :not(script,sup)').contents().filter(function() {
return this.nodeType === 3 && (regexp.test(this.nodeValue));
}).replaceWith(function() {
return this.nodeValue.replace(regexp, '<sup>$&</sup>');
});
@JMayfield
JMayfield / README-Template.md
Created July 30, 2019 23:44 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@JMayfield
JMayfield / .eslintrc.json
Last active July 2, 2019 23:46
ESLint, Prettier, Stylelint VSCode Setup
{
"extends": ["wesbos"],
"rules": {
"no-console": 2,
"prettier/prettier": [
"error",
{
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 120,
@JMayfield
JMayfield / gentle-jquery-scroll-event.js
Last active October 21, 2020 17:57
A gentle way to hook up to the jQuery scroll event while maintaining a reasonable frame-per-second scroll rate.
var scrolled = false;
$(window).scroll(scrollEvents);
function scrollEvents() {
scrolled = true;
}
setInterval(function() {
if(didScroll) {