Skip to content

Instantly share code, notes, and snippets.

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

Kcko

🦜
fly like a bird ...
View GitHub Profile
<aw-alert v-for="flash in {$control->getVueDataVar('flashes')}" :type="flash.type">{_}Je to správně? Zkuste číslo opsat ještě jednou.{/_}</aw-alert>
<template v-for="image in $presenter.voucher.photos" :key="image.id">
<aw-img src="/assets/temp/enjoyment-1.jpg" class="rounded-ambi" :image="image" size="1230x870x8" />
</template>
<div class="Filters justify-center">
<ambi-filter-tag
v-for="(filter, index) in $controls['filterTagsList'].filters"
function inspectXPath(xpath) {
const element = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
if (element) {
inspect(element);
} else {
console.log("Element not found");
}
}
inspectXPath('/html/body/div[2]/div[4]/div[1]/div/div[2]/div/div/div[1]/article[3]/div[1]')
<script setup>
import { reactive } from 'vue'
import LinkList from "./LinkList.vue"
const links = reactive([
{
id: 1,
name: "AA",
bookmarked: false,
},
<script setup>
import { ref, defineProps, defineEmits, computed, watch } from 'vue';
const emit = defineEmits(['update:modelValue']);
const props = defineProps({
modelValue: {
type: Boolean,
default: false
}
<template>
<div v-for="counter in listOfCounters" :key="counter.id">
<button @click="counter.decrement()">-</button>
{{ counter.count }}
<button @click="counter.increment()">+</button>
</div>
</template>
// Data Store Pattern
/*
This pattern has a few parts:
A global state singleton
Exporting some or all of this state
Methods to access and modify the state
*/
import { reactive, toRefs, readonly } from 'vue';
<?php
// rest ... a,b,c,d,e => []
function concatenate($transform, ...$strings) {
$string = '';
foreach($strings as $piece) {
$string .= $piece;
}
return($transform($string));
enum Direction {
Up,
Down,
Left,
Right
}
const Colors = Object.freeze({
RED: Symbol("red"),
BLUE: Symbol("blue"),
const toggle = (...list) =>
{
// To track the cycle.
let current = -1;
const length = list.length;
return function ()
{
// Increment current and used modulo to cycle back to the start.
current = (current + 1) % length;
// https://javascript.plainenglish.io/structuredclone-the-easiest-way-to-deep-clone-objects-in-javascript-c503b536266b
const testData = {
number: 123,
string: "test",
undefined: undefined,
null: null,
boolean: true,
object: { a: 1, b: { c: 2 } },
array: [1, 2, { d: 3 }],