Skip to content

Instantly share code, notes, and snippets.

@illiichi
Created April 2, 2014 21:42
Show Gist options
  • Save illiichi/9943797 to your computer and use it in GitHub Desktop.
Save illiichi/9943797 to your computer and use it in GitHub Desktop.
(defvar sc-stopwatch ())
(defvar sc-rpm 120)
(defun clear-stopwatch ()
(interactive)
(setq sc-stopwatch ())
(lap-stopwatch))
(defun lap-stopwatch ()
(add-to-list 'sc-stopwatch (time-to-seconds (current-time))))
(defun show-stopwatch ()
(interactive)
(insert (s-join ", "
(let* ((xs sc-stopwatch)
(c (* 8 1.0))
(ds (reverse (-zip-with '- xs (cdr xs))))
(rps (/ 60.0 sc-rpm)))
(->> ds
(--map (/ (* it c) rps))
(--map (/ (round it) c))
(--map (format "%s" it)))))))
(defadvice sclang-eval-string (before sc-lap-time)
(lap-stopwatch))
(ad-activate 'sclang-eval-string)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment