Skip to content

Instantly share code, notes, and snippets.

View diegobarros0701's full-sized avatar
🎯
Focusing

Diego Barros diegobarros0701

🎯
Focusing
View GitHub Profile
@diegobarros0701
diegobarros0701 / settings.md
Last active June 17, 2020 03:24
Initial configurations for Rails RSpec

Add to the Gemfile

gem 'rspec-rails', '~> 3.9'

Run

rails generate rspec:install
@diegobarros0701
diegobarros0701 / settings.md
Last active November 5, 2019 05:02
Apache + PHP (WordPress)

Configurações Apache + PHP (WordPress) para Ubuntu

Adicionar repositório para o PHP

sudo add-apt-repository -y ppa:ondrej/php

Atualizar pacotes

sudo apt-get update && sudo apt-get upgrade
@diegobarros0701
diegobarros0701 / configuracao.md
Last active December 24, 2021 01:19
Instalar PHP + Apache + Configurações

Configurações para Ubuntu

Atualizar pacotes

sudo apt-get update && sudo apt-get upgrade

Instalar Apache

sudo apt install apache2
@diegobarros0701
diegobarros0701 / instructions.md
Last active September 4, 2019 23:58
Disable Docker's iptables and use UFW

Disable Docker's iptables

CentOS 7

sudo mkdir /etc/systemd/system/docker.service.d
sudo nano /etc/systemd/system/docker.service.d/iptables-disabled.conf

Put this config on it

FROM ruby:2.5
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
RUN mkdir /app
WORKDIR /app
COPY Gemfile /app/Gemfile
COPY Gemfile.lock /app/Gemfile.lock
@diegobarros0701
diegobarros0701 / Dockerfile
Last active June 18, 2019 01:14
docker-compose and Dockerfile for RoR environment
FROM ruby:2.6
RUN apt-get update -qq && apt-get install -y nodejs
RUN mkdir /app
WORKDIR /app
COPY Gemfile /app/Gemfile
COPY Gemfile.lock /app/Gemfile.lock
@diegobarros0701
diegobarros0701 / management.rb
Created May 16, 2018 00:30
Session management rails
class ApplicationController < ActionController::Base
before_action :validate_session
def validate_session
if session[:user].nil?
redirect_to new_session_path if controller_name != 'sessions'
else
redirect_to home_index_path if controller_name == 'sessions' && action_name != 'destroy'
end
end
https://www.codecademy.com/pt-BR/articles/deploy-rails-to-heroku
@diegobarros0701
diegobarros0701 / ror-nginx-unicorn.md
Created November 5, 2017 00:40
RoR with Nginx and Unicorn

Nginx configuration

Add the following code in nginx.conf, inside http block

upstream rails {
  # Path to Unicorn socket file
  server unix:/home/username/project_name/shared/sockets/uni$
}