Skip to content

Instantly share code, notes, and snippets.

View artyom-ivanov's full-sized avatar
🤘
Code, UX, rocknroll

Artyom Ivanov artyom-ivanov

🤘
Code, UX, rocknroll
View GitHub Profile
-- СОЗДАЕМ ТАБЛИЦЫ
-- Таблица "Authors" (Авторы)
CREATE TABLE Authors (
author_id SERIAL PRIMARY KEY,
first_name VARCHAR(100) NOT NULL,
last_name VARCHAR(100) NOT NULL,
birthdate DATE,
country VARCHAR(100)
);

The Composable Architecture

CI Slack

Composable Architecture (сокращенно TCA) - это библиотека для создания приложений в последовательном и понятном виде, с учетом композиции, тестирования и эргономики. Ее можно использовать

@artyom-ivanov
artyom-ivanov / youtubeParser.swift
Last active May 23, 2024 09:44
Parse video ids from youtube without API on Swift
func getVideosFor(query: String) -> Set<String> {
let safeQuery = query.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!
let myURLString = "https://www.youtube.com/results?search_query=\(safeQuery)"
guard let myURL = URL(string: myURLString) else {
print("Error: \(myURLString) doesn't seem to be a valid URL")
return Set()
}
do {
@artyom-ivanov
artyom-ivanov / appearance.ts
Created February 1, 2022 19:46
Detect text color for good contrast with background
export function textColorForBackground(hexColor: string): 'white' | 'black' {
let hex = hexColor.replace('#', '');
let r = parseInt(hex.substr(0, 2), 16);
let g = parseInt(hex.substr(2, 2), 16);
let b = parseInt(hex.substr(4, 2), 16);
let brightness = (r * 299 + g * 587 + b * 114) / 1000;
return brightness > 155 ? 'black' : 'white';
}