This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VendasAdmin(admin.ModelAdmin): | |
list_display = ('valor_total', 'outros', 'campos') | |
def valor_total(self, obj): | |
return '%.2f' % obj.balance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
from datetime import datetime | |
from motor.motor_asyncio import AsyncIOMotorClient | |
from umongo import Instance, Document, fields, validate | |
db = AsyncIOMotorClient().test | |
instance = Instance(db) | |
@instance.register | |
class User(Document): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from alguma_coisa_do_django import models | |
TRANSACTION_KIND = ( | |
("in", "Entrada"), | |
("out", "Saida"), | |
("eaj", "Entrada de Ajuste"), | |
("saj", "Saída de Ajuste") | |
) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import functools | |
from http_module import HTTPClient() | |
def _do_upload_something(client, something_headers, something_body): | |
client.post("my_url", something_body, headers=something_headers) | |
client = HTTPClient() | |
upload_something = functools.partial(_do_upload_something, client) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express') | |
const app = express() | |
const port = 3000 | |
app.get('/somar', (request, response) => { | |
console.log(request.query) | |
let resultado = 0 | |
if(request.query && request.query.num1 && request.query.num2) { | |
resultado = parseInt(request.query.num1) + parseInt(request.query.num2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs") | |
function readdirPromise(path) { | |
return new Promise((resolve, reject) => { | |
fs.readdir(path, (err, files) => { | |
if(err){ | |
reject(err) | |
}else{ | |
resolve(files) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs =require("fs") | |
function readdirPromise(path) { | |
return new Promise((resolve, reject) => { | |
fs.readdir(path, (err, files) => { | |
if(err){ | |
reject(err) | |
}else{ | |
resolve(files) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs =require("fs") | |
function readdirPromise(path) { | |
return new Promise((resolve, reject) => { | |
fs.readdir(path, (err, files) => { | |
if(err){ | |
reject(err) | |
}else{ | |
resolve(files) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const produtos = [ | |
{ | |
id: 1, | |
preco: 10.0, | |
qtd: 2 | |
}, | |
{ | |
id: 2, | |
preco: 10.0, | |
qtd: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const produtos = [ | |
{ | |
nome: 'Bicicleta', | |
preco: 1200.0 | |
}, | |
{ | |
nome: 'Capacete', | |
preco: 450.0 | |
} | |
] |