Skip to content

Instantly share code, notes, and snippets.

View chuckreynolds's full-sized avatar
🤖
building things

Chuck Reynolds chuckreynolds

🤖
building things
View GitHub Profile
@thomasgriffin
thomasgriffin / api-helper.php
Last active March 13, 2019 13:46
API Helper to be used during API requests. Should be used as a must-use plugin in WordPress.
<?php
/**
* Plugin Name: TGM API Helper
* Plugin URI: https://thomasgriffin.io
* Description: Whitelists the plugins to be loaded during API requests to reduce overhead.
* Author: Thomas Griffin
* Author URI: https://thomasgriffin.io
* Version: 1.0.0
*/

Git Cheat Sheet

Commands

Getting Started

git init

or

@fjarrett
fjarrett / gist:0fa79273bd879f7ab6b3
Last active September 3, 2021 20:19
Prevent Concurrent Logins
<?php
/**
* Detect if the current user has concurrent sessions
*
* @return bool
*/
function pcl_user_has_concurrent_sessions() {
return ( is_user_logged_in() && count( wp_get_all_sessions() ) > 1 );
}
@zoerooney
zoerooney / page-shopify.php
Last active April 3, 2020 12:44
Shopify Collection Embedded in WordPress
<?php
/**
* Template Name: Shopify Collection Demo
*
*/
get_header(); ?>
<div id="primary" class="full-width">
@markjaquith
markjaquith / nginx.conf
Last active December 25, 2022 15:55
My WordPress Nginx setup
upstream phpfpm {
server unix:/var/run/php5-fpm.sock;
}
upstream hhvm {
server unix:/var/run/hhvm/hhvm.sock;
}
# SSL
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
@norcross
norcross / bypass-auto-update-email.php
Last active August 29, 2015 14:04
Disable the email notification for successful update
<?php
function rkv_bypass_auto_update_email( $send, $type, $core_update, $result ) {
// check our type and bail if successful
if ( ! empty( $type ) && $type == 'success' ) {
return false;
}
// return the send function
return true;
@norcross
norcross / filter-pages-admin-link.php
Last active August 29, 2015 14:04
change default 'pages' link to show only published
@hdragomir
hdragomir / sm-annotated.html
Last active March 5, 2024 08:57
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@pippinsplugins
pippinsplugins / gist:11402562
Last active December 15, 2021 17:07
Custom user fields for Restrict Content Pro
<?php
/*
Plugin Name: Restrict Content Pro - Custom User Fields
Description: Illustrates how to add custom user fields to the Restrict Content Pro registration form that can also be edited by the site admins
Version: 1.0
Author: Pippin Williamson
Author URI: http://pippinsplugins.com
Contributors: mordauk
*/
@chuckreynolds
chuckreynolds / permissions.sh
Created April 24, 2014 10:46
permissions.sh shell script for WordPress installs to set file and directory permissions and ownership. Change the path to fit your install. Make sure to 'chmod 700 permissions.sh' before using './permissions.sh' to run it.
#!/bin/bash
find /var/www/public -type d -exec chmod 755 {} +
find /var/www/public -type f -exec chmod 644 {} +
chown -R www-data:www-data /var/www/public