Skip to content

Instantly share code, notes, and snippets.

@smart-onion
smart-onion / Program.cs
Created August 20, 2025 08:53
ASP.NET HW5 Minimal API
using WebApplication1.Middlewares;
using WebApplication1.Model;
using WebApplication1.Services;
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("upload/image", async (context) =>
@smart-onion
smart-onion / Program.cs
Created July 18, 2025 10:43
ASP.NET HW2
// Program.cs
using hw1;
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
var users = new List<User>();
app.UseStaticFiles();
@smart-onion
smart-onion / program.cs
Created July 14, 2025 17:44
asp.net lesson1
using System.Text;
var builder = WebApplication.CreateBuilder(args);
var persons = new List<Person>
{
new Person("Jon", "Smith", "jon@mail.com", 20, "1234567890"),
new Person("Alex", "Mart", "Alex@mail.com", 18, "1234567890"),
new Person("May", "Doe", "May@mail.com", 20, "1234567890"),
new Person("Jon", "Smith", "Jon@mail.com", 20, "1234567890"),
@smart-onion
smart-onion / hw.js
Created May 31, 2025 14:40
Promises JS11
// task 1
function createOrder(orderId){
return new Promise((resolve, reject) => {
setTimeout(() => {
let rand = Math.random() > 0.3;
if(rand){ resolve(orderId); }
else(reject(`Order ${orderId} was not created`));
console.log("Creating order:" + orderId);
}, 1000)
// task 1
function onError(error){
console.log(error)
}
function onSuccess(result){
console.log(result)
}
function devider(a,b,onSuccess,onError){
if (b === 0) {
onError("Zero division error")
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<link rel="stylesheet" href="css/style.css">
<meta name="description" content="">
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<link rel="stylesheet" href="css/style.css">
<meta name="description" content="">
// Task 1
function randomNumber(){
let div = document.createElement('div');
let text = document.createElement('p');
let h1 = document.createElement('h1');
let btn = document.createElement('button');
text.textContent = "Random number";
h1.textContent = "Number";
// Task 1
function insertTable(){
let table = document.createElement("table");
table.style.border = "1px solid black";
table.style.borderCollapse = "collapse";
for(let i = 0; i < 10; i++) {
let tr = document.createElement("tr");
tr.style.border = "1px solid black";
class HtmlElement {
#tagOpen;
#tagClose;
constructor(name, paired = true) {
this.name = name;
this.paired = paired;
this.textContent = "";
this.children = [];
this.attributes = [];