Skip to content

Instantly share code, notes, and snippets.

View alispat's full-sized avatar
🎯
Focusing

Alisson Patrick alispat

🎯
Focusing
View GitHub Profile
@alispat
alispat / correios-api-service.rb
Created September 19, 2023 20:02
Integração nova API Correios
class CorreiosApiService
def self.get_token
token = nil
correios_token = CorreiosToken.all.first
if correios_token.nil? || correios_token.expires_at <= Time.now.utc - 30 * 60
@alispat
alispat / RAILS_CHEATSHEET.md
Created February 28, 2023 17:42 — forked from mdang/RAILS_CHEATSHEET.md
Ruby on Rails Cheatsheet

Ruby on Rails Cheatsheet

Architecture

Create a new application

Install the Rails gem if you haven't done so before

//PRA PEGAR O EMAIL E O TOKEN PRA SE AUTENTICAR NA API DO PAGSEGURO VC PRECISA IR NO PAINEL LA DO SANDBOX, NO MENU LATERAL NA ESQUERDA
// EM PERFIS DE INTEGRAÇÃO/VENDEDOR AI OS DADOS ESTAO NO INICIO DA PAGINA EM VENDEDOR DE TESTES;
//O PROCESSO DESCRITO ACIMA SÓ TE DA O EMAIL E O TOKEN DO AMBIENTE DE TESTE(SANDBOX), PRA PEGAR O EMAIL E O TOKEN DE PRODUÇÃO VOCE
//PRECISA LOGAR NA SUA CONTA DO PAGSEGURO FORA DO SANDBOX pagseguro.uol.com.br-> ACESSAR MINHA CONTA,
// NO MENU LATERAL NA ESQUERDA IR EM APLICAÇOES/MINHAS APLICAÇOES E CLICAR EM CRIAR NOVA APLICAÇÃO, AI VC PREENCHE TUDO QUE ELES PEDEM //QUE É OBRIGATORIO, DEPOIS VÁ EM PREFERENCIAS/INTEGRAÇÕES NO MENU LATERAL E EM UTILIZAÇÃO DE API CLIQUE EM GERAR UM TOKEN QUE VOCE VAI //USAR NO METODO INICIAR COM O EMAIL DA SUA CONTA DO PAGSEGURO QUE É O MESMO EMAIL USADO NO SANDBOX, EM PRODUÇÃO SO ALTERNE OS TOKENS;
//ABAIXO DOS IMPORTS
@alispat
alispat / nginx.conf
Created February 24, 2023 21:40 — forked from denji/nginx.conf
jefftk.com nginx.conf
# for debugging with valgrind
#daemon off;
#master_process off;
#user nobody;
worker_processes 1;
worker_rlimit_core 500M;
working_directory /tmp/nginx_cores/;
@alispat
alispat / .git-commit-template
Created May 4, 2021 20:10 — forked from zakkak/.git-commit-template
This commit message template that helps you write great commit messages and enforce it across your team.
# [<tag>] (If applied, this commit will...) <subject> (Max 72 char)
# |<---- Preferably using up to 50 chars --->|<------------------->|
# Example:
# [feat] Implement automated commit messages
# (Optional) Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# (Optional) Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
@alispat
alispat / mysql2-catalina.md
Created February 24, 2021 15:20 — forked from fernandoaleman/mysql2-catalina.md
Install mysql2 on MacOS Catalina

Problem

Installing mysql2 gem errors on MacOS Catalina with MySQL 5.7.

Solution

Make sure openssl is installed on Mac via Homebrew.

brew install openssl
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.x.x/dist/alpine.min.js" defer></script>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
</head>
<body>
@alispat
alispat / chromeinstall_ubu16.sh
Created April 28, 2020 02:09 — forked from LoganGray/chromeinstall_ubu16.sh
this worked to install selenium and google chrome on my Ubuntu 16 server.
#!/usr/bin/env bash
# used to install offical chrome and selenium on Ubuntu 16.04.1 LTS, 18.04 desktop, Jan 2020
# also tested and works on Elem OS 5.1 :)
cd ~
sudo apt-get update
sudo apt install python-pip
pip install simplejson
pip install bs4
pip install selenium
apt-get install libasound2 libnspr4 libnss3 libxss1 xdg-utils unzip

Nginx and Puma for Ruby on Rails

When a lot of people are working on the same Rails application, than Vagrant could help to set up environment quick and easy. Even Vagrant is not recommended for production, it is very usefull for testing deployment script. For production we can simply copy deployment script and run manually.

We can deploy Ruby on Rails app using a quick way to deploy ruby on rails on vagrant.

{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 10%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 30%)",
"@gray-light": "lighten(@gray-base, 50%)",
"@gray-lighter": "lighten(@gray-base, 90%)",
"@brand-primary": "#337ab7",
"@brand-success": "#28B62C",