<commit_before><!DOCTYPE html>
<html>
  <head>
    <title>Place searches</title>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <script src="//code.jquery.com/jquery-1.12.0.min.js"></script>
    <style>
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
      }
      div {box-sizing: border-box;}
      .full-width:first-child{margin-top:40px;}
      .full-width {width:80%; margin-left:auto;margin-right:auto;}
      .half {float:left; width:50%; padding:30px;}
      #map {
        height: 500px;
      }
      textarea, button {display:block;}
    </style>
    <script>
      // This example requires the Places library. Include the libraries=places
      // parameter when you first load the API. For example:
      // <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=places">

      var map;
      var infowindow;
      var sanjose = {lat: 37.330, lng: -121.89};

      function initMap() {
        map = new google.maps.Map(document.getElementById('map'), {
          center: sanjose,
          zoom: 11
        });
      }

      function lookup(){
        $('#places_output').empty();
        var in_text = $('#places_input').val();
        console.log(in_text);
        var re = /\s*\n\s*/;
        var nameList = in_text.split(re);

        infowindow = new google.maps.InfoWindow();
        var service = new google.maps.places.PlacesService(map);
        
        for (var i=0; i < nameList.length; i++){
          if (nameList[i].length > 0){
            service.nearbySearch({
              location: sanjose,
              radius: 50000,
              keyword: nameList[i]
            }, callback);
          }
        }
      }

      function copyToClipboard(element) {
        // http://stackoverflow.com/a/30905277/940217
        var $temp = $("<input>");
        $("body").append($temp);
        $temp.val($(element).text()).select();
        document.execCommand("copy");
        $temp.remove();
      }

      function placeToCSV(placeObj){
        var res = [placeObj.name,
        placeObj.geometry.location.lat(),
        placeObj.geometry.location.lng(),
        placeObj.vicinity,
        '['+placeObj.types+']'];
        return res.join(',');
      }

      function callback(results, status) {
        if (status === google.maps.places.PlacesServiceStatus.OK) {
          var out = $('#places_output');
          var res = [];
          for (var i = 0; i < results.length; i++) {
            createMarker(results[i]);
            // console.log(results[i]);
            res.push(placeToCSV(results[i]));
          }
          $('#places_output').prepend(document.createTextNode(res.join('\n')+'\n'));
        }
      }

      function createMarker(place) {
        var placeLoc = place.geometry.location;
        var marker = new google.maps.Marker({
          map: map,
          position: place.geometry.location
        });<commit_msg>fixed issue where map markers wouldn't clear from map on new search.<commit_after><!DOCTYPE html>
<html>
  <head>
    <title>Place searches</title>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <script src="//code.jquery.com/jquery-1.12.0.min.js"></script>
    <style>
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
      }
      div {box-sizing: border-box;}
      .full-width:first-child{margin-top:40px;}
      .full-width {width:80%; margin-left:auto;margin-right:auto;}
      .half {float:left; width:50%; padding:30px;}
      #map {
        height: 500px;
      }
      textarea, button {display:block;}
    </style>
    <script>
      // This example requires the Places library. Include the libraries=places
      // parameter when you first load the API. For example:
      // <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=places">

      var map;
      var infowindow;
      var sanjose = {lat: 37.330, lng: -121.89};
      var markers = [];

      function initMap() {
        map = new google.maps.Map(document.getElementById('map'), {
          center: sanjose,
          zoom: 11
        });
      }

      function reset(){
        // clear output area
        $('#places_output').empty();

        // clear markers on map
        for (var i = 0; i < markers.length; i++) {
          markers[i].setMap(null);
        }
        markers = [];
      }

      function lookup(){
        reset()
        var in_text = $('#places_input').val();
        console.log(in_text);
        var re = /\s*\n\s*/;
        var nameList = in_text.split(re);

        infowindow = new google.maps.InfoWindow();
        var service = new google.maps.places.PlacesService(map);
        
        for (var i=0; i < nameList.length; i++){
          if (nameList[i].length > 0){
            service.nearbySearch({
              location: sanjose,
              radius: 50000,
              keyword: nameList[i]
            }, callback);
          }
        }
      }

      function copyToClipboard(element) {
        // http://stackoverflow.com/a/30905277/940217
        var $temp = $("<input>");
        $("body").append($temp);
        $temp.val($(element).text()).select();
        document.execCommand("copy");
        $temp.remove();
      }

      function placeToCSV(placeObj){
        var res = [placeObj.name,
        placeObj.geometry.location.lat(),
        placeObj.geometry.location.lng(),
        placeObj.vicinity,
        '['+placeObj.types+']'];
        return res.join(',');
      }

      function callback(results, status) {
        if (status === google.maps.places.PlacesServiceStatus.OK) {
          var out = $('#places_output');
          var res = [];
          for (var i = 0; i < results.length; i++) {
            createMarker(results[i]);
            // console.log(results[i]);
            res.push(placeToCSV(results[i]));
          }
          $('#places_output').prepend(document.createTextNode(res.join('\n')+'\n'));
        }
      }

      function createMarker(place) {
        var placeLoc = place.geometry.location;
        var marker = new google.maps.Marker({
          map: map,
          position: place.geometry.location
        });
        markers.push(marker);
{'fraction_non_alphanumeric': 0.1548826886493342, 'fraction_numerical': 0.018230818008877617, 'mean_word_length': 1.946753853339561, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 33, 'https://': 2, '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': '1616599', 'n_tokens_mistral': 2022, 'n_tokens_neox': 1889, 'n_words': 381}