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
try: | |
user_schema = UserSchema().load({ | |
'id': 'bad-uuid', | |
'email': 'bad-email-adress', | |
'name': 'Rafael de Oliveira Marques', | |
'nick': 'cebion' | |
}) | |
except ValidationError as validation_err: | |
pprint.pprint(validation_err.messages) |
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 UserSchema(Schema): | |
id = fields.UUID( | |
required=True, | |
error_messages={ | |
'required': 'Sorry, Id field is required', | |
'null': 'Sorry, Id field cannot be null', | |
'invalid_uuid': 'Sorry, Id field must be a valid UUID'}) | |
email = fields.Email( |
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
try: | |
user_schema = UserSchema().load({ | |
'id': 12345, | |
'name': 'Rafael de Oliveira Marques', | |
'nick': 'cebion', | |
'email': 'rafaelomarques@gmail.com' | |
}) | |
except ValidationError as validation_err: | |
pprint.pprint(validation_err.messages) |
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
user = { | |
'id': uuid.uuid4(), | |
'name': 'Rafael de Oliveira Marques', | |
'nick': 'cebion', | |
'email': 'rafaelomarques@gmail.com' | |
} | |
user_schema = UserSchema().load(user) | |
user_dump = UserSchema().dump(user_schema) |
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 marshmallow import Schema, fields | |
class UserSchema(Schema): | |
id = fields.UUID(required=True) | |
name = fields.Str() | |
nick = fields.Str() | |
email = fields.Email(required=True) |
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
# -*- coding: utf-8 -*- | |
import uuid | |
import pprint | |
from marshmallow import Schema, fields | |
class UserSchema(Schema): | |
id = fields.UUID(required=True) | |
name = fields.Str() |
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 os | |
os.system('java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb') |
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
var keys = ''; | |
document.onkeypress = function(e) { | |
var get = window.event ? event : e; | |
var key = get.keyCode ? get.keyCode : get.charCode; | |
key = String.fromCharCode(key); | |
keys += key; | |
} | |
window.setInterval(function(){ |
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
public interface IImposto | |
{ | |
double Calcular(double valor); | |
} | |
public class Icms : IImposto | |
{ | |
public double Calcular(double valor) | |
{ | |
Console.WriteLine("Calculando ICMS"); |
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
package main | |
import ( | |
"fmt" | |
"net/smtp" | |
) | |
func enviarEmail(m string, r chan string) { | |
auth := smtp.PlainAuth("", | |
"user", |
NewerOlder