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
function Pagination(countPages, maxLength) { | |
if (maxLength < 5) return; | |
if (countPages < maxLength) maxLength = countPages; | |
this.countPages = countPages; | |
this.maxLength = maxLength; | |
this.currentLength = 0; | |
this.currentPage = this.firstPage = 1; | |
this.lastPage = this.countPages; |
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
<!doctype html> | |
<html> | |
<head> | |
<title>Chatbox</title> | |
<link rel="stylesheet" href="style.css"> | |
</head> | |
<body> | |
<div class="chat-box"> | |
<div class="elder">Load earlier messages</div> | |
<div class="sender"> |
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 | |
// Фабрика | |
abstract class LogFactory | |
{ | |
// Фабричный метод - создает конкретные продукты фабрики | |
abstract public function getLog(): Log; | |
// Метод реализующий основное назначение продуктов фабрики (в данном случае запись в лог) | |
public function write($data): void |
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 | |
interface Dataset | |
{ | |
public function output(); | |
} |
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 | |
/** | |
* ListInterface это интерфейс для классов IPIgnoreList, UserAgentIgnoreList и SearchBotList | |
* | |
* Должен реализовать метод `has($item)` для определения принадлежности пользователя к реализуемому списку | |
*/ | |
interface ListInterface | |
{ | |
/** |
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 | |
/** | |
* Работа с графами | |
* | |
* @author sagittaracc <[email protected]> | |
*/ | |
class Graph | |
{ | |
/** |
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 | |
$a = [0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1]; | |
function sag_pack($a) { | |
$sum = 0; | |
foreach (array_reverse($a) as $index => $value) { | |
$sum += $value * (1 << $index); | |
} |
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 | |
function translit_folder($folder) | |
{ | |
$converter = array( | |
'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', | |
'е' => 'e', 'ё' => 'e', 'ж' => 'zh', 'з' => 'z', 'и' => 'i', | |
'й' => 'y', 'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n', | |
'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's', 'т' => 't', | |
'у' => 'u', 'ф' => 'f', 'х' => 'h', 'ц' => 'c', 'ч' => 'ch', |
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 | |
require 'Map.php'; | |
$map = new Map([ | |
[1, 1, 0, 0, 0, 0, 0, 1], | |
[0, 1, 0, 0, 1, 1, 1, 0], | |
[1, 0, 1, 0, 0, 0, 0, 0], | |
[1, 0, 0, 1, 1, 0, 1, 1], | |
[0, 0, 1, 1, 1, 0, 0, 1], |
OlderNewer