Daniel Nitsikopoulos The RSS feed for https://dnitza.com Sat, 04 Feb 2023 03:33:48 +0000 Sat, 04 Feb 2023 03:33:48 +0000 1800 📯 02/04/23 test post again

]]>
a0d3b201-9031-42a1-9829-303781169f07 Sat, 04 Feb 2023 03:33:25 +0000
📯 02/04/23 test post again

]]>
a29edc7f-7992-4a54-9ec2-54cba279cc08 Sat, 04 Feb 2023 03:29:41 +0000
📯 02/04/23 test post again

]]>
f0f8a872-4cc0-4769-bf3e-e663d817fb7d Sat, 04 Feb 2023 03:27:46 +0000
📯 02/04/23 test post again

]]>
ca04530a-be42-4a51-aeb0-a46f2ba8223c Sat, 04 Feb 2023 03:26:17 +0000
📯 02/04/23 test post again

]]>
8f941bfb-6974-4810-bb7e-fb514db0c3a5 Sat, 04 Feb 2023 03:25:33 +0000
📯 02/04/23 test post again

]]>
61e42433-af98-43a5-87ea-39a94dac975f Sat, 04 Feb 2023 03:21:52 +0000
📯 02/04/23 test post

]]>
13d4a2bd-380f-4fb9-ae1d-bec4476c95ae Sat, 04 Feb 2023 03:19:26 +0000
📝 Week 1 — This time, for sure.
  • 📲 New blog, who this? I have been re-building this site with Hanami & Tailwind, following the W3C's Micropub spec (mainly so I can leverage plethora of amazing compatible clients out there to write posts like this).
  • Since the enshitification of Twitter, I have been reflecting on the permanence of the things I put online. Not that I want the things I put online to be there forever, but more that I would like to be the one to control when they go away. To that end I have moved to self-host the things I consider to be important. Right now that is this blog, a single user Mastodon instance, and my RSS aggregator.
  • A little while ago, Hanami rolled out its 2.0 release. As a long-time fan of rodakase and the dry-* ecosystem of Gems, it's super exciting to have a modern framework in Ruby-land. Towards the end of 2022, my team at work spun up a brand new product over the course of 3 months or so, using one of the later betas of Hanami. The service has been rock-solid, and includes things like a mock data layer that can be optionally swapped in for the live data layer to make things like local development and demo data generation possible. This was made maddeningly easy by Hanami's provider API. I didn't get to write much of the code for this, and as such have re-written this site in Hanami, and I plan to open-source it soon!
  • Abby and I have been watching The Last of Us, and gross retconning of the origins of the parasite aside, it has been pretty enjoyable. It's been a long time since I played the game, so I have totally forgotten some of the smaller story beats. This week's episode was an incredibly touching arc of the lives of Bill and Frank. Characters, who, in the game were only hinted at being romantically involved. HBO took this, ran with it, and made the room incredibly dusty for about 2 hours. Helluva backstory just to explain how Joel was able to pick up a spare car battery.
  • I'm trying Vim again for reals this time. I am not writing a whole lot of code these days, so the overhead of Rubymine just to read some code, or make some small changes here and there is just too much. My previous attempts at learning Vim were made tricky by wanting to be as productive as I was in an editor like VSCode or RubyMine. Now that I'm not so much on the critical path of getting code out, this might be a good time to learn. So far, it's been pretty enjoyable, and since I have iTerm open all day anyway, there's one less thing to keep running.
  • I have been growing an Avocado in a pot on my desk. It looked a bit shaky after I repotted it from a smaller glass container. But this week there's been some new growth! A small avocado plant with a few leaves of new growth
  • ]]>
    week-1-this-time-for-sure Fri, 03 Feb 2023 08:23:08 +0000
    📯 01/31/23 Crumpet does this thing where she throws herself around in her bed to get comfortable — this was how she landed.

    ]]>
    b5f46dd8-663c-4e69-b3f2-ff727d2ffbde Tue, 31 Jan 2023 08:59:29 +0000
    📝 Ruby learning materials. I often get asked about recommendations for resources to learn Ruby (and how to program, generally). This list is intended to catalogue the various resources I have shared over the years and be an easy reference point for future learners.

    Ruby Koans

    https://www.rubykoans.com

    This is my go to recommendation for learning the Ruby language from scratch. You'll complete a number of exercises in the form of tests. Your goal is to get each test to pass by writing Ruby code. As with most $language Koans library, it starts off very easy and then ramps up in complexity.

    The Odin Project

    https://www.theodinproject.com

    Specifically the Ruby portion of the "Full Stack Ruby on Rails" course. This course covers off almost all of the basics that you would need to be productive with Ruby in a project that isn't super complex.

    Ruby Weekly

    https://rubyweekly.com

    One of the joys of the Ruby world is that someone is coming out with a Cool New Thing™ almost all the time. This can be hard to keep track of, and I have found Ruby Weekly a great resource to keep on top of all of the happenings in the world of Ruby. There are similar newsletters from the same publisher for other languages, too.

    Ruby Tapas

    https://www.rubytapas.com

    These timeless videos from Avdi Grimm illustrate the why behind a lot design patterns we employ every day, using real examples to help solidify the benefit of following these patterns.

    Blogs

    Podcasts

    • The Bike Shed — Out of thoughtbot, general developer experience, challenges and joys, usually covering Ruby and Javascript.
    • The Ruby on Rails Podcast — A weekly chat about Ruby on Rails, OSS and programming in general. Though not always about Rails specifically.

    Talks

    Boundaries

    Garry BernhardtWatch

    Thinking about the boundaries of and within systems can be tricky for new programmers. This talk does an excellent job of introducing the topic and providing concrete examples to take with you throughout your career.

    Y Not- Adventures in Functional Programming

    Jim WeirichWatch

    A detailed introduction to functional programming with Ruby, via first principles of lambda calculus.

    Refactoring Ruby with Monads

    Tom StuartWatch

    Dealing with unwieldy code using monads to help simplify presence or absence of data in our apps.

    All the Little Things

    Sandi MetzWatch

    Another journey through a hairy refactoring, this talk takes an ugly section of conditional code and converts it into a few simple objects. It bridges the gap between OO theory and practice and teaches straightforward strategies that all can use to improve their code. Also, checkout Sandi's book at Practical Object-Oriented Design, An Agile Primer Using Ruby.

    ]]>
    ruby-learning-materials Mon, 30 Jan 2023 08:37:22 +0000
    📝 Deploying a Hanami 2.0 app to fly.io. I have a couple of small hobby apps that were on Heroku's free tier (RIP) that I have now moved over to Fly.io. Fly.io has a migrate from Heroku process for Rails apps, but as far as I could see, not for any Ruby app. So I had to do things manually, and while deploying to Fly.io is super simple, there were a couple of small things that tripped me up that I thought I'd write about here in case any one else is also trying to deploy a Hanami 2.0 app to Fly.io.

    Getting setup

    After you've setup an account on fly.io and have installed the command line app, you can then follow the docs for setting up a Ruby app.

    While running through the fly launch setup, you should get the option to setup a Postgres database. If you do, the URL will be available as an environment variable in DATABASE_URL.

    Once fly launch has completed, you should have a new fly.toml file in the root of your project.

    Before deploying your application, you'll need to make a couple of changes specific to Hanami 2.0. The fly.toml below is where I landed in terms config for a small, simple app. The biggest changes from the generated file are as follows:

    • on deploy, defines a release command to run database migrations (at the time of writing, migrations are not in Hanami 2.0 by default)
    • defines the web process as bundle exec puma -C config/puma.rb
    • sets the Hanami environment
    • configures the processes to run (as ["web"]) and the internal port to listen on

    Deployment

    Once you've filled out your fly.toml, you can run fly deploy to send your first build to fly.io.

    If you're familiar with Heroku, there's a similar build and deploy log on fly.io. Though I have found it to be not as detailed as Heroku, it has been enough to surface any config errors and correct them, so keep an eye on it as it'll surface any obvious issues.

    Once your deploy is working, you likely wont need to change anything for a little while, so, if you're hosting your code on Github, you can setup an action to build and deploy on a successful build.

    An example GitHub action to build and deploy a Hanami 2.0 to fly.io

    ]]>
    deploying-a-hanami-20-app-to-flyio Sun, 22 Jan 2023 06:29:33 +0000
    📝 Managing dotfiles. It's not often that I get a new computer, but on the odd occasion that I do, I like to have all of my config prepared and ready to copy over!

    To achieve this, I am using chezmoi and GitHub to keep an up to date snapshot of my dotfiles. My previous tool of choice for managing dotfiles was rcm, but chezmoi offers things like password manager integration, scripts, and templates to customise dotfiles based on the machine I am setting up, making it just that little bit more useful.

    The initial setup of chezmoi is super straightforward, just:

    chezmoi init
    chezmoi add ~/.my-first-file
    
    chezmoi cd
    # follow your usual git workflow to add a remote and push
    

    Then, to pull down and apply your dotfiles on another machine, run:

    chezmoi init --apply $github_username
    

    From here, the workflow of adding and updating files is essentially: - Edit the source file on your machine - Then, chezmoi add ~/.file to commit and push to GitHub

    The chezmoi FAQ lists a couple of other ways you can keep a file in sync, including chezmoi edit and chezmoi merge, but I have found add to be the simplest.

    Chezmoi also makes it simple to run scripts when you run chezmoi apply.

    You can decide whether a script is run_once_ when you first run chezmoi apply, or run_onchange_, which will run every time, provided the file has changed.

    The scripts I have at the time of writing are:

    • run_once_00_install-xcode-devtools — Does what it says on the tin, installs Xcode's devtools
    • run_once_01_install_homebrew — Installs Homebrew if it's not already installed
    • run_onchange_after_brew-bundle — To run brew bundle whenever the Brewfile changes
    • run_onchange_after_configure-macos — To configure a bunch of macOS and LaunchBar defaults.

    Having a look through the chezmoi docs, you'll see there's a bunch more you can configure to meet your specific requirements, but hopefully this has provided a brief insight in to what is possible, and how easy it is to get started with a simple setup.

    ]]>
    managing-dotfiles Sun, 22 Jan 2023 06:20:43 +0000
    📝 Naming things is ~hard~ fun Like most people*, I like to name the various devices in the house after a theme. For the longest time, my devices were unnamed, until I moved to Apple's ecosystem and picked up my first external SSD for time machine.

    My chosen theme was the Metal Gear series, so naturally, the drive was named Solid Snake, and my MacBook was Roy Campbell. Fast forward a couple years and now the lineup looks like:

    • MacBook Pro — Zero
    • AirPods — Sigint
    • iPad — Shalashaska
    • iPhone — Fortune
    • Watch — Volgin
    • HomePod mini — Quiet
    • TV — Otacon
    • Wifi — Outer Haven
    • And then I have a room light and a lamp named Olga and Sunny respectively :)
    • ... as well as a previous iPhone and AirPods pairing of Ground Control and Major Tom (which were the only ones to break the theme).

    The only annoying thing is that Air Drop shows the device name as a destination (which makes sense), but doesn't show who owns the device. A solution to this would be to leave everything as "Daniel's Whatever " — but where is the fun in that.

    *computer nerds

    ]]>
    naming-things-is-hard-fun Thu, 05 Jan 2023 05:54:15 +0000