Skip to content

Instantly share code, notes, and snippets.

undefine is the type as perspec
"x is not defined" is different then undefine
eval -> is evil -> cheat lexical scoping in javascript -> compiler or runing becomes slow
useStrict mode -> good for coding standards -> even with eval compiler can do optimization
with key word -> import feature of javascript -> not got with compiler optimization -> useStrict mode doesn't allow to use with keyword
IIFE-> imediatly invoke function expression -> use to avoid leaking of scope
let -> block scope
@kapilghimire
kapilghimire / filterArray.js
Created May 25, 2020 08:11 — forked from jherax/filterArray.js
Filters an array of objects with multiple match-criteria.
/**
* Filters an array of objects using custom predicates.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria
* @return {Array}
*/
function filterArray(array, filters) {
const filterKeys = Object.keys(filters);
return array.filter(item => {
docker run --name mongodb mongo
or
docker run -d -p 27017-27019:27017-27019 --name mongodb mongo:4.0.4 ( for other application to access)
docker exec -it mongodb bash
inside shell
mongo
show dbs
@kapilghimire
kapilghimire / Git comand
Last active June 10, 2019 04:09
Git command
git clean -fd
// to add notepadd++ as default editor
git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
// to reset your working directory to latest commit --- be sure what you are doing
git reset --hard HEAD
// rebase
@kapilghimire
kapilghimire / p4merge-git-tool.md
Created May 17, 2019 12:39 — forked from dgoguerra/p4merge-git-tool.md
Setup p4merge as difftool and mergetool on Windows

Setting up p4merge as diff and merge tool on Windows. Tried for Git version 1.8.4.msysgit.0.

Two alternatives are explained: using the command line, and directly editing the config file.

Setting up from the command line

Being the installation path "C:Program Files\Perforce\p4merge.exe", just run:

$ git config --global diff.tool p4merge
@kapilghimire
kapilghimire / Commands
Created April 20, 2019 07:05
Kubernetes commands
Replicat Set --- collection of pod running for applicaton
Controller
Replica set
Deployment
@kapilghimire
kapilghimire / DAY 2
Last active April 15, 2019 03:06
SQL Server
------------------------
USE Contacts
GO
CREATE PROCEDURE dbo.InsertContacts
AS
BEGIN;
DECLARE @FirstName VARCHAR(40),
@LastName VARCHAR(40),
# yaml is simple
# Basic data type
# all are key value pair
name: "kapil"
occupation: 'programmer'
age: 23
gpa: 3.5
fav_num: 1e+10
male: true
birthday: 1994-02-06 14:33:22 #ISO 8601 formart
@kapilghimire
kapilghimire / links.md
Created March 3, 2019 14:27 — forked from g0t4/links.md
Starting Point Files for Jenkins2 Getting Started course