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

Promises, what ??

I consider myself a ruby developer, not one with long time professional experience, but one with a great attitude and eager to learn new technologies. Lately I have been working more with JavaScript at the beginning I wasn’t really enthusiastic about the idea of working with JavaScript but the project itself really surprise me. For starters it was built with React and Redux for managing the state of the application. It has been a big change to understand how they work and wrapping my head around the concept of Reducers, Store and Actions but I could say is awesome working with this new technologies.

But what really shine the most was the new API for the Promises, for me change the way for working with asynchronous actions.

Read more

Implement Rails Variants in Rails 3.1

Yesterday at work we decided that we need to improve our user experience in web mobile. So we decided that it was time to create a different view for each action. Lately in Rails 4 there is this really cool feature called Variants really neat one if you ask me. Basically depending on the variant you set phone || tablet usually from an before_action inside your ApplicationController, rails will be smart enough to render the right layout and the right view, only with te condition that you add the variants to the file name show.html+mobile.erb.

Ok so easy as pie. Our problem we have a complex rails 3.2 application with a lot of dependencies, that is quite difficult to upgrade to rails 4.1.

Read more