Results: 1022
If we want to commit only part of changes of the same file
--patch
or
-p
is used
git add --patch
Similar to the above command
git add -p
Possible answers for the command:
y
stage this hunk for the next commit
n
do not stage this hunk for the next commit
q
quit; do not stage this hunk or any of the remaining hunks
a
stage this hunk and all later hunks in the file
d
do not stage this hunk or any of the later hunks in the file ... The complete list of the possible answers is on the link of the note
Higher order function that receives function as an argument CODE
Built-in built-in higher order functions that expect to receive a function as an argument
document.addEventListener('click', func);
function func() {
    alert('You clicked me!');
}
Using anonymous function:
document.addEventListener('click', function() {
    alert('You clicked me!');
});
Another built-in function
foreach
that receives a function as an argument
let greatColors = ['green', 'orange', 'yellow'];

greatColors.forEach(listColors);

function listColors(color) {
    document.write('The color ' + color + ' is a great color<br>');
}
XML
stands for
Extensible Markup Language
application/xml
is the official Internet media type for XML.
.xml
is the XML filename extension.
XML is extensible
− XML allows us to create our own self-descriptive tags.
XML carries the data, does not present it
− XML allows us to store the data irrespective of how it will be presented.
XML is a public standard
- XML was developed by an organization called the World Wide Web Consortium. Any type of data can be expressed as an
XML document
XML can be used to
exchange
the information between companies and systems
An XML file contains XML-elements, also called XML-nodes or XML-tags
<?xml version="1.0" encoding = "UTF-8"?>
<student>
   <name>George</name>
   <city>Tbilisi</city>
   <phone>(011) 123-4567</phone>
</student>
The names of XML-elements are enclosed by triangular brackets
< >
<element>
Each XML-element
needs to be closed
either with start or with end elements as shown below
<element>...</element>
XML allows self-closing elements, for example if the tag empty
<?xml version="1.0"?>
<student>
   <name>George</name>
   <city>Tbilisi</city>
   <address/>
   <phone>(011) 123-4567</phone>
</student>
Children elements must not overlap parent elements. i.e., an element end tag must follow all of its children's end tags.
<company>
is closed after the
</contact-info>
tag but it's opened after
</contact-info>
tag, which is wrong!
<?xml version = "1.0"?>
<contact-info>
<company>Learn Practice Teach
</contact-info>
</company>
The following example shows the correct nested tags
<?xml version = "1.0"?>
<contact-info>
   <company>Applications.ge</company>
<contact-info>
One
root element
is necessary for an XML document. In this example below, both
<x>
and
<y>
elements are at the top level and they don't have one parent element, which is wrong:
<?xml version = "1.0"?>
<x>...</x>
<y>...</y>
XML-elements are
case-sensitive
, which means that the start and the end elements names need to be exactly in the same case. This example is not correct XML document, because
case sensitivity
is not correctly applied
<?xml version="1.0"?>
<student>
   <name>George</name>
   <city>Tbilisi</city>
   <address/>
   <phone>(011) 123-4567</Phone>
</student>
In this case
<phone>
and its close tag
</phone>
is not in the same case
a { background-color: yellow; }
a
- selector
{
- declaration start
background-color
- property
:
- property/value separator
yellow
- value
;
- declaration separator
}
- declaration end
1. Interface supports multiple inheritance
class Class_A { }
class Class_B { }
abstract class MyAbstractClass extends Class_A, Class_B { }
Parse error:  syntax error, unexpected ',', expecting '{' in...
. 2. Interface contains only incomplete member (contains only signature of a method)
interface Animal {
    function run() {
        echo 'I am running!';
    }
}
Fatal error:  Interface function Animal::run() cannot contain body in ...
. 3. Interface does not contain data member
interface MyInterface {
    public $foo = null;
}
Fatal error:  Interfaces may not include member variables in ...
. 4. Interface can not have access modifiers (other than
public
), by default everything is assumed as public
interface iTemplate
{
    private function setVariable($name, $var);
    public function getHtml($template);
}
Fatal error:  Access type for interface method iTemplate::setVariable() must be omitted in ...
. Notes (mistakes on the page): 1. Interface does contain CONSTRUCTOR (but can force child classes to implement constructor) as well as abstract class can contain one
interface MyInterface {
    function __construct();
}
class mathh implements MyInterface {
    // function __construct(){ }
}
2. We can have static methods inside interface as well as inside abstract classes
interface MyInterface {
    static function getPI();
}
class mathh implements MyInterface {
    static function getPI(){
        return 3.1415926535;
    }
}
3. Abstract class can contain abstract static member
abstract class Animal {
    // child classes must implement this
    abstract static function prey();

    static public function run() {
        echo "I am running!\n";
    }
}
class Dog extends Animal {
    static public function prey() {
        echo "I killed the cat !\n";
    }
}
$dog = new Dog();
$dog->prey(); // I killed the cat !
XML declaration example
<?xml version = "1.0" encoding = "UTF-8" standalone = "yes"?>
XML document can optionally have an XML declaration. XML document without declaration is also valid
<student>
   <name>George</name>
   <city>Tbilisi</city>
   <phone>(011) 123-4567</phone>
</student>
If the XML declaration is included, it must contain version number attribute
<?xml encoding="UTF-8" standalone="no"?>
<student>
   <name>George</name>
   <city>Tbilisi</city>
   <phone>(011) 123-4567</phone>
</student>
It will generate the following error:
error on line 1 at column 7: Malformed declaration expecting version
The names are always in lower case
<?xml Version="1.0" encoding="UTF-8" standalone="no"?>
<student>
   <name>George</name>
   <city>Tbilisi</city>
   <phone>(011) 123-4567</phone>
</student>
It will generate the following error:
error on line 1 at column 7: Malformed declaration expecting version
The XML declaration must begin with
<?xml
<? version="1.0" encoding="UTF-8" standalone="no"?>
<student>
   <name>George</name>
   <city>Tbilisi</city>
   <phone>(011) 123-4567</phone>
</student>
The following error will be generated:
error on line 1 at column 3: xmlParsePI : no target name
If document contains XML declaration, it must be the
first statement
<student>
   <name>George</name>
   <city>Tbilisi</city>
   <phone>(011) 123-4567</phone>
</student>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
The error will be the following:
error on line 6 at column 6: XML declaration allowed only at the start of the document
The order of placing the parameters is important. The correct order is:
version
,
encoding
and
standalone
<?xml encoding="UTF-8" standalone="no" version="1.0"?>
<student>
   <name>George</name>
   <city>Tbilisi</city>
   <phone>(011) 123-4567</phone>
</student>
This will generate the following error:
error on line 1 at column 7: Malformed declaration expecting version
Either single or double quotes may be used. Here is valid XML document
<?xml version='1.0' encoding='UTF-8' standalone="no"?>
<student>
   <name>George</name>
   <city>Tbilisi</city>
   <phone>(011) 123-4567</phone>
</student>
An HTTP protocol can override the value of encoding that we put in the declaration.
Benefits of using Higher order function that returns a function CODE
Creates several multiplier functions without using
Higher order function
function doubleMe(number) {
    return 2*number;
}
function tripleMe(number) {
    return 3*number;
}
function quadrupleMe(number) {
    return 4*number;
}
document.write(doubleMe(10));
document.write(tripleMe(10));
document.write(quadrupleMe(10));
Creates the same multiplier functions using
Higher order function
In this case we only need to create one function instead of 3 multiplier functions
function multiplier(multiply) {
    return function(number){
        return number*multiply;
    };
}

let double = multiplier(2);
let triple = multiplier(3);
let quadruple = multiplier(4);

document.write(double(10));
document.write(triple(10));
document.write(quadruple(10));
removeEventListener CODE
First we add
click
event listener for two functions:
func1
,
func2
to document object. After clicking three times we remove the event listener for
func1
function
let counter = 0;
document.addEventListener('click', func1);
document.addEventListener('click', func2);

function func1(){
    console.log('You clicked me!');
  
    if (counter>2) {
        console.log('Max limit is 3');
        document.removeEventListener('click', func1);
    }
}
function func2(){
    counter ++;
    console.log('counter: '+counter);
}
.accordion {
  max-width: 600px;

  &__copy {
    display: none;
    padding: 1rem 1.5rem 2rem 1.5rem;

    &--open {
      display: block;
    }
  }
}
This will generate the following regular CSS:
.accordion {
  max-width: 600px;
}
.accordion__copy {
  display: none;
  padding: 1rem 1.5rem 2rem 1.5rem;
}
.accordion__copy--open {
  display: block;
}
Results: 1022