Created
October 25, 2024 21:03
-
-
Save refaktor/b07f35e37d0c3ac56ae32ced1027dbc3 to your computer and use it in GitHub Desktop.
The saved console state after tdesk demo
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
; this is the result of save\current after (in) the asciinema demo: | |
; Building & using simple utils in Rye console https://asciinema.org/a/684031 | |
; There are 2 bugs in current save\current that got exposed with this code and we will fix | |
; * -> is saved in primary form which is |_-> which caused loader error | |
; * [ ] blocks just recently became distinct from { }, we need to update the code to separate them too | |
hn: context { | |
hn: https://hacker-news.firebaseio.com/v0/ | |
get-top: fn { n } { hn ._+ "topstories.json" |get |parse-json |head n |map { .to-integer } } | |
get-titles: fn { ids } { |map { .embed hn ._+ "item/{}.json" |get |parse-json -> "title" } } | |
top: fn { n } { get-top n |get-titles |to-block |display } | |
} | |
somafm: context { | |
list: fn { } { get-links .filter-pls .display } | |
get-links: fn { } { get https://soma.fm |reader |parse-html { <a> [ .attr? 'href |collect! ] } pop-collected! } | |
filter-pls: fn { links } { |filter { .is-match* regexp "^\/[a-z]+\.pls$" } |map { .submatch?* regexp "\/([a-z]+)\." } } | |
play: fn { name } { .embed "mpv --no-video https://somafm.com/{}.pls" |cmd } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment