Skip to content

Instantly share code, notes, and snippets.

@quanganhdo
Last active August 5, 2019 19:16
Show Gist options
  • Select an option

  • Save quanganhdo/9fa96538f3c49436603aa3bf1de9e4c2 to your computer and use it in GitHub Desktop.

Select an option

Save quanganhdo/9fa96538f3c49436603aa3bf1de9e4c2 to your computer and use it in GitHub Desktop.
require 'json'
puts <<HERE
<!DOCTYPE html>
<html>
<!--So long and thanks for all the fish-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Pocket Export</title>
</head>
<body>
<h1>History</h1>
<ul>
HERE
episodes = JSON.parse(File.read('castro-history.json'))
episodes.each do |episode|
puts <<HERE
<li><a href="#{episode['url']}" time_added="#{episode['lastPlayed'].to_s.split('.')[0]}" tags="castro#{episode['starred'] == 1 ? ',castro-starred' : ''}">#{episode['name']} · #{episode['title']}</a></li>
HERE
end
puts <<HERE
</ul>
</body>
</html>
HERE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment