<commit_before><!DOCTYPE html>
<html lang="{{site.locale}}">
{{> html-head }}

<body>
    {{> header }}

    <div id="main">
        <div class="container has-side-nav">

            <aside>
                <ul>
                    <li{{#equals path site.getinvolved.link}} class="active"{{/equals}}>
                        <a href="/{{site.locale}}/{{site.getinvolved.link}}/">{{site.getinvolved.text}}</a>
                    </li>
                    <li{{#equals path site.getinvolved.code-and-learn.link}} class="active"{{/equals}}>
                        <a href="/{{site.locale}}/{{site.getinvolved.code-and-learn.link}}/">{{site.getinvolved.code-and-learn.text}}</a>
                    </li>
                    <li{{#equals path site.getinvolved.contribute.link}} class="active"{{/equals}}>
                        <a href="/{{site.locale}}/{{site.getinvolved.contribute.link}}/">{{site.getinvolved.contribute.text}}</a>
                    </li>
                    <li{{#equals path site.getinvolved.development.link}} class="active"{{/equals}}>
                        <a href="/{{site.locale}}/{{site.getinvolved.development.link}}/">{{site.getinvolved.development.text}}</a>
                    </li>
                    <li{{#equals path site.getinvolved.events.link}} class="active"{{/equals}}>
                        <a href="/{{site.locale}}/{{site.getinvolved.events.link}}/">{{site.getinvolved.events.text}}</a>
                    </li>
                    <li>
                        <a href="https://github.com/nodejs/node/blob/master/CONTRIBUTING.md#code-of-conduct">{{site.getinvolved.conduct.text}}</a>
                    </li>
                </ul>
            </aside>

            <article>
              <script src='https://api.mapbox.com/mapbox.js/v2.2.3/mapbox.js'></script>
              <link href='https://api.mapbox.com/mapbox.js/v2.2.3/mapbox.css' rel='stylesheet' />
              <style>
              div.map {
                height: 400px; 
                width:100%; 
                margin-top:10px;
              }
              .key {
                padding: 8px 0;
                text-align: center;
              }
              .key span {padding-right: 12px;}
              .key-meetup::before {
                content: ""; 
                width: 12px; 
                height: 12px; 
                background: #80bd01; 
                display: inline-block; 
                border-radius: 3px; 
                margin-right: 8px;
              }
              .key-nodeschool::before {
                content: ""; 
                width: 12px; 
                height: 12px; 
                background: #f7da03; 
                display: inline-block; 
                border-radius: 3px; 
                margin-right: 8px;
              }
              .key-conference::before {
                content: ""; 
                width: 12px; 
                height: 12px; 
                background: #3887be; 
                display: inline-block; 
                border-radius: 3px; 
                margin-right: 8px;
              }
              .events #map {
                margin: 0; 
                padding: 0;
              }
              </style>
              <div id="map" class="map"></div>
              <div class="key">
                <span class="key-meetup" data-i18n="events-meetu">Meetup</span>
                <span class="key-nodeschool" data-i18n="events-nodeschool">NodeSchool</span>
                <span class="key-conference" data-i18n="events-conference">Conference</span>
              </div>  
              <script>
              function haversine() {
                var radians = Array.prototype.map.call(arguments, function(deg) { return deg/180.0 * Math.PI; });
                var lat1 = radians[0], lon1 = radians[1], lat2 = radians[2], lon2 = radians[3];
                var R = 6372.8; // km
                var dLat = lat2 - lat1;
                var dLon = lon2 - lon1;
                var a = Math.sin(dLat / 2) * Math.sin(dLat /2) + Math.sin(dLon / 2) * Math.sin(dLon /2) * Math.cos(lat1) * Math.cos(lat2);
                var c = 2 * Math.asin(Math.sqrt(a));
                return R * c;
              }    
                  
              L.mapbox.accessToken = '<KEY>';
              var map = L.mapbox.map('map', 'mapbox.streets-basic')
              var featureLayer = L.mapbox.featureLayer()
              
              featureLayer.on('ready', function () {
                if ("geolocation" in navigator) {
                  /* geolocation is available */
                  navigator.geolocation.getCurrentPosition(function(position) {
                    var lat = position.coords.latitude
                      , lon = position.coords.longitude
                      ;

                    var points = featureLayer.getGeoJSON().features.map(function (feature) {
                      var _lat = feature.geometry.coordinates[1]
                        , _lon = feature.geometry.coordinates[0]
                        ;
                      return [feature.geometry.coordinates[0], feature.geometry.coordinates[1], haversine(lat, lon, _lat, _lon)]
                    })
                    .sort(function (a, b) {              
                      return a[2] > b[2]
                    })
                    
                    function _bounds () {
                      for (var i=0;i<points.length;i++) {
                        var hav = points[i][2]
                        if (i > 10 && hav > .1) {
                          return [points[i][1], points[i][0]]
                        }
                      }
                    }
                    
                    map.fitBounds([[lat, lon], _bounds()])
                    map.setView([lat, lon], map.getZoom()-1)
                  })
                }
              })
              
              featureLayer.loadURL('/static/event-geo.json').addTo(map)
              </script>

                {{#each regions}}
                <div class="region">
                  <h1>{{region}}</h1>
                  {{#if conferences}}<h2>Conferences</h2>{{/if}}
                  {{#each conferences}}
                  <div class="conference">
                    <h3><a href="{{link}}">{{name}}</a>
                      {{#if location}}
                        - <small class="map-link"><a href="https://www.google.com/maps/place/{{location}}">map</a></small>
                      {{/if}}
                    </h3>
                    {{#if desc}}
                    <div class="conference-description">{{desc}}</div>
                    {{/if}}
                  </div>
                  {{/each}}

                  <h2>NodeSchools</h2>
                  <ul class="events-list"><commit_msg>Events: Map bounds, distance ranking code for mapbox/leaflet<commit_after><!DOCTYPE html>
<html lang="{{site.locale}}">
{{> html-head }}

<body>
    {{> header }}

    <div id="main">
        <div class="container has-side-nav">

            <aside>
                <ul>
                    <li{{#equals path site.getinvolved.link}} class="active"{{/equals}}>
                        <a href="/{{site.locale}}/{{site.getinvolved.link}}/">{{site.getinvolved.text}}</a>
                    </li>
                    <li{{#equals path site.getinvolved.code-and-learn.link}} class="active"{{/equals}}>
                        <a href="/{{site.locale}}/{{site.getinvolved.code-and-learn.link}}/">{{site.getinvolved.code-and-learn.text}}</a>
                    </li>
                    <li{{#equals path site.getinvolved.contribute.link}} class="active"{{/equals}}>
                        <a href="/{{site.locale}}/{{site.getinvolved.contribute.link}}/">{{site.getinvolved.contribute.text}}</a>
                    </li>
                    <li{{#equals path site.getinvolved.development.link}} class="active"{{/equals}}>
                        <a href="/{{site.locale}}/{{site.getinvolved.development.link}}/">{{site.getinvolved.development.text}}</a>
                    </li>
                    <li{{#equals path site.getinvolved.events.link}} class="active"{{/equals}}>
                        <a href="/{{site.locale}}/{{site.getinvolved.events.link}}/">{{site.getinvolved.events.text}}</a>
                    </li>
                    <li>
                        <a href="https://github.com/nodejs/node/blob/master/CONTRIBUTING.md#code-of-conduct">{{site.getinvolved.conduct.text}}</a>
                    </li>
                </ul>
            </aside>

            <article>
              <script src='https://api.mapbox.com/mapbox.js/v2.2.3/mapbox.js'></script>
              <link href='https://api.mapbox.com/mapbox.js/v2.2.3/mapbox.css' rel='stylesheet' />
              <style>
              div.map {
                height: 400px; 
                width:100%; 
                margin-top:10px;
              }
              .key {
                padding: 8px 0;
                text-align: center;
              }
              .key span {padding-right: 12px;}
              .key-meetup::before {
                content: ""; 
                width: 12px; 
                height: 12px; 
                background: #80bd01; 
                display: inline-block; 
                border-radius: 3px; 
                margin-right: 8px;
              }
              .key-nodeschool::before {
                content: ""; 
                width: 12px; 
                height: 12px; 
                background: #f7da03; 
                display: inline-block; 
                border-radius: 3px; 
                margin-right: 8px;
              }
              .key-conference::before {
                content: ""; 
                width: 12px; 
                height: 12px; 
                background: #3887be; 
                display: inline-block; 
                border-radius: 3px; 
                margin-right: 8px;
              }
              .events #map {
                margin: 0; 
                padding: 0;
              }
              </style>
              <div id="map" class="map"></div>
              <div class="key">
                <span class="key-meetup" data-i18n="events-meetu">Meetup</span>
                <span class="key-nodeschool" data-i18n="events-nodeschool">NodeSchool</span>
                <span class="key-conference" data-i18n="events-conference">Conference</span>
              </div>  
              <script>
                (function() {

                  function haversine() {
                    var radians = Array.prototype.map.call(arguments, function(deg) { return deg/180.0 * Math.PI; });
                    var lat1 = radians[0], lon1 = radians[1], lat2 = radians[2], lon2 = radians[3];
                    var R = 6372.8; // km
                    var dLat = lat2 - lat1;
                    var dLon = lon2 - lon1;
                    var a = Math.sin(dLat / 2) * Math.sin(dLat /2) + Math.sin(dLon / 2) * Math.sin(dLon /2) * Math.cos(lat1) * Math.cos(lat2);
                    var c = 2 * Math.asin(Math.sqrt(a));
                    return R * c;
                  }

                  L.mapbox.accessToken = '<KEY>';
                  var map = L.mapbox.map('map', 'mapbox.streets-basic')
                  var featureLayer = L.mapbox.featureLayer()

                  featureLayer.on('ready', function () {
                    if ("geolocation" in navigator) {
                      /* geolocation is available */
                      navigator.geolocation.getCurrentPosition(function(position) {
                        var lat        = position.coords.latitude
                          , lon        = position.coords.longitude
                          , sideEffect = {dist: 100000, point: null}

                        var points = featureLayer.getGeoJSON().features.map(function (feature) {
                          var _lat = feature.geometry.coordinates[1]
                            , _lon = feature.geometry.coordinates[0]
                            , dist = haversine(lat, lon, _lat, _lon)
                          if (dist < sideEffect.dist) { sideEffect.point = [_lat, _lon]; sideEffect.dist = dist; }
                          return [_lon, _lat, dist]
                        })
                        // .sort(function (a, b) { return a[2] > b[2] }) WTF??? Using sideEffect's instead... :shame:
                        map.fitBounds([[lat, lon], sideEffect.point])
                      })
                    }
                  })

                  featureLayer.loadURL('/static/event-geo.json').addTo(map)
                })();
              </script>

                {{#each regions}}
                <div class="region">
                  <h1>{{region}}</h1>
                  {{#if conferences}}<h2>Conferences</h2>{{/if}}
                  {{#each conferences}}
                  <div class="conference">
                    <h3><a href="{{link}}">{{name}}</a>
                      {{#if location}}
                        - <small class="map-link"><a href="https://www.google.com/maps/place/{{location}}">map</a></small>
                      {{/if}}
                    </h3>
                    {{#if desc}}
                    <div class="conference-description">{{desc}}</div>
                    {{/if}}
                  </div>
                  {{/each}}

                  <h2>NodeSchools</h2>
                  <ul class="events-list">
{'fraction_non_alphanumeric': 0.14610413726509694, 'fraction_numerical': 0.015301195870162668, 'mean_word_length': 1.1566554541086016, 'pattern_counts': {'":': 0, '<': 149, '<?xml version=': 0, '>': 155, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4694994', 'n_tokens_mistral': 4017, 'n_tokens_neox': 3539, 'n_words': 590}