Skip to content

Instantly share code, notes, and snippets.

Phillip Gooch pgooch

Block or report user

Report or block pgooch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View XSS game
pgooch / plugin-settings.html
Created Oct 20, 2012
Use the default wordpress media uploader into your plugin.
View plugin-settings.html
<!-- This is just the code for the button and hidden input -->
<input id="backdrop_upload_button" value="Upload/Select Image" type="button" class="button" />
<input type="hidden" name="the_image" id="the_image" value="<?= $settings['the_image'] ?>" />
pgooch / .htaccess
Created Aug 11, 2012
Perfect PHP .htaccess rewrites
View .htaccess
# What this does is enable rewriting, then checks if your trying to access something that exits
# if not it will take you to the index, with the path your requesting attached to the url varible
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
pgooch / gist:2907566
Created Jun 10, 2012
Google Maps API V3 Javascript Full
View gist:2907566
// This javascript will create a complex google javascript map with multiple locations selected marked. The
// map will be centered in the middle and zoomed so that all point can be seen. It also stylizes the map
// making it mostly desaturated with bits of orange. More explanation as to how to set this up and change it
// at the url.
window.onload = function(){
// Define addresses, define varible for the markers, define marker counter
var addrs = ['219 4th Ave N Seattle Wa 98109','200 2nd Avenue North Seattle Wa 98109','325 5th Ave N Seattle Wa 98109'];
var markers = [];
pgooch / gist:2907561
Created Jun 10, 2012
Google Maps API V3 Javascript Basic
View gist:2907561
// This javascript will create a google map on the div with the ID "the_map" and centered on an address with
// a marker on it. In this example the address is for Jet City Improv. More information on setup and
// customization at:
window.onload = function(){
var geocoder = new google.maps.Geocoder();
geocoder.geocode({'address':'5510 University Way NE Seattle, WA 98105'},function(result,status){
var map = new google.maps.Map(document.getElementById("the_map"),{
pgooch / gist:2907553
Created Jun 10, 2012
Google Maps V2 Static Maps
View gist:2907553
<!-- Below are several different types of google static maps.
The first is a map with a single marker on the Space Needle. The second is one with 3 marks, one on the Space
Needle, one on the Seattle Science Center, and One on the EMP Museum. The last three have the same 3 markers
but varios styles.
Generally markers are separated with "|" pipes, styles are a bit more complex and require multiple parts
separated with pipes and for more advanced stuff multiple markers. I have a writeup at: -->
pgooch / .htaccess
Created May 11, 2012
Proper URLs that SEO and load with javascript and AJAX updated data
View .htaccess
# This should take everything in the path and pass it to the index file as the path get varible
RewriteEngine On
RewriteCond %{REQUEST_URI} !index.php
RewriteRule (.*) index.php?page=$1 [QSA,L]
# More explanation :
pgooch / wordpress wp_redirect redirect().php
Created Apr 5, 2012
Wordpress Redirects with wp_redirect()
View wordpress wp_redirect redirect().php
// The Base Function
/* This needs to be run on an action, or at least I wanted able to get it to run outside of an action, I suggest template_redirect */
// In Use Example
add_action('template_redirect', 'redirect');
function redirect(){
You can’t perform that action at this time.