<commit_before>---
---

// h/t http://stackoverflow.com/a/12262820/1247272
angular.module('analytics', ['ng']).service('analytics', [
      '$rootScope', '$window', '$location', function($rootScope, $window, $location) {
        var track = function() {
            ga('send', 'pageview', {'page': $location.path()});
        };
      $rootScope.$on('$routeChangeSuccess', track);
    }
]);

var healthApp = angular.module("healthApp", ['ngRoute', 'analytics'])
.config(function($routeProvider, $locationProvider){
    $routeProvider.when("/help", {
        templateUrl: "help.html",
        controller: "IndexCtrl",        
    });
    
    $routeProvider.when("/about", {
        templateUrl: "about.html",
        controller: "IndexCtrl",        
    });

    $routeProvider.when("/sms", {
        templateUrl: "sms.html",
        controller: "IndexCtrl",        
    });    
    
    $routeProvider.when("/", {
        templateUrl: "search.html",
        controller: "SearchCtrl",        
    });    
});

healthApp.filter('escape', function() {
  return window.encodeURIComponent;
});

healthApp.controller('IndexCtrl', ['$scope', '$http', 'analytics', function($scope, $http, analytics){
    
}]);

healthApp.controller('SearchCtrl', ['$scope', '$http', '$location', 'analytics', function($scope, $http, $location, analytics){
    $scope.searchLocation = ($location.search()).l || "";
    $scope.geocodeError = false;
    $scope.noResultsError = false;
    $scope.lat = ($location.search()).lat;
    $scope.lon = ($location.search()).lon;
    $scope.dist = ($location.search()).d || 1609;
    $scope.searchType = ($location.search()).typ || 0;
    
    // $scope.map = new google.maps.Map(document.getElementById("map-canvas"), {zoom: 12, mapTypeId: google.maps.MapTypeId.ROADMAP});
    
    $scope.doGeocode = function(){
        // hit google for lat/lng
        var geocoder = new google.maps.Geocoder();
        
        geocoder.geocode( { 'address': $scope.searchLocation + " chicago, il"}, function(results, status) {
            if (status == google.maps.GeocoderStatus.OK) {
                $scope.lat = results[0].geometry.location.ob;
                $scope.lon = results[0].geometry.location.pb;
                           
                $scope.doSearch();
                
                // $scope.map.setCenter(results[0].geometry.location);
                //                     $scope.map.setZoom(14)
                //                     var marker = new google.maps.Marker({
                //                         map: $scope.map,
                //                         position: results[0].geometry.location
                //                     });
                $scope.geocodeError = false<commit_msg>fix broken gmaps geocode response<commit_after>---
---

// h/t http://stackoverflow.com/a/12262820/1247272
angular.module('analytics', ['ng']).service('analytics', [
      '$rootScope', '$window', '$location', function($rootScope, $window, $location) {
        var track = function() {
            ga('send', 'pageview', {'page': $location.path()});
        };
      $rootScope.$on('$routeChangeSuccess', track);
    }
]);

var healthApp = angular.module("healthApp", ['ngRoute', 'analytics'])
.config(function($routeProvider, $locationProvider){
    $routeProvider.when("/help", {
        templateUrl: "help.html",
        controller: "IndexCtrl",        
    });
    
    $routeProvider.when("/about", {
        templateUrl: "about.html",
        controller: "IndexCtrl",        
    });

    $routeProvider.when("/sms", {
        templateUrl: "sms.html",
        controller: "IndexCtrl",        
    });    
    
    $routeProvider.when("/", {
        templateUrl: "search.html",
        controller: "SearchCtrl",        
    });    
});

healthApp.filter('escape', function() {
  return window.encodeURIComponent;
});

healthApp.controller('IndexCtrl', ['$scope', '$http', 'analytics', function($scope, $http, analytics){
    
}]);

healthApp.controller('SearchCtrl', ['$scope', '$http', '$location', 'analytics', function($scope, $http, $location, analytics){
    $scope.searchLocation = ($location.search()).l || "";
    $scope.geocodeError = false;
    $scope.noResultsError = false;
    $scope.lat = ($location.search()).lat;
    $scope.lon = ($location.search()).lon;
    $scope.dist = ($location.search()).d || 1609;
    $scope.searchType = ($location.search()).typ || 0;
    
    // $scope.map = new google.maps.Map(document.getElementById("map-canvas"), {zoom: 12, mapTypeId: google.maps.MapTypeId.ROADMAP});
    
    $scope.doGeocode = function(){
        // hit google for lat/lng
        var geocoder = new google.maps.Geocoder();
        
        geocoder.geocode( { 'address': $scope.searchLocation + " chicago, il"}, function(results, status) {
            if (status == google.maps.GeocoderStatus.OK) {
                $scope.lat = results[0].geometry.location.lat();
                $scope.lon = results[0].geometry.location.lng();
                           
                $scope.doSearch();
                
                // $scope.map.setCenter(results[0].geometry.location);
                //                     $scope.map.setZoom(14)
                //                     var marker = new google.maps.Marker({
                //                         map: $scope.map,
                //                         position: results[0].geometry.location
                //                     });
                $scope.geocodeError = false
{'fraction_non_alphanumeric': 0.17337685890460647, 'fraction_numerical': 0.010155966630395358, 'mean_word_length': 2.069003895381191, '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': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6568855', 'n_tokens_mistral': 1609, 'n_tokens_neox': 1550, 'n_words': 257}