Skip to content

Instantly share code, notes, and snippets.

View revilon1991's full-sized avatar
🐈
work hard, play hard

Evgenii Kuznetsov revilon1991

🐈
work hard, play hard
View GitHub Profile
@revilon1991
revilon1991 / gist:b736d80c6e3b14b4c41bd17ac3ca06d5
Last active August 14, 2019 19:56
Alcohol toy collection

Alcohol toy collection

Водка

"Чистые Росы", 0.05l "Finlandia", 0.05l

Ликёр

@revilon1991
revilon1991 / main.m
Last active July 28, 2021 22:33
How open a modal window and save chosen path to bookmarks on osx [objective c]
NSOpenPanel *openPanel = [[NSOpenPanel alloc] init];
[openPanel setCanChooseFiles:NO];
[openPanel setCanChooseDirectories:YES];
[openPanel setCanCreateDirectories:YES];
[openPanel beginWithCompletionHandler:^(NSInteger result) {
if (result == NSModalResponseOK) {
for (NSURL *fileURL in [openPanel URLs]) {
NSString *filename = [fileURL path];
[[NSUserDefaults standardUserDefaults] setObject:filename forKey:@"your_key_for_bookmark"];
@revilon1991
revilon1991 / worklog.php
Created January 21, 2022 16:37
Jira worklog with php
#!/usr/bin/env php
<?php
const JIRA_HOST = ''; // ex. github.atlassian.net
const USERNAME = ''; // ex. iivanov@github.com
const TOKEN = ''; // from https://id.atlassian.com/manage-profile/security/api-tokens
[, $task, $time] = $argv;
$ch = curl_init();
@revilon1991
revilon1991 / RESTAPI.md
Last active July 6, 2022 07:44
REST API Recommendation

REST API

Схема доставки ресурса от клиента до бекенда.

  • В колонке result учитывается состояние модели полученное хендлером (не БД)
  • Required - означает, что поле должно фигурировать в запросе, иначе ошибка.
  • Default - если значение по умолчанию не было задано, оно рассматривается как null. api

Определения параметров в GET запросах

Есть три основных параметра, которые передаются в формате массива/значения

<?php
// here installed https://github.com/dragonmantank/cron-expression
require_once '/Users/ekuznetsov/projects/pamyatki/vendor/autoload.php';
// current time is 2022-08-18 18:30:30
date_default_timezone_set('Europe/Moscow');
$c = new \Cron\CronExpression('0 0 1 * *');
@revilon1991
revilon1991 / restartTouchPad.sh
Last active September 2, 2022 15:36
When you macbook tuchpad is broken and does'nt work multi touch
launchctl stop com.apple.Dock.agent
@revilon1991
revilon1991 / AppController.php
Created January 9, 2023 20:06
CRUD symfony form with ManyToMany relations
<?php
declare(strict_types=1);
namespace App\Controller;
use App\Entity\Article;
use App\Entity\ArticleHasTag;
use App\Entity\Tag;
use Doctrine\Common\Collections\ArrayCollection;
@revilon1991
revilon1991 / mysql_lock.md
Last active November 6, 2023 17:07
MySQL InnoDB synthetic lock

Table-level lock type compatibility is summarized in the following matrix

X IX S IS
X Conflict Conflict Conflict Conflict
IX Conflict Compatible Conflict Compatible
S Conflict Conflict Compatible Compatible
IS Conflict Compatible Compatible Compatible
  • A shared (S) lock permits the transaction that holds the lock to read a row.
  • An exclusive (X) lock permits the transaction that holds the lock to update or delete a row.
  • An intention shared lock (IS) indicates that a transaction intends to set a shared lock on individual rows in a table.
# Majority Grouping
select concat(repeat('*', floor(a.trCount / 100))) as bar,
floor(avg(a.trCount)) as avgTrCnt,
max(a.trCount) as maxTrCnt,
min(a.trCount) as minTrCnt,
count(*) as accountCnt
from Account a
where 1
and a.trCount > 10
group by bar
@revilon1991
revilon1991 / gcal_countries.py
Last active July 3, 2024 13:32 — forked from seanblanchfield/gcal_countries.py
Google calendar public holiday names by country
# Complete mapping of ISO 3166 2-letter country codes to descriptions used in Google calendar URLs, accurate as of 29 July 2021.
iso_to_gcal_description = {
"ad": "ad",
"ae": "ae",
"af": "af",
"ag": "ag",
"ai": "ai",
"al": "al",
"am": "am",