Skip to content

Instantly share code, notes, and snippets.

View rg3915's full-sized avatar
🏠
Working from home

Regis Santos rg3915

🏠
Working from home
View GitHub Profile
@rg3915
rg3915 / README.md
Last active April 19, 2024 01:24
Guia básico de conceitos sobre Django - conceitos django - backend vs frontend

Objetivo

Login com CPF e senha

authenticate

Falta login

django-cpf-cnpj

@rg3915
rg3915 / README.md
Created April 14, 2024 03:08
Digital Ocean Storage
@rg3915
rg3915 / index.html
Created April 6, 2024 19:16
Mask mascara VanillaMasker mask JS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<link rel="shortcut icon" href="http://html5-training-in-hyderabad.blogspot.com.br/favicon.ico">
<title>Mask</title>
@rg3915
rg3915 / README.md
Created March 28, 2024 18:50
git branch delete
@rg3915
rg3915 / example.py
Created February 22, 2024 00:23
timezone
from datetime import timezone, timedelta
tz = timezone(timedelta(hours=-3))
datetime.now(tz)
datetime.now(tz).isoformat()
@rg3915
rg3915 / views.py
Created February 21, 2024 01:59
Cria e Edita PessoaFisica e PessoaJuridica com OneToOne com Cliente e usando o mesmo formulário
class ClienteCreateView(CreateView):
model = Cliente
template_name = 'clientes/cliente_form.html'
form_class = ClienteForm
success_url = reverse_lazy('listar_clientes')
def form_valid(self, form):
"""
If the form is valid, save the associated model.
https://ccbv.co.uk/projects/Django/5.0/django.views.generic.edit/CreateView/#form_valid
@rg3915
rg3915 / README.md
Last active February 18, 2024 19:04
Create folders files with Python in command line

Create folders, subfolders and file in command line with Python and Shell Script.

Install

sudo cp create_folders_files.py /usr/bin/
sudo cp mkf.sh /usr/bin/mkf
sudo chmod +x /usr/bin/mkf
@rg3915
rg3915 / api.py
Last active February 16, 2024 19:42
Retorna Estado choices Django Ninja API
from ninja import Router, Schema
router = Router()
STATE_CHOICES = (
('AC', 'Acre'),
('AL', 'Alagoas'),
('AP', 'Amapá'),
('AM', 'Amazonas'),
('BA', 'Bahia'),
@rg3915
rg3915 / create_folder_files.sh
Created February 3, 2024 21:33
Create one folder and files inner this folder with Shell script. Create folder and files with Shell script.
#!/bin/bash
: << 'COMMENT'
Create one folder and files inner this folder.
Example
$ source teste.sh "folder1/{file1.txt,file2.txt}" "folder2/{file3.txt,file4.txt}"
COMMENT
@rg3915
rg3915 / README.md
Created January 26, 2024 13:50
commit

Escrever mensagens de commit claras e informativas é uma prática crucial para manter um histórico de código legível e compreensível. Aqui estão alguns exemplos de mensagens de commit para diferentes tipos de alterações em um projeto Python:

Exemplos de Mensagens de Commit:

  1. Feature: Adição de funcionalidade para calcular a média de uma lista:

    Adiciona função calculate_media() para calcular a média de uma lista de números
    
  2. Bugfix: Correção do erro ao tentar calcular média de lista vazia: