(C-x means ctrl+x, M-x means alt+x)
The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf
:
const arrayOfData = [1, 2, 3, 4] | |
const promises = []; | |
for (let i = 0; i < arrayOfData.length; i += 1) { | |
// Don't use await here, as each request needs to wait untill previous not complete. | |
// Let's push all the promise and resolve them once instea | |
// await someAPI(arrayOfData[i]) | |
promises.push(someAPI(arrayOfData[i])); | |
} |
package main | |
import ( | |
"log" | |
"net/http" | |
) | |
func main() { | |
http.Handle("/", http.StripPrefix("/", http.FileServer(http.Dir("./")))) | |
log.Println("Listening at 3000...") |
const fs = require('fs') | |
function myReaddir() { | |
return new Promise((resolve, reject) => { | |
fs.readdir("./aaa", function(err, files){ | |
if(err) { | |
reject(err); | |
} else { | |
resolve(files); | |
} |
copy directory
cp -R --dir
Find files
find / name *.js
mlocate - ubuntu
locate - mac
check space
df -h
List of dependencies used by project. | |
go list -f '{{.Deps}}' | tr "[" " " | tr "]" " " | xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' |
includes. | |
========= | |
// old way was using indexOf() functio. | |
let a = "ABCD" | |
console.log(a.includes("A")) // true | |
console.log(a.includes("Z")) // false | |
Remove unwanted properties from object. | |
======================================= | |
// To remove all process | |
docker rm -f $(docker ps -a -q) | |
// To remove all images | |
docker rm -f $(docker images -q) | |
// To stop running containers | |
docker stop -f $(docker ps -q) | |
// To remove images with same tag |
const MongoClient = require('mongodb').MongoClient | |
const faker = require('faker'); | |
if (process.argv[2] === "1") { | |
var DATA = []; | |
DATA[0] = { | |
fname: "AAA", | |
lname: "BBB", | |
age: 20, | |
gender: "M", |
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const app = new express(); | |
var DB; | |
var MongoClient = require('mongodb').MongoClient | |
MongoClient.connect('mongodb://localhost:27017/mytest', function (err, db) { | |
if (err) throw err |