Set Content Type in RSpec

The last week I had a spec with a request where I needed to specify the content type and Google sensei didn’t help me. It took me an hour until I finally found it, so let me show here briefly how to do it just in case I have to find it again. ...

Bruno: Localizable.strings to strings.xml (iOS - Android)

I’ve created a small gem, Bruno, to convert a Localizable.strings (iOS) file to a strings XML file (Android) and vice-versa. ...

Dynamic Conditions for Associations in Rails 3

If you are using dynamic conditions in Rails 3, like Time.now or 1.week.ago you should use a Proc for that condition. ...

Rescue from MultiJson::DecodeError in Ruby on Rails

If you are developing an API with Rails you need to rescue from the errors produced by a bad formatted JSON. In order to do that I use a middleware file placed in app/middleware named ParamsParserRescue.rb. ...

Programming Challenges

I’d like to share some sites with programming challenges, also known as programming puzzles. I find them very useful to learn a new language, much more than reading a lot of books. Actually, I usually read one book for beginners of the language and after that I go to one of the following sites and start to code. My favourite is /r/dailyprogrammer. /r/DailyProgrammer. Subreddit with three challenges every week or so (easy, intermediate and hard). Project Euler. Math problems, created to be solved with a program. Code Forces. More problems! Code Golf. Part of the Stack Exchange platform. Very focus on the number of lines, but that makes it more fun. Coding Bat. Most of the problems here are easy, and some of them include the solutions. /r/ProgrammingChallenges. Another subreddit, less organized. Extra: a post with more links to challenges. Enjoy! ...