Created
April 2, 2014 21:42
-
-
Save illiichi/9943797 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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