Skip to content

Instantly share code, notes, and snippets.

View filipechagas's full-sized avatar
🏖️
OOO

Filipe Chagas filipechagas

🏖️
OOO
View GitHub Profile
brew install postgresql
# OR
brew brew install postgresql@9.6
brew link postgresql@9.6 --force
brew services start postgresql@9.6
initdb /usr/local/var/postgres -E utf8

Multiple MySQL Versions for Development

Options included below:

  • Using Docker docker-compose
  • Using Homebrew brew

Using Docker (recommended)

This gist was originally created for Homebrew before the rise of Docker, yet it may be best to avoid installing mysql via brew any longer. Instead consider adding a barebones docker-compose.yml for each project and run docker-compose up to start each project's mysql service.

@filipechagas
filipechagas / docker-no-restart.sh
Created March 15, 2019 12:53
Prevent docker from restarting
docker update --restart=no [container-id]
@filipechagas
filipechagas / rails_bootstrap_delete_confirmation_modal.md
Created March 1, 2018 20:43 — forked from wicliff/rails_bootstrap_delete_confirmation_modal.md
A nice delete confirmation modal in Rails courtesy of Bootstrap. Now remote.

Here's what you get.

Some CoffeeScript (verbosely commented for clarity)

# Override Rails handling of confirmation

$.rails.allowAction = (element) ->
  # The message is something like "Are you sure?"
  message = element.data('confirm')
@filipechagas
filipechagas / spec_helper.rb
Created June 14, 2017 12:08
Saving failing tests in a file to run them later
# spec_helper.rb
RSpec.configure do |config|
config.example_status_persistence_file_path = "examples.txt"
end
# when running the tests it's gonna write the failing tests in the examples.txt file
# then you can run the tests again this way
# rspec spec --only-failures
@filipechagas
filipechagas / keybase.md
Created March 20, 2017 12:50
Keybase Verification

Keybase proof

I hereby claim:

  • I am filipechagas on github.
  • I am filipechagas (https://keybase.io/filipechagas) on keybase.
  • I have a public key ASBraGx6E97N8ENZMg05Mn2dQcmZEpPff3E1OaVQKEIQJAo

To claim this, I am signing this object:

@filipechagas
filipechagas / remove-merged-branches.sh
Created October 18, 2016 13:54
Remove all local branches that were already merged
git branch --merged | egrep -v "(^\*|master)" | xargs git branch -d
@filipechagas
filipechagas / block-search-nginx.conf
Created May 27, 2016 15:08
Block Search Engine Index from Nginx
add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
@filipechagas
filipechagas / remove-refind.sh
Created May 26, 2016 23:18
Removing REFIND from Mac
# Start on recovery mode
# Go on terminal
$ mount -t msdos /dev/disk0s1 /Volumes/ESP.
$ rm -rf /Volumes/ESP/efi/refind
# from http://www.rodsbooks.com/refind/installing.html#uninstalling
@filipechagas
filipechagas / bad.rb
Created February 19, 2016 14:01
Cyclomatic Complexity - Guard clause overused
def compute_thing(thing)
if thing[:foo]
update_with_bar(thing)
if thing[:foo][:bar]
partial_compute(thing)
else
re_compute(thing)
end
end
end