Skip to content

Instantly share code, notes, and snippets.

View esteedqueen's full-sized avatar
😼

Esther Olatunde esteedqueen

😼
View GitHub Profile
@esteedqueen
esteedqueen / address_in_use_error.md
Created July 31, 2018 00:53
How to handle address already in use error

You attempted to start up a server, only to be confronted with the following error:

Address already in use - bind(2) for "0.0.0.0" port 3000 (Errno::EADDRINUSE)

What do you do?

  1. Figure out what service is using that address port.
@esteedqueen
esteedqueen / rails_console_docker.md
Last active July 5, 2018 13:54
Access Rails console in a docker container

To access the rails console in a docker container, run:

docker-compose run web rails console
@esteedqueen
esteedqueen / fix_rbenv.md
Last active October 29, 2024 02:55
How to fix rbenv: version `x.x.x` is not installed

So, you just cloned an existing project's repo and you run bundle install but you got the error: rbenv: version x.x.x is not installed....

What the issue means? The project uses a specific ruby version that you do not have on your system.

Here's how to fix it:

  • Install the Ruby build for the specified version using:
rbenv install x.x.x
@esteedqueen
esteedqueen / dumping_pg_data.md
Last active August 31, 2018 18:48
TIL - dumping production PG database into development PG database

Step 1 - Create a Backup and Download it

heroku pg:backups:capture
heroku pg:backups:download

Step 2 - Using pg_restore command

pg_restore --verbose --clean --no-acl --no-owner -h localhost -U username -d development_dbname ~/Downloads/blah1234blah789

@esteedqueen
esteedqueen / rails_g_migration.md
Last active September 7, 2023 04:36
The curious case of frozen/hanging terminal when you run a`rails g migration` command

Ref: https://stackoverflow.com/questions/24622568/rails-generate-model-hangs

So, I ran into a mysterious situation where running a rails g migration ... command on my terminal freezes/hangs for a really long time.

Running ps aux | grep spring gave me a clue into what was going on.

I got the following:

esther 4201 0.0 0.0 2480224 2692 ?? S 6Sep17 0:00.82 spring server | panacea | started 191 hours ago
@esteedqueen
esteedqueen / print_page_capybara.md
Created August 12, 2017 23:04
TIL - Logging the page content in capybara

This is useful for when debugging your tests.

Option 1:

puts page.body

Option 2:

save_and_open_page
@esteedqueen
esteedqueen / jq.md
Last active September 21, 2017 16:36
TIL - introducing jq

Today I learnt about jq - "a lightweight and flexible command-line JSON processor".

One of the use cases is pretty-printing JSON response on the terminal.

It essentially makes JSON data more readable on your terminal. If you work with a lot of JSON data on your terminal, you need to install jq.

Before jq:

$ curl localhost:3001/api/food?q=hash+browns
@esteedqueen
esteedqueen / check_version_conflict.md
Created May 21, 2017 07:46
How I fixed `check_version_conflict` error in rails multiple versions

I have multiple verstions of rails and ruby gems on my machine and I ran into the error below when I tried to run any rails command such as rails -v, rails new new_app, etc.

.../ruby/2.3.0/rubygems/specification.rb:2274:in `check_version_conflict': can't activate activesupport-5.1.0, already activated activesupport-5.0.1 (Gem::LoadError)

Here's how I fixed it.

The version conflict points to ActiveSupport so I ran the command below to check the different versions of activesupport on my machine:

@esteedqueen
esteedqueen / multiple_heroku_accounts.md
Last active May 16, 2017 09:06
Managing keys for pushing to multiple heroku accounts

I had a challenge with pushing to another heroku account from my command line...

These are the steps I took to fix the error (redacted) below:

 !  Your account [email protected] does not have access to xx-heroku-app.
 !
 !  SSH Key Fingerprint: xx:xx:xx...

fatal: Could not read from remote repository.
@esteedqueen
esteedqueen / puma.md
Last active August 31, 2018 18:16
Puma gem install w/ ruby 2.0.0, rails 3.2 on MacOS 10.12

If you're installing puma version below 3.7 or 3.8, because puma requires openssl, you'll get the following error when you attempt to install the puma gem either directly or from a Gemfile:

Building native extensions.  This could take a while...
ERROR:  Error installing puma:
	ERROR: Failed to build gem native extension.

    current directory: /Users/esther/.rbenv/versions/2.3.0/gemsets/contagious/gems/puma-2.6.0/ext/puma_http11
/Users/esther/.rbenv/versions/2.3.0/bin/ruby -r ./siteconf20170830-2950-8i5exi.rb extconf.rb
creating Makefile