Moving around in Vim is one of its great strengths. Except for command line mode, which I’ve always struggled with – it doesn’t seem to allow normal Vim movements. You can, however, move the cursor left and right with your normal arrow keys, but you can move one word at a time by adding
I wrote my first ever Automator Quick Action 🤯 When I’m filing away paperwork I always manually prepend the filename with the date. For example
I thought there must be a better way than manually adding the date, and there is, the “Rename Finder Items: Add Date or Time” Action hooked up as a “Quick Action” in Finder.
Notetaking, the forever project, is still on-going. I’m lost in the woods with it right now, but I have learnt a few new things about Lua which I will share here.
Check a file exists using in Neovim
if vim.loop.fs_stat("path/to/file") then -- it exists end
Here is a handy function to get the current git branch
-- https://www.reddit.com/r/neovim/comments/uz3ofs/heres_a_function_to_grab_the_name_of_the_current/ function current_branch_name() local git = vim.fn.system("git rev-parse --is-inside-work-tree 2> /dev/null") if git ~= "" then local branch = vim.fn.system("git branch --show-current | tr -d '\n'") return branch else return "" end end
Get the length of a string by prepending a
local name = "Dave" if #name > 3 print("Hello, Dave") end
I’ve started reading Seven Languages in Seven Weeks, too, of which the first chapter is about Lua, so I hope to pick up some new tricks in the coming weeks.
Talking of MySQL…this is the first time in a long time that MySQL has had a feature that I wish Postgres did – making an index invisible before deletion.
Deleting an unused index is still a risky operation: If you are wrong (and it is still needed) the database will become slow. Before deleting it, you can make the index invisible first and make it visible again instantly if you still need it.
I agree with Josef Strzibny on all points in “Why I don’t enjoy RSpec all that much”, especially the parts about “Indirect references”. RSpec tests always start off looking great, DRY, neat, tidy. Until they grow and grow as they tend to at which point you have slow, difficult to grok, tests.
I almost exclusively use RSpec. And I know it better than minitest. Why? Because it’s the default in 99% of projects I work on. I think Rails shipping with minitest tests is the right thing to do, but I would bet one of the first thing most developers do is install RSpec.
Speaking of which, @searls describes everything wrong with RSpec.
The DSL provides numerous ways to structure tests and everyone has a different opinion (subject is great, subject is evil, let is good/bad, nesting is good/bad), leading to terrific inconsistency on projects as individuals express their own favorite way on the specs they write unless you dictate a style in a really authoritarian way
As soon as anything resembling feature behavior or “business logic” or real work, I get the hell out of dodge and into a PORO that I control and that lives in a namespace in app/lib.
Honestly, I don’t do this. But I wish I could.
I accidentally came across Live Text on macOS Monterey this week. I reading some text from a screenshot and realised I could select it with my mouse. A very nice feature and complementary to Cleanshot’s OCRing capability.
Another project milestone passed by this week. The end is in sight.