Results: 1022
Copy all files and folders to another directory
Copies all files and folders from
source_dir
to
destination_dir
cp -r /home/user/source_dir/. /var/www/html/destination_dir/
-r
- copies recursively (with subfolders and files)
.
- copies all files and folders inside the folder
http / https
If the URL starts with
https
it will make a request on
443
$ch = curl_init("https://xdatavpn.example.com/Bank");
If it starts with
http
the request will use
80
port
$ch = curl_init("http://xdatavpn.example.com/Bank");
Select column comment with some other column specifications
Shows details about each column from
decorations
table including column comments
SHOW FULL COLUMNS FROM decorations
Select column comment
Selects
is_optional
column comment which exists in
decorations
table using
information_schema
database
SELECT COLUMN_COMMENT 
FROM information_schema.COLUMNS 
WHERE TABLE_SCHEMA = 'geiger' 
    AND TABLE_NAME = 'decorations' 
    AND COLUMN_NAME = 'is_optional'
Set column comment
Sets new comment for
name
column in
channels
table
ALTER TABLE `channels` CHANGE `name` `name` varchar(255) COMMENT 'name of channel'
Select table comment
Selects comment of
channels
table which exists in the
geiger
database
SELECT table_comment 
FROM INFORMATION_SCHEMA.TABLES 
WHERE table_schema='geiger' 
    AND table_name='channels'
Set table comment
Sets comment for the specified table to make it easy for other developers what the purpose of this table is
ALTER TABLE `the_table_name` comment 'Some text about the table'
function "call" CODE
If we call
driveCar()
function using
call()
function,
this
will refer to the object that will be passed. In this case:
john
object
let john = {
  firstName: 'John',
  lastName: 'Doe'
}

function driveCar() {
  document.write(this.firstName + ' ' + this.lastName + ' is driving a car<br/>')
}

driveCar.call(john)
filter CODE
The function
filter
filters the array members based on the
getNames
function condition
let myFavoritePlanets = [
    {name: 'Earth', radius: 6371}, 
    {name: 'Jupiter', radius: 69911}, 
    {name: 'Neptune', radius: 24622, moons: ['Triton', 'Thalassa', 'Nereid', 'Proteus', 'Hippocamp', 'Naiad']}
]
let biggerPlanetsNames = myFavoritePlanets.filter(getNames);

function getNames(planet) {
  return planet.radius > 20000
}
console.log(biggerPlanetsNames );
splice CODE
Function
splice
changes content of an array. Let's first create an array of integers
let myFavoriteNumbers = [5, 14, 16, 18, 23, 25, 27, 50, 70]
If we want to remove one element from an array, we need to pass
1
as the second argument and the index of the item as the first argument. In this example
14
(second item) will be removed by passing
1 and 1
as arguments
myFavoriteNumbers.splice(1, 1);  // [5, 16,18, 23, 25, 27, 50, 70]
To remove two adjacent items, we need to pass first item's index
2
and quantity of items
2
that we want to remove. In this example we want to remove
18
and
23
from the array at the same time
myFavoriteNumbers.splice(2, 2);  // [5, 16, 25, 27, 50, 70]
Replaces 3 items starting from index 2 with
27
,
29
and
31
myFavoriteNumbers.splice(2, 2, 27, 29, 31);  // [5, 16, 27, 29, 31, 50, 70]
Removes all the items of the array except the first and the last items
myFavoriteNumbers.splice(1, 5);  // [5,70]
Adds the two new items
100
and
200
to the array after the first item
myFavoriteNumbers.splice(1, 0, 100, 200);  // [5, 100, 200, 70]
Results: 1022