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
// Receive an | |
const flatArray = (key,list)=>{ | |
let obj={}; | |
list.forEach((item,i)=>{ | |
obj[`${key}.${i}`]=item; | |
}); | |
return obj; |
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
let route_list = {}; | |
function print (path, layer) { | |
if (layer.route) { | |
layer.route.stack.forEach(print.bind(null, path.concat(split(layer.route.path)))) | |
} else if (layer.name === 'router' && layer.handle.stack) { | |
layer.handle.stack.forEach(print.bind(null, path.concat(split(layer.regexp)))) | |
} else if (layer.method) { | |
const pathRoute = `${layer.method.toUpperCase()} - ${path.concat(split(layer.regexp)).filter(Boolean).join('/')}`; |
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 cls = require('cls-hooked'); | |
const { v4: uuidV4 } = require('uuid'); | |
// generate a unique value for namespace | |
const name = 'settle-context'; | |
const nsId = `${name}:${uuidV4()}`; | |
const ns = cls.createNamespace(nsId); | |
const correlationIdKey = 'x-correlation-id'; |
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 { v4 as uuidv4 } from 'uuid'; | |
const register = (server, options) => { | |
server.ext({ | |
type: 'onRequest', | |
method: (request, h) => { | |
request.id = request.headers['x-request-id']||uuidv4(); | |
return h.continue; | |
} | |
}); |
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
echo "Tageando version..." | |
sh ./tag.sh | |
echo "Borrando container..." | |
docker stop challenge-api-server | |
docker rm challenge-api-server | |
echo "Borrando imagen..." | |
docker rmi challenge-api |
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
#Extract project field name package.json | |
export PACKAGE_NAME="$(cat package.json | grep name | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g')" | |
#Extract version field from package.json | |
export PACKAGE_VERSION="$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g')" | |
#Set the package tag name | |
export PACKAGE_TAG="$(echo ${PACKAGE_NAME}:${PACKAGE_VERSION} | tr -d ' ')" |
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
drop table testtb; | |
drop table test_duplicated; | |
drop table test_unique; | |
create temporary table testtb ( | |
entity varchar(10) not null, | |
duplicate varchar(10) not null | |
); | |
insert into testtb |
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
# Descargar el instalador desde aqui:https://www.microsoft.com/en-us/download/details.aspx?id=101064 bajar ".exe" | |
# Version SQL SERVER 2019 - EXPRESS | |
# Basado en esta web: https://silentinstallhq.com/microsoft-sql-server-2019-express-silent-install-how-to-guide | |
@echo off | |
echo "1) Creo directorio temporal..." | |
mkdir c:\crypton-install-tmp | |
echo "Ok" | |
echo "2) Extraigo instalador .exe..." |
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 year = { | |
num: 2019, | |
month: { | |
num: 1, | |
avgDollarValue: 90, | |
month: { | |
num: 2, | |
avgDollarValue: 105, | |
month: { | |
num: 0, |
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
// Se espera que el resultado lo muestres en un console.log | |
const arbol = { | |
num: 25, | |
izq: { | |
num: 23, | |
izq: { | |
num: 10, | |
}, | |
der: { | |
num: 80, |
NewerOlder