Skip to content

Instantly share code, notes, and snippets.

View leonardocintra's full-sized avatar
🎯
Focusing

Leonardo Nascimento Cintra leonardocintra

🎯
Focusing
View GitHub Profile
@leonardocintra
leonardocintra / settings.json
Last active March 14, 2024 20:15
Visual Studio - Settings
{
"window.zoomLevel": 0.2,
"workbench.colorTheme": "Min Dark",
"workbench.iconTheme": "symbols",
"symbols.hidesExplorerArrows": false,
"editor.guides.bracketPairs": "active",
"editor.fontFamily": "JetBrains Mono",
"editor.fontSize": 13,
"editor.lineHeight": 1.7,
"editor.rulers": [
@leonardocintra
leonardocintra / views.py
Created August 17, 2017 09:52
CreateView para Laudo
# Atencao, esse codigo não esta completo! Ainda precisa de uma refatorada boa.
# Estou usando aqui apenas para mostrar um exemplo
class LaudoCreate(LoginRequiredMixin, FormView):
model = Laudo
template_name = 'laudo/laudo_form.html'
form_class = LaudoForm
def get_initial(self):
@leonardocintra
leonardocintra / searcheasy.sql
Created July 18, 2017 18:03
Pesquisa object, tabela, procedure facilmente no Microsfot SQL Server
use seubanco
--use seuOutroBanco
--use seuBancoOutro
go
DECLARE @Search varchar(255)
SET @Search='trecho que deseja procurar'
SELECT DISTINCT
@leonardocintra
leonardocintra / convertUTCtoLocalTime.asp
Created July 12, 2017 13:09
Converter UTC to GMT3 (ou local time)
Function ConvertUTCToLocalTime(sTime)
'Fonte: https://anandthearchitect.com/2006/11/08/convert-utc-to-local-time-and-vice-versa-using-vbscript/'
Dim od, ad, oShell, atb, offsetMin
Dim sHour, sMinute, sMonth, sDay
Dim ResultDate
'Convert the UTC time 2006-11-07T18:00:000Z to
'a normal date format 11/07/2006 10:00:00
'Note the converted date would be 24 hr format
@leonardocintra
leonardocintra / admin.py
Created March 14, 2017 15:27
Cadastro da Imagem do Produto junto com o cadastro do Produto
from django.contrib import admin
from .models import Product, ProductImage
class ProductImageInline(admin.TabularInline):
model = ProductImage
extra = 5
class ProductAdmin(admin.ModelAdmin):
list_display = ['name', 'slug', 'category', 'created', 'modified']
search_fields = ['name', 'slug', 'category__name']
@leonardocintra
leonardocintra / models.py
Last active March 14, 2017 15:32
Model Product and Imagens
from django.db import models
from django.db.models import permalink
from django.core.urlresolvers import reverse
from cloudinary.models import CloudinaryField
class Product(models.Model):
name = models.CharField('Nome', max_length=100)
slug = models.SlugField('Identificador', max_length=100, help_text='identificador baseado no titulo', unique=True)
description = models.TextField('Descrição', blank=True)