<commit_before>greenvilleJS.controller('wayCoolCtrl', ['$scope', '$q', '$timeout', function ($scope, $q, $timeout) {
  $scope.address = "";
  $scope.mapMarkers= [];
  $scope.zoom = 8;
  $scope.geoCoder = new google.maps.Geocoder(); 

  $scope.mapCenter = function() {
    return $scope.map.center;
  };

  $scope.map = {
    center: {
      latitude: 29,
      longitude: -95
    },
    zoom: $scope.zoom
  };

  $scope.initMap = function() {
    // Set map.center to $scope.currentPosition() ?
  };

  $scope.find = function() {
    // set map.center = geocode($scope.address) 's coords
    // set mapMarkers = [newCoords]
  }

  geoCode = function(address) {
    $scope.geoCoder.geocode({address: address}, function(results, status) {
      return { latitude:  results[0].geometry.location.d,
               longitude: results[0].geometry.location.e});
  };

  $scope.currentPosition = function() {
    navigator.geolocation.getCurrentPosition( function (position) {
      return position.coords;
    });
  };
}
]);
<commit_msg>Update to promises<commit_after>greenvilleJS.controller('wayCoolCtrl', ['$scope', '$q',  function ($scope, $q) {
  $scope.address = "";
  $scope.mapMarkers= [];
  $scope.zoom = 8;
  $scope.geoCoder = new google.maps.Geocoder(); 

  $scope.mapCenter = function() {
    return $scope.map.center;
  };

  $scope.map = {
    center: {
      latitude: 29,
      longitude: -95
    },
    zoom: $scope.zoom
  };

  $scope.initMap = function() {
    $scope.currentPosition().then(function(center){
      $scope.map.center = center;
    });
  };

  $scope.find = function() {
    geoCode($scope.address).then(function(newCoords) {
      $scope.map.center = newCoords;
      $scope.mapMarkers = new Array(newCoords);
    });
  };

  geoCode = function(address) {
    var deferred = $q.defer();
    $scope.geoCoder.geocode({address: address}, function(results, status) {
      deferred.resolve( { latitude:  results[0].geometry.location.d,
                          longitude: results[0].geometry.location.e});
    });
    return deferred.promise;
  };

  $scope.currentPosition = function() {
    var deferred = $q.defer();
    navigator.geolocation.getCurrentPosition( function (position) {
      deferred.resolve(position.coords);
    });
    return deferred.promise;
  };


}
]);

{'fraction_non_alphanumeric': 0.1697048611111111, 'fraction_numerical': 0.006076388888888889, 'mean_word_length': 2.9672977624784855, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7351755', 'n_tokens_mistral': 791, 'n_tokens_neox': 758, 'n_words': 128}