-
Query PSQL JSON Field
We recently created a table with JSON field in our Rails app. When the time comes that we need to query the table to find the record with the same JSON field, we find it didn't work as we expected. Suppose the table name is filter_sets and…
-
React Hooks Not to Run on Initial Load
There are times that a page would error out if on initial load, it renders more than once. Rendering more than once unnecessarily is always a waste of resource and loading time, but in some occasion, the page stops loading if there are more than one initial load. For example,…
-
Extending build-in ruby classes in Rails
It's a useful skill to extend build-in ruby classes in Rails. And it turns out to be fairly straightforward. We're going to use an example to explain how to do that. Use case: we have an array of scheduled jobs, work orders and events. We'…
-
Sidekiq Server Side Middleware
Our team recently has converted all our background jobs from delayed job to Sidekiq. There are many things that we have learned along the way. One of the useful tools is to utilize sidekiq middleware to manipulate the job when pushing the job to a redis server or right before…
-
Sidekiq WebUI Access Control
Sidekiq built-in webui is simple and useful. We would like to take the advantage of that instead of reinventing the wheel. Sidekiq recommends for a bare Rack app, a session middleware before Sidekiq::Web in config/routes.rb should be used (reference [https://github.com/mperham/sidekiq/blob/main/Changes.…
-
Write Ng Add Schematics for Library in Monorepo
In our monorepo, we have about 30-40 projects under library. We use custom schematics to integrate our library with Angular CLI. This post shows how we create schematic for ng add to enhance the initial installation process for our consumers. Our initial workspace/library structure is shown as: /<workspace&…