Skip to content

Instantly share code, notes, and snippets.

View esteedqueen's full-sized avatar
😼

Esther Olatunde esteedqueen

😼
View GitHub Profile
@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
@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 / authenticable.rb
Last active December 7, 2022 08:52 — forked from Bomadeno/registrations_controller.rb
JSON API User Registration and Sessions with Devise
module Authenticable
# Devise methods overwrite
def current_user
@current_user ||= User.find_by(authentication_token: request.headers['Authorization'])
end
def authenticate_with_token!
render json: { errors: "Not authenticated" },
status: :unauthorized unless user_signed_in?
@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 / fix_rbenv.md
Last active April 14, 2024 00:15
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