This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Populates empty database fields, ghetto fix for not having default values. | |
* | |
* @param string $table Table name to grab fields from | |
* @param array $data Array of data to merge the default values into. | |
* @param object $db Reference to the database connection, yea I'm a ghetto superstar. | |
* | |
* @return array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function addXhrProgressEvent($) { | |
var originalXhr = $.ajaxSettings.xhr; | |
$.ajaxSetup({ | |
progress: function() { console.log("standard progress callback"); }, | |
xhr: function() { | |
var req = originalXhr(), that = this; | |
if (req) { | |
if (typeof req.addEventListener == "function") { | |
req.addEventListener("progress", function(evt) { | |
that.progress(evt); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Handles chained select boxs | |
* @author Shawn Crigger | |
*/ | |
;(function ( $, window, document, undefined ) { | |
// Create the defaults once | |
var chainSelects = "chainSelects", | |
self = null, | |
defaults = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Listing_Image is a sample class for demonstrating the PDO::FETCH_CLASS method, like a boss. | |
* | |
* Example usage: | |
*<code> | |
* $img = $q->fetch(PDO::FETCH_CLASS, "Listing_Image"); | |
* echo $img->get_image_tag(); | |
*</code> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("a").click(function() { | |
var href, href_lower; | |
href = ($(this).attr("href") === undefined ? "" : $(this).attr("href")); | |
href_lower = href.toLowerCase(); | |
if (href_lower.substr(-3) === "pdf" || href_lower.substr(-3) === "xls" || href_lower.substr(-3) === "doc") { | |
_gaq.push(["_trackEvent", "document", "download", href_lower.substr(-3), $(this).text()]); | |
_gaq.push(["_trackPageview", href]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<img src="http://nonhover.jpg" alt="" class="roll-over" data-roll-over="http://hover.jpg" /> | |
<script> | |
jQuery( "img.roll-over" ).hover( function() { | |
var old = $(this).attr('src'); | |
var roll = $(this).data('roll-over'); | |
$(this).attr('src', roll).data('roll-over', old); | |
}, function() { | |
var old = $(this).attr('src'); | |
var roll = $(this).data('roll-over'); | |
$(this).attr('src', roll).data('roll-over', old); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class DB | |
{ | |
/** | |
* Returns the *Singleton* instance of this class. | |
* | |
* @staticvar Singleton $instance The *Singleton* instances of this class. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
remove_action('wp_head', 'wp_generator'); | |
remove_action( 'wp_head', 'wlwmanifest_link'); | |
remove_action ('wp_head', 'rsd_link'); | |
remove_action( 'wp_head', 'wp_shortlink_wp_head'); |
OlderNewer