- Code must follow PSR-2.
- Classes must have a docblock documentation describing their purpose.
- Class methods must have a docblock documentation, in this order:
- A mandatory one-line short description.
- An optional multi-line long description.
- A mandatory
@param
annotation for each parameter:@param [type] [name] [description]
[type]
is the type of the variable, primitive or class.[name]
is the name of the parameter, including the leading$
.[description]
is a short description of the parameter. If the description spans multiple lines, all lines must be indented by the same number of spaces as the first line.
- The indentation must be such as types, names and descriptions for all parameters of a single method start on the same column.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ -z $1 ]; then | |
echo "Usage: $(basename $0) [name]" | |
exit 1 | |
fi | |
message() { | |
printf '%-60s' "$*" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$variadics = 1000; // number of objects passed to each variadic function | |
$iterations = 1000; // number of calls of each function | |
class Foo { | |
} | |
function withoutTypeHinting(...$foos) { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Converts a text message to HTML. | |
* | |
* The following transformations are applied: | |
* - Special characters are encoded to HTML entities, | |
* - Lines of text separated by an emtpy line are converted to paragraphs, | |
* - Newline characters are converted to `<br>`, | |
* - Links and e-mail addresses are converted to HTML links, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Replace with your connection parameters & database name */ | |
$hostname = 'localhost'; | |
$username = 'root'; | |
$password = ''; | |
$database = 'test'; | |
$pdo = new PDO("mysql:host=$hostname", $username, $password); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -e | |
sudo yum update -y | |
sudo yum install -y yum-utils wget | |
# EPEL repo | |
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm | |
sudo yum-config-manager --enable epel | |
# Remi repo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Converts a string using CR, LF, CRLF, or possibly a mix of these, to the given EOL character(s). | |
* | |
* @param string $text The text to convert. | |
* @param string $eol The line break character(s). | |
* | |
* @return string | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Brick\DateTime\LocalDate; | |
use Brick\DateTime\LocalTime; | |
use Brick\DateTime\LocalDateTime; | |
/** | |
* Formatter for date-time classes. | |
*/ | |
class DateTimeFormatter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Solves the following equations: | |
* | |
* a·x + b·y = c | |
* d·x + e·y = f | |
* | |
* Returns an array with [x, y] | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
password=$(grep -oP 'temporary password(.*): \K(\S+)' /var/log/mysqld.log) | |
mysqladmin --user=root --password="$password" password aaBB@@cc1122 | |
mysql --user=root --password=aaBB@@cc1122 -e "UNINSTALL PLUGIN validate_password;" | |
mysqladmin --user=root --password="aaBB@@cc1122" password "" |
OlderNewer