<commit_before>CATS.Utils = Classify({
    init: function () {
    },

    add_time: function (date, time) {
        var d = new Date();
        d.setTime(date.getTime() + time * 60 * 1000);
        return d;
    },

    get_time_diff: function (date1, date2) {
        return Math.floor((date2 - date1) / (1000 * 60));
    },

    zeroPad: function (num, places) {
        var zero = places - num.toString().length + 1;
        return Array(+(zero > 0 && zero)).join("0") + num;
    },

    minutes_to_formated_hours: function (min) {
        return Math.floor(min / 60) + ":" + this.zeroPad(min % 60, 2);
    },

    formated_hours_to_minutes: function (h) {
        var time = h.split(":");
        return time[0] * 60 + time[1] * 1;
    },

    proxy_url: function(url) {
        return CATS.Config.proxy_path + encodeURIComponent(url) + '&json=?';
    },

    proxy_get: function(url, callback) {
        CATS.App.utils.json_get(CATS.App.utils.proxy_url(url),
            function(data) { callback($.parseHTML(data.result)); });
    },

    proxy_get_xml: function(url, callback) {
        CATS.App.utils.json_get(CATS.App.utils.proxy_url(url),
            function(data) { callback($.parseXML(data.result)); });
    },

    proxy_get_json: function(url, callback) {
        CATS.App.utils.json_get(CATS.App.utils.proxy_url(url),
            function(data) { callback($.parseJSON(data.result)); });
    },

    json_get: function (url, callback) {
        $.ajax({
            // Avoid "not well-formed" error when loading JSON from local file.
            beforeSend: function(req) { req.overrideMimeType('application/json'); },
            url: url,
            dataType: 'json'
        }).done(function(data) {
            console.log("success " + url);
            callback(data);
        })
        .fail(function(a, b, c) {
            console.log("error " + a + b + c);
        });
    },
});

<commit_msg>utils: Add cors_get_html<commit_after>CATS.Utils = Classify({
    init: function () {
    },

    add_time: function (date, time) {
        var d = new Date();
        d.setTime(date.getTime() + time * 60 * 1000);
        return d;
    },

    get_time_diff: function (date1, date2) {
        return Math.floor((date2 - date1) / (1000 * 60));
    },

    zeroPad: function (num, places) {
        var zero = places - num.toString().length + 1;
        return Array(+(zero > 0 && zero)).join("0") + num;
    },

    minutes_to_formated_hours: function (min) {
        return Math.floor(min / 60) + ":" + this.zeroPad(min % 60, 2);
    },

    formated_hours_to_minutes: function (h) {
        var time = h.split(":");
        return time[0] * 60 + time[1] * 1;
    },

    proxy_url: function(url) {
        return CATS.Config.proxy_path + encodeURIComponent(url) + '&json=?';
    },

    proxy_get: function(url, callback) {
        CATS.App.utils.json_get(CATS.App.utils.proxy_url(url),
            function(data) { callback($.parseHTML(data.result)); });
    },

    cors_get_html: function(url, callback) {
        $.ajax({
            url: url,
            crossDomain: true,
            dataType: 'html',
        }).done(function(data) {
            console.log("success " + url);
            callback($.parseHTML(data));
        })
        .fail(function(a, b, c) {
            console.log("error " + a + b + c);
        });
    },

    proxy_get_xml: function(url, callback) {
        CATS.App.utils.json_get(CATS.App.utils.proxy_url(url),
            function(data) { callback($.parseXML(data.result)); });
    },

    proxy_get_json: function(url, callback) {
        CATS.App.utils.json_get(CATS.App.utils.proxy_url(url),
            function(data) { callback($.parseJSON(data.result)); });
    },

    json_get: function (url, callback) {
        $.ajax({
            // Avoid "not well-formed" error when loading JSON from local file.
            beforeSend: function(req) { req.overrideMimeType('application/json'); },
            url: url,
            dataType: 'json'
        }).done(function(data) {
            console.log("success " + url);
            callback(data);
        })
        .fail(function(a, b, c) {
            console.log("error " + a + b + c);
        });
    },
});


{'fraction_non_alphanumeric': 0.16299455105425253, 'fraction_numerical': 0.013740819710968964, 'mean_word_length': 2.0975788701393983, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3567062', 'n_tokens_mistral': 1441, 'n_tokens_neox': 1358, 'n_words': 259}