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 MongoClient = require('mongodb').MongoClient | |
const url = `mongodb://root:mo1542653!@localhost:27017/?authMechanism=SCRAM-SHA-1&authSource=admin` | |
var _connInstance | |
const getInstance = async () => { | |
if (!_connInstance) { | |
_connInstance = await getConnection() | |
} | |
return _connInstance |
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
export const currency = (value, decimalPlaces = 2, symbol = true) => { | |
let formatedValue = parseFloat(value).toFixed(decimalPlaces) | |
.replace('.', ',') | |
.replace(/\d(?=(\d{3})+,)/g, '$&.') | |
return (symbol) ? `R$ ${formatedValue}` : formatedValue | |
} |
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 { DateTime } = require('luxon') | |
function eachDays(d1, d2, response = 'DateTime') { | |
let parse = (date) => { | |
switch(date.constructor) { | |
case Date: | |
return DateTime.fromJSDate(date).startOf('day') | |
case String: | |
return DateTime.fromSQL(date).startOf('day') |
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
function toMoney(value) { | |
value += ''; | |
x = value.split('.'); | |
x1 = x[0]; | |
x2 = ''; | |
if (x.length > 1 ) { | |
if (x[1].length < 2) { | |
x[1] = x[1]+'0'; | |
} else { |
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 ms = require('ms'); | |
const c = require('colors'); | |
class Debugger { | |
debug(description) { | |
let prevTime = this.prevTime; | |
let curr = +new Date(); | |
let milliseconds = curr - (prevTime || curr); |
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
{ | |
"apps": [ | |
{ | |
"name": "server", | |
"script": "/app/node-server/server.js", | |
"exec_mode" : "cluster", | |
"instances" : 3, | |
"watch": ["./"], | |
"ignore_watch": ["node_modules", "./websocket.js", ".git"] | |
}, |
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 node:carbon | |
RUN groupadd -r docker && usermod -aG docker node | |
RUN chown -R node:docker /usr/local/lib/node_modules | |
RUN chown -R node:docker /usr/local/bin | |
RUN npm install --quiet -g pm2 | |
WORKDIR /ai/esta |
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
[[runners]] | |
name = "rdponline-docker" | |
url = "https://gitlab.com/" | |
token = "152d782cda979eff7b7f30ee4ce67d" | |
executor = "docker" | |
builds_dir = "/apptest/builds" | |
[runners.docker] | |
tls_verify = false | |
image = "node:carbon" | |
privileged = false |
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 callbackFunc = (name, callback) => { | |
setTimeout(() => { | |
return callback(name + '123'); | |
}, 3000); | |
} | |
const qCallbackFunc = (name) => { | |
return new Promise((resolve, reject) => { | |
callbackFunc(name, (result) => { | |
console.log(result); |
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
deb http://ubuntu.c3sl.ufpr.br/ubuntu/ xenial main restricted | |
deb http://ubuntu.c3sl.ufpr.br/ubuntu/ xenial universe | |
deb-src http://ubuntu.c3sl.ufpr.br/ubuntu/ xenial universe | |
deb http://ubuntu.c3sl.ufpr.br/ubuntu/ xenial-updates universe | |
deb-src http://ubuntu.c3sl.ufpr.br/ubuntu/ xenial-updates universe | |
deb http://ubuntu.c3sl.ufpr.br/ubuntu/ xenial multiverse | |
deb http://ubuntu.c3sl.ufpr.br/ubuntu/ xenial-updates multiverse | |
deb http://ubuntu.c3sl.ufpr.br/ubuntu/ xenial-backports main restricted universe multiverse | |
deb http://ubuntu.c3sl.ufpr.br/ubuntu/ xenial-security main restricted | |
deb http://ubuntu.c3sl.ufpr.br/ubuntu/ xenial-security universe |
NewerOlder