Skip to content

Instantly share code, notes, and snippets.

View shaunparker's full-sized avatar

Shaun Parker shaunparker

  • Lohi Labs
  • Denver, CO
View GitHub Profile
@shaunparker
shaunparker / media_segments.cljc
Last active August 14, 2019 20:16
A coding exercise for merging media segments and calculating the total duration of a piece of media that was watched.
(ns media-segments)
(defn merge-segments
"Merges two overlapping segments into one segment."
[[start1 end1] [start2 end2]]
[(min start1 start2) (max end1 end2)])
(defn normalize-segments
"Takes a sequence of segments, sorts them, and merges any that overlap.
@shaunparker
shaunparker / README.md
Last active February 10, 2019 18:13
Tagged literal to reduce namespaced keyword verbosity