<commit_before>$( document ).ready(function() {
  // Handler for .ready() called.
    function logit(s){
        var date = moment();
        var msSinceEpoch = date.valueOf();
        var strMsSinceEpoch = msSinceEpoch.toString(10);
        console.log(strMsSinceEpoch.substring(strMsSinceEpoch.length - 6) + ' ' + s);
    }
    var count = 0;
    function onSuccess () {
        logit('In onSuccess. About to increment count. Current value is  : ' + count);
        count++;
    }
    function callback (data) {
        logit('Call back : ' + data);
    }
        
    function showData() {
        logit('showData : ' + count + ' (invoked when both method1 and method 2 have succeeded)');
    }
    function method1() {
        return $.ajax('http://jsfiddle.net/echo/jsonp/', {
            dataType: 'jsonp',
            //jsonp: '$callback',
            success: onSuccess
        });
    }
    function method2() {
        return $.ajax('http://jsfiddle.net/echo/jsonp/', {
            dataType: 'jsonp',
            //jsonp: '$callback',
            success: onSuccess
        });
    }
    logit("1++++++++++++++++++++++++++++++++++++++++++++++++++++++");
    logit("About to invoke method1 and method 2");
    $.when(method1(), method2()).then(showData);
    logit("Finished invoke of method1 and method 2");
    logit("2++++++++++++++++++++++++++++++++++++++++++++++++++++++");
    var myAjaxCall1 = function() {
       return $.ajax('https://httpbin.org/get?Z=Y,X,W');
    };

    var myAjaxCall2 = function() {
       return $.ajax('https://httpbin.org/get?A=B,C,D');
    };
    var allGood = function(a1, a2){
        // a1[0] is data from first ajax call
        // a2[0] is data from second ajax call
        logit("Start allGood");
        logit("Reporting results from invocation of myAjaxCall1 and myAjaxCall2");
        logit(a1[2].status);
        logit(a1[0].args.Z);
        logit("");
        logit(a2[2].status);
        logit(a2[0].args.A);
        logit("End allGood");
    };

    logit("About to invoke myAjaxCall1 and myAjaxCall2");
    $.when( myAjaxCall1(), myAjaxCall2() ).then(allGood)
    logit("Finished invoke of myAjaxCall1 and myAjaxCall2");
    logit("3++++++++++++++++++++++++++++++++++++++++++++++++++++++");
});<commit_msg>Fleshing out some other optinos<commit_after>$( document ).ready(function() {
  // Handler for .ready() called.
    function logit(s){
        var date = moment();
        var msSinceEpoch = date.valueOf();
        var strMsSinceEpoch = msSinceEpoch.toString(10);
        console.log(strMsSinceEpoch.substring(strMsSinceEpoch.length - 6) + ' ' + s);
    }
    var count = 0;
    function onSuccess (data, textStatus, jqXHR) {
        debugger;
        logit('In onError.');
        logit('In onSuccess. About to increment count. Current value is  : ' + count);
        count++;
    }
    function onError (data, textStatus, jqXHR) {
        debugger;
        logit('In onError.');
    }
    function callback (data) {
        logit('Call back : ' + data);
    }
        
    function showData() {
        logit('showData : ' + count + ' (invoked when both method1 and method 2 have succeeded)');
    }
    function method1() {
        return $.ajax('http://jsfiddle.net/echo/jsonp/', {
            dataType: 'jsonp',
            //jsonp: '$callback',
            success: onSuccess,
            error: onError
        });
    }
    function method2() {
        return $.ajax('http://UNLIKELYjsfiddle.net/echo/jsonp/', {
            dataType: 'jsonp',
            //jsonp: '$callback',
            success: onSuccess,
            error: onError
        });
    }
    logit("1++++++++++++++++++++++++++++++++++++++++++++++++++++++");
    logit("About to invoke method1 and method 2");
    $.when(method1(), method2()).then(showData);
    logit("Finished invoke of method1 and method 2");
    logit("2++++++++++++++++++++++++++++++++++++++++++++++++++++++");
    var myAjaxCall1 = function() {
       return $.ajax('https://UNLIKLEYhttpbin.org/get?Z=Y,X,W');
    };

    var myAjaxCall2 = function() {
       return $.ajax('https://httpbin.org/get?A=B,C,D');
    };
    var allGood = function(a1, a2){
        // a1[0] is data from first ajax call
        // a2[0] is data from second ajax call
        logit("Start allGood");
        logit("Reporting results from invocation of myAjaxCall1 and myAjaxCall2");
        logit(a1[2].status);
        logit(a1[0].args.Z);
        logit("");
        logit(a2[2].status);
        logit(a2[0].args.A);
        logit("End allGood");
    };
    var someProblems = function(a1, a2){
        logit("Start someProblems");
        logit("End someProblems");
    };

    logit("About to invoke myAjaxCall1 and myAjaxCall2");
    $.when( myAjaxCall1(), myAjaxCall2() ).then(allGood, someProblems)
    logit("Finished invoke of myAjaxCall1 and myAjaxCall2");
    logit("3++++++++++++++++++++++++++++++++++++++++++++++++++++++");
});
{'fraction_non_alphanumeric': 0.20738636363636365, 'fraction_numerical': 0.017045454545454544, 'mean_word_length': 2.473572938689218, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '3263465', 'n_tokens_mistral': 1598, 'n_tokens_neox': 1527, 'n_words': 343}