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 | |
/** | |
* \cURLWrapper is helper class that allows to send GET/POST requests, upload files | |
* | |
* @package cURLWrapper | |
* @author Maxim 'Cra3y' | |
* @license LGPL | |
* @link https://gist.github.com/max-dark/4c08575bcff9d4c6ea926cd8c9813c01 | |
* | |
* Date: 12.07.16 |
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 | |
/** | |
* Функция-генератор для однообразного перебора загруженных файлов | |
* Системные требования | |
* PHP >= 5.5.0 | |
* @link http://php.net/manual/ru/language.generators.php | |
*/ | |
/** | |
* Генератор для однообразного перебора загруженных файлов |
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 | |
/** | |
* split utf-8 string to array of chars | |
* @param string $str | |
* @return array | |
*/ | |
function chars_of($str) { | |
return preg_split('/(?<!^)(?!$)/u', $str); | |
} |
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
/* | |
build: g++ -std=c++11 pugi_test.cpp -o ptest -lpugixml | |
Used docs: | |
- (XPath select)[http://pugixml.org/docs/manual.html#xpath.select] | |
- (XPath examples)[https://msdn.microsoft.com/ru-ru/library/ms256086(v=vs.120).aspx] | |
*/ | |
#include <string> | |
#include <iostream> | |
#include <pugixml.hpp> |
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
#include <functional> | |
#include <algorithm> | |
#include <iostream> | |
#include <utility> | |
#include <string> | |
#include <vector> | |
#include <assert.h> | |
template <class type> | |
using compare = std::function<bool(const type&, const type&)>; |
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
#include <iostream> | |
#include <locale> | |
#include <string> | |
#include <cstdint> | |
#include <limits> | |
static_assert(sizeof(char) == sizeof(uint8_t), "char != 8 bit"); | |
constexpr uint64_t make_cs(const char str[], std::size_t cnt, std::size_t n) noexcept { | |
return ( |
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 | |
/** | |
* @file https://gist.github.com/max-dark/f39028cc106ed32e8ce1b55a11643b43 | |
*/ | |
define('ROOT_NODE', null); | |
/** | |
* восстанавливает дерево по таблице связей | |
* @param array $data |
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
#include <cstdlib> | |
#include <cwchar> | |
#include <string> | |
#include <memory> | |
std::wstring to_wstring(const char* str) { | |
std::unique_ptr<wchar_t[]> tmp = nullptr; | |
size_t sz, len; | |
len = mbstowcs(nullptr, str, 0); | |
sz = len + 1; |
NewerOlder