So the other day I found an exciting project Anycable that allow using custom WebSocket server within your ruby application. I immediately got hooked up, and I started reading about it, and the first thing that I never heard of it was Grpc.

Grpc is an Open Source RPC framework developed by Google which uses protocol buffers. RPC (remote procedure call) the idea is that we can call a method on a server as we were calling a local object.

So the first thing I did was visit the official site for Grpc and went straight to the ruby section. What I found is a tutorial that is not up to date with the code from the repo at Github, and I found a little hard to follow, so I decided to merely extract the tutorial to my repo and explaining the overview of what I learned.

Read more

Revised by Andy Holland

Lately, there has been a significant change in the industry towards functional programming, new languages have appeared: Elixir, Scala, Elm.

With all this new hype I decided to give a try to some of them, and I have to say that they are really cool, but wether I like it at work I mostly use ruby. Not that I complain or anything but is exciting to be able to play with the new kid on the block.

After some time playing with a new functional programming languages, I have noticed that Ruby has some similarities with them.

I’m not going to say that ruby is a FP language nor that Matz the creator is incorrect.

To quote Matz words from an interview with O’Reilly.

I wanted a scripting language that was more powerful than Perl, and more object-oriented than Python.

So Ruby is an object-oriented language – that’s is for sure – but I wanted to share my idea that ruby is a multipurpose language.

Read more

Following with my previous post, Dry-web-roda part 1, I have decided to create my own small website to keep track of all the things I learn throughout the day.

Yes, I know, another Today I Learned Website 😓 – til_web, but this time I started with the persistence layer and I wanted to share my experience with you.

First of all, we will need dry-web-roda that will behave as our web application stack. When creating a new project with it, we have two options regarding the architecture point of view of our application: umbrella or flat.

Umbrella means that our functionality will be divided into sub-apps – for example the public site and the admin site.

Flat is a simpler architecture with a single module for the entire app.

In my app I decided to use the flat option for simplicity at the beginning, but in the future I plan to move to sub-apps.

Read more

Revised by Piotr Solnica and Andy Holland

Lately, I have been playing around and contributing to the great ecosystem of dry-rb, first of all, I have to say the community is absolutely fantastic, super supportive and eager to welcome many new contributors.

First I will like to thank Piotr Solnica, Andy Holland, Tim Riley and Nikita Shilnikov – they have been really helpful and patient with my many questions.

Yesterday I decided to start playing around with a gem call dry-web-roda this small framework aims to provide an alternative to building web apps using ruby, with the use of small libraries such as dry-view, dry-container, dry-transaction, roda, rom and many more; the help you build clearer, flexible and more maintainable code.

Read more

My setup for every project

I took me some time, to figure out how to correctly setup every project I worked on, not that I work in tons of projects, but now that I have a better understanding of how to setup, it makes more sense to me, at least.

I’m sure I did not understand it early, because of my lack, in reading the documentation, I know is a horrible habit, I’m working on it.

RVM

So RVM or Ruby Version Manager, allow to install different ruby version on the same machine without them collision it.

Read more

React Components

This is not going to be another post describing React and what is good or what is bad about it, I’m just learning it, and part of the learning process I decided that I will write a blog post for helping me maintain this new concepts. I will avoid many concepts, like how to create a project for importing all the libraries, I will create another post regarding that topic.

Component

The basic idea behind a component, is that is a reusable piece of code, every component has to have a render function that returns the actual component, in this examples I’ll be using JSX, so if you want to check it JSX in Depth, this basically lets us write some sort of html inside our JavaScript file, that when compiled it will look more Reactable.

1
2
3
4
5
var Nav;
// Input (JSX):
var app = <Nav color="blue" />;
// Output (JS):
var app = React.createElement(Nav, {color:"blue"});

Back to our Component lets start with a simple one:

1
2
3
4
5
6
7
8
9
class Example extends React.Component {
  render(){
    return(
      <div>
        <p> Hello </p>
      </div>
    )
  }
}

So this is our initial component, to make use of it, we will have to tell React to render it in the DOM.

1
ReactDOM.render(<Example/>, document.getElementById('app'))
Read more

After a long vacation, I came with a lot of energy and new goals for the new year.

So I decided that I’m going to start making things right, been a developer is not always easy, you have to continuosly update your knowledge and keep practicing even outside office hours. Don’t get me wrong I love coding but there are days or weeks that I’m more lazy than usual.

To solve this situation I’m going to start using somo Todo App for managing my free time, and create a timetible of small but doable goals.

Here is a list of some of my goals:

  1. Blog once a week:

    • The post don’t need to be extremly technical, but the idea is to blog about something that I learn new every week, maybe is a new Design Pattern or just a new way of dealing with stress.
  2. Learn Elixir.

  3. Learn React.
  4. Learn new way of improve my ruby skills:
    • Lately I’ve been reading a lot about using Functional Programming with OO principles. So I have an eye on the great work of Piotr Solnica. I will try to create a couple of gems following this new dry-rb concepts.

So hope you guys come join me in this new year of goals and challenges.

In the last couple of weeks I have been working, with a little project of my own. I always love Command Line Tools, I don’t know what they have but using them make feel more like a Hackers or someone that actually know what he is doing.

So I decided to build one, with the help of a gem called Thor, which by the way is a great gem, that help you build your CLI really easy.

Codewars provided a great service by letting us the programmer improve our coding skills, I decide to build a CLI to interact with it.

Probably I will write a post in future about creating a CLI but for now I want to focus on test.

My project is called Codewars_Cli, any one interested, is open for suggestions and pull requests.

Testing

In my day to day I use Rspec for testing, so the idea of using Cucumber really strike as a chance to learn a little more about this testing framework.

Wihch is focus on Behavior Driven Development.

Read more

This is the second part of my previous post Improving our rake tasks.

In this one we will discuss a way for testing our rake task, the example will be very straight forward. We will invoke the rake task and expect that some class receive the correct arguments.

I will use Rspec as my test framework.

And I will continue with the same example from last post.

Read more

Lately I have been writting some rake tasks, for downloading backups, for accesing API’s, or for automating teadious and repetitive work. Rake task are great, but dangerous at the same time.

We tend to add so much code to our rake task, that they become a source of errors. Following the principles of OOP we can clean our rake tasks, improving our code and making them much easier to test.

Let’s look up an example from work:

Read more