Skip to content

Instantly share code, notes, and snippets.

View kdankov's full-sized avatar

Konstantin Dankov kdankov

View GitHub Profile
@kdankov
kdankov / tabs.html
Created April 15, 2025 14:05
Semantic Tabs with Details and Summary
<h1>Warp Drive</h1>
<p>A warp drive or a drive enabling space warp is a fictional superluminal (faster than the speed of light) spacecraft propulsion system in many science fiction works, most notably Star Trek, and a subject of ongoing real-life physics research. The general concept of "warp drive" was introduced by John W. Campbell in his 1957 novel Islands of Space and was popularized by the Star Trek series. Its closest real-life equivalent is the Alcubierre drive, a theoretical solution of the field equations of general relativity.</p>
<section class="tabs">
<details name="group" open>
<summary>History and characteristics</summary>
<p>Warp drive, or a drive enabling space warp, is one of several ways of travelling through space found in science fiction. It has been often discussed as being conceptually similar to hyperspace. A warp drive is a device that distorts the shape of the space-time continuum. A spacecraft equipped with a warp drive may travel at speeds greater than that of light by
@kdankov
kdankov / app.js
Created November 27, 2024 22:10
Gem Collection - Task 1 from JS Advanced Exam - 05 April 2023
window.addEventListener("load", solve);
function solve() {
const inputElements = ['gem-name', 'color', 'carats', 'price', 'type'];
const previewEl = document.querySelector('#preview-list');
const collectionEl = document.querySelector('#collection');
function getFormInputsAndValues() {
@kdankov
kdankov / jquery-alias-selector.js
Created November 14, 2024 21:38
Aliases for querySelector(All)
var $ = document.querySelector.bind(document);
var $$ = document.querySelectorAll.bind(document);
Element.prototype.$ = function() {
return this.querySelector.apply(this, arguments);
};
Element.prototype.$$ = function() {
return this.querySelectorAll.apply(this, arguments);
};
@kdankov
kdankov / solution.js
Created November 12, 2024 11:57
Fun with JS
function solve(s, o) {
Object
.entries([...s, ...o].reduce((s, p, i, a) => ( i % 2 === 0 ? { ...s, [p]: (s[p] || 0) + Number(a[i + 1]) } : s), {}))
.forEach(([p, q]) => console.log(`${p} -> ${q}`));
}
@kdankov
kdankov / month-printer.js
Created October 31, 2024 09:59
Month Printer
function solve(num) {
if ( num > 0 && num < 13 ) {
console.log(new Date(2000, num-1).toLocaleString('default', { month: 'long' }));
} else {
console.log('Error!');
}
}
import type { Loader } from 'astro/loaders';
import { z } from 'astro:content'
import type { YouTubeLoaderOptions } from "./types/youtube-loader-options.type.ts";
export function youtubeLoader(options: YouTubeLoaderOptions): Loader {
const url = new URL('https://www.googleapis.com/youtube/v3/search');
url.searchParams.append('key', options.apiKey);
url.searchParams.append('channelId', options.channelId);
@kdankov
kdankov / hide-shorts.css
Created February 15, 2023 15:34
Hide YouTube shorts from Subscriptions feed
ytd-grid-video-renderer:has(*[overlay-style="SHORTS"]) {
display: none;
}
@kdankov
kdankov / podcast.xml
Created January 31, 2023 11:40
Podcast RSS Template for Jekyll
---
---
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xml:lang="{{ site.lang }}">
<channel>
<atom:link href="{{ site.url }}/podcast.rss" rel="self" type="application/rss+xml" />
<title>{{ site.title }}</title>
<link>{{ site.url }}{{ site.baseurl }}</link>
@kdankov
kdankov / List of Fonts
Created November 11, 2022 18:29
Install Nerd Fonts with Homebrew
# Nerd Fonts for your IDE
# https://www.nerdfonts.com/font-downloads
brew tap homebrew/cask-fonts
brew install --cask font-3270-nerd-font
brew install --cask font-fira-mono-nerd-font
brew install --cask font-inconsolata-go-nerd-font
brew install --cask font-inconsolata-lgc-nerd-font
brew install --cask font-inconsolata-nerd-font
brew install --cask font-monofur-nerd-font
@kdankov
kdankov / index.html
Created January 31, 2022 18:29
HTML & CSS Essentials - Introduction - 01
<!DOCTYPE html>
<html>
<head>
<title>My First HTML Document</title>
</head>
<body>
<h1>My First HTML Document</h1>
<p>It is really cool, isn't it?</p>
</body>
</html>