Fork me on GitHub
#clojure-europe
<
2022-06-24
>
RAMart05:06:25

👋 :rain_cloud:

Adam Helins07:06:00

Bonjour à tous!

reefersleep07:06:40

Godmorgen 🙂

reefersleep07:06:31

What’s a git superpower that you feel really clever for knowing and using?

reefersleep07:06:54

I can’t believe I learned about git add -i so late in the game.

simongray07:06:35

Nice trick. I just use a GUI for anything slightly complex…

reefersleep07:06:11

I’ve weaned myself off of git GUIs. Terminal only atm, so trying to pick up tricks 🙂

dharrigan07:06:32

git commit -i is also an alternative

dharrigan07:06:08

Other ones are git bisect

reefersleep07:06:36

Yeah, I discovered the commit -flag one by mistake, it’s nice!

reefersleep07:06:47

I also just go directly to git add -p a lot of the time

dharrigan07:06:35

I use delta for diffs at the command line

reefersleep07:06:42

I’ll have a look at that.

reefersleep07:06:19

I love the idea of git bisect, but I never got the initial hurdle of fitting whatever I want to test into some script that tests automatically.

reefersleep07:06:54

Many of the times that I’ve thought to use it, my problem has been e.g. visual (when did the UI suddenly start acting/looking like this?)

practicalli-johnny07:06:43

My Git superpowers are all via Emacs Magit, makes selective adding of changes, rebase, cherry pick, rewriting commit message, creating/branching a PR, etc all pretty trivial to do all from one tool

👍 1
1
reefersleep07:06:44

Guess I could use it even without scripts, but I never did, for whatever reason.

reefersleep07:06:32

I’m with you @U05254DQM and @U04V5VAUN: magit is awesome! It’s the sole reason that I kept using emacs for a looooong time after I stopped using it for anything else. I finally decided that it was a bit silly, and also that I’d like to be more fluent in “native git”.

practicalli-johnny07:06:20

There is neogit for Neovim and edamagit for VS Code,not sure if they are as complete as magit, but we're pretty good when I used them I find there it too much to remember for the command line, that it limits my use of git. I like things simple 😉

reefersleep11:06:53

Don’t we all @U05254DQM ;D I’m trying to exercise my git memory. I think it’s mostly about remembering the options that I have available, and then look up how to perform the options when I need them. It certainly has inconsistent and/or odd naming and arrangement of concepts and commands, which makes it harder.

dharrigan07:06:34

I have multiple branches checked out, all isolated from one another.

reefersleep07:06:02

I could use this!

reefersleep07:06:23

Is it like a more ergonomic way of git cloning at a different path?

dharrigan07:06:40

Adopts Michael Caine voice

dharrigan07:06:00

Not a lot of people know this, but you also work with a worktree explicitly

dharrigan07:06:18

When you clone something, say master/main or whatever, and it's not a bare repo, you have a worktree

dharrigan07:06:40

Worktrees are great when working with monorepos

dharrigan07:06:13

for if a frontend person has their own branch in the repo, you check out that as a worktree, whilst also keeping your own worktree of your own branch of the same monorepo

dharrigan07:06:00

I also use worktrees as throwaway pocs

reefersleep07:06:33

Very very cool.

reefersleep07:06:00

Does having multiple worktrees checked out at once enable some kind of easier diffing? Or maybe something related to comparing branches.

dharrigan11:06:41

It's the same really, you're just diff'ing between directories 🙂 YOu also still can diff between branches whilst in a worktree

dharrigan11:06:03

remember, you always have at least one work tree, the master branch (or main or whatever you call it). so the diffing is the same

👌 1
robert-stuttaford12:06:26

wait so i've just been using local branches to do this

robert-stuttaford12:06:54

ah ok i get it, it's a branch <> sub-folder sync / admin system

reefersleep10:07:09

I just used it! I was starting up the environment for one branch, and wanted to check something on a different branch. Created a worktree, checked out the correct branch, looked at the code, removed the worktree. All while my environment was building. Sweet!

robert-stuttaford10:07:27

nifty. honestly i just use github to read code in other branches. probably lazy that way

reefersleep10:07:29

I do that too, but I like having options 🙂

reefersleep10:07:19

Also, @U11EL3P9U, I installed Delta, and I’m pretty happy about the Github themed terminal diff I’m now getting! (Because I actually normally use Github for looking a diffs 😅 )

reefersleep10:07:45

So thank you 🙌 🥳

dharrigan10:07:52

I'm working on a project atm, with 4 different worktrees all local. I can do a bit of work on one worktree, push it for testing, then cd to another worktree, do some work there and so on...

reefersleep10:07:05

That’s brilliant.

dharrigan10:07:24

Sometimes, I do some work, leave it there, uncommitted whilst I test locally, and whilst the tests are running, I cd to another worktree do a bit of work there and so on.

reefersleep10:07:54

I considered doing something similar with my main work project, but it’s not really set up for that kind of stuff… Just the editor, to begin with, has a bunch of configuration stuff that I’d need to configure every time I check out a new worktree.

dharrigan10:07:58

Glad to hear it's helping you 🙂 It's another tool to call upon if you need it 🙂

dharrigan10:07:40

I am also a huge user of direnv

reefersleep10:07:05

Me too! I use a very minimal .envrc file:

#!/usr/bin/env bash

# .env is the source of truth for environment variables for this project, since IntelliJ can load from it using the EnvFile plugin. This file ensures that same environment variables are present in the terminal, provided that the system is using direnv.

for line in $(cat .env); do
    eval "export $line"
done

reefersleep10:07:21

(So, not a “huge user” lol, but a user)

dharrigan10:07:13

it's all good. I think we all strive to have a productive working environment, so every little tool helps 🙂

reefersleep10:07:16

But adding the worktree project to IntelliJ, setting up the REPLs and such, I don’t think that’s scriptable. (But I should really look into it to make sure…)

dharrigan10:07:34

Ha! I use neovim + conjure 🙂

dharrigan10:07:44

Lifelong vim'er 🙂

reefersleep11:07:08

I’ve got custom styling on github to make the diff pages take up 100% width instead of just a center column. And I’ve got a very little custom styling script in our ticket tracking system that allows me to easily pull the name of an issue, the link and the number, all in one string. It’s a tiny thing, but I use it all the time, and I’m very happy and proud of it (even if imperfect)

reefersleep11:07:44

I use vim heavily for text editing, showing it in everywhere I can, but I like IntelliJ for Clojure (and everyone in my team uses it, so there’s a hive mind around it)

reefersleep11:07:58

neovim actually.

reefersleep11:07:09

Just set it up as a man pager an hour ago!

reefersleep11:07:00

And as I described to the other person assisting me in that, I haven’t dared “living” in neovim/vim yet, for a number of reasons. I just zoom in and out.

dharrigan11:07:45

My usage of intellij is for kotlin/java. I do use datagrip quite a bit and pycharm too.

reefersleep12:07:09

The Jetbrains family is generally nice, I gather

reefersleep12:07:52

What’s your most recent text editing epiphany in vim/neovim?

reefersleep12:07:04

I try to add a little bit of knowledge every week, but some stuff is so esoteric that it’ll end up being re-added years after. Using “o” to move the cursor into the other end of a visual selection is something I keep meaning to do, but keep forgetting, for example.

reefersleep12:07:31

Also, maybe I haven’t had much use for it… Tend to visually select whole lines, anyway

reefersleep12:07:24

Executing the current line in bash by hitting !!bash is one that I’ve used loads, recently, on the other hand.

reefersleep12:07:15

(not text editing, though :face_with_monocle:)

dharrigan12:07:30

I've started to use Telescope. It's great.

👌 1
slipset07:06:51

magit

👍 3
simongray07:06:10

Good morning

simongray07:06:35

Nice trick. I just use a GUI for anything slightly complex…

genRaiy08:06:07

Good morning

simongray08:06:20

I was not prepared for how many resource-related quirks one must work around when building an uberjar…

simongray08:06:00

suddenly regular file access is turned into guess which resource path is shadowing my file now…

simongray08:06:25

I guess this has something to do with class loaders???

mccraigmccraig08:06:50

what sort of issues are you seeing @simongray?

simongray08:06:03

@mccraigmccraig https://clojurians.slack.com/archives/C0K65B20P/p1656059501795929 Basically, Pedestal serves me random resources in libraries rather than stuff that’s on disk. I guess I need to find some classloader which only loads resources from disk and force Pedestal to use that. Yesterday I having issues resulting in some code needing to be modified, since I couldn’t use io/file on resources any longer when it was packaged as an uberjar (since those were no longer technically files), but the same code worked fine running it in the REPL. It just seems that there’s a bunch of gotchas that necessitate rewriting code to handle both the regular REPL environment and the state of being packaged as an uberjar.

simongray08:06:09

since io/resource apparently returns proxies for different types in dev and prod, i.e. files and whatever-you-call-the-things-inside-uberjars-but-it’s-definitely-not-files

plexus09:06:47

io/resource scans the classpath and returns a URL, not a file. Assuming it points at a file is a mistake. If you only want things to come from the filesystem then don't use io/resource. Since resources are looked up on the classpath there is a potential for clashes. Just as we don't use (ns main) you shouldn't have an (io/resource "main.css"), that's asking for trouble. Use (io/resource "my_app/main.css") instead. If you do want to force it to prefer a certain directory on disk, then make sure that directory precedes the uberjar in the classpath. java -cp my_dir:uberjar.jar my.main.ns.

simongray09:06:08

In this particular case (solved yesterday) I did want to use io/resource, though.

simongray09:06:33

But thank you for pointing that out. Helpful to know.

borkdude08:06:43

Well, well, well. If this isn't a morning.

🌅 1
dominicm09:06:08

@simongray the real bug is a library putting a file in style.css.

dominicm09:06:21

That shouldn't be happening without a prefix of some kind.

simongray09:06:49

Is it really, though…? You really can not guard against resources being named specific things. I think the apparent lack of namespacing for resources is the true issue. Everything’s apparently just in one huge global namespace…? Seems like a terrible design that we avoid otherwise in every other situation.

plexus09:06:26

It works for clojure namespaces and java classes.

simongray09:06:40

Neither of which are resources :S

plexus09:06:28

Both are loaded the same way as resources, by looking them up on the classpath. Both of which use directories to add unique prefixes. Resources should be treated the same way.

👍 1
2
simongray10:06:47

That did the trick. Thanks once again.

dominicm09:06:28

The resources folder in lein is a misnomer. There's no separation in the JVM.

simongray09:06:28

Hmmm… ok….

dominicm09:06:11

A while ago I stopped separating the two and just use src for everything now.

1
💯 2
😲 1
pez09:06:14

I do that too increasingly, @dominicm. Haven't dared mentioning it out loud because it makes me feel heretic. 😃

😄 4
dominicm09:06:53

It does feel scary for some reason. But I also enjoy the look on people's faces when they realise it doesn't matter 😂

simongray09:06:41

too bad my webcam was off this time around 😛

simongray09:06:49

Lesson learned, though

genRaiy10:06:26

my view: everything can just go in a big database and we take it from there

pez10:06:01

I saw some Haskell project where they are doing something like this. Don't recall the name of the thing right now...

genRaiy10:06:30

that's just a search though so not as ambitious as what I'm suggesting

mccraigmccraig10:06:24

@pez @dominicm throwing my hat in the ring with y'all on using src for resources

dominicm10:06:12

I heard filesystems are just a big database.

upvote 2
mccraigmccraig10:06:27

delete from "c:" where path like '\System32%';

😍 2
genRaiy10:06:35

I heard databases are just big filesystems

😆 2
simongray11:06:23

Classloaders are like a box of chocolates

simple_smile 3
otfrom11:06:32

mmm... shiny new kit for doing data science on https://simplynuc.co.uk/product/nuc12dcmi9-full/ looking forward to lighting up all the cores

otfrom11:06:42

might even have to find a second hand GPU to put in it

genRaiy11:06:02

Data science is your new name for mining?

otfrom12:06:29

It is how I make money...

😂 1
⛏️ 1
practicalli-johnny19:06:00

I'll take one like this if you are bitcoin mining :rolling_on_the_floor_laughing: 4TB of solid state memory should be enough

otfrom19:06:02

Just to be clear, data science is how I make my money. Don't have any bitcoin or other

💯 1
pez11:06:19

@raymcdermott this was the thing I was remembering. Probably something totally different from your idea. It has just been tickling the same spots in my brain, hearing you talk about it. https://www.unison-lang.org/learn/the-big-idea/

genRaiy11:06:12

Yes, a few of the same concepts especially using content based addresses. It's not first class in Clojure but it can become so in a place where the code has been transformed into data.

simongray13:06:44

That’s it. I’m going out the playground to drink IPAs with the other parents. Have a great summer weekend everyone!

🍻 5
reefersleep13:06:21

You too! 😎

❤️ 1
lread13:06:09

Good morning all

plexus17:06:58

Good morning!