Skip to content

Instantly share code, notes, and snippets.

View brendannee's full-sized avatar

Brendan Nee brendannee

View GitHub Profile
@brendannee
brendannee / Add_Custom_Div_to_Google_Map.js
Created January 18, 2010 07:53
Add a custom div to google maps
// Add custom pane
function DragPane() {}
DragPane.prototype = new GControl;
DragPane.prototype.initialize = function(map) {
var me = this;
me.panel = document.createElement("div");
me.panel.style.width = "400px";
me.panel.style.height = "25px";
me.panel.innerHTML = "<div class='message'>Drag and drop icons to calculate a new route</div>";
@brendannee
brendannee / Make any page editable
Created July 20, 2010 08:57
Make Any Page Editable in the Browser with Javascript
//If you type the following javascript code snippet into your navigation bar, you should be able to edit any text on the page:
javascript:document.body.contentEditable='true'; document.designMode='on'; void 0
@brendannee
brendannee / SVN checkout to wordpress
Created August 6, 2010 05:41
Checkout wordpress with svn and skip the .svn files
svn export http://core.svn.wordpress.org/trunk/ . --force
@brendannee
brendannee / List top level pages in Wordpress
Created September 27, 2010 05:55
List top level pages in Wordpress
<?php
$parents = get_post_ancestors($post);
if(count($parents)>=2):
//Page is a grandchild, show highest level parents as menu
echo '<ul>';
wp_list_pages('title_li=&child_of='.end($parents));
echo '</ul>';
elseif(count($parents)==1):
//Page is a child
echo '<ul>';
@brendannee
brendannee / gist:988231
Created May 24, 2011 06:50
Add Google Transit layer to Google Maps API
var transitOptions = {
getTileUrl: function(coord, zoom) {
return "http://mt1.google.com/vt/lyrs=m@155076273,transit:comp|vm:&" +
"hl=en&opts=r&s=Galil&z=" + zoom + "&x=" + coord.x + "&y=" + coord.y;
},
tileSize: new google.maps.Size(256, 256),
isPng: true
};
var transitMapType = new google.maps.ImageMapType(transitOptions);
@brendannee
brendannee / gist:988233
Created May 24, 2011 06:52
Google Maps Bike Layer
var bikeLayer = new google.maps.BicyclingLayer();
bikeLayer.setMap(map);
@brendannee
brendannee / gist:988234
Created May 24, 2011 06:53
Google Maps Traffic Layer
var trafficLayer = new google.maps.TrafficLayer();
trafficLayer.setMap(map);
@brendannee
brendannee / file1.php
Created November 3, 2011 17:37
Disable the Wordpress Admin Bar for all but admins
/* Disable the Wordpress Admin Bar for all but admins. */
if (!current_user_can('administrator')):
show_admin_bar(false);
endif;
@brendannee
brendannee / file1.php
Created November 3, 2011 17:38
Disable the Wordpress Admin Bar for everyone.
/* Disable the Wordpress Admin Bar for everyone. */
show_admin_bar(false);
@brendannee
brendannee / file1.txt
Created November 3, 2011 17:41
Redirect root domain of custom short URLs using bit.ly pro in .htaccess file
RewriteEngine on
RewriteRule ^/?$ http://511contracosta.org [L]
RewriteRule ^(.*)$ http://bit.ly/$1 [R=301,NC]