JSFiddle

  • Lock ratio with pure css #9 is the latest revision

    You can use this technique for pretty much anything that doesn't maintain aspect ratio in a browser. Handy for responsive layouts :D

    // No JS required!
  • jQuery Marquee #208 is the latest revision

    I shopped around for a plugin but couldn't find what i was looking for so i knocked one up. welcome to the year 2000

    
    
        var off = 10,
            l = off,
            $As = $('.marquee li'), 
            speed = 2,
            stack = [],
            pause = false;
    
        $.each($As, function(){
          var W = $(this).css ...
  • grabbing barcode reader

    jQuery 1.8.3, HTML, CSS, JavaScript

    // lock scope
    var barcodes = (function(){ 
        // init empty string to hold current code
        var str = '';
        // bind to key down event
        $(window ...
  • caching ajax requests with jQuery

    memoization?

    var data = (function() {
    
        var $data;
    
        return {
            get: function(options) {
    
                var success = options.success;
    
                $.extend(options, {
                    success: function(data) {
                        success($data ...
  • Placeholder ticker #2 is the latest revision

    jQuery 1.8.3, HTML, CSS, JavaScript

    $('[placeholder]').each(function() {
        var $ths = $(this),
            scrpt = $ths.attr('placeholder') + '        ',
            chr, str, reset = function() {
                str = ' > ';
                chr = 0;
            },
            set = function() {
                if ...
  • A super class

    even though collective thinking states that this is a bad idea.

    var s = function(o){
        this.o = o;
        this.bind()
        this.do('init');
    }
    
    s.prototype.bind = function(){
        for(opt in this ...
  • Raphael starfield #8 is the latest revision

    responsive starfield example

        
        var canvas = (function(){
    
            var $window = $(window),    
                paper = Raphael(document.getElementById('paper'), $window.width(), $window.height()); 
    
            $window.resize(function(){
                paper.canvas ...