How to configure multi term in Emacs to allow login shell
To configure multi term in Emacs to allow login shell
(setq multi-term-program-switches "--login")
- Reference
http://stackoverflow.com/questions/19750218/emacs-multi-term-as-a-login-shell
Responsive vs Adaptive Design
-
Responsive Design - Responsive websites respond to the browser size at any given point. No matter the browser width, the site adjusts its layout.
-
Adaptive Design - Adaptive websites adapt to the browser size at specific points.
-
Reference - https://css-tricks.com/the-difference-between-responsive-and-adaptive-design/
Difference between CSS reset and normalize
Normalize.css
- Preserves useful defaults rather than “unstyling” everything.
- Corrects some common bugs that are out of scope for reset.css.
- Doesn’t clutter your dev tools.
- Is more modular.
- Has better documentation.
- Reference http://stackoverflow.com/questions/6887336/what-is-the-difference-between-normalize-css-and-reset-css http://nicolasgallagher.com/about-normalize-css/
Different ways of creating Objects in JavaScript
Explained below are some of the different ways of creating Objects in JavaScript.
- Objects created with syntax constructs (Object Literal Notation)
var o = {a: 1};
- With Function (New Objects with Constructor function)
A constructor is a function that contains instructions about the properties of an object when that object is created and assigned. Advantage over object literal is you can create many instances of objects that have the same properties.
function Car() {
this.make = 'Honda';
this.model = 'Civic';
}
var c = new Car();
- With Object.create
ECMAScript 5 introduced a new method Object.create.
var a = {a: 1};
var b = Object.create(a);
console.log(b.a); // 1 (inherited)
- With Class
JavaScript classes were introduced in ECAMScript 2015 (ES6)
Class Car {
constructor(make, model) {
this.make = make;
this.model = model;
}
}
var c = new Car();
Reference
What is prototype and prototype chain in JavaScript
Each JavaScript object has a private property which holds a link to another object called its prototype. That prototype object has a prototype of its own, and so on until a object is reached with null as its prototype. null has no prototype and acts as the final link in this prototype chain.
Multiple inheritance with prototypes is referred to as a prototype chain.
function Car() {
this.make = "Honda";
this.model = "Civic";
}
let c = new Car();
Car.prototype.fuel = "Gas";
console.log(c.make); // "Honda"
console.log(c.model); // "Civic"
console.log(c.fuel); // "Gas"
To check whether an object has a property defined on itself
and not somewhere on its prototype chain, it is necessary to use the
hasOwnProperty
method which all objects inherit from Object.prototype
.
c.hasOwnProperty("make"); //true
c.hasOwnProperty("fuel"); //false