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
version: '3.8' | |
services: | |
postgres: | |
image: 'postgres:latest' | |
restart: always | |
volumes: | |
- './postgres_data:/var/lib/postgresql/data' | |
ports: | |
- "5432:5432" |
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
version: '3.7' | |
services: | |
mongodb_container: | |
image: mongo:latest | |
environment: | |
MONGO_INITDB_ROOT_USERNAME: root | |
MONGO_INITDB_ROOT_PASSWORD: password | |
ports: | |
- 27017:27017 | |
volumes: |
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
// CLOSURE | |
const anotherFunction = () =>{ | |
var count = 0; | |
const countFuction =(value)=>{ | |
return count += value; | |
} | |
return countFuction; | |
} | |
let test = anotherFunction(); |
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
//Ejemplos de la expreciones this en javascript | |
//(Amplia mas en:https://developer.mozilla.org/es/docs/Web/JavaScript/Referencia/Operadores/this) | |
//Variable del objecto global | |
this.nombre ='Objecto global' | |
console.log(this.nombre); | |
function inprimir (){ | |
console.log(this.nombre);//Toma el valor del objecto global |
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
// El objeto Set permite almacenar valores únicos de cualquier tipo, incluso valores primitivos u referencias a objetos. | |
let set = new Set([1,2,3,3,4,4,5]) | |
console.log(set); | |
// Metodo .add() nos ayuda agregar nuevos datos a nustros Sets | |
set.add(7); | |
set.add(6); | |
set.add(6); | |
set.add(6); | |
set.add(8); |
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
// Los valores de los tipos de datos Symbols son unicos e inmutables se suele ser utlizado como indetificadores en un objecto. | |
const id = Symbol('keys');//Asi se declara un symbol y se le pasa como parametro una descripcion para nostros(Opcional) | |
const id2 = Symbol('keys'); | |
const id3 = Symbol('keys'); | |
const SALUDAR = Symbol(); | |
const PERSON_ID = { | |
[id]: '001',// Los valores de esta propiedad son tipos symbol | |
[id2]: '002', |
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 cuadradoPromise =(value)=>{ | |
return new Promise((resolve,reject)=>{ | |
if(typeof value !== 'number') { | |
return reject(`El valor ingresado ${value} no es un numero es un ${typeof value}`) | |
} | |
setTimeout(() => { | |
resolve({ | |
value, | |
resul: value * 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
//Promise Determina el existo o el fracaso de una operacion asincrona | |
const cuadradoPromise =(value)=>{ | |
//aSSe ustliza el costructor new Promise para crear nuentras promesas | |
return new Promise((resolve,reject)=>{//Pasamamos los palametros resolve y reject | |
if(typeof value !== 'number') {//Se valida para encontrar algun tipo de error. | |
return reject(`El valor ingresado ${value} no es un numero es un ${typeof value}`) | |
//Si se encuentra el error llamamos al reject que en este caso sera el que guardara el error para manejarlo | |
} | |
setTimeout(() => { | |
resolve({//En caso de no tener error utilizamos resolve, que este guardara lo realizado para luego utilizarlo |
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 elevadosCallbacks =(value, callback)=>{ | |
setTimeout(() => { | |
callback(value, value * 2) | |
}, 0 || Math.random() * 4000); | |
} | |
elevadosCallbacks(0, (value, resul)=>{ | |
console.info('Inicio Del Callbacks'); | |
console.log(`Resultado: ${value}, ${resul}`); | |
elevadosCallbacks(1, (value, resul)=>{ | |
console.log(`Resultado: ${value}, ${resul}`); |
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
(()=>{ | |
console.info('Asingronia en javaScript'); | |
const inicio =()=> setTimeout(() => console.log('Inicio'), 5000); | |
const uno =()=> setTimeout(() => console.log('Uno'), 4000); | |
const dos =()=> setTimeout(() => console.log('Dos'), 3000); | |
const tres =()=> setTimeout(() => console.log('Tres'), 2000); | |
const fin =()=> setTimeout(() => console.log('Fin'), 1000); | |
inicio(); |
NewerOlder