Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@pgooch
pgooch / plugin-settings.html
Created October 20, 2012 21:33
Use the default wordpress media uploader into your plugin.
<!-- 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
pgooch / wordpress wp_redirect redirect().php
Created April 5, 2012 02:06
Wordpress Redirects with wp_redirect()
// The Base Function
wp_redirect('http://www.urlofsite.com/path/to/location',301);
/* 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(){
if($redirect){
wp_redirect(get_bloginfo('url').'/wp-content/plugins/redirector/site/index.php',302);
@pgooch
pgooch / .htaccess
Created August 11, 2012 07:08
Perfect PHP .htaccess rewrites
# 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
pgooch / gist:2907553
Created June 10, 2012 22:34
Google Maps V2 Static Maps
<!-- 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:
http://fatfolderdesign.com/607/code/google-maps-api-2-the-second-post-multiple-locations-map-styling-and-the-new-geolocation -->
@pgooch
pgooch / gist:2907561
Created June 10, 2012 22:37
Google Maps API V3 Javascript Basic
// 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:
// http://fatfolderdesign.com/607/code/google-maps-api-2-the-second-post-multiple-locations-map-styling-and-the-new-geolocation
window.onload = function(){
var geocoder = new google.maps.Geocoder();
geocoder.geocode({'address':'5510 University Way NE Seattle, WA 98105'},function(result,status){
if(status==google.maps.GeocoderStatus.OK){
var map = new google.maps.Map(document.getElementById("the_map"),{
@pgooch
pgooch / gist:2907566
Created June 10, 2012 22:40
Google Maps API V3 Javascript Full
// 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.
// http://fatfolderdesign.com/607/code/google-maps-api-2-the-second-post-multiple-locations-map-styling-and-the-new-geolocation
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
pgooch / .htaccess
Created May 11, 2012 05:23
Proper URLs that SEO and load with javascript and AJAX updated data
# 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 : http://fatfolderdesign.com/583/php/ajax-sites-with-real-url-using-history-pushstate
@pgooch
pgooch / XSS game
Last active August 29, 2015 14:02
$('body').on('click','#log',function(){
alert('!');
});