Results: 1021
border-bottom shothand
border-bottom: 3px dashed orange;
The above style is a shorthand property of the following three properties:
border-bottom-width: 20px; 
border-bottom-style: dotted; 
border-bottom-color: blue;
font shorthand
font: bold italic 14px Tahoma;
The above style is a shorthand property of the following four properties:
font-weight: bold; 
font-style:italic; 
font-size: 14px; 
font-family: Tahoma;
We can also search for more than one term by passing multiple arguments
composer search keyword1 keyword2
In JSON: Array values must be of type
string
,
number
,
object
,
array
,
boolean
or
null
... In JavaScript: Array values can be all of the above, plus any other valid JavaScript expression, including
functions
,
dates
,
undefined
,
symbol
create database backup using mysqldump
Creates
backup.sql
backup file of
some_db
database using
some_user
MySQL user. The database is located at
34.mysql.servage.net
server.
mysqldump -h 34.mysql.servage.net -u some_user -p some_db > backup.sql
Creates
backup.sql
backup file of
some_db
database with the same MySQL user but without
-h
flag. If the database is located on the same server (localhost)
-h
flag is not necessary to specify
mysqldump -u some_user -p some_db > backup.sql
If we want to include all the routines (procedures, functions), then we need to use flag
-R
mysqldump -u some_user -p some_db -R > backup.sql
If we want to export only one or several tables, then we should list tables after database name
mysqldump -u root -p sdtokens sdt_prices another_table > sdt_prices.sql
After running the command, we will be required to enter password of the
some_user
mysql user. After that, MySQL will create
backup.sql
file on the same location
Method chaining technique gives us ability to call several methods with only one PHP expression (in one go)
class Bill {
    public $dinner = 20;
    public $dessert = 5;
    public $drink = 3;
    
    public $bill = 0;
    
    public function dinner($count) {
        $this->bill += $count * $this->dinner;
        return $this;
    }
    public function dessert($count) {
        $this->bill += $count * $this->dessert;
        return $this;
    }
    public function drink($count) {
        $this->bill += $count * $this->drink;
        return $this;
    }
}

$bill = new Bill;
We can call several methods one by one and print the
$bill
:
$bill->dinner(3); 
$bill->dessert(2);
$bill->drink(1);
echo $bill->bill;
Or we can combine the above 4 expressions using method chaining. The result will be the same:
echo $bill->dinner(3)->dessert(2)->drink(1)->bill;
Installs exactly the specified version of the module
npm install moment@2.25.2
Installs the specified module with the latest
patch
npm install moment@2.25
Installs the specified module with the latest
minor
and
patch
versions
npm install moment@1
Installs the latest version of the module (with latest
major
,
minor
and
patch
versions)
npm install moment
The drag and drop feature lets you
grab
an object and drag it to a different location. To make an element draggable, we set the
draggable
attribute to true. JS
function allowDrop(ev) {
    ev.preventDefault();
}
function drag(ev) {
    ev.dataTransfer.setData("text", ev.target.id);
}
function drop(ev) {
    ev.preventDefault();
    var data = ev.dataTransfer.getData("text");
    ev.target.appendChild(document.getElementById(data));
}
HTML
<div id="box" ondrop="drop(event)" ondragover="allowDrop(event)" style="border:1px solid black; width:200px; height:200px"></div>

<img id="image" src="https://image.shutterstock.com/image-photo/large-beautiful-drops-transparent-rain-260nw-668593321.jpg" draggable="true" ondragstart="drag(event)" width="150" height="50" alt="" />
Several ways to call non-static method from static method: One way is to use
new
keyword followed by the class name
(new Foo)->nonStaticMethod();
Another method is to use
self
which comes after
new
keyword
(new self)->nonStaticMethod();
Complete example:
class Foo {

    public function nonStaticMethod()
    {
        return 'non-static';
    }

    public static function staticMethod()
    {
        // return (new Foo)->nonStaticMethod();
        return (new self)->nonStaticMethod();
    }
}

echo Foo::staticMethod();
The second method
new self
is better, because if we want to rename the class later, we will not need to change the class name more than one place
Conditionally checking columns
Select students with
gmail
account. Using
IF
statement:
SELECT * 
FROM `students` 
WHERE IF(LENGTH(mail), mail, mail2) LIKE '%gmail.com%'
ORDER BY points
Using
OR
logical operator:
SELECT *
FROM  `students` 
WHERE 
    (`mail` LIKE '%gmail.com%' AND LENGTH(mail))
    OR 
    (mail2 LIKE '%gmail.com%') 
ORDER BY points
Using
CASE
SELECT * 
FROM `students` 
WHERE 
    (CASE
        WHEN LENGTH(mail) THEN mail
        ELSE mail2
    END) LIKE '%gmail.com%'
ORDER BY points
Results: 1021