The Internet generally and YouTube specifically can be pretty amazing!
This evening I was told I needed to learn how to make balloon animals… in 45 minutes I progressed from zero to confidently (even if not competently) making dogs, swords and even 2 colour flowers!
Two items for the “you could but probably shouldn’t” category and Postgres:
Today I configured a new Rails app with Scripts to Rule Them All. It’s a “normalized script pattern that GitHub uses in its projects” to standardise projects and simplify on-boarding. It’s probably premature for an app I’m working on solo… but if you can’t experiment on side-apps, when can you? 😜
I ran into a catch-22 where, the first time you setup the repository, the setup
script tries to initialise the database, which relies on the database server being available. The support
script that starts the database relies on the setup
script (or more specifically, the bootstrap
script it calls) already having been run to install the database server. But the setup
script relies on the support
script… etc, etc
Rather than get fancy I decided to let the developer deal with it. The setup
script is idempotent so there’s no harm in running most of it the first time and then all of it the second time. After DuckDuckGoing how to check if Postgres is running and how to write if/else statements in shell scripts I settled on this clause in the setup
script:
if pg_isready; then
echo "==> Setting up database…"
bin/rails db:create db:reset
else
echo "==> Postgres is not running (this is normal on first setup)."
echo "==> Launch ‘script/support’ in another console and then try again"
exit 1
fi
echo "==> App is now ready to go!"
I’ve been helping with a POS implementation on Vend (https://www.vendhq.com/).
It’s just a delightful application to use with amazing attention to detail! The way they gracefully handle data imports is a great example of how they understand what their customers need.
While searching for my POODR ebook, I stumbled across some notes I wrote last time I read it… I took notes and I still don’t remember reading it! 😬
This (U.S.) thanksgiving weekend I’m thankful that several podcast hosts are having a break, letting me catch up on my backlog a little 😆
I’ve been enjoying reading Noah Gibbs’ thoughts on deliberate coding practise:
Following his encouragement, I think my next book will be 99 Bottles of OOP
German from Thoughtbot with a great post demonstrating a pattern for a generic (SMS) client with multiple adaptors… Nice abstraction with the added benefit of being able to mock an adaptor for testing:
Ruby Science by Thoughtbot: gumroad.com/l/ruby-sc…
Another awesome resource from Thoughtbot, and made all the more accessible since they reduced the price of all their content to $0
Extracting classes decreases the amount of complexity in each class, but increases the overall complexity of the application. Extracting too many classes will create a maze of indirection that developers will be unable to navigate.
Enjoying the practical advice in Ruby Science!
Bookmarking this clever approach to re-using an ActiveRecord scope (i.e. at the class level) within an instance method to prevent duplication
I had some fun reading about pangrams and lipograms after reading this Twitter thread about self-referencing pangrams:
I’m a little disappointed with WatchOS 6… I’m experiencing two significant bugs, one with the alarm complication and one with the Activity app; both of which are key features of the watch.
Seems like Apple’s hit a bit of a rough patch with software stability in their new OSes
Yesterday I subscribed to a few repositories on CodeTriage. It sends an email each day with an open issue and/or snippet of documentation from projects you care about. My goal is to build it into a small daily habit of supporting open source projects
Manton Reece is knocking it out of the park with Micro.blog! The new auto-categorisation feature is an awesome addition!!! www.manton.org/2019/09/2…
I might have to trim down my podcast subscriptions… my feed is starting to overflow now the Northern Hemisphere summer is over!
I’m currently reading The Well Grounded Rubyist 📖
I think I probably should have read this one BEFORE Ruby Under a Microscope… it’s a lot more practical and down to earth 🙂
It wasn’t really the point of the latest Code[ish] but I was once again struck by the sheer volume of effort that goes into open source development tools
Sure beats pirating REALBasic as a kid because you want to code but can’t afford a license!
We’ve been enjoying Apple Arcade! It’s so nice to let the kids try new games without having to warn them about manipulative game mechanics and exploitative in-app purchases (IAP) or worry about them seeing mildly inappropriate in-game ads!
My favourites so far are Mini Motorways and WHAT THE GOLF?.
Naomi has been enjoying Spek.. This morning I was surprised to hear her, unprompted, say “Augmented Reality is fun!”
Ben’s favourite so far is Kings League II. He has always enjoyed games with constant levelling up that are never too difficult.
We’ve never been big into games (I’ve only owned three game systems in my whole life: a Sega Master System II, a second hand Sega Game Gear and, more recently, a Nintendo Wii) but I am mildly tempted to buy a game controller or two for Christmas to play some of the more involved games with the kids.
Which leads me to my only “complaint” with Apple Arcade… so far I haven’t found any games that dont require somewhat constant attention. When I’m on the train I tend to prefer slower paced games where the game waits for me to take my next turn. I’m keen to see whether Apple Arcade fosters (directly or indirectly) more quality, casual games like in the “good old days” of the App Store.
The NYT has a long but fascinating read about the Boeing 737 Max crashes and the (lack of) pilot training that seriously contributed to them!
I’ve enjoyed reading reviews of the iPhones 11, particularly for photos.
I aim to upgrade every 3 years so still a couple of years left on my iPhone XR (which I’m very content with). Still not sure what to get my wife when her iPhone SE eventually dies though…
I recently upgraded to macOS Catalina (10.15 public beta). There are several “under the hood” changes to the Unix underpinnings which may trip people up. I’m comfortable at the command line but by no means an expert so this post is mainly designed as a reference for future me.
You’ll probably notice the first change when you launch Terminal. If your default shell is set to Bash you will receive the following warning every time:
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit [https://support.apple.com/kb/HT208050](https://support.apple.com/kb/HT208050).
FWIW, I think this is an excellent warning message… it states the “problem”, provides instructions on how to fix it and links to a much more detailed article with more information (including how to suppress the warning if you want to use the ancient version of Bash that’s bundled with macOS for some reason).
Personally, I took the opportunity of changing shells to switch to fish shell again. I used it on my last computer but hadn’t bothered to set it up again on this one. It’s a lot less similar to Bash than Zsh but most of the time that’s a good thing (Bash can be quite cryptic and inconsistent). On those occasions where a tool or StackOverflow post doesn’t have fish instructions (and I can’t figure out the fish equivalent myself) it’s usually a simple matter of running bin/bash
(or bin/zsh
now) to temporarily switch to a supported shell.
The next change you might notice is when you go to use a Ruby executable (e.g. irb
). The first time I ran it I received this warning:
WARNING: This version of ruby is included in macOS for compatibility with legacy software.
In future versions of macOS the ruby runtime will not be available by
default, and may require you to install an additional package.
I was a little surprised by this one, not that Ruby was being deprecated (that got a fair bit of coverage in the nerd circles I move in), but because I knew I had installed rbenv, and the latest version of Ruby through that, prior to upgrading to Catalina.
Thankfully the excellent rbenv README had a section on how rbenv works with the PATH
and the shims rbenv needs at the start of your PATH
for it to work properly.
After changing shells (to Zsh or fish), there’s a good chance that whatever technique you previously used to modify your PATH
when your shell session starts is no longer in effect in your new shell.
The README says to run rbenv shell
to fix it, however on my machine (regardless of shell) I kept getting a warning that it’s unsupported and to run rbenv init
for instructions. You should probably do the same (in case the instructions get updated) but at the time of writing the instructions rbenv init
gave for various shells are:
# fish:
> rbenv init
# Load rbenv automatically by appending
# the following to ~/.config/fish/config.fish:
status --is-interactive; and source (rbenv init -|psub)
# Zsh:
% rbenv init
# Load rbenv automatically by appending
# the following to ~/.zshrc:
eval "$(rbenv init -)"
# Bash:
$ rbenv init
# Load rbenv automatically by appending
# the following to ~/.bash_profile:
eval "$(rbenv init -)"
Once you restart your terminal window you should be able to confirm that rbenv is handling ruby versions (via its shims) for you:
> which ruby
/Users/matthew/.rbenv/shims/ruby
> ruby -v
ruby 2.6.4p104 (2019-08-28 revision 67798) [x86_64-darwin18]
I used Sign In With Apple for the first time today in the beta version of Micro.blog
As a customer it was quick, clear and put me in control of what info I shared without being fiddly.
For companies, I suspect it will make customer support a bit trickier though.
I’ve been enjoying listening to www.founderquestpodcast.com lately…
3 devs who launched a successful product/company but are optimising for profit rather than growth. I like their down to earth outlook and pragmatic approach (& guerilla marketing 🙂)
I recently finished listening to The President is Missing by Bill Clinton and James Patterson (while doing some work in the back yard). 📖 🎧
It was pretty good… not amazing but enjoyable nonetheless.