What is rel noopener?

Make links to cross-origin destinations safe

In HTML, link types indicate the relationship between two documents, in which one links to the other using an <a>, <area>, <form>, or <link> element. When you open another page using target="_blank", the other page may run on the same process as your page, unless Site Isolation is enabled. The other page can access your window object with the window.opener property. This allows other page to redirect your page to a malicious URL - see About rel=noopener for more details. [Read More]

Difference between HTML and HTML5?

Let's explore feature of HTML5 that were not part of HTML

One of the major difference between HTML and HTML5 is; later supports video and audio whereas in HTML, Adobe Flash plugin was required to play multimedia on website. Other differences are HTML5 added support for Geolocation API to identify user however user permission is required to enable same HTML5 added support for multiple storage options like application cache, web storage, local storage etc. whereas HTML used browser cache as temporary storage HTML5 sockets allows full duplex communication between client and server whereas in HTML communication between client and server was done through streaming and long pooling as it doesn’t have socket support. [Read More]

What is HTML?

A quick introduction to HTML

HTML is Hypertext Markup Language used to structure and present the World Wide Web contents. Hypertext stand for pages connected with each other using hyperlink which when clicked, takes us to connected page Markup consist of several key components, including those called tags(and their attributes) HTML document example 1 2 3 4 5 6 7 8 9 10 11 12 <!DOCTYPE html> <html lang="en"> <head> <title>Example Page</title> </head> <body> <h1>Main Heading</h1> <p>This is a <a href="demo. [Read More]

Git - How to create project specific config?

Override global git configuration with project specific configuration

Suppose you are working for two different companies and you want to commit code with different credentials i.e. user name and user email. Git commit will by default pick the configuration from your home directory ~/.gitconfig How To Override Credentials For Project To override setting for project you should navigate to desired directory on terminal and set configuration individually as follows specific to your project git config user.email "gulshan.saini@gmail.com" git config user. [Read More]

Git - How to create constants in JavaScript?

Immutable in JavaScript is not necessarily constant.

ES5 is not having built in support for constants. If you want to declare constant you need to write variable name in ALL_CAPS so that anyone should not accidentally update the variable - that is the convention developers have followed for long time. // Declaring constant in ES5 var NAME = 'Gulshan Saini' console.log(NAME) // Output: Gulshan Saini Assigning new value to constant in ES5 // Declaring constant in ES5 var NAME = 'Gulshan Saini' // assign new value NAME = 'Aditi Saini' console. [Read More]

What is module in Node.js?

Deep dive into creating and exporting functions and objects from modules

Module in Node.js? In Node.js each file is treated as separate module. For example, consider below code // ES5 syntax - file math.js module.exports.add = () => a + b What is module.exports in above code? Each module is wrapped in function by Node.js before execution as shown below ;(function(exports, require, module, __filename, __dirname) { // Module code actually lives in here }) During execution our code will look like the following: [Read More]

What is libuv?

A quick intro to libuv - Node internals

libuv is C++ open source library that gives Node.js access to OS internals, Networking and Concurrency. It was primarily developed for use by Node.js, but it’s also used by Luvit, Julia, pyuv, and others. What is libuv? libuv is built on top of epoll/kequeue/event ports/etc on Unix and IOCP on Windows systems providing a consistent API on top of them. Features of libuv Full-featured event loop backed by epoll, kqueue, IOCP, event ports. [Read More]

How to track folder or file changes in Node.js?

Watch folder(s) when its contents are changed

Problem How to observe/watch the folders OR files that gets changed using Node.js Solution Node.js comes with builtin method fs.watch() method that will emit ‘change’ event whenver specific directory or file is modified Example fs.watch( './folder/or/file/path/to/watch', { encoding: 'buffer' }, (eventType, filename) => { if (filename) { console.log(filename) // Prints: <Buffer ...> } } ) Save above code in watch.js file and run the program node watch.js. Make sure you change folder or file name. [Read More]

What is Node.js?

Simplified and quick intro to Node.js

Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine. Its nonblocking event-driven architecture makes it suitable for intensive I/O applications. Before we look at Node.js we should get familiar with V8. What is V8? V8 is JavaScript Engine that uses the same JavaScript interpreter as Google Chrome. V8 compiles javascript to native machine code and executes it. It also, optimise the code to run it faster. Similar to V8 we have other JavaScript engines mentioned below for popular web browsers [Read More]