This file contains hidden or 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
var builder = WebApplication.CreateBuilder(args); | |
var app = builder.Build(); | |
app.MapPost("/upload/{filename}", async (HttpRequest request, string filename, IWebHostEnvironment env) => | |
{ | |
if (!request.ContentType?.StartsWith("image/") == true) | |
return Results.BadRequest(); | |
var uploads = Path.Combine(env.WebRootPath ?? env.ContentRootPath, "uploads"); | |
if (!Directory.Exists(uploads)) |
This file contains hidden or 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
namespace DZ3 | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
var builder = WebApplication.CreateBuilder(args); | |
builder.Services.AddControllers(); | |
var app = builder.Build(); |
This file contains hidden or 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 createOrder(orderId) { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
const success = true; | |
console.log(`order created: ${orderId}`); | |
if (success) resolve(orderId); | |
else reject("Error creating order"); | |
}, 1000); | |
}); |
This file contains hidden or 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 divide(a, b, onSuccess, onError) { | |
if(b === 0) { | |
return onError(new Error("Divide by zero is restricted.")); | |
} | |
else { | |
return onSuccess(a / b); | |
} | |
} |
This file contains hidden or 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 input = document.querySelector("input"); | |
input.addEventListener("keydown", function (event) { | |
if(event.key >= "0" && event.key <= "9") { | |
event.preventDefault(); | |
} | |
}); |
This file contains hidden or 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
//----------------------------------------------------------------------- 111 | |
// const target = document.querySelector(".insert-here"); | |
// | |
// const table = document.createElement("table"); | |
// | |
// const rows = 3; | |
// const cells = 3; | |
// | |
// for (let i = 0; i < rows; i++) { |
This file contains hidden or 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
class Product { | |
constructor(id, name, price, description) { | |
this.id = id; | |
this.name = name; | |
this.price = price; | |
this.description = description; | |
} | |
} | |
class ProductCatalog { |
This file contains hidden or 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
class Printmachine { | |
constructor(size, color, fontFamily) { | |
this.fontSize = size; | |
this.color = color; | |
this.fontFamily = fontFamily; | |
} | |
print(string) { | |
const element = document.createElement("div"); |
This file contains hidden or 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
//------------------------------------------------ Class | |
class Point { | |
constructor(x, y) { | |
this.x = x; | |
this.y = y; | |
} | |
} | |
class Rectangle { | |
constructor(a, b) { |
This file contains hidden or 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
//----------------------------------------111 1 | |
const comparaison = (a, b) => { | |
if (a < b) return -1; | |
if (a > b) return 1; | |
return 0; | |
} | |
//-----------------------------------------222 3 | |
const stringSum = (...numbers) => numbers.reduce((a, x) => a + x, 0).toString(); |
NewerOlder