Skip to content

Instantly share code, notes, and snippets.

View jgraup's full-sized avatar

Jesse Graupmann jgraup

View GitHub Profile
@jgraup
jgraup / run-ngrock.sh
Created July 15, 2017 21:30
ngrok with local Vagrant WordPresss site
# site.dev is the name of your hostname
HOST="site.dev";
PORT=80;
IP="$(vagrant ssh -- -t 'ip address show eth1 | grep "inet " | sed -e "s/^.*inet //" -e "s/\/.*$//" | tr -d "\n" | tr -d "\r"; ')";
echo -e "\nHOST:\t$HOST\nIP:\t$IP\nPORT:\t$PORT\n\tStarting ngrok "`date +%Y-%m-%d\ %H:%M:%S`... and opening http://127.0.0.1:4040/"\n";
open http://127.0.0.1:4040;
ngrok http -host-header=$HOST $IP:$PORT
@jgraup
jgraup / class-walker-nav-menu-edit.php
Created November 5, 2016 22:41
Proposed: Add action after core edit fields, allowing for custom fields trigger without required duplicated of the entire edit page. `add_action(`post_walker_nav_menu_edit_menu_item_settings)`
<?php
/**
* Navigation Menu API: Walker_Nav_Menu_Edit class
*
* @package WordPress
* @subpackage Administration
* @since 4.4.0
*/
/**
@jgraup
jgraup / gist:3f71f038b0580d9e4819
Last active December 8, 2015 06:27 — forked from ericandrewlewis/gist:95239573dc97c0e86714
Setting up a WordPress site on AWS

Setting up a WordPress site on AWS

This tutorial walks through setting up AWS infrastructure for WordPress, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

This tutorial assumes you're relatively comfortable on the command line and editing system configuration files. It is intended for folks who want a high-level of control and understanding of their infrastructure. It will take about half an hour if you don't Google away at some point.

If you experience any difficulties or have any feedback, leave a comment. 🐬

Coming soon: I'll write another tutorial on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.

@jgraup
jgraup / js-common.htm
Last active January 3, 2016 01:09
JS-Common.js
<!-- JSON -->
<script id="myJson" type="application/json">{"name":"foo"}</script>
<!-- Load JSON -->
<script type="text/javascript">
(function(){
var obj = jQuery.parseJSON($('#myJson').html());
@jgraup
jgraup / genColors.css
Last active January 1, 2016 06:38
Dynamically generate named CSS classes from list of variables using LESS
// c7da3b
.c_c7da3b{color:#c7da3b}
.cb_c7da3b{background-color:#c7da3b}
.ca_c7da3b a:not(.image){color:#c7da3b}
.cah_c7da3b a:not(.image):hover{color:#c7da3b}
.cba_c7da3b a:not(.image){background-color:#c7da3b}
.cbah_c7da3b a:not(.image):hover{background-color:#c7da3b}
.cbs_c7da3b ::selection{background-color:#c7da3b}
.cs_c7da3b ::selection{color:#c7da3b}
@jgraup
jgraup / my.command
Created December 21, 2013 06:42
.command | .tool
#!/bin/sh
/my.app -arguments
kill -9 $(ps -p $(ps -p $PPID -o ppid=) -o ppid=)
@jgraup
jgraup / imageOptim.sh
Last active January 1, 2016 00:19
Automator Workflow: Add service to right-click and run php file in Finder. Based on http://superuser.com/questions/373284/how-create-an-os-x-service-that-passes-a-files-path-to-a-shell-script
# Automator Service: Optimize Image files or folder
# Link: http://imageoptim.com/command-line.html
# Service receives selected (files or folders)
# in Finder.app
# Shell: /bin/sh
# Pass input: as arguments
open -a ImageOptim "$@"
@jgraup
jgraup / microsoft-surface-v1-hands.json
Last active December 30, 2015 15:29
Microsoft Surface V1. Recorded Hand Data - 08/17/2008. Currently Named PixelSense: http://www.microsoft.com/en-us/pixelsense/default.aspx
[{"data":"a:726,873.5203,670.6459,1.363869,0,32,32,False,True,200","time":59775},{"data":"u:726,873.5203,670.6459,1.363869,0,32,32,False,True,200","time":59775},{"data":"a:67109592,950.6808,716.2418,4.169744,0.09765626,15.80542,12.35887,True,False,-1","time":59775},{"data":"a:67109542,869.7405,672.4647,2.964334,6.472657,175.2489,111.524,False,False,-1","time":59775},{"data":"u:726,875.9941,664.2858,1.336133,0,32,32,False,True,200","time":59788},{"data":"u:67109592,954.7174,708.5912,4.203292,0.09765626,15.41338,12.57445,True,False,-1","time":59788},{"data":"u:67109542,872.2556,665.9513,2.924986,6.484375,175.5226,111.6473,False,False,-1","time":59788},{"data":"u:726,879.7538,656.316,1.236937,0,32,32,False,True,200","time":59803},{"data":"u:67109592,960.5,700.7223,1.871176,0.08984376,15.08006,12.68222,True,False,-1","time":59803},{"data":"u:67109542,875.8844,659.087,2.880384,6.5,175.8551,111.5101,False,False,-1","time":59803},{"data":"u:726,884.6677,649.558,1.189918,0,32,32,False,True,200","time":59817},{"data":
// LED
TKLed led(O0);
led.on(); // turn LED on
led.off(); // turn LED off
@jgraup
jgraup / Cron
Created November 27, 2013 12:42
Cron Job for Dreamhost - Command to run a php file where the result can be ignored or emailed. DH LINK: https://panel.dreamhost.com/index.cgi?tree=goodies.cron INFO: http://wiki.dreamhost.com/Run_PHP_from_cron
/usr/bin/curl http://www.example.com/dir/cron.php