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
| version: '3.5' | |
| services: | |
| mysql: | |
| container_name: mysql_db | |
| image: mysql:5.7 | |
| volumes: | |
| - ~/datadir/mysql:/var/lib/mysql | |
| ports: | |
| - 3306:3306 | |
| - 33060:33060 |
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
| FROM node:carbon | |
| # Create app directory | |
| WORKDIR /usr/src/app | |
| # Bundle app source | |
| COPY . /usr/src/app/ | |
| # npm install | |
| RUN apt-get update && apt-get install && npm install |
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
| { | |
| // Use IntelliSense to learn about possible Node.js debug attributes. | |
| "version": "0.2.0", | |
| "configurations": [ | |
| { | |
| "type": "node", | |
| "request": "attach", | |
| "name": "Node: Nodemon", | |
| "restart": true, | |
| "protocol": "inspector", |
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
| { | |
| // Use IntelliSense to learn about possible Node.js debug attributes. | |
| "version": "0.2.0", | |
| "configurations": [ | |
| { | |
| "type": "node", | |
| "request": "launch", | |
| "name": "Launch Program", | |
| "runtimeExecutable":"node --inspect", |
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
| fs.readdir(source, function (err, files) { | |
| if (err) { | |
| console.log('Error finding files: ' + err) | |
| } else { | |
| files.forEach(function (filename, fileIndex) { | |
| console.log(filename) | |
| gm(source + filename).size(function (err, values) { | |
| if (err) { | |
| }.bind(this)) | |
| } |
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
| const {promisify} = require('util'); | |
| const fs = require('fs'); | |
| const readFileAsync = promisify(fs.readFile); | |
| readFileAsync(filePath, {encoding: 'utf8'}) | |
| .then((text) => { | |
| console.log('CONTENT:', text); | |
| }) | |
| .catch((err) => { | |
| console.log('ERROR:', err); | |
| }); |
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 request = require("request"); | |
| var userDetails; | |
| function initialize() { | |
| return new Promise(function(resolve, reject) { | |
| // Do async job | |
| request.get("https://api.github.com/users/tkssharma", function(err,resp,body) { | |
| if (err) { | |
| reject(err); | |
| } else { | |
| resolve(JSON.parse(body)); |
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
| function switchFunction(num: number) { | |
| let b: string = "functionb"; | |
| switch (num) { | |
| case 1: { | |
| let b: string = "case 1"; | |
| break; | |
| } // After break | |
| case 2: | |
| { |
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
| function switchFunction(num: number) { | |
| let b: string = "functionb"; | |
| switch (num) { | |
| case 1: { | |
| let b: string = "case 1"; | |
| break; | |
| } // After break | |
| case 2: | |
| { |
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
| const arr: number[] = [1, 2, 3]; | |
| arr.push(4); | |
| const myObj: { x: number } = { x: 1 }; | |
| myObj.x = 2; | |
| let n2: string | undefined = Math.random() > 0.5 ? undefined : "test"; | |
| // console.log(n2.substring(0, 1)); // Won't compile since can be null | |
| if (n2 !== null) { |