Static websites are very popular nowadays. They’re simple, easy to maintain and super fast. A normal static site hosted on a CDN can be 10 times faster time-to-first-byte than a site built with a CMS or framework. A static site is also reliable as it doesn’t depend on the database and other services. And we can also worry less about deploy and just publish a static site on Github Pages for free or use any of the countless hosting providers around the world.

No surprise there is a variety of online platforms nowadays where anyone can build a static website…

It is always good to have your project code organised and decomposed into multiple files/folders. Certainly, nothing stops you from writing an entire application code within a single file. But that would prove to be a nightmare to read and maintain.

Modern JS frameworks, like Express and others, provide powerful tools for dynamic html rendering, internationalisation, etc.

But what if you don’t have a framework? …

Thu, Jan 28, 2016

In our AngularJS project, we have a chat built with the ruby server and Faye pub/sub messaging system. The chat is pretty simple — users can only send text messages and files to each other. When a user sends a file it is being uploaded on a separate file server and then interlocutor receives download link.

Recently I received an interesting bug: after user clicked on download link he was not able to receive new messages until the page was refreshed.

When I reproduced the problem I found this in the Faye browser log:


If second database config is isolated in a separate file the way it was described in a previous post, then to make this work on Heroku it is required to set the environment variable with url to the database you want to use as second one. For instance, if you created a second database called HEROKU_POSTGRESQL_SECOND_DB_URL all you have to do is to set this database url’s value using the Heroku toolbelt:

And you’re ready to go. But this works only in cases when second database allows connections from all ip addresses. If database is placed behind the firewall…

During the last 6 months our team have written around 1.5k unit tests in jasmine for our angular application. That was an interesting experience and here are some notes that I made along the way and would like to share.

Watch out for memory leaks

If your tests leak memory, the browser will get slower and slower and so the more tests you have the slower they will run no matter how well they are written.

If you have a large amount of unit tests you will probably want to run them in PhantomJS browser because it works faster than any other browser. But there…

Sources used:

There are many different scenarios why you may want to have more than one database in your Rails application. For instance, to segregate large DB into several small DBs like accounts, logs, etc. Or you may have client that already has some database replication going on in their deployment. Another use case is migrating from an old schema to a new one. Last, but not least, it…

Slava K

Ruby on Rails consultant - web performance, security, scalability, architecture planning. Founder and

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