Skip to content

Instantly share code, notes, and snippets.

View ZachWatkins's full-sized avatar

Zachary K. Watkins ZachWatkins

View GitHub Profile
@ZachWatkins
ZachWatkins / leapardhp
Created July 25, 2015 19:48
Leap Motion Arduino Hand Position
var leapjs = require('leapjs'),
five = require('johnny-five'),
board = new five.Board(),
myServo,
controller = new leapjs.Controller();
controller.on('connect', function() {
console.log('Successfully connected.');
});
@ZachWatkins
ZachWatkins / functions.php
Last active October 4, 2016 21:31
WordPress Theme Switch Prevention
/**
* Add this code to functions.php
* Modify as needed to prevent a WordPress theme from becoming active if one or more plugin dependencies are not found.
* If you know of a better way to detect if a plugin is installed and active, please share! ^_^
*/
// Intercept theme switch
add_action( 'after_switch_theme', 'check_theme_dependencies', 10, 2 );
/**
@ZachWatkins
ZachWatkins / .sass-lint.yml
Created May 19, 2017 19:20
Sass style guide for AgriLife Communications
# Linter Options
# https://github.com/sasstools/sass-lint/tree/master/docs/rules
options:
# Don't merge default rules
merge-default-rules: false
# File Options
files:
include: 'css/src/**/*.s+(a|c)ss'
ignore:
- 'sass/vendor/**/*.*'
@ZachWatkins
ZachWatkins / removefolder.sh
Created January 17, 2019 15:17
Remove folder from github history and push changes
git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch vendor -r' \
--prune-empty --tag-name-filter cat -- --all
git push -f
@ZachWatkins
ZachWatkins / Gruntfile.coffee
Last active July 29, 2020 13:08
Github Release Gruntfile
module.exports = (grunt) ->
@initConfig
pkg: @file.readJSON('package.json')
release:
branch: ''
repofullname: ''
lasttag: ''
msg: ''
post: ''
url: ''
# Get around shallow update restriction
if [ -f ${HOME}/clone/.git/shallow ]; then git fetch --unshallow; fi
# Add User Data
git config --global user.name "wpengine-git-push-user-name"
git config --global user.email "my-wpengine-account-email-address"
# Add servers
git remote add servers $WPENGINE_GIT_PUSH_REMOTE
git remote set-url --add --push servers $WPENGINE_GIT_PUSH_REMOTE
git remote set-url --add --push servers $WPENGINE_GIT_PUSH_REMOTE_2
git remote set-url --add --push servers $WPENGINE_GIT_PUSH_REMOTE_3
@ZachWatkins
ZachWatkins / gist:de046890f7859ee89aefb5a0bd63bf18
Created January 22, 2021 16:14
Gravity Forms Single Product Field Error
// Get order form.
$form = \GFAPI::get_form( 1 );
// Get next form field ID.
$new_field_id = 0;
foreach( $form['fields'] as $field ) {
if( $field->id > $new_field_id ) {
$new_field_id = $field->id;
}
}
$new_field_id++;
@ZachWatkins
ZachWatkins / index.html
Created July 9, 2021 02:38
Mobile Listing JS Template
<script id="template-listing" type="text/template"><div class="pro"><a class="property-link" href="{{ permalink }}"><div class="thumbnails owl-carousel owl-theme"><div class="item"><img src="{{ thumb1 }}"></div><div class="item"><img src="{{ thumb2 }}"></div><div class="item"><img src="{{ thumb3 }}"></div></div><span class="heading-frame"><h3 class="property-title">{{ StreetNumber }} {{ StreetName }}, {{ City }}, {{ State }} {{ PostalCode }}</h3><span class="price overlay br">{{ ListPrice }}</span><span class="city overlay bl hide-medium">{{ City }}, {{ State }}</span></span>{{ DaysSinceListed }}<span class="prop-content details">{{ Bed }} Bed <span class="separator">~</span> {{ Bath }} Bath <span class="separator">~</span> {{ Acres }} acres<br>{{ PropertyType }} <span class="separator">~</span> {{ County }} County</span><div class="prop-content"><div class="desc collapse">{{ Description }}</div></a><button type="button" class="btn btn-default btn-danger btn-bg read-more hide-medium" data-target=".desc" data-
@ZachWatkins
ZachWatkins / color-picker-hook.php
Created July 19, 2021 20:27
WordPress Add Color Picker to Admin Adding Body Color Variables
add_action( 'in_admin_header', 'add_profile_theme_color_picker' );
function add_profile_theme_color_picker() {
?><div id="ui-picker">
<div><input type="color" id="base-color" name="base-color" value="#23282d" /> <label for="base-color">Base color</label></div>
<div><input type="color" id="highlight-color" name="highlight-color" value="#0073aa" /> <label for="highlight-color">Highlight color</label></div>
<div><input type="color" id="notification-color" name="notification-color" value="#d54e21" /> <label for="notification-color">Notification color</label></div>
<div><input type="color" id="menu-submenu-text" name="menu-submenu-text" value="#0073aa" /> <label for="menu-submenu-text">Submenu Text color</label></div>
<script type="text/javascript">
// Function for lightening or darkening colors according to how they are done in the wp-admin sass file.
@ZachWatkins
ZachWatkins / index.html
Created August 9, 2021 02:52
My Own Lightbox as a jQuery Plugin
<a class="lightbox-open lightbox-button" href="javascript:;">Click to open lightbox</a>
<div class="lightbox hidden" data-lb-open>
<div class="lightbox-viewport-outer">
<div class="lightbox-viewport">
<div class="lightbox-viewport-inner">
<div class="lightbox-title">A Wonderful Title</div>
<div class="lightbox-content lightbox-content-scroll-small">
<div class="lightbox-md-6 lightbox-sm-12 lightbox-content-scroll-medium"><code id="demo"></code></div>
<div class="lightbox-md-6 lightbox-sm-12 lightbox-content-scroll-medium">
<form name="inquiry" id="inquiry" role="form">