Home
David Angulo - Software Engineer
Cancel

Redirect 404 pages in JavaScript

I recently migrated this blog from WordPress to Jekyll but due to the differences in permalinks, some posts now appear as 404. My old permalink for post is /:slug while it’s now /posts/:slug. I cu...

Pretty print data in Ruby

In the previous post we have learned to pretty print JSON in JavaScript. Now we’ll try to do the same with Ruby. As a Rails developer, I have been dealing with Rails console almost every day, tryi...

Attach file URL on ActiveStorage Rails

In a past post, we have learned to attach base64 file on ActiveStorage. Now we will learn to attach a file URL to ActiveStorage. Use case In my current job, we maintain REST APIs consumed by 3rd p...

Pretty print JSON in JavaScript

There are times that I use JSON.stringify to print my JSON just to see its contents. When the object is large it gets tedious to look at very fast, especially when dealing with array of objects. L...

DRY by reading .ruby-version in your Gemfile

Most Ruby projects have a .ruby-version file that is used by different version managers to automatically switch Ruby version based on the content of that file. Very useful if you have many projects...

Get the filesize of base64 file

In the previous post, we have learned to attach a base64 file on ActiveStorage in Rails. The another dilemma that I have encountered is how to validate the filesize of the uploaded files that are ...

Attach base64 file on ActiveStorage Rails

Base64 has been my go-to encoding when uploading files from my external front-end apps such as React Native to my Rails APIs. It’s a simple way to represent a binary data as string, where string i...

Check if Sidekiq is running

There is a simple command to check whether sidekiq is running or not. $ ps aux | grep '[s]idekiq' If it’s running you should get something like the following as a response: davidangulo 5526...

Check if Redis is running

Redis CLI There is a simple command to check whether redis is running or not. Just simply run the following command on your command line. $ redis-cli ping If it is running it should respond wit...

How to get statusbar height in React Native

There are different ways of getting the statusBarHeight in React Native and I will show some ways. Expo If you’re using Expo you can use Constants.statusBarHeight. import Constants from 'expo-con...