<commit_before>// Add event listener to reveal.js slide changes
Reveal.addEventListener('slidechanged', function(event) {
    // event.previousSlide, event.currentSlide, event.indexh, event.indexv

    var iframeId = $(event.currentSlide).attr('data-remove-iframe');
    if (iframeId) {
        $('#' + iframeId).remove();
    }
});

// Add event listener to reveal.js fragments
Reveal.addEventListener('fragmentshown', function(event) {
    // event.fragment = the fragment DOM element

    var iframeId = $(event.fragment).attr('data-add-iframe');
    if (iframeId) {
        $('<iframe />', {
            name: iframeId,
            id:   iframeId,
            frameborder: 0,
            src:  'http://localhost/reactive-life/app/#?pattern=Acorn&color2=hotpink&interval=600&autostart&noGrid&embedded'
        }).appendTo('.reveal');
    }
});

function runCode(element) {
    var container = $(element).closest('section');
    var codeToExecute = $(container.find('.code').get(0)).text();
    var outputContainer = $(container.find('.output').get(0));
    
    outputContainer.text('');
    
    console.log('runCode', codeToExecute);
    
    try {
        eval(codeToExecute);
    } catch (error) {
        print('Error: ' + error);
    }
    
    function print(value) {
        console.log('print', value);
        outputContainer.append(value + "\n");
    }
}

function searchWikipedia(term) {
    console.log('searchWikipedia', term);
    
    var promise = $.ajax({
        url: 'http://en.wikipedia.org/w/api.php',
        dataType: 'jsonp',<commit_msg>Load game of life from github.io instead of localhost<commit_after>// Add event listener to reveal.js slide changes
Reveal.addEventListener('slidechanged', function(event) {
    // event.previousSlide, event.currentSlide, event.indexh, event.indexv

    var iframeId = $(event.currentSlide).attr('data-remove-iframe');
    if (iframeId) {
        $('#' + iframeId).remove();
    }
});

// Add event listener to reveal.js fragments
Reveal.addEventListener('fragmentshown', function(event) {
    // event.fragment = the fragment DOM element

    var iframeId = $(event.fragment).attr('data-add-iframe');
    if (iframeId) {
        $('<iframe />', {
            name: iframeId,
            id:   iframeId,
            frameborder: 0,
            src:  'http://cvuorinen.github.io/reactive-life/app/#?pattern=Acorn&color2=hotpink&interval=600&autostart&noGrid&embedded'
        }).appendTo('.reveal');
    }
});

function runCode(element) {
    var container = $(element).closest('section');
    var codeToExecute = $(container.find('.code').get(0)).text();
    var outputContainer = $(container.find('.output').get(0));
    
    outputContainer.text('');
    
    console.log('runCode', codeToExecute);
    
    try {
        eval(codeToExecute);
    } catch (error) {
        print('Error: ' + error);
    }
    
    function print(value) {
        console.log('print', value);
        outputContainer.append(value + "\n");
    }
}

function searchWikipedia(term) {
    console.log('searchWikipedia', term);
    
    var promise = $.ajax({
        url: 'http://en.wikipedia.org/w/api.php',
        dataType: 'jsonp',
{'fraction_non_alphanumeric': 0.16257861635220125, 'fraction_numerical': 0.00440251572327044, 'mean_word_length': 2.8417874396135265, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '3786067', 'n_tokens_mistral': 1006, 'n_tokens_neox': 963, 'n_words': 177}