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.
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:
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.
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…
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…