jacopo beschi: yet another web guy

Posts Archive

Coffeescript Model class with attr_accessor rails alike

Created at: Feb/21/2015 jacopo beschi

Nowadays I've been toying around with the fabolous coffeescript language and I've created a basic model class.
This class allow you to use attr_accessor method as you can do in Ruby. If you don't know what attr_accessor is you can take a look here: Ruby attr_accessor.
Briefly what attr_accessor does is to let you access object attributes in "object.attribute" form (which in javascript is built in) but more importantly let you add a constrain on read/write permission of that attribute! In fact if you want the attribute to be readonly you need to use the "attr_reader" method, in the opposite case you need to use the "attr_writer" method. If you don't want to add any constraint you can use the "attr_accessor".

Read on

Install Ruby on Rails pg gem on MACOSX with Postgres.app

Created at: Jan/24/2015 jacopo beschi

Hello everybody. Happened many times that i forgot the command to install the pg (postgres) gem for Ruby on Rails. For this reason i wrote this article in order to help anybody who has the same problem. If you are using the postgres.app application on your MacOSX here is the command that you need to run: gem install pg -- --with-pg-dir="/Applications/Postgres93.app/Contents/MacOS/"

Happy rubying!

Read on

Strong Typing vs Duck Typing PHP, C#, Ruby

Created at: Dec/27/2014 jacopo beschi

If you have heard of strong and weak typing but doesn't know the main difference and advantages/disadvantages of both the paradigms in this article I'll try to help you having a better undestanding of the overall concept. The first thing you need to understand is what types are. When you save some data in the memory you can associate to that space of memory a data-type, by associating a type you can have different behavior when manipulating that piece of data. In an object orientet language generally there are two main categories of data:

Read on

The best shell for progamming: oh my zsh

Created at: Nov/26/2014 jacopo beschi

Hello guys, it's been years that i'm using bash as my preferred shell. Recently i've found a cool tool that you should try, it's called: oh my zsh. What's that? It's zsh: basically bash with some more features and also have cool plugins made by develpers that you can enable to have easier time progamming in your preferred language.

Read on

Test double php introduction

Created at: Nov/20/2014 jacopo beschi

When you start unit testing your code you don't want to test a full behavior of your code but just a little part in isolation to the rest. In order do do that you need to isolate your class from the other context, test doubles are tools (aka patterns) that allow you to do that. There are five common test double:

  1. Dummy
  2. Stub
Read on