This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copied from 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 }], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script setup> | |
import { reactive } from 'vue' | |
import LinkList from "./LinkList.vue" | |
const links = reactive([ | |
{ | |
id: 1, | |
name: "AA", | |
bookmarked: false, | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script setup> | |
import { ref, defineProps, defineEmits, computed, watch } from 'vue'; | |
const emit = defineEmits(['update:modelValue']); | |
const props = defineProps({ | |
modelValue: { | |
type: Boolean, | |
default: false | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div v-for="counter in listOfCounters" :key="counter.id"> | |
<button @click="counter.decrement()">-</button> | |
{{ counter.count }} | |
<button @click="counter.increment()">+</button> | |
</div> | |
</template> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// rest ... a,b,c,d,e => [] | |
function concatenate($transform, ...$strings) { | |
$string = ''; | |
foreach($strings as $piece) { | |
$string .= $piece; | |
} | |
return($transform($string)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum Direction { | |
Up, | |
Down, | |
Left, | |
Right | |
} | |
const Colors = Object.freeze({ | |
RED: Symbol("red"), | |
BLUE: Symbol("blue"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
NewerOlder