Skip to content

Instantly share code, notes, and snippets.

View sunmeat's full-sized avatar
🐈
MEOW

Oleksandr Zahoruiko sunmeat

🐈
MEOW
View GitHub Profile
@SomeNiceCode
SomeNiceCode / app.js
Created July 1, 2025 20:00
Forms Validation JS
document.getElementById("registrationForm").addEventListener("submit", function (e) {
e.preventDefault();
const email = document.getElementById("email").value.trim();
const username = document.getElementById("username").value.trim();
const password = document.getElementById("password").value;
const errorMsg = document.getElementById("errorMsg");
errorMsg.textContent = "";
if (!email.includes("@")) {
@SomeNiceCode
SomeNiceCode / app.js
Created July 1, 2025 19:21
Dz events
const images = [
"https://bigfoto.name/uploads/posts/2022-01/1641988718_10-bigfoto-name-p-polirovannii-beton-v-interere-22.jpg",
"https://tse2.mm.bing.net/th/id/OIP.GhCdwqjnQ_4lDbolnBlTRgHaEK?rs=1&pid=ImgDetMain&o=7&rm=3",
"https://klike.net/uploads/posts/2019-11/1574510006_2.jpg"
];
let currentIndex = 0;
const imgElement = document.getElementById("gallery-image");
const prevButton = document.getElementById("prev-button");
#include <iostream>
#include <windows.h>
#include <algorithm>
#include <ctime>
using namespace std;
class Vector {
unsigned int capacity = 10;
int* data = new int[capacity];
unsigned int length = 0;
#include <iostream>
#include <string>
using namespace std;
// Электрочайник
class Electrochainik {
private:
string brand;
float volume;
int* temps;
@sunmeat
sunmeat / task.txt
Created June 21, 2025 10:42
завдання для групи СПР411 на тему структура даних вектор та перевантаження операторів операцій
в код вектора з заняття https://gist.github.com/sunmeat/e1888d2d87ad112e3716809c22d467a7
// додати методи:
// RemoveFromFront() - метод видаляє значення по індексу 0
// Insert(value, index) - метод який вставляє значення по індексу без втрати елемента по індексу
// RemoveByIndex(index) - метод видаляє елемент по індесу
// RemoveByValue(value) - метод видаляє всі вказані значення з масиву
// Sort() - метод сортує масив за зростанням
// Reverse() - метод змінює порядок слідуання елементів на протилежний
// Shuffle() - метод випадковим чином перемішує елементи в масиві
@sunmeat
sunmeat / main.cpp
Created June 21, 2025 10:39
поточна версія кастомного класу вектор
#include <iostream>
#include <windows.h>
#include <algorithm>
using namespace std;
class Vector {
unsigned int capacity = 10; // при створенні масиву, він одразу для себе робить запас пам'яті на 10 елементів
int* data = new int[capacity];
unsigned int length = 0; // фактична (реальна) кількість елементів, присутніх у масиві
@sunmeat
sunmeat / task.txt
Created June 19, 2025 16:48
завдання до класу ерей
використавши саме приклад з уроку за посиланням https://gist.github.com/sunmeat/74becfb24bd3d64314f3bb5e5deb15dd
переписати в класі наступні методи:
- RemoveFromBack
- Print (додати інформацію про ленс та кепесіті)
- конструктор копіювання
дописати наступні методи:
- RemoveFromFront(); // видаляє елемент з початку динамічного масиву
- Insert(value, index); // вставляє нове значення по вказанному індексу (з перевіркою на вихід за межі масиву, існуючий по цьому індексу елемент не має переписуватися)
- RemoveByIndex(index); // видалити один елемент по вказаному індексу (з перевіркою на вихід за межі масиву та присутність там елементів взагалі)
@sunmeat
sunmeat / main.cpp
Created June 19, 2025 16:42
приклад з уроку (клас ерей)
#include <iostream>
#include <windows.h>
#include <algorithm>
using namespace std;
class Array {
unsigned int capacity = 10; // при створенні масиву, він одразу для себе робить запас пам'яті на 10 елементів
int* data = new int[capacity];
unsigned int length = 0; // фактична (реальна) кількість елементів, присутніх у масиві
#include <iostream>
#include <string>
using namespace std;
// Электрочайник
class Electrochainik {
private:
string brand;
float volume;
@SomeNiceCode
SomeNiceCode / app.js
Created June 16, 2025 14:47
OOP JS 2
class AbstractProduct {
constructor(id, name, price, category) {
if (new.target === AbstractProduct) {
throw new Error("AbstractProduct — это абстрактный класс.");
}
this.id = id;
this.name = name;
this.price = price;
this.category = category;
}