menu
To check if any module in a project is 'old':
npm outdated
'outdated' will check every module defined in package.json and see if there is a newer version in the NPM registry.

CDN
Use CDN if you are developing a website that will be accessible by public internet users.

CDN Benefits:
  • Will be cached on most browsers because it's used by a lot of other websites
  • Reduce the bandwidth

NPM
npm is a great tool for managing your app's dependencies using a module bundler.

Example:

assume using a webpack module bundler and jQuery is installed
import $ from 'jQuery'
...
var content = $('#id').html();

but the browser does not understand the import statement so you have to transpile the code with Webpack commands, the bundler will check all the used dependencies and bind them in a single file without any dependency problems.

Source: javascript - Using CDN vs Installing library by NPM - Stack Overflow

ACID properties are principles of transaction-oriented database recovery.
ACID is an acronym for a set of properties for database transactions used to make sure data is valid.

The ACID principles are:
  • Atomicity: A transaction is made up of multiple statements. Atomicity ensures that either all statements are executed or none are executed.
  • Consistency: Consistency ensures that integrity restraints are followed.
  • Isolation: Transaction often occurs concurrently, at the same time, and isolation ensures that this does not lead to inconsistent data.
  • Durability: Durability ensures that once a transaction is committed, it will remain committed even in the case of a system failure.

See more examples on: https://www.freecodecamp.org/news/acid-databases-explained/?ref=dailydev
List the stashes:
git stash list

Show the files in the most recent stash:
git stash show

Show the changes in the most recent stash:
git stash show -p

Show the changes in the named stash:
git stash show -p stash@{1}

Or in short:
git stash show -p 1 
To prevent SQL injection in Node.js, use parameterized queries with a database library, such as pg for PostgreSQL or mysql2 for MySQL.

Example using pg for PostgreSQL:

const { Client } = require('pg');

// Bad: Concatenation (vulnerable to SQL injection)
const insecureQuery = `SELECT * FROM users WHERE username = '${inputUsername}'`;

// Good: Parameterized query (prevents SQL injection)
const secureQuery = 'SELECT * FROM users WHERE username = $1';
const values = [inputUsername];

const client = new Client();
client.connect();

client.query(secureQuery, values, (err, result) => {
  // Handle the query result
  client.end();
});

By using parameterized queries, you avoid directly interpolating user input into SQL statements, reducing the risk of SQL injection.

The pointer-events CSS property is used to control under what circumstances an element can trigger user interface events like mouse clicks and hover. It allows you to control the visibility and interaction of elements on the page.


The pointer-events property can take the following values:

  • auto: The element behaves as normal. It is subject to mouse events according to its CSS styling.
  • none: The element is completely transparent to mouse events. It will not block any interactions with elements beneath it, effectively making it "click-through."

This property is beneficial when you want to overlay an element on top of another but still want the underlying element to receive mouse events. It provides a way to flexibly control layered elements' interaction behavior.


process.nextTick() is a function in Node.js designed to schedule a callback function to be invoked in the next iteration of the event loop. 

It allows a callback to be executed immediately after the current operation but before the event loop continues. This makes it useful for ensuring that certain tasks, especially related to the execution context or I/O, are deferred until the next tick of the event loop. It is often used to break down large asynchronous operations into smaller, more manageable chunks.
Isomorphic JavaScript works in the context of a single-page application (SPA). In a typical SPA, most of the application logic, including routing, is encapsulated in a bundled JavaScript file that is sent to the client. While this frees up the server, as it does not have to handle so many requests, it also makes the initial load slow for the client, as the entire application needs to be sent over to the client.

With Isomorphic JavaScript, when a client web page is first requested from the server, the view of the page is generated on the server, similar to server-side dynamic web pages, and sent over to the client. The client can then render the view immediately. After the initial view is rendered, the complete SPA is downloaded in the background, and subsequent actions are handled client-side.

The shortcut for opening the Visual Studio Code command palette is:

Ctrl/Cmd + Shift + P
Hide the terminal with the following shortcut:

Ctrl/Cmd+j
 This method is used to create a new Map data structure. A Map is a built-in data structure in JavaScript that allows you to store key-value pairs and provides various methods for working with these pairs. Here's how you can use "new Map()" to create a new Map:
 
Example:

const myMap = new Map();myMap.set('name', 'John'); 
myMap.set('age', 30);console.log(myMap.get('name')); // Output: 'John' 
console.log(myMap.get('age')); // Output: 30

This command is useful for ensuring that your local npm cache is in a healthy state, which can help prevent issues when installing or updating packages. If any issues or corruption are detected, npm cache verify will attempt to fix them. It's a maintenance command to help maintain the reliability of your local npm package cache.

A reverse proxy is like a guardian for web servers. It sits between client devices (like browsers) and web servers, accepting requests from clients and directing them to the appropriate server to fulfill those requests. It's a way to balance the load on multiple servers and provide an extra layer of security and performance optimization for websites and web applications. 


  • Operational Direction: A reverse proxy is placed between a client and one or more backend servers. It serves as a gateway for client requests, forwarding those requests to the appropriate backend server or server cluster based on various criteria. 
  •  
    Load Balancing: Reverse proxies are commonly used for load balancing across multiple servers, ensuring even distribution of incoming requests to maintain system performance. 

  • Security and Protection: They provide an additional layer of security by shielding backend servers from direct exposure to the internet. This helps protect servers from direct attacks.
In Ruby, the .is_a? method is used to check if an object is an instance of a particular class or a subclass of that class. It allows you to determine if an object belongs to a certain class in the class hierarchy. The .is_a? method returns true if the object is an instance of the specified class or one of its subclasses, and false otherwise. 

Example:

# Define a class 
class Animal 
end# Create an object 
dog = Animal.new# Check if the object is an instance of a class 
puts dog.is_a?(Animal) # true 
puts dog.is_a?(Object) # true, since all objects are instances of Object 
puts dog.is_a?(String) # false, since a dog is not a String
In Elasticsearch, you store your data in indices, which are like containers for your information. Each index can have different kinds of data, like text, numbers, or dates.

Now, think of "mapping" as a set of rules that tells Elasticsearch what kind of data to expect in each index. It's like saying, "In this index, we have names, and they should be stored as text. In that index, we have numbers, and they should be treated as numbers."

So, when you request the _mapping, you're basically asking Elasticsearch to show you the rule book for each index. This rule book describes how data is organized and what type of data each field should contain.