<commit_before>export function httpGet (url, callback) {
    let request = new XMLHttpRequest();
    let method = 'GET';

    request.onreadystatechange = function () {
        if (request.readyState === 4 && request.status === 200) {
            let response = request.responseText;

            // TODO: Actual error handling
            let error = null;
            callback(error, response);
        }
    };
    request.open(method, url, true);
    request.send();
}

export function debounce (func, wait, immediate) {
    let timeout;
    return function () {
        let context = this;
        let args = arguments;
        let later = function () {
            timeout = null;
            if (!immediate) {
                func.apply(context, args);
            }
        };
        let callNow = immediate && !timeout;
        clearTimeout(timeout);
        timeout = setTimeout(later, wait);
        if (callNow) {
            func.apply(context, args);
        }
    };
}

//  Check if a variable is a number
export function isNumber (n) {
    return /^-?[\d.]+(?:e-?\d+)?$/.test(n);
}

export function getDevicePixelRatio (ctx) {
    let devicePixelRatio = window.devicePixelRatio || 1;
    let backingStoreRatio = ctx.webkitBackingStorePixelRatio ||
                            ctx.mozBackingStorePixelRatio ||
                            ctx.msBackingStorePixelRatio ||
                            ctx.oBackingStorePixelRatio ||<commit_msg>Remove unused httpGet and debounce functions from tools/common<commit_after>//  Check if a variable is a number
export function isNumber (n) {
    return /^-?[\d.]+(?:e-?\d+)?$/.test(n);
}

export function getDevicePixelRatio (ctx) {
    let devicePixelRatio = window.devicePixelRatio || 1;
    let backingStoreRatio = ctx.webkitBackingStorePixelRatio ||
                            ctx.mozBackingStorePixelRatio ||
                            ctx.msBackingStorePixelRatio ||
                            ctx.oBackingStorePixelRatio ||
{'fraction_non_alphanumeric': 0.11105527638190955, 'fraction_numerical': 0.003015075376884422, 'mean_word_length': 1.9894894894894894, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6681911', 'n_tokens_mistral': 538, 'n_tokens_neox': 525, 'n_words': 134}