Skip to content

Instantly share code, notes, and snippets.

@jonshipman
jonshipman / docker-compose.yml
Created March 11, 2021 16:19
WordPress Docker-compose
version: '3.7'
services:
db:
image: mariadb:10.1.41
restart: always
environment:
MYSQL_DATABASE: WORDPRESS
MYSQL_USER: WORDPRESS
MYSQL_PASSWORD: WORDPRESS
@jonshipman
jonshipman / thememods-gql.php
Last active November 19, 2020 15:54
Adds themeMods to WP-Graphql
<?php
/**
* Registers the field ThemeMod
*
* @return void
*/
function gql_theme_mod() {
$_mods = get_theme_mods();
$config = array();
const keyGeneration = ({ loading, value }) => {
return loading
? `loading-${value}-${new Date().getTime()}`
: `loaded-${value}-${new Date().getTime()}`;
};
const Select = forwardRef(function Select(
{
id,
label,
@jonshipman
jonshipman / Animate.js
Last active June 5, 2020 15:32
Animate React Component
import React, { Component, createRef } from 'react';
class _sharedScrollHandler {
functions = []
attached = false;
constructor() {
this.boundHandler = this.handleScroll.bind(this);
this.addFun = this.add.bind(this);
this.removeFun = this.remove.bind(this);
@jonshipman
jonshipman / ScrollToTop.js
Created May 27, 2020 16:25
Scroll to top on internal navigation | React Component
// React Component
// Navigation within app will scroll to top.
import { Component } from 'react';
import { withRouter } from 'react-router-dom';
class ScrollToTop extends Component {
componentDidUpdate(prevProps) {
if (this.props.location !== prevProps.location) {
window.scrollTo(0, 0);