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
// Importamos paquete | |
const bcrypt = require("bcryptjs"); | |
// Primero vamos a hashear la contrase帽a | |
const palabraSecretaTextoPlano = "hunter2"; | |
// Entre m谩s rondas, mejor protecci贸n, pero m谩s consumo de recursos. 10 est谩 bien | |
const rondasDeSal = 10; | |
const palabraSecretaEncriptada = await bcrypt.hash(palabraSecretaTextoPlano, rondasDeSal); | |
console.log("Y hasheada es: " + palabraSecretaEncriptada); |
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 Equipo = require("./modelo_equipo"); |
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
// Definimos nuestro modelo | |
class Equipo extends Model { | |
} |
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
await TuModelo.update({ | |
campo: "nuevo_valor", | |
otro_campo: "otro_valor", | |
// ... | |
}, { | |
where: { | |
campo: "determinada_condici贸n", | |
otro_campo: "otra_condici贸n (ser铆a como usar and)", | |
} | |
}); |
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
await modeloEquipo.update({ | |
trabajadoreId: peticion.body.idTrabajador, | |
}, { | |
where: { | |
id: idEquipo, | |
} | |
}); |
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
/* | |
____ _____ _ _ _ | |
| _ \ | __ \ (_) | | | | |
| |_) |_ _ | |__) |_ _ _ __ _____| |__ _ _| |_ ___ | |
| _ <| | | | | ___/ _` | '__|_ / | '_ \| | | | __/ _ \ | |
| |_) | |_| | | | | (_| | | / /| | |_) | |_| | || __/ | |
|____/ \__, | |_| \__,_|_| /___|_|_.__/ \__, |\__\___| | |
__/ | __/ | | |
|___/ |___/ | |
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
float calcularVoltaje(float corriente, float resistencia) | |
{ | |
return corriente * resistencia; | |
} | |
float calcularResistencia(float corriente, float voltaje) | |
{ | |
return voltaje / corriente; | |
} |
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
/* | |
____ _____ _ _ _ | |
| _ \ | __ \ (_) | | | | |
| |_) |_ _ | |__) |_ _ _ __ _____| |__ _ _| |_ ___ | |
| _ <| | | | | ___/ _` | '__|_ / | '_ \| | | | __/ _ \ | |
| |_) | |_| | | | | (_| | | / /| | |_) | |_| | || __/ | |
|____/ \__, | |_| \__,_|_| /___|_|_.__/ \__, |\__\___| | |
__/ | __/ | | |
|___/ |___/ | |
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
int esFlotanteValido(char *cadena) { | |
int longitud = strlen(cadena); | |
// Quitar espacios, saltos de l铆nea, etc茅tera | |
while (longitud > 0 && isspace(cadena[longitud - 1])) | |
longitud--; | |
if (longitud <= 0) return 0; | |
int i; | |
int haEncontradoElPunto = 0; | |
for (i = 0; i < longitud; ++i) { | |
// En caso de que sea un gui贸n, y que no est茅 al inicio, no es v谩lido |
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
int esEnteroValido(char cadena[LONGITUD_CADENA]) { | |
int longitud = strlen(cadena); | |
// Quitar espacios, saltos de l铆nea, etc茅tera | |
while (longitud > 0 && isspace(cadena[longitud - 1])) | |
longitud--; | |
if (longitud <= 0) return 0; | |
int i; | |
for (i = 0; i < longitud; ++i) { | |
// En caso de que sea un gui贸n, y que no est茅 al inicio, no es v谩lido | |
if (cadena[i] == '-' && i > 0) { |