- Everything in Ruby is an Object (except blocks) and everything has methods.
- In Ruby,
{}
are generally interchangeable with the keywordsdo
andend
. - 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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_support/all' | |
def single_hash(keys, value) | |
splitted = keys.split(":") | |
hash = { splitted.last => value } | |
splitted[0..-2].reverse.each do |key| | |
hash = { key => hash} | |
end | |
hash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Installation guide for Ruby stack in Ubuntu (Work In Progress) | |
Open your terminal and copy and paste the following commands: | |
# This will install: git, ruby and zsh: | |
sudo apt-get update | |
sudo apt-get install build-essential git zlib1g-dev openssl libopenssl-ruby1.9.1 libssl-dev libruby1.9.1 libreadline-dev libcurl4-gnutls-dev librtmp-dev curl -y | |
sudo apt-get install zsh -y |
iTerm2
http://iterm2.com/
Oh my ZSH
https://github.com/robbyrussell/oh-my-zsh
HomeBrew
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Problem topic: postgres | |
-> Error: psql: could not connect to server: No such file or directory | |
-> The solution which worked for me: | |
a pid file was blocking postgres from starting up. To fix it: | |
rm /usr/local/var/postgres/postmaster.pid | |
and then all is well. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
- Send data from local to server
scp -P [port_number] [files_to_send] [user]@[ip_server]:[folder_in_server]
- Export only data
mysqldump -u [username] -p --no-create-db --no-create-info [database_name]+ [table_name]* > [filename]+.sql
- Export only structure
mysqldump -u [username] -p --no-data [database_name]+ [table_name]* > [filename]+.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Descomprimir .tgz | |
``` | |
$ tar -xvzf archivo.tgz | |
``` | |
- Descomprimir .tar | |
``` | |
$ tar -xvf archivo.tar |