Skip to content

Instantly share code, notes, and snippets.

View Kcko's full-sized avatar
🦜
fly like a bird ...

Roman Janko Kcko

🦜
fly like a bird ...
View GitHub Profile
@Kcko
Kcko / tricks.js
Last active September 30, 2025 10:30
// https://medium.com/@ThinkingLoop/12-dom-tricks-no-libraries-required-61268e398c50
// 1) Query once, act many
const $ = (sel, root = document) => root.querySelector(sel);
const $$ = (sel, root = document) => [...root.querySelectorAll(sel)];
const app = $('#app');
const buttons = $$('.action', app);
buttons.forEach(btn => btn.addEventListener('click', onAction));
@Kcko
Kcko / layers.css
Last active September 19, 2025 06:43
/* 1. Define the order of all layers */
@layer reset, base, library, components, utilities, overrides;
/* 2. Place different styles into corresponding layers */
/* reset.css or normalize.css */
@layer reset {
/* ...reset the browser's default styles... */
* { box-sizing: border-box; }
}
@Kcko
Kcko / index.html
Last active September 18, 2025 13:02
<!DOCTYPE html>
<html lang="cs">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>SVG Mask Test</title>
<style>
.container {
display: flex;
gap: 20px;
<!--
https://jsbin.com/tuticinojo/1/edit?html,css,output
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Pure CSS Interactions Demo</title>
<style>
@Kcko
Kcko / index.html
Last active September 13, 2025 06:56
<!--
https://jsbin.com/kiliyineca/2/edit?html,css,output
-->
<!-- /// 1 /// -->
<!-- .btn -->
<div class="btn" style="--status: success">Success</div>
/* works in one direction, if both direction is needed, we need to use
@starting-style for second direction, @see: https://www.youtube.com/shorts/xVt8Foa2u7I (Kevin Powell)
/* toggle - two 2 , starting-style needed */
/* https://jsbin.com/sokazavera/edit?html,css,output */
.txt {
background-color: #eee;
padding: 20px;
margin-top: 15px;
@Kcko
Kcko / api.ts
Last active July 19, 2025 18:56
// plugins/api.ts
export default defineNuxtPlugin((nuxtApp) => {
const api = $fetch.create({
baseURL: 'https://api.example.com',
onRequest({ options }) {
options.headers.set('Authorization', 'Bearer your-token');
},
});
return {
@Kcko
Kcko / ex.js
Last active July 11, 2025 07:25
// index.js
export * as MathUtils from "./math.js";
export * as StringUtils from "./string-utils.js";
// Usage:
// import { MathUtils, StringUtils } from './index.js';
_
<!-- 1 -->
<component
v-if="transport?.image"
:is="typeof transport.image === 'object' ? 'aw-img' : 'img'"
v-bind="
typeof transport.image === 'object'
? { image: transport.image, size: 'eop-icon', style: 'max-width: 40px' }
: { src: transport.image, size: 'eop-icon', style: 'max-width: 40px' }
"
/>