This file contains hidden or 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
{% macro menu(entries, active, level) %} | |
{% if entries|length %} | |
{% set level = level|default(1) %} | |
<ul class="level-{{ level }} {{ level > 1 ? "dropdown sub" : "left top" }}"> | |
{% for n in entries %} | |
<li class="{{ loop.first ? "first" : "" }} {{ loop.last ? "last" : "" }} | |
{%- if n.children|length %}has-dropdown{% endif %} | |
{%- if active is defined and (active.descendantOf(n) or active.id == n.id) %} active{% endif %}"> | |
<a href="{{ n.url }}"> | |
{{ n }} |
This file contains hidden or 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
<? | |
# /local/php_interface/init.php | |
/** | |
* Вывод дебага через класс Kint | |
* @author Павел Белоусов <pb@infoexpert.ru> | |
* | |
* @param mixed $var Данные, которые требуется вывести | |
* @param string $function Функция, вызываемая из класса Kint. По умолчанию 'd'. Можно передать s, cd или ddd | |
* @param boolean $bAllUsers True — выводить всем пользователям (по умолчанию только для админов) |
This file contains hidden or 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 isUtf8($string) | |
{ | |
return preg_match('%(?:' | |
. '[\xC2-\xDF][\x80-\xBF]' // non-overlong 2-byte | |
. '|\xE0[\xA0-\xBF][\x80-\xBF]' // excluding overlongs | |
. '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}' // straight 3-byte | |
. '|\xED[\x80-\x9F][\x80-\xBF]' // excluding surrogates | |
. '|\xF0[\x90-\xBF][\x80-\xBF]{2}' // planes 1-3 |
This file contains hidden or 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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
# serves a .webp image instead of jpg/png | |
RewriteCond %{HTTP_ACCEPT} image/webp | |
RewriteCond %{REQUEST_FILENAME} ^(.+)\.(jpe?g|png)$ | |
RewriteCond %1\.webp -f | |
RewriteRule ^(.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1] | |
</IfModule> |
This file contains hidden or 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
### BEGIN INIT INFO | |
# Provides: unoconvd | |
# Required-Start: $network | |
# Required-Stop: $network | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Description: unoconvd Converting documents to PDF by unoconv | |
### END INIT INFO | |
#!/bin/sh | |
case "$1" in |
This file contains hidden or 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 GuzzleHttp\Client; | |
use GuzzleHttp\Exception\ConnectException; | |
use GuzzleHttp\Exception\RequestException; | |
use GuzzleHttp\Handler\CurlHandler; | |
use GuzzleHttp\HandlerStack; | |
use GuzzleHttp\Psr7\Request as Psr7Request; | |
use GuzzleHttp\Psr7\Response as Psr7Response; | |
use Psr\Log\LoggerInterface; | |
const MAX_RETRIES = 2; |
This file contains hidden or 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
if ('NodeList' in window && !NodeList.prototype.forEach) { | |
console.info('polyfill for IE11'); | |
NodeList.prototype.forEach = function (callback, thisArg) { | |
thisArg = thisArg || window; | |
for (var i = 0; i < this.length; i++) { | |
callback.call(thisArg, this[i], i, this); | |
} | |
}; | |
} |
This file contains hidden or 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 | |
namespace Thinkscape\Guzzle; | |
use Psr\Http\Message\RequestInterface; | |
use Psr\Http\Message\ResponseInterface; | |
class EffectiveUrlMiddleware | |
{ | |
/** | |
* @var Callable |
This file contains hidden or 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 | |
/** | |
* Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended | |
* to the end of the array. | |
* | |
* @param array $array | |
* @param string $key | |
* @param array $new | |
* |
This file contains hidden or 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 | |
/** | |
* Method to generate random date between two dates | |
* @param $sStartDate | |
* @param $sEndDate | |
* @param string $sFormat | |
* @return bool|string | |
*/ | |
function randomDate($sStartDate, $sEndDate, $sFormat = 'Y-m-d H:i:s') | |
{ |
OlderNewer