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 / Home.jsx
Last active February 19, 2026 15:49
import { useEffect, useState } from "react";
import BlogList from "./BlogList";
import useFetch from "./useFetch";
const Home = () => {
const { error, isPending, data: blogs } = useFetch('http://localhost:8000/blogs')
return (
<div className="home">
{ error && <div>{ error }</div> }
import { useState } from "react";
function Cart() {
const [cart, setCart] = useState({
items: [],
total: 0,
discount: null,
isLoading: false,
});
@Kcko
Kcko / index.txt
Last active February 14, 2026 16:14
https://jsbin.com/qiyeriziyi/edit?html,css,output
https://jsbin.com/jewegaseyo/edit?html,css,output
https://jsbin.com/cawipexoma/edit?html,css,output
.toast {
--base-toast-color: hsl(226, 87%, 56%);
color: oklch(from var(--toast-color) 25% c h);
border: 2px solid var(--toast-color);
background: oklch(from var(--toast-color) 90% calc(c / 2) h);
box-shadow: 0 12px 12px -8px oklch(from var(--toast-color) l c h / 0.325);
}
.oklch {
[data-toast="info"] {
@Kcko
Kcko / index.css
Last active January 6, 2026 08:57
/*
https://jsbin.com/setohiqiwe/edit?html,css,output
*/
:root {
--color: red;
}
.a, .b, .c {
margin: 1rem;
@Kcko
Kcko / index.php
Last active November 28, 2025 09:50
<?php
$regex1 = '/(\d+) \1/'; // Backreference
$regex2 = '/(\d+) (?1)/'; // Subroutine
100 100 // ✅ only backreference
100 200 // ✅ both!
// https://github.com/Hamz-a/php-regex-best-practices/blob/master/07%20Writing%20modular%20regexes.md
// useFormHandler.js
import { ref } from 'vue'
export function useFormHandler(initialData = {}) {
const formData = ref({ ...initialData })
const errors = ref({})
const validate = () => {
errors.value = {}
Object.keys(formData.value).forEach(key => {
if (!formData.value[key]) errors.value[key] = 'Required'
https://jsbin.com/qonusuciru/6/edit?html,css,output