Blog

I share bite-sized insights, tips, and tutorials on DevOps, Software Engineering, Web Development, Linux, and more, out of my continuous learning journey

I hope that you find something that helps you on your own journey


  • June 4 2024

    Form Objects in Ruby on Rails

    As a Ruby on Rails developer, you've likely come across situations where forms don't map directly to a single model or models that have complex validation and business logic. This is where a Form Object design pattern comes in! It encapsulates all the logic related to form processing, validation, and data persistence. It acts as an intermediary between the Controller and the Model. Form Objects offer numerous benefits such as encapsulation of form logic, handling composite forms, implementing custom validations, delegating data persistence, and re-usability of logic across different parts of the application.

  • June 3 2024

    Variable swapping in Ruby

    In the world of programming, swapping variables is a routine task. As a web developer, you might have used a temporary variable or the Bitwise XOR operator to swap values in languages like C, Java, or Python. However, Ruby offers a more straightforward, elegant, and concise way to do this. Ruby's multiple assignment syntax allows us to swap variables effortlessly. For instance, to swap variables a and b, you can just write: a, b = b, a. This approach works well with integers, but for strings, using a temporary variable or multiple assignment proves handy. Just remember, Ruby's approach to swapping variables is a testament to its simplicity and elegance in handling common tasks.

  • June 2 2024

    Quirky Ruby Feature - Mixing Code and Data

    Ruby has some fun quirky features. One of them is that you can mix code and data in a single file using the special keywords __END__ and DATA. This is a weird concept, but Ruby allows you to use the script itself as a source of data.

  • May 22 2024

    Momentum

  • May 6 2024

    Addicted to Learning

    In this article, I discuss the dangerous addiction of unchecked learning in the field of software development, as highlighted by Healthy Software Developer. I reflect on my personal struggle with using tech learning as a method of procrastination and how I've allowed this habit to interfere with both my professional and personal responsibilities over the last two years. Much of this behavior is fueled by fear, stemming from a job loss in 2022. Rather than focusing on honing my existing skills and growing as an employee, I found myself scrambling to learn popular technologies. I realize now, this approach was not fruitful and only served to distract me from my real responsibilities and growth opportunities. Looking ahead, I understand the importance of facing fears head-on and being more strategic about my learning commitments.

  • April 16 2024

    How to change a Users Password via Tinker in Laravel

  • April 15 2024

    A docker based setup for testing with Laravel

    I experienced some annoying issues while running integration tests in a Laravel app. The official MySQL docker image will create a user and a database for you which is very convenient, but that user does not have permission to create new databases. I configure my applications to use a separate database for testing, usually with a _testing suffix and so just hit a brick wall. The solution was to mount an entrypoint script, basically, some SQL statements I want to execute when the container is created. The script will create all of the necessary databases I need.

  • April 15 2024

    Add taggable support to my personal blog

    In today's post, I discuss enhancing my blog's tag support, moving from a simple comma-separated list to a more powerful and dynamic queryable system using the Ruby gem 'acts-as-taggable-on'. I illustrate the process of installing and migrating the gem with MySQL. I then detail the code for tagging in the Blog model, updating blog forms and controllers. It's crucial to migrate existing tags to the new system, which I did using Maintenance Tasks, including tips for covering edge cases in the tests for the task. Updating existing tests for the blog model to incorporate the new taggable system was the final step. Future considerations include creating a Stimulus Controller for auto-suggested tags and extending this functionality to the Project model.

  • April 14 2024

    Trying to Dispatch Jobs via Tinker with Laravel and SQLite

    In my quest to effectively test Laravel queues and jobs, I've had to navigate through several challenges. Initially, I created a one-off controller action to replay jobs, but the solution was a tad clunky. Next, I attempted to use Laravel's Tinker to interact with my SQLite database, but encountered unexpected I/O errors. Despite a deep dive into the issue and experimenting with different PHP versions, the SQLite errors persisted. Eventually, I decided to switch to MySQL and Docker, which turned out to be an effective solution, finally enabling me to query my database successfully. One key learning from this experience: when using Tinker to dispatch jobs, the appropriate method is to use Bus::dispatch or Queue::push, due to their dependency on garbage collection. All in all, while the journey was filled with obstacles, I'm thrilled to share these insights, with Tinker proving to be an excellent tool for Laravel developers.

  • April 2 2024

    Use Ansible to Configure your Workstation

    In this blog post, I share a straightforward way to manage your MacOS workstation using Ansible, based on Jeff Geerling's collection of Ansible roles and collections. After installing the necessary dependencies, such as the Ansible Galaxy mac collection and dotfiles role, you can define the dotfiles you want to symlink, and where to get them, and confogure which packages to install via homebrew. This approach allows you to set up your workstation as code, achieving about 80% of the setup process, with the remaining requiring some manual configuration.

  • March 19 2024

    DevOpsDays LA & SCaLE 21x

    The conference was a real blast, packed with awesome talks, some seriously geeky stuff, and plenty of chances to mingle with vendors, developer relations teams, and other attendees. I picked up some gems along the way, like Paul Tevis dropping knowledge bombs on building a high-trust culture, the ongoing saga of secrets management, and how DevOps is now just part of doing business. I had some great discussions with fellow attendees about the importance of pushing quality checks to the left, and engaged with talks about the value of Open Source projects and their QA game. Oh, and let's not forget diving deep into potential security headaches like typo-squatting in AI and what that could mean for us. These events aren't just about filling our brains with new info; they're about forging real connections beyond our screens.

  • March 10 2024

    Develop for Environment Specific Configuration

    I've observed a common pattern among junior developers regarding environment-specific configuration. Many junior developers misunderstand the need for a single environment-aware configuration and end up creating separate fields for development and production environments in their apps. They often misconstrue the need to store keys for different environments as a requirement to create two distinct fields in the admin, one for each environment. This leads to unnecessary duplication of logic to handle these different keys based on the environment.

  • March 9 2024

    Managing Jumpstart Pro Updates

    Jumpstart Pro is a Ruby on Rails SaaS template that streamlines the creation of business-ready web applications, eliminating the need for repetitive coding and configurations. Despite its numerous advantages, maintaining the software can become complex or tedious as applications grow - primarily due to merge conflicts during updates. I share a few strategies I employ to simplify this process, including removing files from the git index that don't require updates, regenerating files like yarn.lock and Gemfile.lock, and refraining from altering core Jumpstart files. I also use a script post-merging to automate the regeneration of these files. These methods have significantly eased the application of Jumpstart Pro updates for me, and I believe they could be beneficial to other developers as well.

  • November 23 2023

    Simple Database Seeder for WordPress

    As someone working with WordPress development, I've found that the development life-cycle could use some improvements to make the developer experience much better. One of the things missing from the out-of-the-box experience of developing with WordPress is a way to seed a database with dummy or test content, which is extremely useful for onboarding new developers to a project, running automated tests, and for ensuring proper practices by _not_ using production data.

  • September 6 2023

    Turbo Will Call Stimulus `connect()` Twice

    When you click a link to return to a page, or use your browsers back button to return to a page Turbo will render a cached preview of the page. It will then fetch an updated version of the page.

  • April 24 2023

    The Three Core Principles of DevOps

    DevOps is a tried and true framework for creating software. It's not just about automating pipelines or assigning operations work to developers; it's a mental model built on key principles aimed at improving work processes. These principles, known as the "Three Ways of DevOps" from "The DevOps Handbook," include the Principle of Flow, the Principle of Feedback, and the Principle of Continuous Improvement. To sum it up, DevOps is a transformative mindset that, when properly implemented, can significantly enhance a company's ability to deliver high-quality software more efficiently. As a reminder, always think of the three F's: Flow, Feedback, and Fine-tuning.

  • March 3 2023

    How To Use Docker Compose Effectively as a Development Tool

    In this article, I explore how Docker Compose can simplify software development, using Ruby on Rails as an example project. Docker Compose simplifies the setup and teardown of a project, reduces inconsistencies in development environments, and makes it easier to add ancillary services such as database and caching servers. I demonstrate this by creating a new Rails project, setting up a docker-compose.yml file, and adding services like PostgreSQL and Redis. Once done, I run and develop the new application in Docker. This process eliminates the need to juggle multiple versions of tools and services on a workstation, minimizes bugs caused by different development environments, and conserves resources. I also share insights on how to clone the example repo, create a new project, add the first service to Docker Compose, and develop the application in Docker.

  • February 3 2023

    Running Ruby on Rails on Docker

    Let's explore a process for running Ruby on Rails in Docker with Nginx to handle serving static assets.

  • November 5 2022

    Getting Familiar with RSpec in Rails

    I spent some time over the weekend getting familiar with RSpec. Gonna brain dump (with just a little bit of structure) the process and what I did and learned. To start I set up in a new rails project and kinda tweaked it into a place where I can be productive.

  • September 30 2022

    Execute Workflows with Path Filtering in CircleCI

    Path filtering in CircleCI to reduce build times, overall cost, and to better support monorepo strategies.

‹ Prev
1 3