Skip to content

Instantly share code, notes, and snippets.

@devth
Created May 21, 2020 23:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devth/bd154e76536eed783974764dc6e6a2d3 to your computer and use it in GitHub Desktop.
Save devth/bd154e76536eed783974764dc6e6a2d3 to your computer and use it in GitHub Desktop.
(defn xkcd-cmd
"xkcd # fetch current xkcd comic"
{:yb/cat #{:fun :img}}
[_]
((juxt :title :img :alt) (get-json endpoint)))
(defn xkcd-idx-cmd
"xkcd <index> # fetch xkcd number <index>"
{:yb/cat #{:fun :img}}
[{index :match}]
;; TODO fetch https://xkcd.com/<index>/info.0.json
)
(cmd-hook #"xkcd"
#"\d+" xkcd-idx-cmd
_ xkcd-cmd)
@devth
Copy link
Author

devth commented May 21, 2020

Maybe extract (juxt :title :img :alt) to a format helper to be shared across both xkcd-cmd and xkcd-idx-cmd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment