Skip to content

Instantly share code, notes, and snippets.

View bhatmand's full-sized avatar

Mandeep Singh Bhatia bhatmand

View GitHub Profile
@bhatmand
bhatmand / common-items.js
Created November 25, 2020 12:48
Given two arrays, find common items in both arrays.
// ------------------------------------------------
// question: Given two arrays, find common items in both arrays.
var a = [ 1,2,13,11,6,7,4, 8,9,10]
var b = [ 2,4,5,11,13 ]
// ------------------------------------------------
// ------------------------------------------------
// solution: compare each item of the array containing least items, with the other array, and return the common ones.
var a = [ 1,2,13,11,6,7,4,8,9,10 ];
var b = [ 2,4,5,11,13 ];
@bhatmand
bhatmand / reading-list.adoc
Created September 17, 2020 06:08 — forked from wwerner/reading-list.adoc
Reading list for young developers
Table of Contents

The Pragmatic Programmer

Straight from the programming trenches, The Pragmatic Programmer: From Journeyman to Master cuts through the increasing specialization and technicalities of modern software development to examine the core process—what do you do, as an individual and as a team, if you want to

@bhatmand
bhatmand / books.txt
Created September 13, 2020 09:35 — forked from jjaffeux/books.txt
books
Exceptional Ruby (Avdi Grimm)
Objects on Rail (Avdi Grimm)
Confident Ruby (Avdi Grimm)
Eloquent Ruby (Russ Olsen)
Growing Object-Oriented Software Guided by Tests (Steve Freeman and Nat Pryce)
Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation (Jez Humble and David Farley)
Clean Code (Robert C. Martin)
Working with UNIX processes (Jesse Storimer)
Working With TCP Sockets (Jesse Storimer)
Founders at Work (Livingston)
@bhatmand
bhatmand / README-Template.md
Created July 12, 2020 09:26 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@bhatmand
bhatmand / git-recover-branch.md
Created April 2, 2020 11:25 — forked from jbgo/git-recover-branch.md
How to recover a git branch you accidentally deleted

UPDATE: A better way! (August 2015)

As pointed out by @johntyree in the comments, using git reflog is easier and more reliable. Thanks for the suggestion!

 $ git reflog
1ed7510 HEAD@{1}: checkout: moving from develop to 1ed7510
3970d09 HEAD@{2}: checkout: moving from b-fix-build to develop
1ed7510 HEAD@{3}: commit: got everything working the way I want
70b3696 HEAD@{4}: commit: upgrade rails, do some refactoring
@bhatmand
bhatmand / README.md
Created January 30, 2020 15:01 — forked from nikcub/README.md
Facebook PHP Source Code from August 2007
@bhatmand
bhatmand / it-ebooks.md
Created January 25, 2020 15:21 — forked from baiwfg2/it-ebooks.md
Download ebooks as you want
@bhatmand
bhatmand / all-countries-cities-array.json
Created October 10, 2019 05:32
list of all countries and their cities as js array [ country1, city1-country1, city2-country1, ...etc-cities-country1, country2, city1-country2, city2-country2, ...etc-cities-country2, ...etc ]
This file has been truncated, but you can view the full file.
["Afghanistan","Herat (Afghanistan)","Kabul (Afghanistan)","Kandahar (Afghanistan)","Molah (Afghanistan)","Rana (Afghanistan)","Shar (Afghanistan)","Sharif (Afghanistan)","Wazir Akbar Khan (Afghanistan)","Albania","Elbasan (Albania)","Petran (Albania)","Pogradec (Albania)","Shkoder (Albania)","Tirana (Albania)","Ura Vajgurore (Albania)","Algeria","Algiers (Algeria)","Annaba (Algeria)","Azazga (Algeria)","Batna City (Algeria)","Blida (Algeria)","Bordj (Algeria)","Bordj Bou Arreridj (Algeria)","Bougara (Algeria)","Cheraga (Algeria)","Chlef (Algeria)","Constantine (Algeria)","Djelfa (Algeria)","Draria (Algeria)","El Tarf (Algeria)","Hussein Dey (Algeria)","Illizi (Algeria)","Jijel (Algeria)","Kouba (Algeria)","Laghouat (Algeria)","Oran (Algeria)","Ouargla (Algeria)","Oued Smar (Algeria)","Relizane (Algeria)","Rouiba (Algeria)","Saida (Algeria)","Souk Ahras (Algeria)","Tamanghasset (Algeria)","Tiaret (Algeria)","Tissemsilt (Algeria)","Tizi (Algeria)","Tizi Ouzou (Algeria)","Tlemcen (Algeria)","Andorra","Andorra l
@bhatmand
bhatmand / all-countries-cities-object.json
Created October 10, 2019 05:28
list of all countries and their cities as js object { country1: [city1, city2, ...etc ], country2: [city1, city2, ...etc ], ...etc }
This file has been truncated, but you can view the full file.
{"Afghanistan":["Herat","Kabul","Kandahar","Molah","Rana","Shar","Sharif","Wazir Akbar Khan"],"Albania":["Elbasan","Petran","Pogradec","Shkoder","Tirana","Ura Vajgurore"],"Algeria":["Algiers","Annaba","Azazga","Batna City","Blida","Bordj","Bordj Bou Arreridj","Bougara","Cheraga","Chlef","Constantine","Djelfa","Draria","El Tarf","Hussein Dey","Illizi","Jijel","Kouba","Laghouat","Oran","Ouargla","Oued Smar","Relizane","Rouiba","Saida","Souk Ahras","Tamanghasset","Tiaret","Tissemsilt","Tizi","Tizi Ouzou","Tlemcen"],"Andorra":["Andorra la Vella","Canillo","Encamp","Engordany","Escaldes-Engordany","La Massana","Llorts","Ordino","Santa Coloma","Sispony","Soldeu"],"Angola":["Ambriz","Benguela","Cabinda","Cacole","Camabatela","Cazeta","Huambo","Kuito","Lobito","Luanda","Lubango","Lucapa","Lumeje","Malanje","Menongue","Muxaluando","Namibe","Ondjiva","Piri","Saurimo","Talatona"],"Antigua and Barbuda":["All Saints","Cassada Gardens","Codrington","Old Road","Parham","Woods"],"Argentina":["28 de Noviembre","Abasto","Acass
const { createServer } = require('http');
createServer((req, res) => {
res.writeHead(200, {
Connection: 'Transfer-Encoding',
'Content-Type': 'text/html; charset=utf-8',
'Transfer-Encoding': 'chunked'
});
res.write(`