Skip to content

Instantly share code, notes, and snippets.

View Imperat's full-sized avatar

Mikhail Leliakin Imperat

View GitHub Profile
const EDITABLE = 2;
const VISIBLE = 1;
const HIDDEN = 0;
function userHasPermission('permissionName', EDITABLE) { … }
#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
using namespace std;
template <typename RandomIt>
void MergeSort(RandomIt range_begin, RandomIt range_end) {
if (next(range_begin) == range_end) {
function copy(str){
let tmp = document.createElement('INPUT'), // Создаём новый текстовой input
focus = document.activeElement; // Получаем ссылку на элемент в фокусе (чтобы не терять фокус)
tmp.value = str; // Временному input вставляем текст для копирования
document.body.appendChild(tmp); // Вставляем input в DOM
tmp.select(); // Выделяем весь текст в input
document.execCommand('copy'); // Магия! Копирует в буфер выделенный текст (см. команду выше)
document.body.removeChild(tmp); // Удаляем временный input
@Imperat
Imperat / checkBiraplate.cpp
Created December 22, 2017 19:00
Проверка графа на двудольность и Алгоритм Диница
#include <iostream>
#include <queue>
#define V 4
using namespace std;
bool isBipartite(int G[][V], int src) {
int colorArr[V];
for (int i = 0; i < V; ++i)
colorArr[i] = -1;
colorArr[src] = 1;
def decorator(func):
def result(*args, **kwargs):
print ('log function!', func)
return func(*args, **kwargs)
return result
def regenerate(d):
new_d = {}
for i, j in d.items():
const details = [40, 20, 31, 79, 100];
const templates = [
[10, 0, 0, 0, 20],
[5, 5, 0, 5, 5],
[3, 6, 8, 5, 0],
[2, 0, 0, 0, 1],
]
const maxTemplates = [4, 8, 1, 10];
var not = window.Notification || window.mozNotification || window.webkitNotification;
Notification.requestPermission(p => {});
list = [
"Слава выбросил своих кеды!",
"Пыльник в наших сердцах!",
"Между первой и второй - вишнёвая",
"Будем играть что ль первого января?",
"Спартак - чемпик",
"Я за сток сити, блять!",
"Максим Кривопатря - новый администратор АДФС"
const o = {
ras: 2,
dva: 3,
tri: 4,
};
const b = { ras: 3, dva: 5, };
console.log(o);
console.log(b);
import argparse
import codecs
from itertools import cycle
parser = argparse.ArgumentParser(description='XOR en/decrypter')
parser.add_argument('--key', type=str, nargs=1, required=True)
parser.add_argument('--file', type=str, nargs=1, required=True)
parser.add_argument('--decrypt', required=False, action='store_true')
# Syntax analyser
# Операторы
# var id{,id}*
# val id = выражение
# fun id (id{,id}*) = выражение
# Выражения
# let операторы in выражение end
# if выражение then выражение else выражение
# операция выражение