Backbone.js is great for doing single page apps or to tidy up some messy javascript code. But there are a few things that are a bit tricky to do, like uploading files. Sure, some browsers support uploading files via XHR, but some others don’t (I’m looking at you IE). There are a few workarounds for this situation. Here’s a quick explanation on how I achieved file uploads using Backbone.js in a recent project.
Rails Security Pitfalls
Another article for SitePoint. This one’s about some security issues and considerations on Rails. A few important things to have in mind. Go take a look!
Quick Ruby Tip: || vs or
Quick heads up on operator precedence:
If you want to assign a value to a variable depending on a boolean, use ||
not or
.
||
takes precendence over =
. or
does not.
Example:
a = false or true
puts a # => false
a = false || true
puts a # => true
Fixing a CPU-consuming logrotate
Last week I noticed one CI server was taking a huge amount of time to finish a test suite. It was supposed to run a few minutes, but was taking hours instead. A few months before, when the server was just set up, it ran in a few minutes as expected. Here’s how it was diagnosed and fixed.
Simple Background Jobs with Sucker Punch
Another post for SitePoint (ex RubySource) about running simple backgrounds jobs in your Ruby apps with the Sucker Punch gem. It’s a great and easy way to offload jobs from a request cycle. Go take a look!
Get Your App Ready for Rails 4
Wrote an article for SitePoint (ex RubySource) about preparing a Rails 3 app to upgrade to Rails 4. Covers most new features and deprecations. Go take a look!