<commit_before>
var forEach = Array.prototype.forEach;

function run() {

    $('.covers').hide();

    showAww($('img.cover'));

    rebuildCreatorMixesList($('.sidebar_collection'));
}

function showAww(img) {

    var $img = $(img);

    $img.hide();

    if(!$img.data('aww')) {

        $(img).data('aww', true);

        $.getJSON( "http://www.reddit.com/r/aww/new.json?sort=new", function(response) {
            var posts = response.data.children
            if(posts) {
                var idx = Math.floor((Math.random() * posts.length) + 1);
                var url = posts[idx].data.url;

                $img.attr('src', url);
                $img.show();
            }
        });
    }
}

function mixCreator(sidebarCollection) {

    var mixesByRegex = /Mixes\sBy\s([\w]+)\s?[0-9]*/i;

    var $mixByH6 = $(sidebarCollection).prev('h6');

    var matches = mixesByRegex.exec($mixByH6.text());
    if(matches) {
        return matches[1];
    }
    return '';<commit_msg>added image hiding on failure<commit_after>
var forEach = Array.prototype.forEach;

function run() {

    $('.covers').hide();

    showAww($('img.cover'));

    rebuildCreatorMixesList($('.sidebar_collection'));
}

function showAww(img) {

    var $img = $(img);

    $img.hide();

    if(!$img.data('aww')) {

        $(img).data('aww', true);

        $.getJSON( "http://www.reddit.com/r/aww/new.json?sort=new", function(response) {
            var posts = response.data.children
            if(posts) {
                var idx = Math.floor((Math.random() * posts.length));
                var post = posts[idx];
                if(post) {
                    var data = post.data;
                    if(post.data) {
                        $img.error(function() {
                            $(this).hide(); // hide if image fails
                        });
                        $img.attr('src', data.url);
                        $img.show();
                    }
                }
            }
        });
    }
}

function mixCreator(sidebarCollection) {

    var mixesByRegex = /Mixes\sBy\s([\w]+)\s?[0-9]*/i;

    var $mixByH6 = $(sidebarCollection).prev('h6');

    var matches = mixesByRegex.exec($mixByH6.text());
    if(matches) {
        return matches[1];
    }
    return '';
{'fraction_non_alphanumeric': 0.17688266199649738, 'fraction_numerical': 0.005691768826619965, 'mean_word_length': 1.7530120481927711, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4953514', 'n_tokens_mistral': 748, 'n_tokens_neox': 706, 'n_words': 116}