MySQL 5.7+ STRICT mode

If you have a project that is so old and so broken but you have to maintain anyway, but you are developing locally using MySQL 5.7+, just run this on your MySQL console to remind yourself how poorly coded your codebase is everyday!

> set global SQL_MODE="NO_ENGINE_SUBSTITUTION";

The next day, run it again and again and again, until your team fixes the codebase.

Posted in MySQL | Leave a comment

AWS Lambda with API Gateway Integration

In this post, I will go through the process of using an AWS Lambda function served via AWS API Gateway HTTPS endpoint. My existing NodeJS API performs one task and is not called too often which is a perfect candidate … Continue reading

Posted in AWS | Tagged , , | Leave a comment

Rails – Healthy Migration Habbits – a repost

We are using a gem that encrypts database table columns. So far, it is working as intended, however, we encountered several issues where a column or a model attribute is missing, or simply not working. It turns out that we … Continue reading

Posted in Rails | Tagged , | Leave a comment

Redirect All Requests to HTTPS with Nginx

Assuming that you already have a working HTTPS configuration for your website and you decided to redirect all requests to HTTPS, here is a simple nginx configuration for that. This assumes that you don’t want to serve HTTP anymore. This … Continue reading

Posted in Linux | Tagged | Leave a comment

Creating Self-Signed Certificate for Web Servers Like Nginx

I’m not sure if I have written this before, but here is how we create a self-signed certificate (without the passphrase) to be used by web servers like Apache or nginx. Gist – creating self-signed certificate. This one works for … Continue reading

Posted in Linux | Tagged , , | Leave a comment

Angular 4.x – Add a 404 page

For a frontend application like Angular, the 404 page is served by the frontend application rather than the web server. To make this work, we should always return the index.html of our angular application for all applications, except for asset … Continue reading

Posted in Angular | Tagged , , | Leave a comment

Angular 4.x and Beyond – Twitter Bootstrap Nav Bar Not Working in Mobile

Yesterday, I have deployed my personal site into production which is built with Angular 4.x using an old template (Twitter Bootstrap 2.x). I just recently noticed that the navigation menu is not expanding when viewed in smaller screens. It is … Continue reading

Posted in Angular | Tagged , | Leave a comment

Angular 4.x – Integrate a jQuery Plugin

I’m using a very old twitter bootstrap template which is using jQuery Colorbox plugin to handle image preview modal like lightbox did. It took me more or less 4 hours to figure it out given I’m fairly new to Angular … Continue reading

Posted in Angular | Tagged , | Leave a comment

Rails – Encrypting Database Columns with Key Rotation

Encryption is not an easy task. You have to manage the encryption itself, key rotation and securing the keys. In this post, I’ll describe how we managed to encrypt our database columns and enable key rotation as well. This post … Continue reading

Posted in Rails | Tagged , , , , | Leave a comment

AWS RDS In A VPC

For the past few days, I’m trying to replicate a setup in AWS where the database server access is secured in a private subnet while the web server is located in a public subnet. The documentation is pretty straightforward for … Continue reading

Posted in AWS | Tagged , , | Leave a comment