This file contains hidden or 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 { hashSync, compareSync } from 'bcrypt-nodejs'; | |
| export function generateHash(data: any) { | |
| return hashSync(data, undefined); | |
| } | |
| export function compareHash(data: any, hash: any) { | |
| return compareSync(data, hash); | |
| } |
This file contains hidden or 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
| npm i mongoose | |
| import { Schema, model, connect } from 'mongoose'; | |
| connect('mongodb://localhost:27017/monetarium', {useNewUrlParser: true, useUnifiedTopology: true}); | |
| const UserSchema = new Schema({ | |
| email: String, |
This file contains hidden or 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
| ssh gdg@qandle.us | |
| forever list - მიმდინარე forever-ით გაშვებული node პროცესი | |
| forever stopall - გათიშვა ყველა პროცესის | |
| forever restartall | |
| forever ით დასტარტვაა აპლიკაციის : | |
| export NODE_ENV=production && forever start ~/core/server/dist/server.js | |
| node-ით ლაივ რეჟიმში დასტარტვა აპლიკაციის : | |
| export NODE_ENV=production && node ~/core/server/dist/server.js |
This file contains hidden or 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
| cd server/ | |
| npm init --yes | |
| npm i express | |
| import express from 'express'; | |
| // const express = require('express'); | |
| // rest of the code remains same | |
| const app = express(); | |
| const PORT = 8000; | |
| app.get('/', (req: any, res: any) => res.send('Express + TypeScript Server')); |
This file contains hidden or 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
| input object : | |
| { | |
| itemOne:{ | |
| subItemOneOne:{}, | |
| subItemOneTwo:{ | |
| SubSubItemOneTwoOne:'ZEZEZEZEZEZEZE', | |
| SubSubItemOneTwoTwo:"kkokokokok" | |
| }, | |
| subItemOneThree:['erererer', 'ffdfdfdf'] |
This file contains hidden or 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 Youtube = (function () { | |
| 'use strict'; | |
| var video, results; | |
| var getThumb = function (url, size) { | |
| if (url === null) { | |
| return ''; | |
| } |
This file contains hidden or 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 a = moment();//now | |
| var b = moment('2020-04-30T13:28:00'); | |
| console.log('now',moment().toDate()); | |
| console.log(a.diff(b, 'milisecunds')) // 44700 | |
| console.log(a.diff(b, 'seconds')) // 44700 | |
| console.log(a.diff(b, 'minutes')) // 44700 | |
| console.log(a.diff(b, 'hours')) // 745 | |
| console.log(a.diff(b, 'days')) // 31 | |
| console.log(a.diff(b, 'weeks')) // 4 | |
| setTimeout(()=>{ //<<<--- using ()=> syntax |
This file contains hidden or 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
| return Model.aggregate([ | |
| { $lookup: {from: 'courses', localField: 'courseId', foreignField: '_id', as: 'course'} }, | |
| { $sort: { date: 1 } }, | |
| {$group : { _id: { | |
| year : { $year: '$date' }, | |
| month : { $month: '$date'}, | |
| day : { $dayOfMonth: '$date'}, | |
| // date: '$date' | |
| }, | |
| 'count' : { $sum: 1 }, |