1

I finally published my first addon, and it hit the asset library today!

Log.pr(...) and Log.prn(...) are intended as drop-in replacements for print(...):

  • colorizes the output data based on type
  • recursively prints dictionaries and arrays
    • (with a sane max count, i.e. not printing 1000 entries in an array)
  • adds a script-name prefix and line-number before each log
    • with different treatment for [src:12]: vs <addons:12>: vs {test:12}: scripts

For me this helps reduce wall-of-text noise and eye strain while reading logs at a glance.

I created a docs site via docsify, and the code is on github.

I'll be adding support for more types and customizing the color choices soon. You can opt-in to pretty-printing with your own objects by implementing a to_printable() function. I'm brainstorming ways to add support for not-your custom types as well (for example, Pandora Entities) - I have a few ideas but nothing implemented yet.

I've been using it in my own projects for a few months now, so it feels ready to share - I'm hopeful that others find it useful!

Try it out, let me know what you think!

[-] russmatney@programming.dev 5 points 8 months ago

There are a few collections around like: https://github.com/adi1090x/rofi

These things tend to imply dependencies for how they're implemented plus whatever they are integrating. The UX is definitely the right one tho! Rofi is great for working on custom dev tools - you can pass lines in as stdin, it sends back the selected item on stdout, then you exec the matching output command.

I started a project called 'ralphie' to do this with babashka a couple years ago, but later i absorbed that into a monorepo called clawe - you can see the rofi namespace here: https://github.com/russmatney/clawe/blob/3987390ffe538d878045e9d886190542fb111b9e/src/ralphie/rofi.clj#L146-L156

[-] russmatney@programming.dev 4 points 8 months ago

streets of rage 2!

[-] russmatney@programming.dev 5 points 1 year ago

This was a cool talk on teaching programming gradually (with a lang called hedy) at last year’s strangeloop: https://youtu.be/fmF7HpU_-9k - might be some useful takeaways for you in there

[-] russmatney@programming.dev 2 points 1 year ago

It was pointed out to me i should add OOP. Burn it all down!

[-] russmatney@programming.dev 4 points 1 year ago

Types and unit tests are bloat that increase the maintenance cost of whatever code they are involved in. Most types force premature design/optimization. Most unit tests lock up some specific implementation (increasing cost of inevitable refactors) rather than prevent actual bugs.

Nil-punning in clojure has spoiled me rotten, and now every other language is annoyingly verbose and pedantic.

[-] russmatney@programming.dev 3 points 1 year ago

Just to share a perspective from erlang/elixir: pattern matching to filter for only happy-path inputs and the principle of “letting it fail” (when the inputs don’t match the expected shape) works really well in some paradigms (in this case, the actor model + OTP, erlang’s 9 9s of uptime, etc). In that kind of architecture you can really only care about the happy path, because the rest is malformed and can be thrown away without issue.

[-] russmatney@programming.dev 2 points 1 year ago

I think of this as interactive development, or repl-driven development. You can work this way today in Clojure (frontend, backend, and lately even for scripting via babashka), and with lisps in general - the syntax lends itself to sending expressions to the repl and returning values to your editor.

It’s really the best way (my favorite, at least) to program that i’ve found for exactly the reasons you mentioned - it’s excellent for debugging and ensuring the behavior of small functions with minimal overhead.

Types are frustrating because they lock things up and they don’t guarantee behavior, which is really all a program cares about. I feel similarly about unit tests… it’s extra code locking up your behaviors, so make sure they’re what you actually want! A general problem with types is that you have to commit to some shape early, which can lead to premature design and basically some arbitrary DSL when you just needed a couple functions/transformations. Feels like the problem of OO at times.

On the other side, the trouble (beyond people generally not wanting to read/learn lisps, which is unfortunate) is that repl-driven dev requires that you take care of your tools, which means there’s a tough learning curve and then some maintenance cost for whatever editor you want to use.

At a career-level scale, in my opinion, the investment is well worth it, but it’s a tough thing to figure out early in your career. I expect most devs with a couple years of js/python see types and feel like it’s a huge relief, which is real, and maybe types make sense at a certain team size…

I think people should spend time in several different languages and paradigms - it makes the ones you go back to make more sense :D

[-] russmatney@programming.dev 2 points 1 year ago

Feedback loops are super important! For momentum, for reducing burnout, for implementing/debugging, everything. I think of it mostly as a tooling problem - the point of maintaining and improving your tools is to maintain/improve your feedback loops.

For me it's about this question: How quickly and easily can you verify that the code is doing what you think it's doing?

This is what I love about writing Clojure - you can write and evaluate abritrary bits of code (functions, expressions) without leaving the editor. Invoke a keybinding to send the current expression to the running repl, and the resulting value is returned, and can be interactively explored/walked in the editor. It makes for a fun interactive dev-loop, and is a nice way to design a solution to some problem. (A caveat is that getting into a working repl is non-trivial, as it's dependent on your editor+plugins. It takes a bit of learning and unfortunately isn't beginner-friendly.)

Vim and emacs are also excellent for improving you feedback loops - both take some investment and some discomfort in the beginning, but ultimately you get out what you put in, and soon you can imagine and realize better workflows without much effort (adding your own functions, keybindings, hydras, etc). VSCode and other editors are also hackable, to some extent.

Mostly I think it's important to hack on your tooling on a regular basis, at least once a week or so.

My old boss used to say he expected us to keep 'sharp knives' (as in cooking). I think companies should make time for the devs to work on tooling to improve these feedback loops - it's the hiccups in the workflow that build up and lead to burnout/fatigue. Smooth workflows can actually be energizing instead of energy-draining!

1

One of my favorite command line tips: you can add 'comments' full of keywords to shell commands, which makes searching your command history easier.

> obscure-cmd --with-weird-flags -Qdt # searchable comment keywords

Presumably you're using something like fzf for history search, but this is still useful without it.

This is especially useful for cli tools with obscure names/flags, or when you can't remember where a particular log file is.


Some examples from my history:

tail awesomewm logs:

tail -f ~/.cache/awesome/logs -n 2000 # tail follow log awesomewm

fix linux clock drift:

sudo ntpd -qg && sudo hwclock --systohc # fix linux clock time drift

copy ngrok public url to clipboard:

curl -s http://localhost:4040/api/tunnels | jq ".tunnels[0].public_url" | tr -d '"' | tr -d '\n' | xclip -selection clipboard -i # fetch ngrok url uri, copy to clipboard

sign ssh and gpg, then refresh the emacs keychain env:

keychain --agents gpg,ssh --eval id_rsa <some-gpg-id> && emacsclient -e '(keychain-refresh-environment)' # sign ssh,gpg password, refresh emacs env

Another gpg one:

git config commit.gpgsign false # disable gpg signing for this repo

Pacman/pamac commands, like listing orphaned packages:

pacman -Qdt # list orphans
pamac list -o # list orphans

xprop - super useful for debugging window management, for some reason i can never remember what it's called:

xprop # mouse click window x11 linux describe info client helper whateveritscalled

Some helpers from my clawe project:

bb --config ~/russmatney/clawe/bb.edn -x clawe.sxhkd.bindings/reset-bindings # reset sxhkd bindings
bb --config ~/russmatney/clawe/bb.edn -x clawe.restart/reload # reload clawe

Aliases come to mind as well - in some cases that might be a better fit. I like this because it's so low-lift.

[-] russmatney@programming.dev 4 points 1 year ago

Nice work!

Tauri is great. I haven't built a proper app with the nice native backend features, but i wrote a wrapper for passing a url on the command line, which lets you run an arbitrary web app like it's a native one: https://github.com/russmatney/clove

Very happy to have something lightweight!

[-] russmatney@programming.dev 8 points 1 year ago

every time i'm playing some old guilty pleasure that isn't 'actually good' (think: just wanted to play a jock jam for a moment), i worry about the influence on next week's discover weekly....

[-] russmatney@programming.dev 7 points 1 year ago

I’m liking wefwef, as a PWA it feels pretty much just like Apollo

[-] russmatney@programming.dev 7 points 1 year ago

I knew I'd seen something like this, and was very happy to find this in my notes from a few years ago: https://devchallenges.io/

There are a few full-stack 'challenges', ultimately building up to a twitter and then trello clone. Maybe it's the kind of thing you're looking for? I'm not sure if the submit + review portion of the site is still a thing, but w/e, you can still take the ideas and build your own thing.

Here's a quick article on it from the creator: https://dev.to/nghiemthu/8-projects-with-modern-designs-to-become-a-full-stack-master-2020-14j9

One thought I had when looking through these is that keeping the project small (e.g. an image uploader that adds a filter and renders it) might be preferrable to an otherwise larger/never-ending project. OR you could do more design work for a larger site if that's the part of software you want to practice.

You might also look into coding 'kata' or something like advent of code, tho that's definitely a different direction and lower-level scope.

Building stuff is fun! Good luck with it!

view more: next ›

russmatney

joined 1 year ago