All Posts

Publish-subscribe pattern on Rails with wisper

I’m gonna skip introduction about what is publish-subcribe patter, what wisper is or how to use it and get straight to the real-life example.

How to migrate your old Synology to new Synology

Recently I have upgraded my good old Synology DS411slim to newer, bigger model - DS918+. I kinda started to run out of free space (1TB 2.5” x4) and decided to invest some money into new box and new drives. There is an official guide how you can do migration with disk swipe, but as I wanted to move my data to new drives I just decided I would try to rsync everything. And BTW there is a screen command if you would like to run in the background that can be found on synocommunity.

PhotoSwipe gallery with StimulusJS (on Rails)

StimulusJS, born at Basecamp, was officially released around a year ago - and I kind-of ignored it’s existence as I simply didn’t need it anywhere (I worked on React-based project for a while). But right now I’m working with an app that relies heavily on backend-rendering and Rails itself - in such scenario dropping whole ecosystem of any javascript framework with client-side rendering makes no sense business-wise. But gluing random js snippets can get you far until a some point. I think the biggest advantage of stimulus is that it gives you some sane structure. It integrates nicely with webpack/er and introduces idea of controllers. So let’s take a practical example what we can do with it.

Crystal app: Resurrection

So it’s been a while since I finished prototyping my very first app in Crystal. I decided to dust if off a little bit around a week ago. It’s not available under domain, but aside that I got yet another idea based on the original concept.

Surviving technological hype with a peace of mind

How can you sleep when people are building serverless application in the cloud with blockchain while sitting in a self-driving car powered by AI and machine learning? Don’t get me wrong - behind some of those words are hidden really interesting things and problems, but as an average Joe that is doing mostly web-related stuff how do you deal with such noise? I think the answer to this is the same principle you might apply to different problems - keep it simple.

User systemd and capistrano

Few weeks ago I was upgrading legacy infrastructure for small sized project and decided to go with systemd for service management as I had quite good experience with it while tinkering with my toy apps written in Crystal. If you want to use systemd for rails/ruby project - there is a great news everyone! capistrano-systemd-multiservice will basically do the work for you and it I must say - it works just great.

Randomly failing RSpec test suite - is there a hope?

Fortunately thanks to very smart people in the community - yes there is! So worry not, warrior of legacy code, protector of good practices. Now you have tools that will help you lead the way into the clean and solid code, where tests are always green and developers are happy. Ok, maybe I got carried a way a little bit here, let’s get down to the business ;). Rspec 3.3 introduced bisect command which is truly awesome, from docs:

How to POST multipart form in Crystal and receive in it Express.js (Node.js framework)

I was still tinkering with my pet project a little bit - connecting it to social media was an interesting learning experience as I had to create tiny service in Node.js due to fact Crystal lacked proper libraries (and that is ok, you don’t have to duplicate everything in every language). Below are some short notes that might help you a little bit if you’re trying to do similar thing.

Writing Chip-8 Emulator (interpreter) in Crystal

It was middle of a week, around noon I think. I thought to myself “I should write a yet-another NES emulator, that would be awesome!”. Few minutes later I am reading blogposts, articles, browsing repositories. And I am like “Damn it looks complicated”.

(Kind-of) Gotcha In Postgres Upsert Query

I noticed funny thing happening in my most recent pet project. All of the sudden (auto incremented) primary key was out of range for my smallint column. But how come? I had like 15 records in that particular table. It turns out it was all by design and completely makes sense when you think about it, but I managed to miss that anyway. The problem is when you do an upsert sequence on your primary key will be incremented anyway - it had to be obtained before actual insert so when you take a step back it’s like pretty obvious ;).