Skip to content

Instantly share code, notes, and snippets.

@craigeley
Created January 12, 2019 23:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craigeley/523bdbab38fccdd84e7ce59873ab9e2e to your computer and use it in GitHub Desktop.
Save craigeley/523bdbab38fccdd84e7ce59873ab9e2e to your computer and use it in GitHub Desktop.
This app parses the Arc iOS app's GPX exports and sends location to the Day One journaling app. You must have the Day One command line interface installed and set the path to your GPX files on line 8.
#!/usr/local/opt/ruby/bin/ruby
# Scipt to send Arc locations to Day One
require 'nokogiri'
require 'time'
require 'json'
filepath = "/Path/to/files/#{ARGV[0]}.gpx"
f = File.open(filepath)
gpxdoc = Nokogiri::XML(f)
gpxdoc.css("wpt").each do |point|
lat = point.attr("lat")
lon = point.attr("lon")
place = point.css("name").text.strip
t = point.css("time").text
time = Time.parse(t)
iso = time.utc.iso8601
`dayone2 new "## #{place}\n\n" -j Inbox -isoDate #{iso} --coordinate #{lat} #{lon}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment