Skip to content

Instantly share code, notes, and snippets.

View YavorK's full-sized avatar
🥥

Yavor Kirov YavorK

🥥
View GitHub Profile
@YavorK
YavorK / Exercise.md
Created November 14, 2025 13:04 — forked from purrarri/Exercise.md
Q2. Breakdown test cases as in cucumber/ gherkin formatting as for assesment : Mention all necessary fields which should be included in a bug.

Q2 Go to https://petstore.octoperf.com/actions/Catalog.action and report at least 3 bugs.

Bug Report in Gherkin/Cucumber Format

This document serves as a bug report in Gherkin/Cucumber format for reporting an identified issue in the system. The bug report follows the structured format of Gherkin to provide clear details about the bug and its expected behavior.

Usage

The bug report is written using the Gherkin syntax, which allows for easy understanding and communication between stakeholders, developers, and testers. Each bug report includes the following information:

@YavorK
YavorK / dump_dd.php
Last active September 1, 2025 10:04
<?php
// standalone implementation of functions similar to Laravel's dd(), dump() etc. functions. just copy and paste this code into any
// enviromnent's config.php or something
// and use dump() and dd() freely
if (!function_exists('dump')) {
/**
* Dump the given variables and continue execution
@YavorK
YavorK / index.html
Created May 9, 2023 18:58 — forked from edofic/index.html
htmx with a "backend" in service worker
<!DOCTYPE html>
<html>
<head>
<title>Hello Page</title>
<script src="https://unpkg.com/[email protected]"></script>
</head>
<body>
<h1>Hello</h1>
@YavorK
YavorK / htmx.min.js
Created May 6, 2023 16:26
Validate HTMX Form on change without losing fields focus and without extra endpoints.
(function(e,t){if(typeof define==="function"&&define.amd){define([],t)}else if(typeof module==="object"&&module.exports){module.exports=t()}else{e.htmx=e.htmx||t()}})(typeof self!=="undefined"?self:this,function(){return function(){"use strict";var z={onLoad:t,process:Tt,on:le,off:ue,trigger:ie,ajax:dr,find:b,findAll:f,closest:d,values:function(e,t){var r=Jt(e,t||"post");return r.values},remove:B,addClass:j,removeClass:n,toggleClass:U,takeClass:V,defineExtension:yr,removeExtension:br,logAll:F,logger:null,config:{historyEnabled:true,historyCacheSize:10,refreshOnHistoryMiss:false,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:20,includeIndicatorStyles:true,indicatorClass:"htmx-indicator",requestClass:"htmx-request",addedClass:"htmx-added",settlingClass:"htmx-settling",swappingClass:"htmx-swapping",allowEval:true,inlineScriptNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:false,timeout:0,wsReconnectDelay:"full-jitter",wsBinaryType:"blob",disableSelector:"[hx-dis
@YavorK
YavorK / template_engine.php
Last active June 1, 2023 17:21
Template engine with fragments.
<?php
/**
* Use
* <?= fragment_start('this_is_my_fragment') ?>
* Fragment content <?= $with_variables_and_stuff ?>
* <?= fragment_end('this_is_my_fragment') ?>
*/
/**
# Theory
## Vuejs
- Vue Step By Step (up to & including ep. 29) - https://laracasts.com/series/learn-vue-2-step-by-step
## VueX
Vuex is state management for Vue.
- Short intro https://www.youtube.com/watch?v=LW9yIR4GoVU - The example is good to understand how Vuex works. However DO NOT use Vuex to build components with. We only use it to share app-wide data - for example the currently logged in user or the current shop's data (that many components might need). If you are building a component tree, just pass the data as props.
- Docs https://vuex.vuejs.org/
/*
Solution to https://edabit.com/challenge/voZCqTGMSNjCrRhf9
Minesweeper I — Grid
This challenge is based on the game Minesweeper.
Create a function that takes a grid of # and -, where each hash (#) represents a mine and each dash (-) represents a mine-free spot. Return an array where each dash is replaced by a digit indicating the number of mines immediately adjacent to the spot (horizontally, vertically, and diagonally).
Examples
numGrid([
["-", "-", "-", "-", "-"],
["-", "-", "-", "-", "-"],
["-", "-", "#", "-", "-"],
@YavorK
YavorK / sse.html
Last active November 24, 2022 05:45 — forked from Deele/sse.html
Server-Sent Events example, Javascript client-side, PHP server-side
<html>
<body>
<div id="result"></div>
<script>
if (typeof(EventSource) !== 'undefined') {
console.info('Starting connection...');
var source = new EventSource('/stream.php');
source.addEventListener('open', function(e) {
console.info('Connection was opened.');
}, false);
<?php
$combos = [
'paper' => [
'vs_rock' => 'wins',
'vs_scissors' => 'loses',
],
'rock' => [
'vs_paper' => 'loses',
'vs_scissors' => 'wins',
<?php
$percentages = [
'Milk' => 50,
'Coffee' => 30,
'Water' => 20,
];
$percentSum = 0;
foreach ($percentages as $valuePercent) {
$percentSum = $percentSum + $valuePercent;