Create a LAMP server using an AWS EC2 instance

In this article I’m going to show you how to easily create a LAMP server in an EC2 instance in Amazon AWS. You need an AWS account to follow this tutorial and don’t worry about the price of Amazon instances because we are going to use its free tier instance. Simplifying, a LAMP server is …

Read moreCreate a LAMP server using an AWS EC2 instance

How to manage Webpack configurations

Configuring Webpack is quite easy but it may become more difficult if there are many environments and requirements. I’ve included Webpack in different projects recently and I would like to share with you an easy way to configure it. I’m sure there are many different ways to configure Webpack, maybe better, but I’m just going to compare two of them:

  • One file to rule them all
  • Extended configurations

Read moreHow to manage Webpack configurations

Introduction to Node modules and ES Modules.

In one project I’m working on, we have migrated from a non-standard building tool to Webpack. This change has allow us to use a standard module system to import/export our code instead of the legacy builder we were using to just concatenate code.

Why is useful to use Javascript Modules?

Javascript modules are needed to maintain the principles of encapsulation and dependency.

As a project grows, it is useful to reuse pieces of software developed in isolation. When one of these pieces of software is brought into a project, a dependency between them is created. For example, many projects nowadays relay in some JS framework like Angular, ReactJS, VueJS or others. This concept is known as dependency.

When a dependency is created between these pieces of software it is of importance that no conflicts arise. This is known as encapsulation. Encapsulation is important because it isolates and guarantees that there won’t be any interference between different pieces of code.

Read moreIntroduction to Node modules and ES Modules.

How I secured my server with Fail2Ban.

The other day I received a lot of alerts from the service I use to monitor the uptime of my blogs, all of them were down without an apparent reason. My blogs are hosted in a virtual private server configured with just a basics configuration, a LAMP server running in Ubuntu, no Webmin, no PhpMyAdmin, just the basic stack. Basics are the best, but that’s a topic for another post.

No worries, I have a solution for these kind of situations…

Read moreHow I secured my server with Fail2Ban.

DIY bluetooth speaker with a vintage radio

Last month I was at my aunt’s and I found a vintage radio. I switched it on to check if it stills worked but it didn’t. Radio receiver wasn’t working fine and music had interferences, but I still wanted to do something useful with this radio because I liked its outside design. That’s why I decided to convert it into a Bluetooth speaker.

Read moreDIY bluetooth speaker with a vintage radio

My conclusions using Angular 2 for the first time

I’ve been working these days using Angular2 for the first time and this is what I have to say.

It hasn’t been easy to get used to Angular2 and I still don’t really know how some things are working. My rule of thumb: If it works, don’t touch it.Adrián Gómez

Before starting with this text, I have to say this opinion is totally personal and based in my own experience. Talking about my experience: I’ve been working with Angular 1 for more than three years. I started with Angular 1.2.3 and I’m currently using version 1.5.8 with these rules:

  • I use a Component based architecture and Components only deal with “scope”.
  • I only use Factory for services and they usually have all the business logic.
  • Directives just for small DOM things.
  • John Papa styleguide is a good ruleset to follow.

Read moreMy conclusions using Angular 2 for the first time

Put yourself on internet with Jekyll, GitHub and Cloudflare

Having a website on internet is a very powerful tool, you can create a tech blog, like mine, a site with your curriculum vitae, a portfolio, whatever you want. Being on internet increases your visibility and let other people know who you are, what do you do, or other information you consider important. But if you dedicate yourself to technology, computers, development and so on, you must have your space on internet. No excuses.

There are literally a lot of ways (platforms, CMS, etc.) to create your own site on internet: WordPress, Medium, Ghost… But today, I’m introducing you an static site generator named Jekyll.

Read morePut yourself on internet with Jekyll, GitHub and Cloudflare

Build a secure API with Auth0, ExpressJS and AngularJs

Many modern projects separate the backend from the frontend user interface. The bakend usually handles incoming requests and responses with some information in JSON or XML.

When you are working with an architecture like this, your API needs to be exposed in a secure way and here is where Auth0 will simplify your design.

In this post I’m going to explain how I have integrated a website made with AngularJS with an API using ExpressJS and secured with Auth0.

Read moreBuild a secure API with Auth0, ExpressJS and AngularJs

Solar system simplified (HTML + LESS)

Summer has arrived. I can’t forget those summer nights at my village when I was young, looking at a bright night sky with a lot of glittering stars.

The infinite of the sky made me small, leaving my mind at a point I thought about anything and everything at the same time, braindead, stunned, relaxed.

I looked at a whole sky without paying attention to any specific star, seeing satellites crossing the sky in a “perfect” straight line. I loved those nights as much as I loved the universe although I don’t know as much I’d like about it.

Read moreSolar system simplified (HTML + LESS)

To bind nor not to bind

If you have read my previous article about chaining promises, you’ll know I love using small functions in “then” methods, but sometimes chaining is not that simple.

For example, when you have to execute in your “then” method a function receiving two parameters it is not possible… or it is?

In these cases you can use some alternatives as seen below:

  1. Using an anonymous function to chain our second promise
  2. Use “bind”  to pass the second parameter to our second function
  3. Wrap our second function into another function and chain this wrapper instead.

Read moreTo bind nor not to bind

Avoid idling in Openshift with UptimeRobot

Yesterday I prepared a presentation for my coworkers comparing two PaaS services, Heroku and OpenShift, and now, an idea has come to my mind.

If this is the first time you’ve heard about a PaaS I would tell you that a PaaS is a platform that abstracts you from all infrastructure needs to host an application and also offers some extras like NodeJS, Python, MongoDB, MySQL, etc. If this explanation is not enough you can read what Tom’s IT wrote about it.

These services usually have free plans where applications are idling if they not receive a request in a period of time, for example:

  • Heroku: Idling on 30 minutes of inactivity (6 hours sleeping daily, so bad)
  • Openshift: Idling o 24 hours of inactivity (App never sleeps, so good)

Reading above, please migrate your services to Openshift because it has a 24 hours idling and not sleep time on its free plan.

If you want to avoid application idling but you don’t want to hear about paying, (I would recommend you to pay a plan or buy a cheaper host like OVH) you can try UptimeRobot.

Read moreAvoid idling in Openshift with UptimeRobot

Clean code chaining $q promises

$q promises for angular are not only good for async tasks but an incredible way to write clean and readable code.

Since a few months, I’ve decided to write my code in very small functions with its in/out parameters and its detailed documentation.

Maybe you are not following the relation between $q promises and organizing the code in small-low-complex functions. I’m explaining myself.

Read moreClean code chaining $q promises