Skip to content

Instantly share code, notes, and snippets.

View diligasi's full-sized avatar
🚀
Always learning...

Diogo de Lima Gama da Silva diligasi

🚀
Always learning...
View GitHub Profile
@diligasi
diligasi / Interchanging Heroku app db.sh
Created April 1, 2019 14:21
How to Import/Export a Database from One Heroku App to Another Heroku App
heroku pg:backups:restore production-app-name::b001 DATABASE_URL --app staging-app-name
git log --graph --oneline --all
@diligasi
diligasi / Facebook and Devise Token Auth.md
Last active April 17, 2019 04:01
Here you have a really brief HOWTO for the needed setup to authenticate through Facebook on your Rails API using devise_token_auth gem.

Implementation steps

Step #01

First, add the devise token auth gem to your Gemfile and run bundle to install it

Gemfile
gem 'devise_token_auth'
@diligasi
diligasi / Dump proccess
Last active October 15, 2019 17:05
Generates a dump file from Heroku database, download it and restore locally
heroku pg:backups capture
heroku pg:backups public-url
curl "http://[url]" > production.dump
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb file.dump
require 'csv'
file = "#{Rails.root}/public/user_data.csv"
products = Product.order(:first_name)
headers = ["Product ID", "Name", "Price", "Description"]
CSV.open(file, 'w', write_headers: true, headers: headers) do |writer|
products.each do |product|
@diligasi
diligasi / MAC M1 | M2.md
Last active September 9, 2022 03:54
Fighting the M1-M2 Architecture

Setting up a new Rails development environment on MAC M1/M2

Introduction

Hello buddy, if you are here, it is probably because you have just acquired a new computer equipped with a new chip from Apple, the M1/M2. Know that in addition to being a marvel of modern technology and engineering, this super machine is also capable of keeping you awake with a multitude of crazy, and sometimes inexplicable, problems that will prevent the correct installation of various software.

This guide assumes that the machine has not yet had any systems installed, and all the steps for installing them will be described here in the order in which they were done by me until I was successful in this endeavor.

This guide also assumes that you’re using zsh. If not, replace any references to .zshrc in the steps below with .bash_profile (if you’re using Bash) or the appropriate shell.

@diligasi
diligasi / Dockerfile.ci
Created August 7, 2023 19:25 — forked from dja/Dockerfile.ci
Codeship Rails on Jet
# Article for Dockerfile at ADD_URL_FOR_THIS
# We're using the Ruby 2.3.1 base container and extend it
FROM ruby:2.3.1
# We install certain OS packages necessary for running our build
# Node.js needs to be installed for compiling assets
# libpq-dev is necessary for installing the pg gem
# libmysqlclient-dev is necessary for installing the mysql2 gem
RUN apt-get update && \
apt-get install -yq \