Skip to content

Instantly share code, notes, and snippets.

View codenothing's full-sized avatar

Corey Hart codenothing

View GitHub Profile
@codenothing
codenothing / performance.js
Created March 16, 2011 04:38
Semi-Detailed page load performance timings
// http://w3c-test.org/webperf/specs/NavigationTiming/
(function( window ) {
// Skip unsupported browsers
if ( ! window.performance || ! window.performance.timing ) {
return;
}
// Output
function perf(){
var rootjQuery = jQuery( document );
jQuery.live = function( selector, type, fn ) {
// Binding object of events to a selector
if ( fn === undefined && typeof type == 'object' ) {
for ( var i in type ) {
rootjQuery.delegate( selector, i, type[ i ] );
}
} else {
// Single event binding
// jslint.js
// 2010-03-12
// Changes Made by Corey Hart (http://www.codenothing.com)
// Removed 'undefined' from reserved variable list
/*
Copyright (c) 2002 Douglas Crockford (www.JSLint.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of
/*
* Defined Object Extension
* May 15, 2010
* Corey Hart @ http://www.codenothing.com
*/
/*
dext( { str1: 'test1', str2: 'test2' }, { str1: 'overwrite', str3: 'wont-extend' } );
=> { str1: 'overwrite', str2: 'test2' }
*/
function dext(){
/*
* Duck Punched Filter
* May 1, 2010
* Corey Hart @ http://www.codenothing.com
*/
(function( $, undefined ) {
// Keep a copy of the old filter for reference
var old = $.fn.filter;
<html>
<head>
<title>Random Color Generator Revisited</title>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'></script>
<script type='text/javascript' src='random-color-generator-revisited.js'></script>
<script type='text/javascript'>
// Used jQuery because it's just easier that way
jQuery(function($){
var $tbody = $('tbody'), Color = new RandomColorGenerator();
// Creating Color
<html>
<head>
<title>Random Color Generator</title>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'></script>
<script type='text/javascript' src='Color.js'></script>
<script type='text/javascript'>
// Used jQuery because it's just easier that way
jQuery(function($){
var $tbody = $('tbody');
// Creating Color
/*!
* GET URL Parsing
* September 24, 2009
* Corey Hart @ http://www.codenothing.com
*/
;(function(window){
var
// Storage of param keys to values
$_GET = window.$_GET = {},
// Storage of vanity slices