Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Esther Olatunde esteedqueen

🎯
Focusing
Block or report user

Report or block esteedqueen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@esteedqueen
esteedqueen / address_in_use_error.md
Created Jul 31, 2018
How to handle address already in use error
View address_in_use_error.md

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 Jul 5, 2018
Access Rails console in a docker container
View rails_console_docker.md

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

docker-compose run web rails console
@esteedqueen
esteedqueen / fix_rbenv.md
Last active May 31, 2018
How to fix rbenv: version `x.x.x` is not installed
View fix_rbenv.md

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 Aug 31, 2018
TIL - dumping production PG database into development PG database
View dumping_pg_data.md

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 Sep 1, 2018
The curious case of frozen/hanging terminal when you run a`rails g migration` command
View rails_g_migration.md

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 Aug 12, 2017
TIL - Logging the page content in capybara
View print_page_capybara.md

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 Sep 21, 2017
TIL - introducing jq
View jq.md

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
How I fixed `check_version_conflict` error in rails multiple versions
View check_version_conflict.md

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
Managing keys for pushing to multiple heroku accounts
View multiple_heroku_accounts.md

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 xxx@gmail.com 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 Aug 31, 2018
Puma gem install w/ ruby 2.0.0, rails 3.2 on MacOS 10.12
View puma.md

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
You can’t perform that action at this time.