Skip to content

Instantly share code, notes, and snippets.

View jvidalba1's full-sized avatar

Mateo Vidal jvidalba1

  • Medellín - Colombia
View GitHub Profile
@jvidalba1
jvidalba1 / test.rb
Created December 5, 2014 16:28
creating hash given a string and deeping them with deep_merge from active_support gem
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

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.
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
@jvidalba1
jvidalba1 / mac_install.md
Last active September 6, 2023 04:29 — forked from edymerchk/mac_install.txt
Mac installation environment

iTerm2

http://iterm2.com/

Oh my ZSH

https://github.com/robbyrussell/oh-my-zsh

HomeBrew

@jvidalba1
jvidalba1 / main
Created June 26, 2014 19:10
problems
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.
=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')

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

@jvidalba1
jvidalba1 / transfer_data.md
Last active August 29, 2015 13:57
Transfer data via scp
  • Send data from local to server
scp -P [port_number] [files_to_send] [user]@[ip_server]:[folder_in_server]
@jvidalba1
jvidalba1 / mysqldump.md
Last active August 29, 2015 13:57
Export data from mysql by command line
  • 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 
@jvidalba1
jvidalba1 / unzipping
Last active August 29, 2015 13:57
List of commands to get files from compressed folders
- Descomprimir .tgz
```
$ tar -xvzf archivo.tgz
```
- Descomprimir .tar
```
$ tar -xvf archivo.tar