Skip to content

Instantly share code, notes, and snippets.

View conorbarclay's full-sized avatar

Conor Barclay conorbarclay

View GitHub Profile
/**
* Middleware to check a user token
* @param {Object} req Express request object
* @param {Object} res Express response object
* @param {Function} next Express response object
*/
function authCheck(req, res, next) {
const token = req.signedCookies.token
if (token && token !== 'null') {
@conorbarclay
conorbarclay / wp_auto_install.sh
Created September 25, 2019 16:01 — forked from nicomollet/wp_auto_install.sh
WP-CLI auto install script
#!/bin/bash
# Default options
LOCALE="fr_FR"
DB_HOST='localhost'
VIRUSTOTAL_KEY='YOUR_KEY'
printf "Name of the project? cf My Project: "
read PROJECT_NAME
@conorbarclay
conorbarclay / hny-disable-acf-on-frontend.php
Last active July 26, 2019 19:28 — forked from billerickson/be-disable-acf-frontend.php
A forked and modified version of Bill Erickson's "Disable ACF Frontend" MU plugin that adds some extra checks for front-end requests.
<?php
/**
* Plugin Name: Disable ACF on Front-End
* Description: Provides a performance boost if ACF front-end functions aren't being used.
* Version: 1.0
* Author: Honeycomb Creative
* Author URI: https://www.billerickson.net/code/disable-acf-frontend/
* License: MIT
* License URI: http://www.opensource.org/licenses/mit-license.php
*/
@conorbarclay
conorbarclay / GoogleMap.js
Last active August 19, 2018 07:41
WordPress + Google Map Workflow (using ACF field data)
/* global google */
import $ from 'jquery';
class GoogleMap {
constructor(el) {
this.el = $(el);
this.icon = {
path: 'M25,0C15.957,0,8.625,7.277,8.625,16.253C8.625,31.638,25,50,25,50s16.375-17.37,16.375-33.747 C41.375,7.277,34.044,0,25,0z M25,23.084c-3.383,0-6.125-2.742-6.125-6.125s2.742-6.125,6.125-6.125s6.125,2.742,6.125,6.125 S28.383,23.084,25,23.084z',
fillColor: '#ed1c2e',
fillOpacity: 1,
@conorbarclay
conorbarclay / navScroll.js
Last active February 1, 2018 22:15
Adds a class to hide the nav at a specific scrollDelta, add class to show it upon beginning to scroll back up again.
import $ from 'jquery';
export default {
collapseScrollTolerance: 100,
direction: 1,
scrolled: 0,
header: '.js-site-header',
init() {
this.header = $(this.header);
@conorbarclay
conorbarclay / wp-nested-tax-cpt-loop.php
Created November 3, 2017 19:47
WordPress nested taxonomy + custom post type loop example
<?php
$post_type = 'post_type';
$taxonomy = 'taxonomy';
$terms = get_terms( $taxonomy );
?>
<?php
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
foreach ( $terms as $term ) { ?>
@conorbarclay
conorbarclay / _print.scss
Created August 18, 2017 20:56
Starter print-friendly SCSS partial
@media print {
* {
&:before,
&:after {
background: transparent !important;
color: $black !important; // Black prints faster
text-shadow: none !important;
box-shadow: none !important;
}
}