In my experience and the apps I worked on, there were a few times I needed to find records based on empty associations.

Let’s imagine a silly example where you were writing a software to manage your franchise of electronic stores. You wanted to find store locations that run out of both Sega Genesis consoles and VCR players (I know, I’m old.) Being a programming nerd and recently picked up on Elixir, you would want to write your own Ecto query to find those. How would you do this?

NOT EXISTS with fragment function is the answer! (Well, you can…


I picked up Elixir last year at work. While some debugging tools are good to casual debug things in Elixir, IO.puts/2 and IO.inspect/2 are sometimes much faster to show what I wanted to see in the console log output.

The drawback of IO.puts/2 is that it can only take a strings. It will fail if you pass in anything else, try a map or list! Using IO.inspect/2 is nice and all but I found that a lot of times the output just got lost in the logs.

I came up with a simple way to format the output so that…


The dev team at Vendorful take code quality seriously. We invest in writing tests for every bug fix and new feature being implemented and in well reviewed merge requests. As any good developer should know from their past experience that with good test coverage they can actually move faster as a team in the long run. However, in addition to having good test coverage, writing human-readable code and tests is equally important. …


I ran into this when I was cleaning up my local git. I deleted both a local and its remote branch on origin! 🤦‍♂ And the branch I deleted is still in a Merge (Pull) Request! 💀 I used a third party app called SourceTree (I’m sure you heard of it) to delete them, so my commit is not in the reflog

What I did to restore the local branch is as follow:

  1. Since my commit is not in the reflog, I had to do this to print out and ultimately find my commit’s sha

git fsck --full --no-reflogs --unreachable…


I picked up ReactJS recently after a few years away from coding in Javascript at all. Since ReactJS is a powerful and useful framework with a lot of bells and whisles, in the midst of so many new things to learn, I lost sight of it being just a *javascript* framework. Yes, I can still use vanilla JS in my ReactJS app! (duh)

Here is one example:

My team wanted to implement a simple debounced auto-save function for our text box input. At first we used lodash's debounce to make it work. It seemed to be working and we launched…


Hands up! Or I will dynamically access your property.

Recently, I’ve picked up Javascript again at my day job writing software using ReactJS and Elixir. It had been a while I hadn’t code javascript professionally since AngularJS 1. Since 2014, there are so many new changes to the JS libraries and communities! I need to catch up.

Today I learned the new way in ES6 to use a dynamic key to access or assign an object property.

ES6 enables developers to create or access an object by dynamic keys or names:

You can think of many ways you can apply this to your coding scenario. How about the…


I have recently talked to a friend of mine who had just gotten rejected for a job interview earlier that day. He mentioned that the company disqualified him because he was not as “senior” as he said in his resume. He was only working for 3 years as a software engineer. So where is the line where a software engineer can call him/herself a senior?

I think the answer to that question is very personal and there is no hard-and-fast rule to determine who is “qualified” as a senior engineer. Generally, the industry thinks the senior title is up to…


Please note that this post is not a tutorial and it requires knowledge of Rails 5 ActionCable and ReactJS / Javascript custom library building.

One of the awesome features that comes with Rails 5 is ActionCable. With ActionCable, you can build all the real-time features you can think of via websocket. While struggling to build a chat system, I had found multiple examples on the ‘net of how to build a chat app with Rails 5 ActionCable but they are extreme simple to even apply the concept for any real life chat application. …


A service is an independent module which contains logic that doesn’t belong to one model or controller. As the name indicates, it provides a service to a model, controller or even another service. It does one thing and does it well. The determination of creating or use a service based on a specific thing that the logic does (Single Responsibility)

Think of this example of a property owner who hires a property manager to manage this property. The property manager provides a management service. This manager in turns hires a plumbing contractor, a carpet cleaner, … to help him fix…


Code Climate is a good product. I used it at a company I worked for before. But then again, I’m cheap, and I’m a nerd. So I built my own and integrated it with my own Jenkins server, and have it run code check on each pull request on my GitHub repo. I’d spend the extra money on marketing.

So here it goes.

Since the setup uses the Jenkins pull request builder, and I already have a build project for RSpec using the plugin, so I created a new project copying from that project. …

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store