Centered Div

#centered {
position: absolute;
height: 200px;
width: 400px;
margin: -100px 0 0 -200px;
top: 50%;
left: 50%;
background-color:#666;
}

/* The Html
<div id="centered"><p>This is example content for the centered Div</p></div>
*/

Ipad/Iphone Redirect

if(strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'],'iPod')) {
header('Location: http://yoursite.com/iphone');
exit();
}

Redirect Ipad/Iphone

<script type="text/javascript"> // <![CDATA[
if ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1) || (navigator.userAgent.indexOf('iPad') != -1)) {
document.location = "http://www.scottrockers.com/iphone.html";
} // ]]>
</script>

Reverse Geocode from Full Address

<form action="getLatLng.php" method="post">
<label for="propertyAddress">Address</label>
<input type="text" size="60" name="propertyAddress" id="propertyAddress" class="formField">
</div>
<div>

<label for="propertyCity">City</label>
<input type="text" size="20" name="propertyCity" id="propertyCity" class="formField">
</div>

<div>
<label for="propertyState">State/Province</label>
<input type="text" size="25" name="propertyState" id="propertyState" class="formField">
</div>

<div>
<label for="propertyZip">Zip/Postal Code</label>
<input type="text" size="12" name="propertyZip" id="propertyZip" class="formField">
</div>

<div>
<input type="submit" class="button" name="createProperty" id="createProperty" value="Create Your Property">
</div>

</form>

the processor looks like this...

<?php

/* Google Maps API. You need to get your own API Key */

function getLatLng($myAddress) {
$mapsApiKey = 'YOUR_API_KEY_HERE';
$query = "http://maps.google.com/maps/geo?q=".urlencode($myAddress)."&output=json&key=".$mapsApiKey;
$data = file_get_contents($query);
// if data returned
if($data){
// convert into readable format
$data = json_decode($data);
$long = $data->Placemark[0]->Point->coordinates[0];
$lat = $data->Placemark[0]->Point->coordinates[1];
return array('Latitude'=>$lat,'Longitude'=>$long);
}else{
return false;
}
}

$myAddress = $_POST['propertyAddress'] . "+" . $_POST['propertyCity'] . "+" . $_POST['propertyState'] . "+" . $_POST['propertyZip'] . "+" . $_POST['propertyCountry'];

$coords = getLatLong($myAddress);
$lat = $coords['Latitude'];
$lng = $coords['Longitude'];

$insert = mysql_query( " INSERT INTO locations SET lat = '$lat', lng = '$lng' ");

// redirect to thank you/results page here

?>

Super Simple Form Formatting

<style type="text/css">

#formID label { float: left; width: 100px; font-weight: bold; line-height: 24px;}
.formItem {clear: both; margin-bottom: 5px;}
.formFieldText {width: 100px; height: 20px; color: #444444;}

</style>

<form action="" method="post" id="formID">

<div class="formItem">
<label for="firstName">First Name</label>
<input class="formFieldText" type="text" value="" name="firstName" id="firstName" >
</div>

<div class="formItem">
<input type="submit" name="submit" value="Submit The Form">
</div>

</form>

Dynamic Div

var divTag = document.createElement("div");

divTag.id = "div1";

divTag.setAttribute("align","center");

divTag.style.margin = "0px auto";

divTag.className ="dynamicDiv";

divTag.innerHTML = "This HTML Div tag created using Javascript DOM dynamically.";

document.body.appendChild(divTag);

Dead Center Div

//The CSS

#horizon {position:absolute; top:50%; left:0px; width:100%; height:1px; overflow:visible;}

#content {position:absolute; top:-200px; left:50%; margin-left:-300px; width:600px; height:400px; background-color:#000;}

//The Html

<div id="horizon">
<div id="content">

</div>
</div>

Hide by Classname

<script type="text/javascript">
var hidden = false;
function getElementsByClass(searchClass, domNode, tagName) {
if (domNode == null) domNode = document;
if (tagName == null) tagName = '*';
var el = new Array();
var tags = domNode.getElementsByTagName(tagName);
var tcl = " "+searchClass+" ";
for(i=0,j=0; i<tags.length; i++) {
var test = " " + tags[i].className + " ";
if (test.indexOf(tcl) != -1)
el[j++] = tags[i];
}
return el;
}

function toggle_hideme()
{
hidden = !hidden;
var newDisplay;
if(hidden)
{
newDisplay = 'none';
}
else
{
newDisplay = 'block';
}
var hellos = getElementsByClass("div_class_name", null, "div");
for(var i = 0; i < hellos.length; i++)
{
hellos[i].style.display = newDisplay;
}
}
</script>

<input type="checkbox" name="a_name" value="a_name" onClick="toggle_hideme('div_class_name');">
<div class="div_class_name">
Blah Blah Blah
</div>
<div class="something_else">
What ever is here will not disappear!
</div>
<div class="div_class_name">
more blah blah blah
</div>

Check for active plugin

$plugins = get_option('active_plugins');
$required_plugin = 'PLUGIN-DIRECTORY/PLUGINFILE.php';
$debug_queries_on = FALSE;
if ( in_array( $required_plugin , $plugins ) ) {
$debug_queries_on = TRUE; // Example for yes, it's active
}

if ($debug_queries_on){
//THIS IS THE CODE TO RUN IF PLUGIN IS ACTIVE
}