Skip to content

Instantly share code, notes, and snippets.

View jvidalba1's full-sized avatar

Mateo Vidal jvidalba1

  • Medellín - Colombia
View GitHub Profile

Introduction to Ruby

Things about Ruby

  • Everything in Ruby is an Object (except blocks) and everything has methods.
  • In Ruby, {} are generally interchangeable with the keywords do and end.
  • There is no method overloading, the last one declared is invoked, because it overrides the others.
  • Instance variables (attributes) are trapped inside the instance and need to be published throught attribute accessors methods, for instance.
@rderoldan1
rderoldan1 / migration.rb
Created August 5, 2013 06:32
Rails number db format
t.integer :int # int (4 bytes, max 2,147,483,647)
t.integer :int1, :limit => 1 # tinyint (1 byte, -128 to 127)
t.integer :int2, :limit => 2 # smallint (2 bytes, max 32,767)
t.integer :int3, :limit => 3 # mediumint (3 bytes, max 8,388,607)
t.integer :int4, :limit => 4 # int (4 bytes)
t.integer :int5, :limit => 5 # bigint (8 bytes, max 9,223,372,036,854,775,807)
t.integer :int8, :limit => 8 # bigint (8 bytes)
t.integer :int11, :limit => 11 # int (4 bytes)
@ryansobol
ryansobol / gist:5252653
Last active November 22, 2023 11:53
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

@runlevel5
runlevel5 / how_to_install_ruby_193-p392_on_osx_10_8.md
Last active January 23, 2019 22:51
How to install Ruby 1.9.3-p392 on OSX 10.8+

How to install Ruby 1.9.3-p392 on Mac OSX 10.8+

RVM:

rvm get stable && rvm reload

Firstly, the OpenSSL comes with your OSX 10.8+ is outdated, you need to get latest version

@rderoldan1
rderoldan1 / gist:1648004
Last active November 25, 2015 19:43
errors that can appear when you try to install ruby gems

###This error can appear when you try to install ruby gems follow this steps:

###Error: no such file to load --zlib 1. sudo apt-get install zlib1g zlib1g-dev 2. cd /usr/src/ruby-1.9.2-p180/ext/zlib/ 3. sudo ruby extconf.rb 4. sudo make 5. sudo make install

@nhocki
nhocki / nameable.rb
Created August 9, 2011 04:20
Clase de Ruby
# Los nombres de las CLASES y MODULOS debe empezar con mayúscula
# Se considera buena práctica poner estos nombres en un CamelCaseConMayusculaAlPrincipio
module Nameable
# El método self.included se llama cuando una clase INCLUYE este módulo
# El parámetro 'base' es la CLASE que incluye el método
# En este caso es la clase 'Car' y la clase 'User'
# NOTA: No existe un hook similar para extend (no existe self.extended(base)).
def self.included(base)