Microposts
This is a log of learning and collected notes and thoughts along the way. It’s public, but that doesn’t mean it’s likely to be interesting to many people.
- Have moved off NixOS and back to PopOS! There’s a lot I really love about Nix but the world isn’t ready yet 😅
Now that I’ve moved back I spent some time really pimping out my development environment, and it is nice.- ruby-lsp and ruby-lsp-rails
- This gives lots of nice autocomplete stuff
- DAP with a proper UI for debugging
- This only seems to work with Rails while running tests, but that’s still pretty cool.
- Treesitter for excellent syntax highlighting
- Added git hooks to automatically add ticket IDs to commit messages (plus the usual Brakeman and Rubocop)
Tags:
- ruby-lsp and ruby-lsp-rails
- Wrote one very small Redmine plugin (to copy some data to the clipboard in a particular format for export) and have just started another, much bigger one, to manage jobs (in terms of blocks of time sold to clients for budget management).
Tags:
- Signed up for First Ruby Friend after Brighton Ruby and have just been matched to someone! First chat tomorrow.
Tags:
- This looks like it might be helpful when debugging sometimes
Post.attributes_for_inspect = [:id, :title] Post.first.inspect #=> "#<Post id: 1, title: "Hello, World!">"
Tags:
- Was curious if Rails supports database-generated columns: turns out, yes, as of Rails 7:
create_table :users do |t| t.numeric :height_cm t.virtual :height_in, type: :numeric, as: 'height_cm / 2.54', stored: true end
Tags:
- Wrote a little SQL task to convert various tables to a JSON column using rows_to_json, the sheer speed of the thing was incredibly satisfying.
Tags:
Experts don't make fewer errors, but they have better mechanisms to catch them.
Marian Petre (Embedded ep462)Tags:
- Learned a few useful things from Chris Oliver's Rails World talk:
- ActionText Embeds allow for embedding Rails models in a Trix input - might play with that here.
- rails routes --unused
Tags:
- RSpec has a --bisect option which attempts to automatically find the smallest combination of specs causing a failure (use in conjunction with --seed).
Tags:
- Added a helper script to a project that uses RSpec to replicate the default behaviour of Rails segregation of system tests and get faster feedback more easily.
Tags:
- Just learned RSpec has an :aggregate_failures option, to show all failures in specs with multiple assertions.
Tags:
-
- Added the new default /up healthcheck endpoint to this site, and removed the healthcheck from the Kamal config so it can default to using that.
Tags:
- Added Solid Cache to this site. Completely and utterly unnecessary, but this is my Rails playground 😁
Tags:
- Added tags to this site for microposts, which should make tracking things a bit better. In the process discovered you can’t do polymorphic associations with has_and_belongs_to_many, which seems like a missing feature.
Tags:
- Wrote a Rake task to update some database columns then immediately rewrote it in SQL directly. First time working with jsonb in SQL: I like it.
Tags:
-
- I'm not a fan of most of RSpec's DSL, so appreciated this article from Test Double suggesting the use of Ruby 3's endless method syntax instead of using let.
def foo = bar.new
instead oflet foo { bar.new }
Not considered that before, and combined with using instance variables instead of let!, it reinforces and makes more obvious the difference.Tags:
- Set up a git pre-receive hook for ensuring commit messages contain ticket references. It's a shame GitLab makes this so difficult, they should be first class citizens.
Tags:
Different people have different standards for the speed of unit tests and of their test suites. David Heinemeier Hansson is happy with a compile suite that takes a few seconds and a commit suite that takes a few minutes. Gary Bernhardt finds that unbearably slow, insisting on a compile suite of around 300ms and Dan Bodart doesn't want his commit suite to be more than ten seconds
- https://web.archive.org/web/20221222080746/https://dhh.dk/2014/slow-database-test-fallacy.html
- https://web.archive.org/web/20190329045845/https://www.destroyallsoftware.com/blog/2014/tdd-straw-men-and-rhetoric
- https://web.archive.org/web/20220124070115/http://dan.bodar.com/2012/02/28/crazy-fast-build-times-or-when-10-seconds-starts-to-make-you-nervous/
Tags:
- Set up wallabag on the new server. Didn’t end up importing the old articles as they were a bit of a mess. Fresh slate and try and keep up a better reading habit to keep on top of things.
Tags:
- Just used “ensure” in Ruby exception handling for—I think—the first time. Immediately got confused by it! Even if it’s the last thing occurring in a method, the last line isn’t the return value of the method unless you explicitly return it. I presume things are getting handed back up the stack in a way that loses the value, but should investigate the behaviour to understand it when I have time.
Tags:
- Spent time today upgrading the operating system on some VMs running databases. Learned a bunch dumping and restoring data, setting up replicas etc. Found out the hard way that Cloud66 don't automatically update the environment variables to reflect these changes until you redeploy. Some trial by fire learning followed.
Tags:
- Rich Hickey introduces the word complecting in the context of software: to make something more complex by interweaving it with other things.
Saw this in his 2012 Rails Conf keynote, but also remember it from one of his similar Strange Loop talks.Tags:
Code is a user interface and everything we know about HCI can be applied to it.
Tags: