JSFiddle - React, Tailwind, and code Playground

by JamesKyle

HTML

<link rel="stylesheet" href="http://cdn.thejameskyle.com/bootstrap.css">
<link rel="stylesheet" href="http://cdn.thejameskyle.com/bootstrap-responsive.css">

JavaScript

(function($) {

    function shuffle(array) {
        var tmp, current, top = array.length;
        if(top) { while(--top) {
                current = Math.floor(Math.random() * (top + 1));
                tmp = array[current];
                array[current] = array[top];
                array[top] = tmp; 
        } }
        return array;
    }
    
    $.fn.query = function(params) {
        
        // Parameters //
        var options = $.extend({
            'shuffle' : false,
              'limit' : undefined
        }, params),
            output = this;

        // Shuffle //
        if (options.shuffle) {
            output = shuffle(this);
        }
        
        // Limit //
        if (options.limit !== undefined) {
            output = output.slice(0, options.limit);
        }
        
        return output;
    };
    
})(jQuery);

/////////////////////////// Example ///////////////////////////

var example = [ "47191650", "47191648", "47191647", "47191646", "47191645", "47179830", "47179829", "47179828", "47179827", "47179826", "47175715", "47175713", "47175712", "47175711", "47175708", "48478147", "48477901", "48477900", "48477899", "48475442", "48475441", "48475440", "48475437", "48475436", "48474803", "48447530" ];

var query = $(example).query({
    shuffle: true,
    limit: 5
});
console.log(query);