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
1. users. Таблица содержит информацию о пользователях | |
- user_id (integer). Уникальный идентификатор пользователя | |
- name (char). Имя пользователя | |
- email (char). Email пользователя | |
2. statuses. Таблица содержит информацию о статусах задач. |
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
const getFeatureCheckboxs = (feature) => { | |
const { offers, type } = feature; | |
return offers.reduce((res, offer, i) => { | |
return res + ` | |
<input id="event-offer-${type}-${i}" type="checkbox" name="event-offer-${type}"> | |
<label for="event-offer-${type}-${i}">${offer.title}</label> | |
`; | |
}, '') | |
}; |
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
import Chart from "chart.js"; | |
import ChartDataLabels from "chartjs-plugin-datalabels"; | |
const moneyCtx = document.querySelector('.money-chart'); | |
const moneyChart = new Chart(moneyCtx, { | |
plugins: [ChartDataLabels], | |
type: `horizontalBar`, | |
data: { | |
labels: [`✈️FLY`, `🏨 STAY`, `🚕 TAXI`, `🏛️ LOOK`, `🍴 EAT`, `🚗 DRIVE`, `🛳️ SAIL`, `🚂 TRAIN`, `🚌 BUS`], |
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
const leaflet = jest.mock(`leaflet`); | |
const tileLayer = { | |
addTo() { | |
return {}; | |
} | |
}; | |
const marker = { | |
addTo() { |
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
/** | |
* Сначала сравниваем длину строки и определяем строки с максимальной длиной и складываем | |
* в отдельный массив. | |
* После этого классическим образом сортируем строки и получаем максимальный элемент. | |
* Подходит для любого колчиства параметров | |
* | |
* @param args строки для сравнения | |
*/ | |
const solve = (...args) => { | |
if (!args.length) 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
/** | |
* Суть решения: Сначала пробигаемся с начала матрица до конца заполняя левое и верхнее направлевление | |
* для выйграша. Для этого сравниваем текущее и предыдущее значения по этому направлению и проверяем было ли | |
* предыдущее значение выиграшным по этому направлению. Если да, то проверять дальше бессмысленно, то что они | |
* в любом случае будут меньше текущего значения, иначе предверяем следующее число в том же направлении. | |
* | |
* После того как закончим прверять все верхнии и левые значения переходим к нижних правым. Для этого делаем тоже самое | |
* но в обратном направлении. Заодно и складываем сумму. | |
*/ |
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
(function() { | |
var currentFilter = { | |
roomCount: 'any', | |
type: 'any', | |
price: '0' | |
}; // <-- объект который будет храить текущее состояние всех фильтров | |
var filterByRooms = function(offer, roomCount) { | |
if (roomCount === 'any') { | |
return true; // <-- показываем элемент если количество комнат не задано |
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
# Uses python3 | |
# собираем граф из массива | |
def build_graph(arr, fin): | |
graph = {} | |
for node in arr: | |
if not graph.get(node[0]): | |
graph[node[0]] = {} | |
graph[node[0]][node[1]] = node[2] / 100 | |
if not graph.get(node[1]): |
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
def step(mins, n): | |
if n == 1: | |
return 0 | |
if (mins[n] != -1): | |
return mins[n] | |
result = 1 + step(mins, n-1) | |
if (n % 2 == 0): | |
result = min(result, 1 + step(mins, n // 2)) | |
if (n % 3 == 0): |
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
def get_major(items): | |
map = {} | |
major_count = round(len(items) / 2) | |
for item in items: | |
if map.get(item): | |
if map[item] + 1 >= major_count: | |
return item | |
map[item] = map[item] + 1 | |
else: | |
map[item] = 1 |