hapësirë - quote collection with a simple API

a quotes/sayings/proverbs collection with a simple API made with 💜, Ash, Plug and Slime - https://hapesire.kira.computer/ there is a personal coding challenge that i started randomly almost 4 years ago. the main point is to make a CLI utility that fetches random quotes and sayings from one API, formats them in an unsophisticated way: basic colors with ANSI codes and text wrapping by specific width. basically i've been making the same utility in different programming languages preserving the style and some key features however this API is really and i mean really old and has some problems like malformed json responses - apostrophes are escaped for some reason while double quotes are not. i haven't noticed the second issue in all these years until recently. how would you fix unescaped double quotes inside a string in some JSON? by reinventing the wheel with too much effort and pain... and fixing escaped apostrophes was not a problem for me a few weeks ago i was going to make the same utility in Gleam. i paused and thought for a moment on how i would tackle this issue with malformed JSON responses? by using XML or plaintext responses instead (again)? after a quick search for libraries, i got annoyed, frustrated and angry thinking of making such an API myself (there are no other good alternatives) i've chosen to use Ash, to try it the second time. and that was a pleasurable experience then I've decided to make a simple webpage for it, to properly try web development, writing HTML + CSS without js, frameworks and tailwind. oh my that was fun! but my html + EEx templates started to look syntactically heavy and hard to comprehend/maintain... after some research i've stumbled upon https://slime-lang.com/ which was another gift for my case. give it a shot, it's really cool
Slime – An Elixir library for rendering Slim-like templates
An Elixir library for rendering Slim-like templates
No description
10 Replies
kira🌺
kira🌺OP2w ago
color palette is a reference to Starfield btw
ZachDaniel
ZachDaniel2w ago
are you on bluesky?
kira🌺
kira🌺OP2w ago
nope i mainly live in fediverse and telegram. microblogging is really hard for me i have an abandoned en_US blog at q60.github.io it is to be rewritten in my Elixir SSG
Nefcairon
Nefcairon2w ago
Thanks for sharing. Was interesting.
ken-kost
ken-kost2w ago
yea, nifty! I have a feature request 🤓 It would be cool to have auto-refresh. So it can be in the background switching; every time you look up it's some other quote
kira🌺
kira🌺OP2w ago
thanks! the primary feature of hapësirë is the API. having the webpage auto-refresh would add some minuscule load to the API and DB plus an automatic refresh of a website in background seems a bit shady to me... i don't really like such websites. i prefer it when my browser can automatically unload most of the opened pages (and i have a lot) the whole thing is pretty light and takes no time to refresh though. compared to some badly designed not-so-optimized monolithic websites and services such as reddit, youtube and github
ken-kost
ken-kost2w ago
oh, I thought it was live view. Like a live component was the quote box. my bad, now I see it's a JSON:API service. you know what, I could fork it and make my own live view version. 🤠
kira🌺
kira🌺OP2w ago
yeah, i don't use phoenix here purposefully. i wanted to keep it very simple with no overhead for such a page. as you can see, i basically use just HTML + CSS with nothing else. Slime introduces templates with lightweight syntax with no performance drop cuz i precompile them into EEx templates in compile time. so it's basically HTML + EEx + CSS. i am planning to explore web development more without frameworks and possibly without js like here i have several years of experience with Phoenix, but almost none with the web dev itself, only the backend part
ken-kost
ken-kost2w ago
do you have experience with LiveView then?
kira🌺
kira🌺OP5d ago
i used it a couple of times. but that was lame, without learning it properly, not something worth mentioning not an experience i consider good. i think web should be learned starting from the basics - HTML, CSS with no tailwind, LiveView and js frameworks btw, currently writing a new website with much stuff in mind. and oh boy i am learning CSS even faster after this one experience, it's now so much fun to write

Did you find this page helpful?