How to dockerize a Rails application
Introduction Microservices architecture is a particular way of designing software applications so that it can be deployed independently, test independently, and scaled independently. Read What are microservices? to get more deep understanding about…
Toggle NOT NULL constraint with Rails migration
Take advantage of change_column_null to add or remove NOT NULL constraint on a column. The null flag indicates whether the value can be NULL. To add the constraint (says column cannot be NULL): To remvoe the constraint (allows column to be NULL): The…
Docker Cleanup Commands
If you see Docker claiming lot of space on your computer and if you want to reclaim all of your space back from Docker, use following Docker commands for cleanup. Make sure you are aware that this will delete images and containers from your machine…
Git branch naming conventions
As you have spent a couple of years in software or web development and if Git has become part of your work routine, this small tip of the day is going to help you optimize your workflow and increase productivity. The benefit of adopting this habit is…
Understanding MySQL Index Basics
An index is an on-disk or in-memory structure associated with a table or view that speeds retrieval of rows from the table or view. An index contains keys built from one or more columns in the table or view. For on-disk indexes, these keys are stored…
Optional Chaining in JavaScript
Optional chaining enables capabilities for Javascript developers to perform a nil check on the objects before trying to access any object properties. As an example: Optional Chaining behaves similarly to Ruby’s pretzel(&) operator. Checkout the…
Why use React Hooks? Explained
Start with why? If you want to use Hooks in React in your application. Make sure you update your react version to >=16.8 since it was introduced in React v16.8. Before React Hooks was a feature in React the only way to use state in your component was…
Tests are executable documentation
A well-written test case tells a clear story, communicating the intent of code. Learn how to write expressive tests and why duplication isn't always a bad thing in your test cases. - phrase from ThoughtBot blog about TDD. Well written Tests are…
Toggle NOT NULL constraint with Rails migration
Take advantage of change_column_null to add or remove NOT NULL constraint on a column. The null flag indicates whether the value can be NULL. To add the constraint (says column cannot be NULL): To remvoe the constraint (allows column to be NULL): The…
Understanding React stateless components
Since React v14, a simpler way was introduced to define stateless functional components. These component use plain Javascript functions. With React 16.6+, you can declare "pure" functional components via React.memo The simplest way to define a…
Setup aliases and shortcuts for git commands
Here is how you setup aliases and shortcuts for git commands. Edit .gitconfig file in your $HOME directory. Refer to the branch you've checked out when you use git push and/or git pull Here are some more goodies in your aliases list. Thank me later…
Deliberate practice in software development
What is Deliberate Practice (DP)? Deliberate practice is common phenomenon in sports, arts and other industries. Athletes have a dedicated time each and every single working day for deliberate practice. It is same with musicians, actors, painters…