How to copy folder from SSH to local

Category: Ruby :: Published at: 20.12.2021

Copying data from ssh to local is not that hard:

scp -r admin@servername.com:domains/domain-name.pl/public_html/admin/backups admin/backups

This is how to copy from local to remote:

scp /Downloads/example_file.txt admin@servername.com:domains/domain-name.pl/public_html/admin/backups

You can use "-r" flag to copy full folder. Without this you can copy only one file.


Kill your ruby session

Category: Ruby :: Published at: 07.12.2021

Quick cheatsheet to kill your Rails session on port 3000

kill -9 $(lsof -i tcp:3000 -t)


How to configure delayed_job to work on development environment

Category: Ruby :: Published at: 14.10.2021

Please take a note, that this is only brain shortcut for my personal use. 

It won't tell you how to install and configure delayed job on your computer.

Read more

How to filter stacktrace in byebug

Category: Ruby :: Published at: 12.10.2021

Sometimes simple debugging with byebug is not enough and you need to dive deeper.

If you need to get the stacktrace you can simply use command:

Read more

RSpec - How to chain .to change matcher in rubocop

Category: Ruby :: Published at: 23.09.2021

If you use rubocop and want to chain [.to change] matcher, it can be quite confusing.

Here is how you should do it correctly:

subject(:service_call) { my_service.call(car_id: id) }

let(:car) { create :car }

it "passes test" do
  expect { service_call }.to(
    change { car.brand }.to("Opel")
      .and(change { car.model }.to("Astra")
      .and(change { car.production_year }.to(1997),
  )
end


How to connect NGROK with a Rails application

Category: Ruby :: Published at: 01.07.2021

Ngrok let us to publish our local application for the world. It is very useful for example if we want to create a webhook integration.

These are simple steps to connect NGROK with your rails application:

Read more