Skip to content

Instantly share code, notes, and snippets.

View dillten's full-sized avatar
💚

Dillon TenBrink dillten

💚
View GitHub Profile
@dillten
dillten / convert.js
Created February 26, 2021 01:13
Quick and dirty JS for processing ForeFlight KML/GeoJSON properties into timestamps for kepler.gl
const fs = require('fs');
fs.readFile("input.geojson", function(err, data) {
if (err) throw err;
let track = JSON.parse(data);
for (let i = 0; i < track.features[0].geometry.coordinates.length; i++) {
let timestamp = Date.parse(track.features[0].properties.coordTimes[i])
track.features[0].geometry.coordinates[i][3] = timestamp
}
@dillten
dillten / secondMonday.js
Created January 14, 2015 21:45
Get the second Monday of the month using moment.js
var mo = require('moment');
function getSecondMonday(startDate) {
var startOfMonth = mo(startDate).utc().startOf('month').startOf('isoweek');
var studyDate = mo(startDate).utc().startOf('month').startOf('isoweek').add(2, 'w');
if (studyDate.month() == startOfMonth.month()) {
studyDate = studyDate.subtract(1, 'w');
}
return studyDate;