<commit_before>function buildTabs()
{
    var content = "";
    for ( var i = 0; i < tabs.length; ++i )
        {
            content += '<a href="' + tabs[i].url + '">';
            content += '<div class="sub-header-item">' + tabs[i].text + '</div>';
            content += '</a>';
        }

        $('#sub-header').html(content);

}

function buildRepoListItem(name, content) 
{
    return '<div><span class="repo-list-item-label">' + name + ': </span><span class="repo-list-item-value">' + content + '</span></div>';
}

function buildCategories()
{
    var content = "";
    var toc = "<h2>Categories</h2><ul>";
    for ( var i = 0; i < categories.length; ++i )
    {
        content += "<div class='category'>"
        content += '<h2><a class="category-anchor" name="'+ categories[i].code +'">' + categories[i].title + '</a></h2>';
        content += "<label>" + categories[i].description + "</label>"

        toc += "<li><a href='#"+ categories[i].code + "' class='nav-anchor'>" + categories[i].title + "</a></li>"

        for ( var j = 0; j < categories[i].repos.length; ++j )
            {
                var repoName = categories[i].repos[j];
                content += '<div class="repo-list-item-container">';
                content += '<a href="'+ repos[repoName]['html_url']  + '" class="repo-list-item-anchor">'+ repoName.replace( /([a-z])([A-Z])/g, "$1 $2").replace( /[\-_]/g, " ") +'</a>';
                content += '<div class="repo-list-item-description">' + repos[repoName].description+ '</div>'
                content += buildRepoListItem("Language", repos[repoName].language);
                content += buildRepoListItem("Updated", jQuery.format.prettyDate(repos[repoName].updated_at));
                content += buildRepoListItem("Forks", repos[repoName].forks);
                content += buildRepoListItem("Open Issues", repos[repoName].open_issues);
                content +='</div>'
            }
        content += "</div>"
    }

    $('#categories').html(content);
    $('#categoryList').html(toc + "</ul>");

    $(".repo-list-item-description").dotdotdot({

    });
}

function filterList(text)
{
    var list = $('a.repo-list-item-anchor');

    list.each(function() {
        var containsSearchInput = $(this).text().toLowerCase().indexOf(text.toLowerCase()) >= 0;

        if(containsSearchInput) {
            $(this).parent().show();
        } else {
            $(this).parent().hide();
        }
    });
}

var repos = {};

$(function(){
    buildTabs();

    $.ajax({
        url: "https://api.github.com/orgs/interactiveintelligence/repos",
    })
    .done(function( data ) {

        for(var x=0; x< data.length; x++)
        {
            repos[data[x].name] = data[x];
        }
        buildCategories();
    });

    $('.searchInput').on('input', function() {
        filterList($(this).val());
    });
});
<commit_msg>Adding check that the repo actually exists as it appears that GitHub updates their API periodically, which can break the application.<commit_after>function buildTabs()
{
    var content = "";
    for ( var i = 0; i < tabs.length; ++i )
        {
            content += '<a href="' + tabs[i].url + '">';
            content += '<div class="sub-header-item">' + tabs[i].text + '</div>';
            content += '</a>';
        }

        $('#sub-header').html(content);

}

function buildRepoListItem(name, content) 
{
    return '<div><span class="repo-list-item-label">' + name + ': </span><span class="repo-list-item-value">' + content + '</span></div>';
}

function buildCategories()
{
    var content = "";
    var toc = "<h2>Categories</h2><ul>";
    for ( var i = 0; i < categories.length; ++i )
    {
        content += "<div class='category'>"
        content += '<h2><a class="category-anchor" name="'+ categories[i].code +'">' + categories[i].title + '</a></h2>';
        content += "<label>" + categories[i].description + "</label>"

        toc += "<li><a href='#"+ categories[i].code + "' class='nav-anchor'>" + categories[i].title + "</a></li>"

        for ( var j = 0; j < categories[i].repos.length; ++j )
            {
                var repoName = categories[i].repos[j];
                if (typeof repos[repoName] == "undefined") continue;
                
                content += '<div class="repo-list-item-container">';
                content += '<a href="'+ repos[repoName]['html_url']  + '" class="repo-list-item-anchor">'+ repoName.replace( /([a-z])([A-Z])/g, "$1 $2").replace( /[\-_]/g, " ") +'</a>';
                content += '<div class="repo-list-item-description">' + repos[repoName].description+ '</div>'
                content += buildRepoListItem("Language", repos[repoName].language);
                content += buildRepoListItem("Updated", jQuery.format.prettyDate(repos[repoName].updated_at));
                content += buildRepoListItem("Forks", repos[repoName].forks);
                content += buildRepoListItem("Open Issues", repos[repoName].open_issues);
                content +='</div>'
            }
        content += "</div>"
    }

    $('#categories').html(content);
    $('#categoryList').html(toc + "</ul>");

    $(".repo-list-item-description").dotdotdot({

    });
}

function filterList(text)
{
    var list = $('a.repo-list-item-anchor');

    list.each(function() {
        var containsSearchInput = $(this).text().toLowerCase().indexOf(text.toLowerCase()) >= 0;

        if(containsSearchInput) {
            $(this).parent().show();
        } else {
            $(this).parent().hide();
        }
    });
}

var repos = {};

$(function(){
    buildTabs();

    $.ajax({
        url: "https://api.github.com/orgs/interactiveintelligence/repos",
    })
    .done(function( data ) {

        for(var x=0; x< data.length; x++)
        {
            repos[data[x].name] = data[x];
        }
        buildCategories();
    });

    $('.searchInput').on('input', function() {
        filterList($(this).val());
    });
});

{'fraction_non_alphanumeric': 0.21426174496644296, 'fraction_numerical': 0.003691275167785235, 'mean_word_length': 2.4004563605248146, 'pattern_counts': {'":': 0, '<': 75, '<?xml version=': 0, '>': 69, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, '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': '7001034', 'n_tokens_mistral': 1881, 'n_tokens_neox': 1797, 'n_words': 331}