Skip to content

Instantly share code, notes, and snippets.

Rick Waldron rwaldron

Block or report user

Report or block rwaldron

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View type.js
var toString = Object.prototype.toString;
var class2type = {
"[object Boolean]": "boolean",
"[object Number]": "number",
"[object String]": "string",
"[object Function]": "function",
View Comma-First Code Writing Is Bad
var foo = { bar : 'barberic'
, baz : 'bazterd'
, duck : 'punch'
JSLint Results:
View gist:360217
The example given on Ajaxian:
// See comments below.
// standard style
var a = "ape",
b = "bat",
c = "cat",
d = "dog",
View html5-data.js
(function (undefined) {
function detectMutation() {
mutationSupported = true;
this.removeEventListener('DOMAttrModified', detectMutation, false);
var forEach = [].forEach,
regex = /^data-(.+)/,
el = document.createElement('div'),
mutationSupported = false,
View jquery.pollute.js
(function ($) {
$.fn.pollute = function (pollution) {
// first we extend the pollution object to the window, nice!
$.extend(window, pollution);
// make sure we're really nasty, and pollute all the elements as well.
return this.each(function () {
for ( var junk in pollution ) {
View jquery.pollute.js
(function ($) {
$.fn.pollute = function (pollution) {
pollutants = {
window.emit = function(type) {
View index.html
<!DOCTYPE html>
<title>Workers: Basic Demo</title>
document.addEventListener('DOMContentLoaded', function () {
var worker = new Worker('worker-javascript-file.js');
View compatible-filtering-worker.html
<!DOCTYPE html>
<title>Workers: Compatibility</title>
// This script is executed in the main window
we'll use a worker to filter a huge data set
View jquery.detonate.html
<!DOCTYPE html>
<script src=""></script>
<script src="jquery.detonate.js"></script>
$(function () {
View renderer.html
<script src="renderer.js"></script>
You can’t perform that action at this time.