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
<?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}`);
<template>
<TheBase :state="state" />
</template>
<script setup>
import { ref } from 'vue'
import TheBase from './TheBase.vue'
@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;
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('fade-in');
}
});
});
document.querySelectorAll('.section').forEach(section => {
observer.observe(section);

Vue.js Media Transformer - Všechny varianty implementace

1. Composable (Vue 3 Composition API)

// composables/useMediaObjects.js
export function useMediaObjects() {
  const transformMediaObjects = (productGallery, productVideos) => {
    const finalObjects = []
// https://play.vuejs.org/#eNqdVE2P2jAQ/SsjXwCJBlXtic2itohDK7W72u7Rl5BMwItjW7bDUiH+e8d2krJbRNXlgOyZN1/Pb3Jkn43J9i2yOctdaYXx4NC3ZsGVaIy2Ho5gsZ5C6/ARGyMLjw9YwwlqqxsYUehogH7XVSE7RzaLt5CbAKVWzkMTLCH69lW68Si6RpMbrvJZ6oM6oIvvQHS7LywqD/nawoyut3//Bl++br3XCj6VUpS7W876ypk2qMYTzhZ3dEgN57OEvhpXSu0wBi7D6UJkqNz9b7suEh9EX5+Js+SYDWOxKfOO2KnFJntyWtE7HLkC4KzUjRES7Z3xgtjjbA7RE3yFlPr5W7R52+K0t5dbLHcX7E/uEGyc3Vt0aPfI2eDzhd2gT+7Vzx94oPPgpK5bSegrzgd0WrahxwT70qqK2j7DxW6/RokItXl0q4NH5fqhQqMBeYp4zkgwyyuj/2n3Q/YxxnF1IhYHtQUln6kGYLkVsoJxBEzeJp//VM0/xVKJPezfua1+JrRwIStJo5SFc2SI8KVWxBINukgq6u75jGJfSijuyZXdfbWr/TKmsrSKBBnXhXQ44apuVRk4hzRxoj0hs30hWyR8eDAg0s/Q3cAX4TF1wnNVYS0Urg4m4I+xyjRFw4nKv9x953/J9ITZOSW9FkxRVaSnOby32NzAuih3G6tJfXMwsm3oUxJQDelFqA7U6YXKxNTs9BvEAbCg
// Parent
<script setup>
import { ref, useTemplateRef } from 'vue'
import Modal from './Modal.vue'
const modalRef = useTemplateRef('modal');
</script>
<template>