Skip to content

Instantly share code, notes, and snippets.

View Krasipeace's full-sized avatar
🖖

Krasimir Dramaliev Krasipeace

🖖
  • Bulgaria
  • 14:38 (UTC +03:00)
View GitHub Profile
@Krasipeace
Krasipeace / ibanRegexCollection.txt
Created May 31, 2024 19:20
IBAN collection of regex validators
Afghanistan: AF[a-zA-Z0-9]{2}\s?([0-9]{4}\s?){5}\s?
Albania: AL[a-zA-Z0-9]{2}\s?([0-9]{4}\s?){2}([a-zA-Z0-9]{4}\s?){4}\s?
Algeria: DZ[a-zA-Z0-9]{2}\s?([0-9]{4}\s?){4}\s?
Andorra: AD[a-zA-Z0-9]{2}\s?([0-9]{4}\s?){2}([a-zA-Z0-9]{4}\s?){3}\s?
Angola: AO[a-zA-Z0-9]{2}\s?([0-9]{4}\s?){5}\s?
Anguilla: AI[a-zA-Z0-9]{2}\s?([0-9]{4}\s?){4}\s?
Antarctica: AQ[a-zA-Z0-9]{2}\s?([0-9]{4}\s?){4}\s?
Antigua and Barbuda: AG[a-zA-Z0-9]{2}\s?([0-9]{4}\s?){4}\s?
Argentina: AR[a-zA-Z0-9]{2}\s?([0-9]{4}\s?){4}\s?
Armenia: AM[a-zA-Z0-9]{2}\s?([0-9]{4}\s?){4}\s?
@Krasipeace
Krasipeace / backToTheTop.js
Created April 25, 2024 17:27
Animated scroll-up to the top of the page.
const backToTopButton = document.getElementById("btn-back-to-top");
window.onscroll = function () {
scrollFunction()
};
function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
backToTopButton.style.display = "block";
} else {
@Krasipeace
Krasipeace / azureCommands.txt
Last active February 5, 2024 13:47
DevOps CLI commands
docker login azure -- логин през конзолата в азур
docker context create aci nginxacicontext -- създаване на nginx контекст(билд-имидж) през конзолата, където `nginxacicontext` е името на контекста, aci е запазена дума за създаване на контекста
docker context ls -- списък на контекстите
docker context use nginxacicontext -- използва контекст с име `nginxacicontext`
docker context ls -- работещият контекст в списъка има `*` след името си
docker logout -- поради странни обстоятелства, не трябва да сме логнати в докерхъб, за да сработи следващата команда.
docker run -d -p 80:80 nginxdemos/hello -- вдигаме имидж nginxdemos/hello
docker context use default -- използва контекста по подразбиране
docker context rm nginxacicontext -- изтрива nginxacicontext
@Krasipeace
Krasipeace / IterativeBinarySearch.cs
Last active January 6, 2024 14:28
Primitive Binary Search (cs, js, php)
public int BinarySearchIterative(int[] array, int target)
{
int left = 0;
int right = array.Length - 1;
while (left <= right)
{
int mid = left + (right - left) / 2;
if (array[mid] == target)
@Krasipeace
Krasipeace / Trie.cs
Last active January 4, 2024 17:28
Implementation of Trie - Prefix Tree
using System.Text;
public class Trie
{
private TrieNode root;
public Trie()
{
this.root = new TrieNode();
}
@Krasipeace
Krasipeace / priorityQueue.cs
Last active January 1, 2024 14:20
Priority Queue Implementation
public class PriorityQueue<T>
{
private List<T> heap;
private IComparer<T> comparer;
public PriorityQueue()
{
heap = new List<T>();
comparer = Comparer<T>.Default;
}
@Krasipeace
Krasipeace / folderCreator.js
Created November 24, 2023 23:10
JS script for creating many many folders
// tested and working correcty with Node.js
let fs = require('fs');
let path = require('path');
let dir = __dirname; // `current directory` global variable
for (let i = 1; i <= 480; i++) {
let folderName = String(i).padStart(3, '0');
let folderPath = path.join(dir, folderName);
if (!fs.existsSync(folderPath)) {
@Krasipeace
Krasipeace / animatedBackground.html
Created November 24, 2023 19:13
VideoToBackgroundInHtml
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Animated Background</title>
</head>
<body>
@Krasipeace
Krasipeace / buttons.css
Last active September 27, 2023 10:59
buttons.css
body {
background-color: lightgray;
color: black;
padding: 50px;
}
a {
text-decoration: none;
}
@Krasipeace
Krasipeace / button.cshtml
Created August 31, 2023 14:00
toTopButton(slow animation)
<button onclick="toTopFunction()" id="btn-back-to-top" title="Go to top">☝️</button>