Skip to content

Instantly share code, notes, and snippets.

View ivanitch's full-sized avatar

`𝕊𝕖𝕣𝕘𝕖𝕪 𝕀𝕧𝕒𝕟𝕠𝕧 ivanitch

View GitHub Profile
@ivanitch
ivanitch / emoji.md
Last active January 17, 2025 08:02
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@ivanitch
ivanitch / markdown.md
Created March 4, 2024 09:35
Шпаргалка по Markdown
@ivanitch
ivanitch / json_sort.php
Created March 8, 2023 11:52
json_sort.php
<?php
function json_sort(string $json, bool $objects=true, bool $arrays=false): string
{
// uses a recursive lambda
$order = null;
$order = function ($json) use (&$order, $objects, $arrays) {
// sort sub-trees
foreach ($json as $key => $value) {
if (is_array($value) || is_object($value)) {
$tmpFile = $sourceFileName;
$fileName = $this->csvFilePath . DIRECTORY_SEPARATOR . $this->csvFileName;
$command = 'xls2csv -c\; -q0 -s cp1251 -d cp1251 ' . $tmpFile . ' > ' . $fileName;
exec($command);
unlink($tmpFile);
protected function getFilename(UploadedFile $file): string
{
$hash = sha1_file($file->tempName);
$name = substr_replace($hash, '/', 3, 0);
$name = substr_replace($name, '/', 7, 0);
return $name . DIRECTORY_SEPARATOR . $file->extension;
}
@ivanitch
ivanitch / remove_idea_etc
Created July 13, 2022 09:35
Как удалить любую папку, в т.ч. и .idea, и лишние файлы из Git
Как удалить любую папку, в т.ч. и .idea, и лишние файлы из Git
Создаем файл .gitignore в корне репозитария с содержимым:
.idea
logs/
------------------------------------------------------------------
Подробнее можно ознакомиться на странице: https://git-scm.com/book/ru/v1/Основы-Git-Запись-изменений-в-репозиторий
Удаляем ненужные папки и файлы при синхронизации в Git репозиторий
@ivanitch
ivanitch / raec_debug.php
Last active April 28, 2023 14:01
Raec debug runtime
$dataArr = [
0 => 'EF001391',
1 => 'EF000228',
2 => 'EF000227',
];
$debug_log = Yii::app()->runtimePath . '/DebugExport.log';
$dataErr = print_r($dataArr, true);
file_put_contents($debug_log, $dataErr . PHP_EOL, FILE_APPEND);
================================
@ivanitch
ivanitch / xmlToArray.php
Created May 26, 2022 10:19
Преобразование SimpleXMLElement в массив
/**
* Преобразует SimpleXMLElement в array
* @param SimpleXMLElement $xml
* @return array
*/
private static function xmlToArray($xml) {
$xml = (array) $xml;
if(empty($xml)) {
return null;
@ivanitch
ivanitch / nginx.conf
Created April 29, 2022 01:20 — forked from Kison/nginx.conf
Nginnx config for Yii 2 Advanced App Template (subdomains)
# frontend
server {
listen 80;
server_name yii2.lo;
server_tokens off;
client_max_body_size 128M;
charset utf-8;
access_log /var/log/nginx/yii2-access.log main buffer=50k;
@ivanitch
ivanitch / remove-all-from-docker.md
Last active September 30, 2022 00:25 — forked from tomasevich/remove-all-from-docker.md
Удалить/очистить все данные Докера (контейнеры, образы, тома и сети)

Остановить локальные сервисы!

sudo systemctl stop nginx

sudo systemctl stop mysql

sudo chown $USER:$USER /var/run/docker.sock

docker stop $(docker ps -qa)