<commit_before>$.post("https://www.googleapis.com/geolocation/v1/geolocate?key=<KEY>", {}, function (data){
    var lat, lng;
    lat = parseFloat(JSON.stringify(data.location.lat));
    lng = parseFloat(JSON.stringify(data.location.lng));
    $("p.location").replaceWith('');
    getWeather(lat,lng);
    $.get("https://maps.googleapis.com/maps/api/geocode/json?latlng=" + lat + "," + lng + "&key=<KEY>", function (data){ 
        $("p.location2").replaceWith('<h2 style="text-align: right;">' + data.results[0].address_components[3].long_name + "," + data.results[0].address_components[5].long_name + '</h2>');
//        var results = data.results;
    });
});


function convertToCelcius(fren) {
    var celc = (fren - 32) * 5 / 9;
    return celc.toFixed(0);
}

function getTimeArray(){
    return ['12pm','1am','2am', '3am', '4am', '5am', '6am', '7am', '8am', '9am', '10am', '11am', '12pm', '1pm', '2pm', '3pm', '4pm', '5pm', '6pm', '7pm', '8pm', '9pm', '10pm', '11pm'];
}

function loadChart(currentHourlyDataToCel, oldHourlyDataToCel) {
    var chart = document.getElementById("c").getContext("2d");
    var timeLabel = getTimeArray();
    var data = {
        labels: timeLabel
        , datasets: [{
                label: "My First dataset"
                , fillColor: "rgba(220,220,220,0.2)"
                , strokeColor: "rgba(220,220,220,1)"
                , pointColor: "rgba(220,220,220,1)"
                , pointStrokeColor: "#fff"
                , pointHighlightFill: "#fff"
                , pointHighlightStroke: "rgba(220,220,220,1)"
                , data: currentHourlyDataToCel
        },{
                label: "My Second dataset"
                , fillColor: "rgba(151,187,205,0.2)"
                , strokeColor: "rgba(151,187,205,1)"
                , pointColor: "rgba(151,187,205,1)"
                , pointStrokeColor: "#fff"
                , pointHighlightFill: "#fff"
                , pointHighlightStroke: "rgba(151,187,205,1)"
                , data: oldHourlyDataToCel
        }]
    };
    var MyNewChart = new Chart(chart).Line(data, {responsive: true});
}

function parseHourlyData(data){
    
    var hourlyDataToCel = [];
    // Extract hourly tempurature and stored in an array
        for (var i = 0; i < data.length; i++) {
            var time = data[i].time;
            var date = new Date(time * 1000);
            var temp = parseFloat(data[i].apparentTemperature)
            hourlyDataToCel[i] = convertToCelcius(temp);
        };
//    console.log(hourlyDataToCel);
    return hourlyDataToCel;
}

function getWeather(lat, lng){
    var currentHourlyDataToCel = [];
    var oldHourlyDataToCel = [];
    
     $.post('/yesterday', {lat: lat, lng: lng}, function (data) {
        // Weather information passed
        data = JSON.parse(data);
        var oldHourlyData = data.hourly.data;
         
        // Covert to celcius
        oldHourlyDataToCel = parseHourlyData(oldHourlyData);
        
        //Delete the warning message.
        $("p.inner2").replaceWith('');
    });
    
    $.post('/today', {lat: lat, lng: lng}, function (data) {
        
        // Weather information passed
        data = JSON.parse(data);
        var currentHourlyData = data.hourly.data; 

        // Covert to celcius
        currentHourlyDataToCel = parseHourlyData(currentHourlyData);
        
        loadChart(currentHourlyDataToCel, oldHourlyDataToCel); 
        
        //Delete the warning message, replace with currentn wather information.
        $("p.inner").replaceWith('<h2 style="text-align: right;">' + data.currently.summary + '</h2>' + '<h2 style="text-align: right;">' + convertToCelcius(data.currently.temperature) + ' Cº</h2><br>');
    });
    
    
}

//$('#_12hour').on('click',function(){
//    console.log('12hour');
//});
//
//$('#_18hour').on('click',function(){
//    console.log('18hour');
//});
//
//$('#_24hour').on('click',function(){
//    console.log('24hour');
//});
<commit_msg>ui tweaks<commit_after>$.post("https://www.googleapis.com/geolocation/v1/geolocate?key=<KEY>", {}, function (data){
    var lat, lng;
    lat = parseFloat(JSON.stringify(data.location.lat));
    lng = parseFloat(JSON.stringify(data.location.lng));
    $("p.location").replaceWith('');
    getWeather(lat,lng);
    $.get("https://maps.googleapis.com/maps/api/geocode/json?latlng=" + lat + "," + lng + "&key=<KEY>", function (data){ 
        $("p.location2").replaceWith('<h2 style="text-align: right;">' + data.results[0].address_components[3].long_name + "," + data.results[0].address_components[5].long_name + '</h2>');
//        var results = data.results;
    });
});


function convertToCelcius(fren) {
    var celc = (fren - 32) * 5 / 9;
    return celc.toFixed(0);
}

function getTimeArray(){
    return ['12pm','','', '3am', '', '', '6am', '', '', '9am', '', '', '12pm', '', '', '3pm', '', '', '6pm', '', '', '9pm', '', '11pm'];
}

function loadChart(currentHourlyDataToCel, oldHourlyDataToCel) {
    var chart = document.getElementById("c").getContext("2d");
    var timeLabel = getTimeArray();
    var data = {
        labels: timeLabel
        , datasets: [{
                label: "My First dataset"
                , fillColor: "rgba(220,220,220,0.2)"
                , strokeColor: "rgba(220,220,220,1)"
                , pointColor: "rgba(220,220,220,1)"
                , pointStrokeColor: "#fff"
                , pointHighlightFill: "#fff"
                , pointHighlightStroke: "rgba(220,220,220,1)"
                , data: currentHourlyDataToCel
        },{
                label: "My Second dataset"
                , fillColor: "rgba(151,187,205,0.2)"
                , strokeColor: "rgba(151,187,205,1)"
                , pointColor: "rgba(151,187,205,1)"
                , pointStrokeColor: "#fff"
                , pointHighlightFill: "#fff"
                , pointHighlightStroke: "rgba(151,187,205,1)"
                , data: oldHourlyDataToCel
        }]
    };
    var MyNewChart = new Chart(chart).Line(data, {responsive: true});
}

function parseHourlyData(data){
    
    var hourlyDataToCel = [];
    // Extract hourly tempurature and stored in an array
        for (var i = 0; i < data.length; i++) {
            var time = data[i].time;
            var date = new Date(time * 1000);
            var temp = parseFloat(data[i].apparentTemperature)
            hourlyDataToCel[i] = convertToCelcius(temp);
        };
//    console.log(hourlyDataToCel);
    return hourlyDataToCel;
}

function getWeather(lat, lng){
    var currentHourlyDataToCel = [];
    var oldHourlyDataToCel = [];
    
     $.post('/yesterday', {lat: lat, lng: lng}, function (data) {
        // Weather information passed
        data = JSON.parse(data);
        var oldHourlyData = data.hourly.data;
         
        // Covert to celcius
        oldHourlyDataToCel = parseHourlyData(oldHourlyData);
        
        //Delete the warning message.
        $("p.inner2").replaceWith('');
    });
    
    $.post('/today', {lat: lat, lng: lng}, function (data) {
        
        // Weather information passed
        data = JSON.parse(data);
        var currentHourlyData = data.hourly.data; 

        // Covert to celcius
        currentHourlyDataToCel = parseHourlyData(currentHourlyData);
        
        loadChart(currentHourlyDataToCel, oldHourlyDataToCel); 
        
        //Delete the warning message, replace with currentn wather information.
        $("p.inner").replaceWith('<h2 style="text-align: right;">' + data.currently.summary + '</h2>' + '<h2 style="text-align: right;">' + convertToCelcius(data.currently.temperature) + ' Cº</h2><br>');
    });
    
    
}

//$('#_12hour').on('click',function(){
//    console.log('12hour');
//});
//
//$('#_18hour').on('click',function(){
//    console.log('18hour');
//});
//
//$('#_24hour').on('click',function(){
//    console.log('24hour');
//});

{'fraction_non_alphanumeric': 0.17759146341463414, 'fraction_numerical': 0.035315040650406505, 'mean_word_length': 2.4960035523978688, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 21, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, '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': '7517196', 'n_tokens_mistral': 2807, 'n_tokens_neox': 2603, 'n_words': 452}