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
#!/bin/zsh | |
//(){ : ;} | |
//;set -xe # set to -xe if you need to debug | |
//;rstrip() { printf '%s\n' "${1%%$2}" } # AUTHOR: gh!dylanaraps/pure-sh-bible | |
//;NEW="$(rstrip $0 ".js")".min.js | |
//;compress_opt(){ terser --compress ecma=5,computed_props=false $@ } | |
//;clean_opt(){ compress_opt $@ } | |
//;run(){ clean_opt --keep-classnames --keep-fnames -- $@ } | |
//;run $0 | grep -v '#!/bin/zsh' > $NEW | |
//;{ printf 'javascript:' ;cat $NEW ;} | vis-clipboard --copy |
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
(require 'url) | |
(require 'cl-lib) | |
(require 'seq) | |
;;^~~~~~~~~~~~~~^ comment if inadequate. | |
(let* ((url "https://youtu.be/dQw4w9WgXcQ?si=GoFuckYourself&t=420") ;; example url | |
(url-obj (url-generic-parse-url url)) | |
(url-ofs (copy-sequence (url-filename url-obj))) | |
;; url-old-filename-string, used after mutate | |
(si-idx (string-match "?si=.*" (url-filename url-obj))) |
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
(use-modules (srfi srfi-43)) ;; for extra vector functions | |
(define (vassociation-procedure equalfn ref) | |
(lambda (key avec) | |
(let ((idx (vector-index (lambda (x) (equalfn (ref x) key)) avec))) | |
(vector-ref avec idx)))) | |
(define vassq (vassociation-procedure eq? car)) | |
(define vassv (vassociation-procedure eqv? car)) | |
(define vassoc (vassociation-procedure equal? car)) |