Skip to content

Instantly share code, notes, and snippets.

View huogerac's full-sized avatar
:octocat:

Roger Camargo huogerac

:octocat:
View GitHub Profile
@huogerac
huogerac / test_valor_minimo.py
Created August 25, 2024 10:18
Teste valor minimo
@pytest.mark.django_db
def test_deve_fazer_novo_pedido_de_entrega(marca1, grafica, user_delivery_marca1):
# Dado um cadastro e seu estoque disponível
vinil = marca1
vinil_itaim = Unidade.objects.filter(marca=vinil).first()
sacolas = Categoria.objects.create(categoria="Sacolas")
sacola = Produto.objects.create(
nome="Sacola Delivery", categoria=sacolas, marca=vinil, fornecedor=grafica
)
@huogerac
huogerac / conftest.py
Last active July 17, 2024 00:01
testando listar pedido de estoque
import pytest
from embalae.accounts.models import User, Fornecedor, Marca, Unidade
@pytest.fixture
def marca1(db):
marca_um = Marca.objects.create(nome="Marca 1", slug="Marca1")
Unidade.objects.create(nome="Marca 1-U1", marca=marca_um)
return marca_um
@huogerac
huogerac / models.py
Created March 13, 2024 23:23
carrinho de compra no Django
from django.db import models
from django.urls import reverse
from django.contrib.auth import get_user_model
class Categoria(models.Model):
nome = models.CharField(max_length=32)
class Produto(models.Model):
@huogerac
huogerac / main.tf
Created August 18, 2023 19:18
terraform_gcp_postgres
resource "random_integer" "postgres_port" {
min = 5432
max = 5432
}
resource "google_sql_database_instance" "postgres" {
name = "${var.environment}-postgres"
database_version = var.engine_version
deletion_protection = var.deletion_protection
"""
14 <-- \o/
7
T
"""
<template>
<h1>Listar Pokemon</h1>
<ul>
<li v-for="pokemon of listaPokemon" :key="pokemon.id">
<p>
{{ pokemon.name }}
<span><button @click="obterDetalhes(pokemon)">detalhes</button></span>
</p>
<div v-if="pokemon.detalhe">
<p>{{ pokemon.detalhe.base_experience }} <img :src="pokemon.detalhe.image" alt="" /></p>
def cep_json_xml(cep, formato):
cepEntrada = cep
tipoCep =""
cepTemp =""
metodo ="buscarCep"
formato = formato.lower()
url = 'http://m.correios.com.br/movel/buscaCepConfirma.do'
post_data_dictionary = {'cepEntrada': cepEntrada, 'tipoCep': tipoCep, 'cepTemp': cepTemp, 'metodo':metodo}
"""
Celery Tasks
============
This file defines the expected API.
"""
import jsonschema
from celery import Celery, subtask, group, chord
from . import settings
@huogerac
huogerac / HomeView.vue
Created June 7, 2018 03:34
Push Notifications
<template>
<div>
<!-- componente que encapsula o PUSH NOTIFICATION -->
<push-notification
ref="pushNotification"
:currentToken="userToken"
@update-token="onUpdateToken"
@new-message="onNewMessage" />
#!/bin/bash
# This script is based on
# https://medium.com/welcome-to-the-django/guia-definitivo-para-organizar-meu-ambiente-python-a16e2479b753
PYTHON2_VERSION='2.7.12'
PYTHON3_VERSION='3.5.2'
sudo apt-get install -y git python-pip make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev
sudo pip install virtualenvwrapper