Phaengris.Art hand-drawn arts, city photos, linux / dev stories

How to Use Yjs in Rails With Importmap

Yjs is a CRDT (Conflict-free Replicated Data Types) implementation in JavaScript.

What it means is when you want many users work on the same document, permanently adding, updating, deleting parts of it, CRDT is what you need to synchronize document content between all of the users, automatically resolving conflicts between their editings.

Yjs provides a Ruby port and even an ActionCable-based adapter so users of your Rails application can enjoy collaborative editing using an ActionCable websocket connection.

Unfortunately at the moment of writing this Yjs is not so well suited “out of the box” to be used with importmap, which become a standard since Rails 7. Below is my (kinda hacky) recipe how to make it work.

Read more…

Embed Custom Fonts Into PDF Documents With Ruby and Puppeteer

When you need to build a PDF document from HTML, Puppeteer is the tool to use.

But things are not so obvious when it comes to custom fonts.

Read more…

Install Torch.rb on Linux

The process is simple but not without it’s pitfalls. Here’s the instruction how it worked for me. My system is Fedora Linux 38, but I believe it should work for other Linux distros as well.

Read more…