Skip to content

Instantly share code, notes, and snippets.

View tkssharma's full-sized avatar
🎯
only JS

codewithtkssharma tkssharma

🎯
only JS
View GitHub Profile
version: '3.5'
services:
mysql:
container_name: mysql_db
image: mysql:5.7
volumes:
- ~/datadir/mysql:/var/lib/mysql
ports:
- 3306:3306
- 33060:33060
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
{
// 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",
{
// 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",
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))
}
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);
});
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));
function switchFunction(num: number) {
let b: string = "functionb";
switch (num) {
case 1: {
let b: string = "case 1";
break;
} // After break
case 2:
{
function switchFunction(num: number) {
let b: string = "functionb";
switch (num) {
case 1: {
let b: string = "case 1";
break;
} // After break
case 2:
{
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) {