This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen [::]:80; | |
listen 80; | |
server_name jevel.com.br; | |
access_log /var/log/nginx/jevel-flats-access.log; | |
error_log /var/log/nginx/jevel-flats-error.log; | |
location / { | |
gzip on; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ruby:2.6.3 | |
ENV DEBIAN_FRONTEND=noninteractive \ | |
NODE_VERSION=8.9.1 \ | |
TIMEZONE=America/Sao_Paulo \ | |
CODENAME=stretch \ | |
DISPLAY=:0 \ | |
LANG=en_US.UTF-8 \ | |
LANGUAGE=en_US:en \ | |
LC_ALL=en_US.UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[core] | |
... | |
sshCommand = /usr/bin/ssh -i /home/your_user/.ssh/your_file | |
[user] | |
name = Your User | |
email = your@email.com.br | |
... | |
OR | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default: &default | |
adapter: postgresql | |
encoding: utf8 | |
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> | |
host: <%= ENV.fetch('DB_HOST', '127.0.0.1') %> | |
username: <%= ENV.fetch('DB_USER', 'postgres') %> | |
password: <%= ENV['DB_PASSWORD'] %> | |
development: | |
<<: *default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/model/ad_image.rb | |
class AdImage < ApplicationRecord | |
belongs_to :ad | |
# Com o store: 'ad_images_store' estou usando meu backend que criei no initializer para store | |
# Com o cash: 'ad_images_cache' estou usando meu backend que criei no initializer para cache | |
attachment :image, store: 'ad_images_store', cache: 'ad_images_cache', type: :ad_images | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Env var | |
export DISPLAY=:0 | |
# Dependências | |
apt-get install xvfb chromedrive | |
# Configuração do Driver | |
options = { | |
desired_capabilities: { | |
chromeOptions: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
def add_xml(xml) | |
xml.send(:level, 'last') | |
end | |
builder = Nokogiri::XML::Builder.new do |xml| | |
xml.send(:level_1) do | |
xml.send(:level_2) do | |
add_xml(xml) if 1 == 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snippet> | |
<content><![CDATA[ | |
class ${1:model_pluralize}Controller < ApplicationController | |
before_action :set_${2:model_downcase}, only: [ :show, :edit, :update ] | |
def index | |
@${3:model_downcase_pluralize} = ${2:model_downcase}_base.page(params[:p]) | |
end | |
def new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UsersController < ApplicationController | |
before_filter :set_user | |
def edit | |
end | |
def update | |
if @user.update_attributes(user_params) | |
redirect_to root_path, notice: t('devise.registrations.updated') | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#encoding: utf-8 | |
require 'spec_helper' | |
describe "login com facebook" do | |
before do | |
request.env["devise.mapping"] = Devise.mappings[:user] | |
request.env["omniauth.auth"] = OmniAuth.config.mock_auth[:facebook] | |
end | |
it "sets a session variable to the OmniAuth auth hash" do |
NewerOlder