Following the tradition of the last years, I’ve made a geek christmas card. This year I typed it in javascript using the improvements of HTML5.


The card is a minigame where a small and blue snowman has lost his hat and you need to help him to recover it. The characteristic of the game is that the snowman moves autonomously once the user gave him a direction. The blue guy moves along the gray platforms until it bounces with the orange corners or falls outside the game. Later the user can make him jump by pressing space-bar.

Make a click on the picture to play the game.


It’s time for the geek christmas card. This year I wrote it in JAVA and it can generate, randomly, one of four different outputs. It is the simplest card I coded but I made it thinking in simplicity.

The source code for that can be found at my christmas-card’s github (link) inside mc201516. If you take care, you will find a two-output version of this card coded in R (-:

Last Nov 2, 2015 was the 200th birthday of George Boole. Google created one of its doodle in its honour. Here the tweet they did:


But who was George Boole? This man was an English mathematician responsible of The Laws of Thought which contains Boolean algebra. Boolean algebra, also known as Boolean logic, is a set of logical premises that allow the development of the information age.

The doodle was built to implement the basic operations of Boole’s Algebra: not, and, or and xor. All this operations needs two variables as input. This input variables were placed into the second g of Google: x and y. The other letters implemented the operations as:

  1. blue G: x and y
  2. red O: x xor y
  3. yellow O: x or y
  4. second blue G contains the two input variable as two black dots
  5. green L: not y
  6. red e: not x

All this operations return true or false after evaluating the two inputs (that can take true or false as input). Hence the letters were coloured when the result of their operation was true and become grey when false.

Table of Truth

Lets take a look to the table of truth of each operation:

  • NOT: This operation returns the opposite value of its input:
Input Output
false true
true false
  • OR: This operation returns true when, at last, one of the inputs is true.
Input X Input Y Output
false false false
false true true
true false true
true true true
  • AND: This operation returns true when all their inputs are true.
Input X Input Y Output
false false false
false false false
true false false
true true true
  • XOR: This operation returns true when all their inputs are different.
Input X Input Y Output
false false false
false false true
true false true
true true false

Google’s Doodle

Let’s see each step of the Google’s Doodle:

No X nor Y is given:

In this case X and Y have false as value so:
A. false and false = false
B. false xor false = false
C. false or false = false
D. not false = true
E. not false = true

X is given but no Y

Now X takes true and Y false:
A. true and false = false
B. true xor false =; true
C. true or false = true
D. not false = true
E. not true = false

No X given but Y

The opposite situation there, no X but Y:
A. true and false = false
B. true xor false = true
C. true or false = true
D. not true = false
E. not false = true

Both X and Y are given:

Not both X and Y are true:
A. true and true =; true
B. true xor true = false
C. true or true =; true
D. not true = false
E. not true = false


Today I started my first kata at CodeWars as a sensei. The kata is based on an mobile game called Strata (android, iOS).

The kata in CodeWars

The following sections corresponds to the kata I wrote for CodeWars. Now I’m working on the solution. When all the required stuff get finished I will write another post.


Cross-stitch is a popular form of counted-thread embroidery in which X-shaped stitches in a tiled, raster-like pattern are used to form a picture. Cross-stitch is the oldest form of embroidery and can be found all over the world. Many folk museums show examples of clothing decorated with cross-stitch, especially from continental Europe and Asia.

This kata tries to emulate a certain cross-stitch embroidery. We start from a squared canvas where certain tiles are colored, a pattern. The pattern is composed by colored-tiles and empty-tiles (gray in the following example). We need to embroider the canvas and cover each tile with a vertical strand and an horizontal strand. The tile will be colored with the color of the last strand that covers it. The empty tiles can be embroidered with any color.

Take the next picture as reference:

2x2 Canvas

We start with a 2×2 canvas with a total of 4 tiles (1). We can embroider the first row with a blue strand (2). We can do the same for the second row with a purple strand (3). Embroidering the first column with a blue strand (4) we cover the blue tile in the first row with two strands. Since the strand on the top is blue, this tile is colored as blue. This makes the first tile be colored with the requested color.

Then, if we embroider the second column with a blue strand (5a) we fill the last tile (seconds row and second column) as blue, but the tile tells us that it must be colored as purple. So we not match the pattern. For hence, the strand on the second column needs to be purple (5b).


What is requested in this kata is to return a solution given a patterned-canvas. For hence, you are requested to implement the function find_solution that has a two arguments:

  • canvas: This is an array of arrays representing the corss-stitch canvas (an array of rows).
  • colors: This is an array of the colors of the pattern.

I must say that the board will always be squared. An example of canvas and colors is:

canvas = [['b', ' '], [' ', 'p']]
colors = ['b', 'p']

It must be understood as: The canvas has two rows and two columns. And it has two colors, blue (b) and purple (p).

The function find solution must return a valid solution to embroider the canvas and color the given pattern. This solution must follow a specific format detailed here:

  1. It must be an array of hashes
  2. Each hash can have only three keys: :type, :index and :color
  3. The :type key can be 'r' for rows and 'c' for columns (string)
  4. The :index key will be the index of the row or column to be colored (integer). It must be between 0 and board.size - 1
  5. The :color key will be used to fill the row or column (string)

Warning: The canvas will be colore following the array’s order

An example of a solution for a 2×2 canvas:

[{:type=>"r", :index=>0, :color=>"b"}, {:type=>"r", :index=>1, :color=>"b"}, {:type=>"c", :index=>"0", :color=>"b"}, {:type=>"c", :index=>"1", :color=>"b"}]

No programmer can be an entry week at home without typing something. The ruby script squarefy I’m introducing in this post is the result of this afternoon, the 8th day of my Christmas holidays.

  • The repository of the project can he found at github (link).

The idea behind the script is to pixelize a picture but by drawing squares on it. This squares add Gaussian-blur effect on the original picture and also tint effect. So given the following picture:

The squarefy script will add a layer of colored and blurred squares on it with the aim to add a pixelized effect to the picture:

As the previous years, I continued with the tradition of sending a geed Christmas Card to my workmates. This year I wrote it in R, since it is one of the most used languages at CREAL. The result of running the script I sent (just a source code that loaded a file on the cloud) is seen above. The source code for that can be found at my christmas-card’s github (link) as mc201415.R.