Skip to content

Instantly share code, notes, and snippets.

@rkatic
rkatic / README.md
Created February 16, 2010 02:19
type() - a better typeof

type.js - offers an more consistent type checking of native values. It relays on the [[Class]] of objects instead on typeof results.

type2.js - variation that returns "object" for wrapped natives. This one is probably more noob-immune, avoiding some possible strange situations.

Consider something like this:

// Defined by third...

var foo = new String("foo");

;(function(jQuery){
// This jQuery.filter version handles selectors and callbacks.
//
// Selector - ( elems, selector, [not] )
// This is the original jQuery.filter signature with two first arguments swapped.
//
// Callback - ( elems, callback, [thisObject], [inv] )
// This is the old jQuery.grep signature enhanced to support the ECMA-262 filter signature.
@rkatic
rkatic / isPlainObject.html
Created November 8, 2009 13:27 — forked from jeresig/isObjectLiteral.html
isPlainObject
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<title>isPlainObject</title>
<style>
li.PASS { background: #02C500; } li.FAIL { background: red; }
iframe { display: none; }
</style>
</head>
@rkatic
rkatic / jquery.isObject.js
Created November 8, 2009 09:17
jquery.isObject.js
(function(jQuery){
var toString = Object.prototype.toString,
hasOwnProp = Object.prototype.hasOwnProperty;
jQuery.isObject = function( obj ) {
if ( toString.call(obj) !== "[object Object]" )
return false;
//own properties are iterated firstly,
@rkatic
rkatic / jquery.delegate.js
Created November 5, 2009 23:30
jquery.delegate.js
(function($){
var slice = Array.prototype.slice;
$.each({
delegate: "live",
undelegate: "die"
}, function( name, original ) {
$.fn[ name ] = function( selector ) {
var $t = $(null), args = slice.call( arguments, 1 );
@rkatic
rkatic / isObjectLiteral.html
Created July 30, 2009 10:46 — forked from jeresig/isObjectLiteral.html
isObjectLiteral STRICT
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<!-- Online here: http://ejohn.org/files/bugs/isObjectLiteral/ -->
<title>isObjectLiteral</title>
<style>
li { background: green; } li.FAIL { background: red; }
iframe { display: none; }
</style>