hjertnes.blog

Clojure cli and deps.edn

19.04.2019 17:11

When I started to learn Clojure, there was two options: lein and boot. They were kind of the two big options to managing dependencies and building your project. Lein is this huge monolith that includes more or less everything you need and want, but you kind of need to build your project around how it works. And then you have boot that everyone likes better, but most people still use lein because it just works.

Then Cognitect released Deps.edn and the clj / clojure cli stuff. Edn is like JSON but more lispy, and deps.edn is a way you can define three different things: paths, deps and aliases. Paths are where you code is located, deps are your dependencies and aliases are just a way to write aliases for clojure/clj commands per project or globally. Where clj foobar expands to a longer clj command with a lot of options. Kind of similar to what you can do with the scripts stuff in node projects.

The cool thing about deps.edn is that you can add the file to a directory, add a few deps, run clj and it installs them and they are ready to be loaded from the repl. The reason this is interesting is because it only takes care of a few minor parts of what your projects neeed in a way where you can pick other tools to take care of the rest based on what you need. And because both boot and lein have their own ways of dealing with what deps.edn does it will be harder for them to adopt to this.

The way I look at it is that deps.edn provide all the “glue” that ties it all together. And then you just need to add what you need on top if it to get what you need, to build, pack and lint etc.

In my bag

18.04.2019 19:45

I’ve been meaning to post this for a really long time. But every time I’ve gotten to it something new I planned to have in it was on the way to me. This is not just in my bag, but also stuff I have on me, in my pockets etc.

In my pockets / on my person

  • Glasses. Cheap Specsavers storebrand. They basically look like something Elvis Costello would have worn.
  • Apple Watch: Series 4: space gray with a sports loop.
  • Trove Wallet. Red and blue.
  • iPhone 8 Plus, space gray with a popsocket.
  • Keys: just a plain key bring with one of Luna’s old dog tags on it.
  • A piece of cloth to clean my glasses.
  • Bellroy Field Notes case, with Field Notes, some Index Cards and a Golden Bear pencil in the spine
  • A YStudio Fountain pen is always in my pocket.

In my Bag.

  • Misc cables: USB-C to USB-C, USB-A to micro-USB, Lightning USB-C, USB-A Apple Watch charger.
  • Mophie XXL powerbank.
  • Nintendo Switch
  • Kindle Paperwhite 2008.
  • Nock Co Seed A5 case, with a LT1917 Bulletjournal notebook and a Lamy 1.
  • Nock Co Pencil Case with a lot of Golden Bears. I use it to bring sharp pencils to work and bring dull ones back. Usually around 12 in it.
  • Audio-technica ATH-M50x headphones
  • A few Lightning to jack dongles.
  • LT A few lines a day 5 year journal.
  • My work ID/key card, paracetanol, fishermans friends.
  • My 24H Water bottle. Keeps my icewater cold for at least 24 hours.
  • Contigo coffee mug. I’m going to replace this with a more durable one in not too long.

Emacs, flycheck and eslint

14.04.2019 18:04

The first thing I did was to disable eshint and standard.

Then make sure you have a .eslintrc or .eslintrc.js file in your repo; one of them is sufficient.

The next step is to install eslint and all your plugins, configs etc globally (yarn global add or npm i -g). There are ways to get it to work with per project installs, but this is way easier.

Then make sure eslint works. just run eslint –print-config . until it prints the config. Then run M-x flycheck-validate-setup (double check this command) and make sure it work, and restart emacs. And that should be it.

Likes from my Instapaper

12.04.2019 23:22

A while since last time, I wanted to automate this process a little bit. Then I didn’t hear back from Instapaper about a API token and I went for a less ideal solution. It is a lot better though. Long story short, I wrote a node script that parses a exported csv files. I’ll probably get it up on Github soon, I just need to clean it up. And I’ll probably get back to doing this weekly now that it takes much closer to a few minutes, than 15.

Assange

11.04.2019 19:27

  • Julian Assange is a piece of shit.
  • He has not been convicted of anything except “failure to surrender to the court”
  • I have no opinion about what WikiLeaks do today, but I was and still am a big supported of what they did back in 2010
  • Extraditation is a legal concept I have a lot of problems with, and is just a giant mess.
  • Especially when a country you’re not a citizen of or wasn’t in when the ‘crime’ occoured.
  • I get that Ecuador had problems with his behaviour, but anyone would get crazy by basically being in house arrest for close to 7 years.

Micro arcitecture

07.04.2019 20:42

When I say micro arcitectures I mean everything from micro frontends, to services and packages. This means that instead of having a utilities package and a ui-compontents package you may have 10-100 of smalelr packages instead of one large.

Or that you build a smaller app that may contain maybe 20 smaller apps instead of one huge.

There are reasons for this. But it is not because it gives you better performance or because it is easier. It is not.

When you break things up, you do this because you want to update things idenpenent of each other.

If you can push out an update to the login page when it is ready, and then you move over to the registration page and so on.

And on the packages side, you do it to have more flexibility. Let’s say there is a bug in the button package in the latest version. But all the others works fine. If you had a monopackage structure you’d have to wait. But with a micro package system you could just update everything except that.

But there are some things you need to remember if you are looking at this. This is for situations where you are a lot of developers, where build times are limiting how often you can relase. Or that things are so big that it is a real pain to deal with.

I have gone back and forth on this a lot. If smaller companies should do it at all. And I think it depends.

I think everyone should get into and get setup to build smaller packages, and to make smaller components that can be shipped independent of each other sooner than later. And then unless you are really big I’d start thinking about spinning off everything that feels like it is really different from the rest as its own thing.

What I use Emacs for

05.04.2019 22:03

This is a short list of the stuff I use Emacs for.

  • General text editing and notetaking
  • All my blog posts are written in Markdown using Emacs
  • Notes are written as text files
  • Programming in JavaScript, React, C#, ClojureScript, Cucumber tests, Bash scripts, PowerShell scripts and probably a lot more.

24 bottle

31.03.2019 22:57

I’ve had a problem with not drinking enough water for a while now. Probably over a year. The issue have been that the water gets how, and then I had the feeling that I just refilled it, and I dont’ do it and five hours later I have still just had two mouthfulls of water.

Then I started to research water bottles that keeps it cold. And after a lot of time I spend a ridicolus amount of money ordering a 24Bottle from Italy.

They are the kind of company I love, that want to make the one bottle you ever have to buy. There are two different models, one double walled that keeps your water cold for 24 hours and one single walled. I went for the first option. I also went for a 850ML bottle. It is big, like a bottle of wine. But I like it a lot. I can fill it when I get up in the morning, drink cold water until it is empty. Usually a while before lunch. Then refill it and it usually last me until I get home from work.

The build quality is solid, and I like it a lot.

If you are looking for a good bottle, with a lot of design options I’d take a look at them.

Star systems

30.03.2019 11:18

If you want to have some kind of rating, stars are probably the kind of thing you’d start with.

I’m going to do the examples with movies.

I think there are two good ways to do this. Either by using a three star system plus the option to order the items within the top rating. That means that 1 star = did not like it, 2 = fine, 3 = i liked it. And then you can decide if you liked Rockey 1 better than China Town. I didn’t by the way.

The second option is to go with five stars. I don;t think most people understand how this one works. Because I guess most people have a lot with three stars, and a lot with 1 and a lot with 5. This is how I think it should be used: 1=don’t watch this, 2 = didn’t like it, 3 = fine, 4 = great, 5 = one of the best movies ever.

Headphone setup

28.03.2019 20:02

I have two pairs of headphones. One of them have a cable and hare big, while the others are wireless plugs that are very compact.

When I go somewhere I usually end up bringing both. They are my Apple AirPds and my ATH-M50x.

The AirPods are great, for what they are. And they are the best bluetooth sound thing I have ever used, from a UX perspective. The batteries are becoming worse, but still pretty good within the constraints.

While the M50x is what I prefer to use, because it is really comfortable, shuts out everything, and sounds way better. I love this pair of headphones because how much you get for how little money. The retail is $130, but you can find them at $100 if you have some time.

The way I do it is that when I walk around the house, walk the dog or walk from or to the train station I use the AirPods because then I need to be aware what’s hapening around me.

But everywhere else I use the M50x. I don’t want a Bluetooth version of them, but what I miss is a Lightning version of their cable.