Category: Ruby

Working with time zones in Rails sometimes requires a bit knowledge and persistence to get it right; I learned that this is something you can easily do wrong. Ask a random Ruby developer to get today’s Date. He will most likely respond with And what about the current time? He’ll probably say Both […]

Learning Rails – Routing

Posted on: Wednesday, May 21, 2014

Starting the second course, Rapid Prototyping with Ruby on Rails, over at the Tealeaf Academy, I’m starting to learn how to work with Rails. One of the subjects in this lesson of study material is Rails’s Routing documentation. In the Rails Routing guide the 7 different routes are explained that are automatically created when specifying a […]

Final Blackjack game

Posted on: Saturday, Mar 29, 2014

The last lesson (week) of the Tealeaf Academy Ruby on Rails Online Bootcamp was to add betting and AJAXify the Blackjack game. I’ve had the wildest ideas and grand schemes to make the Blackjack game a fun, flashing, exciting and grand game that even could compete with the Casinos.

Blackjack on the web

Posted on: Monday, Mar 24, 2014

In week 3 of the Ruby on Rails online bootcamp I had to remake the Blackjack game using the web framework, Sinatra. As this would be the third time making the Blackjack game, that game logic wasn’t that much of a problem anymore. However, getting used to Sinatra and suddenly making a web application proved to […]

I’m working on the web version of the Blackjack game. This is done using the Sinatra framework for Ruby. While running the development web server (Shotgun/Thin) and using sessions, you may get the following warning in the console: SECURITY WARNING: No secret option provided to Rack::Session::Cookie. This poses a security threat. It is strongly recommended […]

Blackjack console game (continued)

Posted on: Saturday, Mar 15, 2014

In the next week of the Ruby online bootcamp over at the Tealeaf Academy, you have to recreate the Blackjack game using  an object oriented approach. Having worked as a Java Software Engineer before, this isn’t much of a problem to me. I’ve implemented the objects and spruced up the ASCII art even more then […]

Why use symbols as hash keys in Ruby?

Posted on: Wednesday, Mar 12, 2014

Question A lot of times people use symbols as keys in a Ruby hash. What’s the advantage over using a string? E.g.:  hash[:name]  vs.  hash[‘name’] Answer Using symbols not only saves time when doing comparisons, but also saves memory, because they are only stored once. Symbols in Ruby are basically “immutable strings” .. that means that they can not be […]

Blackjack console game

Posted on: Friday, Mar 7, 2014

I’m attending the GoTealeaf Professional Grade Ruby on Rails Online Bootcamp. As an assignment you have to create a procedural Blackjack game that can be run in the console / terminal. I’ve done this but I developed it a bit more then required: I created the Blackjack game with lots of ASCII art to make it […]

Pass by reference versus pass by value

Posted on: Friday, Mar 7, 2014

I’m currently studying Ruby and Rails with the Tealeaf Academy. It’s going well and it’s really fun to study Ruby. After years of Java, I feel Ruby is being a step forward. During the study, the subject of Ruby’s passing by reference or passing by values.  (For the less-technical readers; this is the difference between […]