Skip to content

Instantly share code, notes, and snippets.

View dnovais's full-sized avatar
🏠
Working from home

Diego Novais dnovais

🏠
Working from home
View GitHub Profile
@dnovais
dnovais / remove_all_gems_rbenv.md
Created December 11, 2018 14:27
Rbenv - Remove all gems from environment

$ mkdir -p ~/.rbenv/plugins # create the plugins dir if you haven't already $ git clone https://github.com/jbernsie/rbenv-clean ~/.rbenv/plugins/rbenv-clean

Uninstall all non-default gems in Ruby 2.5.1 and leave every other version un-touched

$ rbenv clean -v 2.5.1 Uninstall all non-default gems in the current global version

$ rbenv clean -c Nuke the entire environment

@dnovais
dnovais / disable_ipv6.md
Created November 13, 2018 17:31
Disable IPV6

IPV6 is the most recent version of internet protocol (IP) designed to eliminate the long-anticipated address exhaustion problem of IPV4. In order to disable IPV6 on Linux/Ubuntu, please follow the steps below:

1 Open Terminal

2 Enter gksudo gedit /etc/sysctl.conf and open the configuration file and add the following lines at the end

net.ipv6.conf.all.disable_ipv6 = 1

net.ipv6.conf.default.disable_ipv6 = 1

@dnovais
dnovais / installing_rmagick_ubuntu_16.04.txt
Created August 24, 2018 21:48 — forked from ryderstorm/installing_rmagick_ubuntu_16.04.txt
Installing rmagick gem on Ubuntu 16.04
# the instructions from here: https://stackoverflow.com/questions/3704919/installing-rmagick-on-ubuntu/31089915#31089915
# worked, but only after I added in line 8
sudo apt-get purge graphicsmagick graphicsmagick-dbg imagemagick-common imagemagick imagemagick-6.q16 libmagickcore-6-headers libmagickwand-dev graphicsmagick-libmagick-dev-compat
sudo apt-get autoremove
sudo apt-get install imagemagick libmagickwand-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config /usr/bin/Magick-config
export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
gem install rmagick
@dnovais
dnovais / git_alias.md
Last active August 14, 2018 15:50
Git - Alias

Atalhos para o git

Segue a lista de atalhos interessantes

git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
@dnovais
dnovais / rspec_private_methods_in_model.md
Last active August 13, 2018 15:06
Model - Rspec with private methods

Para testar meteodos privados no model

Para testar os metodos privados, podemos usar o send para chamar o metodo.

context 'Metodos privados' do
  it 'Metodo para gerar URI' do
    expect(subject.uri).to eq(subject.send(:gerar_uri))
  end
end
@dnovais
dnovais / changing_permissions_with_command_line.md
Created July 30, 2018 23:11
Changing permissions with command line

Changing permissions to folder and files

>sudo chown -R $USER:$USER

@dnovais
dnovais / format_documentation_rspec.md
Last active July 17, 2018 16:59
Setting the output format like documentation in Rspec

Configurando output do Rspec

Por padrão o Rspec usa o formato de progresso para mostrar o andamento dos testes. Dessa forma ele não mostra o texto de cada describe(), context(), e it().

Para que cada um seja mostrado no output será necessário adicionar a seguinte configuração:

No arquivo .rspec

Adicione a linha:

@dnovais
dnovais / rails_app_without_test.md
Last active July 9, 2018 14:15
Creating a rails application without test default

Criando um projeto em Rails sem o mini-test

Quando estamos criando um projeto e vamos usar outras libs/gems de test, por ex. o Rspec, não precisamos do test padrão do Rails, que é o mini-test.

Para criarmos então um projeto ignorando os arquivos padrão de test:

rails new project -T
@dnovais
dnovais / git_tips_and_tricks.md
Last active July 9, 2018 13:40
Git - Tips and Tricks

Como mudar o nome do repositório?

Você precisou mudar o nome do repositório no github e não sabe o que fazer para ajustar isso localmente?

É muito simples, siga as instruções abaixo:

  • Verifique a url atual do repositório em seu projeto
git remote -v
@dnovais
dnovais / curiosity_about_ruby.md
Created July 5, 2018 21:40
Curiosity about Ruby

Curiosidade sobre o Ruby

Nas versões <= 2.3

10.class
=> Fixnum