Rails like console for Node JS (and Node TS)

If you have ever used Rails and then gone over to a Node.js app, one thing that you will surely find missing is the ability to evaluate arbitrary code in the rails console. It's great to run one-off tasks like creating some rows or debugging issues etc. REPL Server…

Runtime validation with react-hook-form

React Hook Form is quickly gaining popularity as the goto form library for React. And with good reason. The API is really well thought, the validation is amazingly easy and the re-renders very efficient. One thing that I often find missing though is that it doesn't allow setting up validations…

Set up a WebSocket Server on Android with GraphQL-WS Protocol

I know this is a very strange topic to be writing about. Why would anyone want to create a WebSocket server on Android and then have it implement the GraphQL-WS protocol? If you are curious about the why or want to know how to implement this, read on. Why a…

[How to] Reduce Heroku Slug Size

Once a slug size reaches 300 MB, Heroku will warn about larger slug sizes having the potential to cause longer boot times. The best practice is to keep slug sizes as small as possible for fast deploys and other operations. Warning: You slug size (400 MB) exceeds our soft limit…

Eager Load Rails classes during development

Rails 6 comes with Zeitwerk as the new default loader. For most users, when upgrading from the previous version of Rails, not much would change (except some inflections because of the way zeitwerk infers file names based on the constant). For people using Single-Table-Inheritance, Rails upgrade guide already provides a…

Mocking with Jest

Jest provides several different ways to mock out things. Here's an effort to list out the most useful ones in a short post. Manual Mocks The most basic kind of mocking is by providing a __mocks__ directory next to the module you want to mock and provide a mock implementation…