Skip to content

Instantly share code, notes, and snippets.

View guilhermecarvalhocarneiro's full-sized avatar

Guilherme de Carvalho Carneiro guilhermecarvalhocarneiro

  • Palmas, Tocantins, Brasil
View GitHub Profile
"""
Middleware for logging requests and responses
"""
import json
import time
import uuid
from collections.abc import Callable
from fastapi import Request, Response
from rich.console import Console
@guilhermecarvalhocarneiro
guilhermecarvalhocarneiro / DockerfileDev
Created August 3, 2022 22:48
DockerFile para ambiente de desenvolvimento
# For more information, please refer to https://aka.ms/vscode-docker-python
FROM python:3.9
EXPOSE 8000
ENV SECRET_KEY=!u^8mqq_pm%jttx@-w+%q9bk9%iij3hw2(+$w13i*ptn#3lm+=
ENV DB_ENGINE=django.db.backends.postgresql_psycopg2
ENV DB_NAME=iteea_db
ENV DB_USER=postgres
ENV DB_PASSWORD=123
@guilhermecarvalhocarneiro
guilhermecarvalhocarneiro / docker-dev.yml
Created August 3, 2022 22:47
Arquivo docker para ambiente de desenvolvimento
version: '3.4'
services:
database:
image: postgres:14.3
restart: always
volumes:
- iteea-db:/var/lib/postgresql/data
environment:
- LC_ALL=C.UTF-8
<script setup lang="ts">
import { onMounted, Ref, ref } from "vue";
const nome = ref("");
const sobrenome: Ref<string> = ref("carvalho carneiro");
const idade = ref(25);
const props = defineProps<{
foo: string;
bar?: number;
@guilhermecarvalhocarneiro
guilhermecarvalhocarneiro / build.py
Created February 15, 2022 22:08
Código para automatizar a geração das urls, forms, templates, views e de um projeto DRF.
"""Esse manager é responsável por gerar os arquivos padrões de um projeto Django (templates, urls, views, forms)
baseado nas informações contidas na classe da App do projeto Django.
"""
import fileinput
import os
from pathlib import Path
from bs4 import BeautifulSoup
from core.management.commands.utils import Utils
import 'package:flutter/cupertino.dart';
/// [Travar o arquivo]
/// Caso deseje \"travar\" o arquivo para não ser parseado novamente
/// pelo manage do Django adicione um # antes da palavra abaixo
/// #FileLocked
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
def test_orgao_list_queryset(self, init, client):
username = "user1"
password = "bar"
user = User.objects.create_user(username=username, password=password)
# Use this:
client.force_login(user)
# Or this:
client.login(username=username, password=password)
request = self.factory.get(reverse('orgao:orgao-list'))
request.user = user
Widget _buildPDFGrid(List<LaudoExameModel> pdf) {
return ListView.builder(
shrinkWrap: true,
// physics: NeverScrollableScrollPhysics(),
primary: false,
itemCount: pdf.length,
itemBuilder: (BuildContext context, int index) {
final _pdf = pdf[index];
return Container(
height: 160,
Widget _buildImagesGrid(List<LaudoExameModel> imagens) {
return GridView.count(
crossAxisCount: 2,
shrinkWrap: true,
crossAxisSpacing: 2.0,
// mainAxisSpacing: 4.0,
children: List.generate(imagens.length, (index) {
final imagemResultado = imagens[index];
return Card(
color: Colors.white,
return SingleChildScrollView(
child: Container(
margin: const EdgeInsets.only(top: 115, bottom: 15),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Imagens"),
_buildImagesGrid(laudosImagensExameList),
Text("PDF's"),