<commit_before>var destinationName;
var cafeName;
var mode = "WALKING";

var map, placesService, directionsService;

function init () {
     map = new google.maps.Map(document.getElementById("map-canvas"), {
      center: new google.maps.LatLng(0, 0),
      zoom: 10
    });

     placesService = new google.maps.places.PlacesService(map);
     directionsService = new google.maps.DirectionsService(map);

    locateMe();
}

function locateMe() {

  document.getElementById("instructions").innerHTML = "<div class='title busy'>A little wait...</div>";

  navigator.geolocation.getCurrentPosition(function (position) {
    searchForCoffee(position.coords.latitude, position.coords.longitude);
  }, function (err) {
    document.getElementById("instructions").innerHTML = "<div class='title warn'>Unable to locate you " + modeButton() + "</div>";
  });
}

function searchForCoffee(lat, lng) {

  myLocation = new google.maps.LatLng(lat, lng);

  var searchRequest = {
    location: myLocation,
    radius: mode === "WALKING" ? 1000 : 5000,
    types: ["cafe"],
    keyword: "espresso",
    openNow: true
  };

  placesService.nearbySearch(searchRequest, foundCoffee);
}

function foundCoffee(results, status) {

  if (status == google.maps.places.PlacesServiceStatus.OK) {

    destinationName = results[0].name;

    var routeRequest = {
      origin: myLocation,
      destination: results[0].geometry.location,
      travelMode: google.maps.TravelMode[mode]
    };

    directionsService.route(routeRequest, foundRoute);
  }
  else {
    document.getElementById("instructions").innerHTML = "<div class='title warn'>No coffee found nearby " + modeButton() + "</div>";
  }
}

function foundRoute(results, status) {

  if (status == google.maps.DirectionsStatus.OK) {

    var route = results.routes[0].legs[0];
    var eta = Math.floor(route.duration.value / 60);

    var list = route.steps.map(function(step) {
      var icon = step.maneuver ? "<div class='adp-maneuver adp-" + step.maneuver + "'>&nbsp;</div>" : "";
      var dist = "<i>" + Math.round(step.distance.value / 50) * 50 + " m</i>";
      return icon + step.instructions + " " + dist;
    });

    document.getElementById("instructions").innerHTML = "<div class='title'>" + destinationName + " (" + eta + " minutes) " + modeButton() + "</div>" + "<ul><li>" + list.join("</li><li>") + "</li></ul>";<commit_msg>omnomnom<commit_after>var destinationName;
var cafeName;
var mode = "WALKING";

var map, placesService, directionsService;

function init () {
     map = new google.maps.Map(document.getElementById("map-canvas"), {
      center: new google.maps.LatLng(0, 0),
      zoom: 10
    });

     placesService = new google.maps.places.PlacesService(map);
     directionsService = new google.maps.DirectionsService(map);

    locateMe();
}

function locateMe() {

  document.getElementById("instructions").innerHTML = "<div class='title busy'>A little wait...</div>";

  navigator.geolocation.getCurrentPosition(function (position) {
    searchForCoffee(position.coords.latitude, position.coords.longitude);
  }, function (err) {
    document.getElementById("instructions").innerHTML = "<div class='title warn'>Unable to locate you " + modeButton() + "</div>";
  });
}

function searchForCoffee(lat, lng) {

  myLocation = new google.maps.LatLng(lat, lng);

  var searchRequest = {
    location: myLocation,
    radius: mode === "WALKING" ? 1000 : 5000,
    types: ["cafe"],
    keyword: "espresso",
    openNow: true
  };

  placesService.nearbySearch(searchRequest, foundCoffee);
}

function foundCoffee(results, status) {

  if (status == google.maps.places.PlacesServiceStatus.OK) {

    destinationName = results[0].name;

    var routeRequest = {
      origin: myLocation,
      destination: results[0].geometry.location,
      travelMode: google.maps.TravelMode[mode]
    };

    directionsService.route(routeRequest, foundRoute);
  }
  else {
    document.getElementById("instructions").innerHTML = "<div class='title warn'>No coffee found nearby " + modeButton() + "</div>";
  }
}

function foundRoute(results, status) {

  if (status == google.maps.DirectionsStatus.OK) {

    var route = results.routes[0].legs[0];
    var eta = Math.floor(route.duration.value / 60);

    var list = route.steps.map(function(step) {
      var icon = step.maneuver ? "<div class='adp-maneuver adp-" + step.maneuver + "'>&nbsp;</div>" : "";
      var dist = "<i>" + Math.round(step.distance.value / 50) * 50 + " m</i>";
      return icon + step.instructions + " " + dist;
    });

    list.push("☕ omnomnom");

    document.getElementById("instructions").innerHTML = "<div class='title'>" + destinationName + " (" + eta + " minutes) " + modeButton() + "</div>" + "<ul><li>" + list.join("</li><li>") + "</li></ul>";
{'fraction_non_alphanumeric': 0.1645357367428212, 'fraction_numerical': 0.009222385244183609, 'mean_word_length': 3.8250758341759354, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, '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': '295074', 'n_tokens_mistral': 1547, 'n_tokens_neox': 1466, 'n_words': 301}