-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.webm filter=lfs diff=lfs merge=lfs -text |
This file contains 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
Git LFS file not shown
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
(defvar snowcrash--refresh-rate "1 sec") | ||
|
||
(defvar snowcrash--symbols '(?█ ? )) | ||
;; (defvar snowcrash--symbols '(?. ? )) | ||
|
||
(defvar snowcrash--buffer-name "*snowcrash*") | ||
|
||
(defvar snowcrash--timer nil) | ||
|
||
(defun snowcrash--draw () | ||
"Draw snowcrash in the current buffer." | ||
(with-current-buffer (get-buffer snowcrash--buffer-name) | ||
(read-only-mode -1) | ||
(erase-buffer) | ||
(dotimes (lines (1- (window-total-height nil 'floor))) | ||
(dotimes (columns (1- (window-total-width nil 'floor))) | ||
(insert-char (nth (random (length snowcrash--symbols)) | ||
snowcrash--symbols))) | ||
(unless (= lines (- (window-total-height nil t) 2)) | ||
(newline))) | ||
(goto-char (point-min)) | ||
(read-only-mode 1))) | ||
|
||
(defun snowcrash--tick () | ||
(snowcrash--draw) | ||
(setq snowcrash--timer | ||
(run-with-timer snowcrash--refresh-rate t #'snowcrash--tick))) | ||
|
||
(defun snowcrash () | ||
(interactive) | ||
(switch-to-buffer (get-buffer-create snowcrash--buffer-name)) | ||
(snowcrash-mode)) | ||
|
||
(defun snowcrash--quit-window-hook () | ||
(when (and (eq major-mode 'snowcrash-mode) | ||
snowcrash--timer) | ||
(cancel-timer snowcrash--timer) | ||
(setq snowcrash--timer nil))) | ||
|
||
(define-derived-mode | ||
snowcrash-mode | ||
special-mode | ||
"Snowcrash" | ||
"Draw snowcrash noise. Fun for the entire family!" | ||
(add-hook 'quit-window-hook #'snowcrash--quit-window-hook) | ||
(message "Type q to quit.") | ||
(snowcrash--tick)) | ||
|
||
(provide 'snowcrash) |