This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-10
Channels
- # announcements (1)
- # babashka (18)
- # beginners (122)
- # calva (18)
- # cider (3)
- # cljs-dev (2)
- # cljsrn (3)
- # clojure (102)
- # clojure-europe (15)
- # clojure-france (2)
- # clojure-nl (1)
- # clojure-portugal (1)
- # clojure-spec (3)
- # clojure-uk (8)
- # clojurescript (46)
- # clojureverse-ops (5)
- # code-reviews (1)
- # conjure (2)
- # cursive (15)
- # datalog (13)
- # datomic (18)
- # emacs (4)
- # fulcro (8)
- # helix (8)
- # instaparse (1)
- # introduce-yourself (2)
- # jobs (4)
- # leiningen (23)
- # lsp (26)
- # malli (21)
- # off-topic (34)
- # pedestal (21)
- # polylith (6)
- # reitit (5)
- # remote-jobs (3)
- # schema (1)
- # sci (8)
- # shadow-cljs (8)
- # spacemacs (3)
- # sql (30)
- # testing (31)
- # tools-deps (21)
- # vim (25)
- # xtdb (8)
With all of the system management discussion recently, I’ve noticed that some people tend to componentize just the most low-level “effects” (eg database connection pool, in-memory cache) while others make components for higher-level subsystems that themselves use lower-level effects. I haven’t seen a lot of discussion or recommendations online or from the tools themselves on this topic, so question for the room: how do you architect your components?
it's components all the way down 🌀 nothing much to add myself, I've used Component to model modules in a modular app (Polylith style), or "repositories" as in data stores, etc. I guess there's no universal answer as there are many ways of an architecting an app.
I maintain a fairly large (~50kloc) web app/SPA in Clojure/Script. Initially I used Component but just for stateful things: web server, DB connection pool, and a handful of thread pools, but I recently decided that Component really wasn’t helpful for such a small number of components. Now I just have functions to start/stop the app by starting those components and passing the dependencies explicitly. For example, the thread pools usually need the DB connection pool, so I start the DB pool first, then pass it to each thread pool as I start it.
I created some Ring middleware to inject all the components into the request map so that web endpoint handlers can pull in whatever they need (typically just the DB pool).
Silly question but why do folks often throw a $
in front of their terminal instructions? like $ curl ...
prevents me from doing a quick copy/paste of the instruction line. I figure I'm missing something here
I'm tempted to throw an alias in of alias $=' '
but I imagine that has some unforeseen consequences
Compare e.g.
$ echo yes
yes
to
echo yes
yes
Run the latter to have the terminal keep agreeing with anything you say. :)At least when the prompt is # you can always safely copy-paste the prompt, but there's historical circumstance to consider. in csh it's %
I've had several folks request that I remove the $
from documentation and just separate commands from output more clearly. I believe there is also a CSS trick you can do to display $
on the web but make it not part of the string you actually copy'n'paste.
Similarly, I've had folks request that long lines not be broken up with \
because that only works on macOS/Linux and produces "bizarre" behavior/errors on Windows.
> I believe there is also a CSS trick you can do to display `$ ` on the web but make it not part of the string you actually copy'n'paste.
The ::before
pseudo-element can do that: https://developer.mozilla.org/en-US/docs/Web/CSS/::before
.terminal-command-input-line::before {
content: "$ ";
}
I don't think making it easy to do quick copy paste from a document into a terminal is actually a good thing. you should be putting more effort into reading the thing you are copying than it takes to avoid grabbing the $
Sure. You can tell that to beginners all you like but it won't stop them doing it 🙂
Yes! What @U051SS2EU said. Copy and pasting into a terminal is a bad habit, similar to curl ... | sudo bash
.
> ... just separate commands from output more clearly. This is a lot harder when you're documenting a back-and-forth command/response "conversation".
2 reasons I can think of: the first and major reason is to tell the user what command is being run vs. output the second is much lesser and a bit more patronizing but I've heard people say that generally we should not be copying + pasting random snippets into our shell :<
I get that to a sense. I try to do that when following a coding tutorial or what not. But something like this $ curl -LO https://github.com/BurntSushi/ripgrep/releases/download/12.1.1/ripgrep_12.1.1_amd64.deb`` and it even has a literal copy to the clipboard button next to it. I don't like it! haha
I still get the prompt from github. Nbd of course, I was just curious of the historical reasons
I think, the reason is to differentiate between a normal user, i.e., "$" and a root user "#". Of course, nowadays, the actual prompt is rewritten/redisplayed by some useful plugins, like powerline etc.., but on a naked shell, it really helps.
(and, #
is also treated as a comment character, so if you're copying commands with abandon, it can really save your bacon, i.e, # rm -rf /
🙂 )
PS1
This variable is used for interactive prompts. Historically, the "superuser" has had a prompt of '#'. Since privileges are not required to be monolithic, it is difficult to define which privileges should cause the alternate prompt. However, a sufficiently powerful user should be reminded of that power by having an alternate prompt.
https://twitter.com/thingskatedid (a fun twitter follow along with https://twitter.com/happyautomata) sets her prompt to ;
with this rationale https://twitter.com/thingskatedid/status/1316081075043463170
It works well in zsh, I decided to try it and in bash I went for :;
to get the same functionality
I discovered that :
works like a no-op in bash
Anyone tried https://jreleaser.org/ with Clojure? Seems like it could still be useful, auto-announce, auto-git-tag, auto-update homebrew, etc.