Holidays helper in Ruby on Rails

Today, while doing a calendar I found a module on Rails called Holidays. I will use the Rails console to demonstrate: bundle exec rails c Loading development environment (Rails 5.0.1) [1] pry(main)> Holidays.on(Date.tomorrow, :pt) => [{:date=>Wed, 01 Nov 2017, :name=>”Dia de Todos-os-Santos”, :regions=>[:pt]}] [2] pry(main)> Holidays.on(Date.today, :pt) => [] Advertisements

Read More Holidays helper in Ruby on Rails

Solving easy problems with Ruby

I got this problem from here Implement a group_by_owners function that: Accepts a hash containing the file owner name for each file name. Returns a hash containing an array of file names for each owner name, in any order. For example, for hash {‘Input.txt’ => ‘Randy’, ‘Code.py’ => ‘Stan’, ‘Output.txt’ => ‘Randy’} the group_by_owners function should return {‘Randy’ => [‘Input.txt’, ‘Output.txt’], ‘Stan’ […]

Read More Solving easy problems with Ruby

How to remove Docker files

I have been using docker for a while in a project and thank god it exists. There is no need in installing many project dependencies. In this case this is a Ruby on Rails 3 project, yes very old. Everything was fine until my root partition “/” was out of space! I thought to myself […]

Read More How to remove Docker files

Design Patterns

I’ve got this book last week. It’s the most expensive I’ve ever bought and I do not regret! I am still in the beginning and learned what are Design Patterns, the catalog of the 23 design patterns in this book and how they solve problems. After, will be shown how to select and use a […]

Read More Design Patterns

Ruby permutation method rocks!

Early today I was doing my first homework assignment for the SaaS course by University of California – Berkeley, and was making a Rspec test work. This method was meant to take 2 arguments, one array with integers and one integer. What we have to do is sum two numbers in the array until it […]

Read More Ruby permutation method rocks!

Taking more than you can handle

Some time ago a friend gave me a coding challenge which I decided to make it in Ruby on Rails, I hesitated because was expecting that an Enterprise would give me a task to build something in JavaScript/HTML/CSS, so the time passed. Then I applied for a company that is hiring any kind of developer […]

Read More Taking more than you can handle

var and let the difference in JavaScript

Javascrit has something called Hoisting. This is when all variables and functions are loaded before the program runs. function loadProfiles(userNames){ // some code… var loadingMessage = “Hold a sec… Profiles loading!”; // some code… } var loadingMessage = “Loading your profile!”; What will happen here is that the first declaration of loadingMessage will be loaded […]

Read More var and let the difference in JavaScript