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 / 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' }
"
/>
<?php
// Pro hesla uživatelů
$hashedPassword = password_hash($userPassword, PASSWORD_DEFAULT);
if (password_verify($inputPassword, $hashedPassword)) {
// přihlášen
}
// Pro bearer tokeny
$token = hash_hmac('sha256', $windowStart, 'secret');
// https://learnvue.co/articles/v-once-v-memo
<script setup>
import { ref } from 'vue'
const subscribers = ref(4000)
const views = ref(10000)
const likes = ref(3000)
</script>
<template>
// https://medium.com/@genildocs/mastering-object-oriented-programming-in-javascript-from-zero-to-hero-c718c3182eba
// Mixin for logging functionality
const LoggerMixin = {
log(message) {
console.log(`[${this.constructor.name}] ${message}`);
},
logError(error) {
console.error(`[${this.constructor.name}] ERROR: ${error}`);
<!--
https://www.youtube.com/watch?v=0L6GXC5jl1I
-->
<script setup>
import { ref, computed, toValue } from 'vue'
function useName(name) {
const changedName = computed(() => toValue(name).toUpperCase())
return {
@Kcko
Kcko / 1.js
Last active June 18, 2025 11:19
// Pattern 1 — Bind Helper
export function S(selector) {
const nodes = document.querySelectorAll(selector);
nodes.forEach(bindAll); // Bind helpers to node(s)
return nodes.length > 1 ? nodes : nodes[0]; // native node(s) returned
}
export function C(tag) {
_
.modal {
/* Hidden state */
display: none;
opacity: 1;
}
.modal.open {
display: block;
/* Regular transition works now */
transition: opacity 300ms;