What I learned this week [2]

A. I’m reading

JQuery Fundamentals: after realizing that I don’t know the syntax of jquery well enough, I decided to self-educate myself on that matter. And I made a decision to start by reading a book, to at least have the basic knowledge.

B. Something new

Using the localization in jquery-ui-datepicker

//= require datepicker-it when written in a *.js file, that line is first parsed by Sprocket in Rails. This line tells rails to preload some external javascript files.

And in order to use a datepicker, we need to include all the languages that we’re going to use.

New gems

spreewald: from makandra, predefine most frequently used cucumber steps.

consul: from makandra again, to restrict the access right to data.

&& vs. andin ruby

use && for the task when you need only the boolean output. && has high precedence.

The and usage is more complicated, in a sense that it connects two parts of the evaluation. Use and in control flow. and has low precedence.

False value

Ruby: false, nil

Javascript: false, NaN, 0, empty string, undefined. In short, this article says, only object is truthy.

C. Something to remember

  • To deploy the code, vagrant ssh, and then bundle exec cap playground deploy. Since we need the ssh private key, and we can only have access to that key while we are still inside the local environment. Deploying from the terminal in vagrant would not work.

My mistakes



What I learned this week [1]



Documentation from relish about aggregate_failures

I found it so cool how rspec:

  • execute all the expectation in the group. That way, we can run through all the expectation within one example . It makes sense for all the independent expectation to be executed all, so we can have a better understanding of the test.
  • Also, the way rspec groups and displays error.

Also, the documentation of Relish – RSpec Core 3.5 is much more readable than the official documentation from RSpec core 3.5


A nice way to test multiple objects with slightly different behaviors. Their same behaviours can be grouped into shared_examples