<commit_before><!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Heatmaps To Go</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.2/leaflet.css" />
  <meta name="description" content="Generate quick heatmaps">
  <style>
    body {
      display: flex;
      margin: 0;
      overflow: hidden;
    }
    .column {
      flex-basis: 50%;
      height: 100vh;
    }
    textarea {
      display: block;
      height: 100vh;
      width: 100%;
    }
  </style>
</head>
<body>
  <div id="map" class="column"></div>
  <div class="column">
    <textarea id="data" name="data">INSTRUCTIONS:

Fill this box with <lat>, <long> (intensity) like:
-37.8839, 175.3745188667, 571
or:
-37.8839, 175.3745188667

Then click out of box to force the map to redraw.

-37.8869090667, 175.3657417333, 486
-37.8894207167, 175.4015351167, 807
-37.8927369333, 175.4087452333, 899
-37.90585105, 175.4453463833, 1273
-37.9064188833, 175.4441556833, 1258
-37.90584715, 175.4463564333, 1279
-37.9033391333, 175.4244005667, 1078
-37.9061991333, 175.4492620333, 1309
</textarea>
  </div>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.2/leaflet.js"></script>
  <script src="https://leaflet.github.io/Leaflet.heat/dist/leaflet-heat.js"></script>
  <script>
    const map = L.map('map')
    const tiles = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
        attribution: '&copy; <a href="https://osm.org/copyright">OpenStreetMap</a> contributors',
    }).addTo(map)

    // Heatmap reference:
    // https://github.com/Leaflet/Leaflet.heat
    const heat = L.heatLayer([], {radius: 10, blur: 10}).addTo(map)
    const stripRegex = /["']/g
    const dataRegex = /(-?[\.0-9]+)[, ]+(-?[\.0-9]+)([, ]+(\d)+)?/

    function _process() {
      const lines = this.value.split('\n')
      const coords = lines
        .map((line) => line.replace(stripRegex, '').match(dataRegex))
        .filter((x) => x)
        .map(([__, lat, lng, _2, intensity]) => [lat, lng, intensity || 1])
      const bounds = L.latLngBounds(coords)
      map.fitBounds(bounds)
      heat.setLatLngs(coords)
    }

    document.getElementById('data').addEventListener('change', _process)
    _process.bind(document.getElementById('data'))()
  </script>
</body>
</html><commit_msg>Output the bounding box of the map<commit_after><!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Heatmaps To Go</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.2/leaflet.css" />
  <meta name="description" content="Generate quick heatmaps">
  <style>
    body {
      display: flex;
      margin: 0;
      overflow: hidden;
    }
    .column {
      flex-basis: 50%;
      height: 100vh;
    }
    textarea {
      display: block;
      height: 100vh;
      width: 100%;
    }
  </style>
</head>
<body>
  <div id="map" class="column"></div>
  <div class="column">
    <textarea id="data" name="data">INSTRUCTIONS:

Fill this box with <lat>, <long> (intensity) like:
-37.8839, 175.3745188667, 571
or:
-37.8839, 175.3745188667

Then click out of box to force the map to redraw.

-37.8869090667, 175.3657417333, 486
-37.8894207167, 175.4015351167, 807
-37.8927369333, 175.4087452333, 899
-37.90585105, 175.4453463833, 1273
-37.9064188833, 175.4441556833, 1258
-37.90584715, 175.4463564333, 1279
-37.9033391333, 175.4244005667, 1078
-37.9061991333, 175.4492620333, 1309
</textarea>
  </div>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.2/leaflet.js"></script>
  <script src="https://leaflet.github.io/Leaflet.heat/dist/leaflet-heat.js"></script>
  <script>
    const map = L.map('map')
    const tiles = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
        attribution: '&copy; <a href="https://osm.org/copyright">OpenStreetMap</a> contributors',
    }).addTo(map)

    // Heatmap reference:
    // https://github.com/Leaflet/Leaflet.heat
    const heat = L.heatLayer([], {radius: 10, blur: 10}).addTo(map)
    const stripRegex = /["']/g
    const dataRegex = /(-?[\.0-9]+)[, ]+(-?[\.0-9]+)([, ]+(\d)+)?/

    function _process() {
      const lines = this.value.split('\n')
      const coords = lines
        .map((line) => line.replace(stripRegex, '').match(dataRegex))
        .filter((x) => x)
        .map(([__, lat, lng, _2, intensity]) => [lat, lng, intensity || 1])
      const bounds = L.latLngBounds(coords)
      map.fitBounds(bounds)
      heat.setLatLngs(coords)

      // Faux permalink. Don't actually read them in because that fights with
      // the bounding box of the data.
      document.location.hash = map.getBounds().toBBoxString()
      map.on('moveend', () => document.location.hash = map.getBounds().toBBoxString())
    }

    document.getElementById('data').addEventListener('change', _process)
    _process.bind(document.getElementById('data'))()
  </script>
</body>
</html>
{'fraction_non_alphanumeric': 0.186685667752443, 'fraction_numerical': 0.12011400651465798, 'mean_word_length': 3.2099400171379604, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 70, 'https://': 12, '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': '1948285', 'n_tokens_mistral': 2252, 'n_tokens_neox': 1823, 'n_words': 361}