scittle

borkdude 2022-12-02T12:09:15.040669Z

@raymcdermott What are the troubles you have with Github pages? There is also an #adventofcode channel where you can share / discuss solutions

๐Ÿ‘๐Ÿผ 1
ray 2022-12-02T12:28:42.775729Z

do you have a CLJ code-formatter for scittle?

borkdude 2022-12-02T12:37:31.683479Z

@raymcdermott you can just code in a file and then refer to that file from a script tag

borkdude 2022-12-02T12:38:11.371559Z

See here: https://babashka.org/scittle/#src

ray 2022-12-02T13:05:14.886499Z

I don't understand yet ... I see the page but don't see how to make the page

borkdude 2022-12-02T13:13:25.548929Z

make?

ray 2022-12-02T13:14:03.955359Z

produce

ray 2022-12-02T13:14:08.124959Z

code up

ray 2022-12-02T13:14:22.720509Z

incantations

ray 2022-12-02T13:15:36.022199Z

I have a function like this:

ray 2022-12-02T13:15:43.160029Z

(defn content
  [day#]
  (let [elves (->> @data
                   str/split-lines
                   (map js/parseInt)
                   (partition-by js/isNaN)
                   (keep (fn [xs]
                           (when-not (js/isNaN (first xs))
                             (reduce + xs)))))]
    [:div
     [:a {:href (str "" day#)}
      "Link to AOC Challenge for day " day#]
     [:br]
     [:br]
     [:h3 "Calorie counting for " (count elves) " elves. They each have this many calories..."]
     [elf-table elves]
     [:br]
     [parts elves]]))

ray 2022-12-02T13:16:07.824069Z

And I want a way to show that function, or a part of that function

ray 2022-12-02T13:16:43.932689Z

not the whole file cos that's cluttered with CSS / html elements

borkdude 2022-12-02T13:19:55.223939Z

ok, you want to show a code sample. Take a look at the scittle README where this is also done

borkdude 2022-12-02T13:20:06.993459Z

not the readme but the http://github.io docs thing

borkdude 2022-12-02T13:20:16.829709Z

https://babashka.org/scittle/

ray 2022-12-02T14:27:03.094229Z

seems like it the same page ๐Ÿ›ž

borkdude 2022-12-02T14:34:38.430679Z

nope

borkdude 2022-12-02T14:35:02.898449Z

This is the page with the docs: https://babashka.org/scittle/ It is not the README.md of the scittle github repo

borkdude 2022-12-02T14:35:16.928269Z

and those docs show code snippets, which is what you were asking about

ray 2022-12-02T15:18:55.860699Z

I'm probably asking it wrong but I don't how that page is made so that it shows the text snippets. I want to make the snippets available dynamically not hard-coded.

borkdude 2022-12-02T15:23:19.303529Z

@raymcdermott you can just look at the source of this page. there is no build process, view source shows it like it was done. I did hardcode the snippets I wanted to show, but I think you could make that dynamic. I see your need for a formatter here. I also have a playground that I pre-populated with some code - again, no build process, everything is loaded directly from jsdeliver / npm https://babashka.org/scittle/codemirror.html

ray 2022-12-02T15:25:42.659269Z

ok - gotcha. Thanks

Richie 2022-12-02T22:33:52.546659Z

What are my options if I want to use a library like https://github.com/philoskim/debux? I can either try to build the library and put js files on a cdn or try and fetch the clj source from github and eval it. Have you done anything like that yet?

borkdude 2022-12-02T22:46:57.054699Z

@rgkirch I think it's likely you'll bump into some incompatibility if you load it from source (I see cljs.analyzer.api is used for example), but you might be able to simplify this lib to evaluate it with scittle directly. If you're going to include as a compiled lib, you have the challenge that this library consists of macros and those macros have to exist at run time in SCI - which basically means copying them as regular functions (see sci.configs for promesa for example).

Richie 2022-12-02T23:14:39.241819Z

Thanks. It looks like nothing in debux would work without changes. The other library that I always reach for is meander. I think Iโ€™ll start by cloning it into my project, reference it from script tags, and find out if itโ€™s incompatible. I guess Iโ€™d have to have a script tag for each source file. And order probably matters. That sounds like a pain. You havenโ€™t done anything in that direction yet?

borkdude 2022-12-02T23:16:52.433419Z

That's how it currently works. meander does work with babashka, but I'd be surprised if it currently worked with scittle. I haven't tried it in #nbb. It's easier to try it out with that, by adding the lib to nbb.edn and then requiring it

Richie 2022-12-02T23:19:33.801639Z

Ok, thanks for that advice!

ray 2022-12-02T00:50:55.198049Z

still trying to get GH pages working (some screwed up custom domain troubles)

ray 2022-12-02T00:50:56.480589Z

https://github.com/raymcdermott/aoc22

ray 2022-12-02T00:51:31.131849Z

a work in progress with ideas welcome

ray 2022-12-02T00:52:21.833019Z

It demonstrates multiple CLJS source files and fetch

ray 2022-12-02T00:53:09.082869Z

also that the javascript variants of parse-long are not as nice ๐Ÿ™‚

ray 2022-12-02T00:53:45.756709Z

so it would be nice to have those here ๐Ÿ™๐Ÿผ

ray 2022-12-02T00:55:05.293649Z

some ideas: I want to highlight the "winning" numbers when revealing the answers. I could also make the table a bit more snazzy.

borkdude 2022-12-02T07:08:14.624069Z

Advent of Code in Scittle, amazing @raymcdermott !

borkdude 2022-12-02T07:09:13.518129Z

Feel free to make issues / PRs for missing stuff, I will support this effort by making more frequent releases for AoC :)

๐Ÿ‘๐Ÿผ 1