Skip to content

Instantly share code, notes, and snippets.

View cheeaun's full-sized avatar
🐘
Follow me on https://mastodon.social/@cheeaun

Chee Aun cheeaun

🐘
Follow me on https://mastodon.social/@cheeaun
View GitHub Profile
@cowboy
cowboy / HEY-YOU.md
Last active September 25, 2025 09:25
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
@subtleGradient
subtleGradient / sg_asyncEach.demo.js
Created November 19, 2010 18:45
sg_asyncEach is like each, but async!
// // // // // // // // // // // // // // // // // // // // //
// works as a generic!
Array.sg_asyncEach([1, 2, 3],
function(value, key, array) {
console.log(value, key, array)
return "eachFn result " + value
},
function(err, result) {
console.log('sg_asyncEach callback', err && "Error!" || "Success!", result)
/*
* matchMedia() polyfill - test whether a CSS media type or media query applies
* primary author: Scott Jehl
* Copyright (c) 2010 Filament Group, Inc
* MIT license
* adapted by Paul Irish to use the matchMedia API
* http://dev.w3.org/csswg/cssom-view/#dom-window-matchmedia
* which webkit now supports: http://trac.webkit.org/changeset/72552
*
* Doesn't implement media.type as there's no way for crossbrowser property
@mrdoob
mrdoob / RequestAnimationFrame.js
Created February 22, 2011 14:50
Provides requestAnimationFrame in a cross browser way.
/**
* Provides requestAnimationFrame in a cross browser way.
* @author paulirish / http://paulirish.com/
*/
if ( !window.requestAnimationFrame ) {
window.requestAnimationFrame = ( function() {
return window.webkitRequestAnimationFrame ||
@ded
ded / domready.js
Created February 24, 2011 08:46
Smallest x-browser DOM Ready, ever
function r(f){/in/(document.readyState)?setTimeout(r,9,f):f()}
@tobie
tobie / gist:842085
Created February 24, 2011 11:53
Moar smallest DOMReady code, EVAR!
function r(f){setTimeout(/in/(document.readyState)?r:f,9,f)}
@necolas
necolas / contain-floats.css
Created April 22, 2011 00:36
Cross-browser, consistent float-containment methods
/*
* Containing floats in a consistent manner
* By Jonathan Neal and Nicolas Gallagher
*/
/*
* New block formatting context method
* IE 6+, Firefox 2+, Safari 4+, Opera 9+, Chrome
*/
@cowboy
cowboy / ba-smallwalker.js
Created May 5, 2011 21:27
Small Walker: A small and simple JavaScript DOM walker
/*!
* Small Walker - v0.1.1 - 5/5/2011
* http://benalman.com/
*
* Copyright (c) 2011 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
// Walk the DOM, depth-first (HTML order). Inside the callback, `this` is the
@remy
remy / fizzbuzz.js
Created May 8, 2011 18:40
fizzbuzz - as short as I can - demo: http://goo.gl/Ssyal
i=0;do console.log(++i%15?i%3?i%5?i:'buzz':'fizz':'fizzbuzz');while(i<100)
function escapeHTML(s,r){r='replace';return s[r](/&/g,'&amp;')[r](/>/g,'&gt;')[r](/</g,'&lt;')}