jacopo beschi: yet another web guy

Welcome, my friend.

Hi there, my name is Jacopo, but i think you already guessed that. I'm a web engineer in italy and yes: "yet another web guy". As i come from italy i like spaghetti but i don't like spaghetti code. In this website you'll find articles talking about web development. Mainly focusing on php oop design patterns and laravel framework (which embraces the "don't reinvent the wheel" philosophy).

Javascript multiple inheritance with ES5 and AngularJs

Created at: Mar/31/2016 jacopo beschi

In this article I'll show you how you can use multiple inheritance(trait) with Javascript EcmaScript 5 and AngularJS 1.0. AngularJS offer you a method: angular.extend that allow you to extend any object with the values and methods of other objects. In this article I show you how you can create a Dog. Dog is an animal but is also a mammal, for this reason a Dog needs to extend animal and also Mammal classes. Below is the code to create a Dog:

Read on

JSON API error handling with ruby

Created at: Mar/29/2016 jacopo beschi

Hello folks, after being inactive for a while I am finally back!
This post is about a technique that I found useful for general error handling with REST API and ruby on rails, but the concept works for any programming language/framework. Most of the time programmers handles api errors without a general pattern, that's bad because it's obvious that is more error prone, by using a general pattern you can also do some interestic automatic operations such as error logging and messaging to a monitoring service.

Read on

Solve problems gracefully with dynamic method generation in ruby

Created at: Aug/20/2015 jacopo beschi

Days ago i was writing an Rspec macro to gracefully handle authenticated api via a token. At the start i begun creating a couple of methods, each for every Rest verb: module RequestMacros def get_authorized(uri, user) get uri, nil, {'X-Api-Token' => user.api_token} end

  def post_authorized(uri, data, user, headers = {})
    post uri, data, headers.merge({'X-Api-Token' => user.api_token})
Read on

Ruby: Dynamically create callbacks with metaprogramming

Created at: Jun/12/2015 jacopo beschi

Hello guys, in this post I'll explain you how you can handle callbacks with metaprogramming on ruby on rails. But before going deeper into detail you should ask me the reason of that: why shall you use callbacks instead of using general oop techniques? For example in a classic oop design given that you have:

Class X
   def method_x(*args)
      #do something
Read on

Ever heard of Fire...Base?

Created at: May/26/2015 jacopo beschi

FireBase is a service that offer you a json rest api, authentication and storage in cloud; pretty cool isn't it? It's also integrated with all the famous Javascript libraries and even more, now is part of the google team! What can i use firebase for?

Read on