Fork me on GitHub
#scittle
<
2022-12-02
>
genRaiy00:12:55

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

genRaiy00:12:31

a work in progress with ideas welcome

genRaiy00:12:21

It demonstrates multiple CLJS source files and fetch

genRaiy00:12:09

also that the javascript variants of parse-long are not as nice 🙂

genRaiy00:12:45

so it would be nice to have those here 🙏:skin-tone-3:

genRaiy00:12:05

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

borkdude07:12:14

Advent of Code in Scittle, amazing @raymcdermott !

borkdude07:12:13

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

1
borkdude12:12:15

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

1
genRaiy12:12:42

do you have a CLJ code-formatter for scittle?

borkdude12:12:31

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

genRaiy13:12:14

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

genRaiy13:12:22

incantations

genRaiy13:12:36

I have a function like this:

genRaiy13:12:43

(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]]))

genRaiy13:12:07

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

genRaiy13:12:43

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

borkdude13:12:55

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

borkdude13:12:06

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

genRaiy14:12:03

seems like it the same page :wheel:

borkdude14:12:02

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

borkdude14:12:16

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

genRaiy15:12:55

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.

borkdude15:12:19

@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

genRaiy15:12:42

ok - gotcha. Thanks

Richie22:12:52

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?

borkdude22:12:57

@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).

Richie23:12:39

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?

borkdude23:12:52

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 #C029PTWD3HR. It's easier to try it out with that, by adding the lib to nbb.edn and then requiring it

Richie23:12:33

Ok, thanks for that advice!