PHP - How to Display All Errors

error_reporting(E_ALL);
ini_set('display_errors', '1');

The Golden Ratio

The Golden Ratio: b = a * 1.61803399

CSS Header Comment

Added 9/23/2011:
http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutoria...

/* ===========================================================
 * Filename:
 * Description:
 * Version:
 * Website:	
 * Author:
 * =========================================================== */

How to scroll to top of window with jQuery


$(document).ready(function(){
$("html, body").animate({ scrollTop : 0 }, 'slow');
return false;
});

How to generate a random number with Javascript

/* The following will generate a random number between 1 and 100.
var numRand = Math.floor(Math.random()*101);

How to check if an element is visible with jQuery

if( $('#foo').is(':visible') ) {
    // it's visible, do something
}
else {
    // it's not visible so do something else
}

How to check which version of jQuery is loaded

var jQueryVersion = $().jquery;

console.log(jQueryVersion); // logs 1.x.x

How to check if jQuery is already loaded

// code to check if jquery is loaded already
/*
 * ------------------------------------------------------
 * First Method
 * ------------------------------------------------------
 */
try{
  var jQueryIsLoaded=jQuery;
  jQueryIsLoaded=true;
}
catch(err){
  var jQueryIsLoaded=false;
}

if(jQueryIsLoaded){
  // jQuery is loaded
}
else{
  // jQuery NOT loaded
}

/*
 * ------------------------------------------------------
 * Second Method
 * ------------------------------------------------------
 */
if (typeof jQuery == 'undefined') 
{  

jQuery Plugin Template Code

/** 
 * Name of the Plugin (Version 1.0.0)
 * 
 * Description of jQuery Plugin
 *
 * Notes:
 * 
 * To-do:
 *
 * 1.0.0 - Initial Release
 * 
 * @author      Author Name
 * @copyright   Copyright (c) 2011 Company Name
 * @link        https://yoursite.com
 */

(function($){

	$.fn.nameOfPlugin = function(opt) {
	
	/* ------------------------------------------------------
	* Setup Defaut Options
	* ------------------------------------------------------ */
	var options = $.extend(true, {
  	}, opt);

    return this.each(function() {
    
Syndicate content