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
@Kcko
Kcko / fn.js
Last active May 17, 2024 07:11
/*
function in javascript is object and we can store what ever inside
*/
function x()
{
console.log('im x')
}
x.$version = '1.3.21'
<template>
<div>
<h1>Async Component Example</h1>
<suspense>
<template #default>
<AsyncComponent />
</template>
<template #fallback>
<LoadingSpinner />
</template>
<!-- MouseTracker.vue -->
<script setup>
import { ref, onMounted, onUnmounted } from 'vue'
const x = ref(0)
const y = ref(0)
const update = e => {
x.value = e.pageX
y.value = e.pageY
<!-- https://www.patterns.dev/vue/data-provider -->
<!-- Provider.vue -->
<template>
<slot :data="data" :loading="loading"></slot>
</template>
<script setup>
import { ref, reactive } from "vue";
import { openBlock as r, createElementBlock as l, toDisplayString as s, defineCustomElement as i } from "https://cdn.jsdelivr.net/npm/vue@3.4.27/dist/vue.runtime.esm-browser.prod.js";
const c = "h1[data-v-883a1ab3]{font-weight:500;font-size:2.6rem;position:relative;top:-10px}h3[data-v-883a1ab3]{font-size:1.2rem}.greetings h1[data-v-883a1ab3],.greetings h3[data-v-883a1ab3]{text-align:center}@media (min-width: 1024px){.greetings h1[data-v-883a1ab3],.greetings h3[data-v-883a1ab3]{text-align:left}}", d = (e, a) => {
const t = e.__vccOpts || e;
for (const [o, n] of a)
t[o] = n;
return t;
}, g = {
__name: "HelloWorld.ce",
props: {
msg: {
-- https://towardsdev.com/sql-case-statement-with-code-examples-04f77dab8d5a
-- 1. Simple case
SELECT
order_id,
CASE customer_id
WHEN 1 THEN 'Premium'
WHEN 2 THEN 'Gold'
WHEN 3 THEN 'Silver'
ELSE 'Regular'
// Composable
const useBurger = () => {
const lettuce = ref(true);
const ketchup = ref(true);
return {
lettuce,
ketchup,
}
// Destructure into multiple variables
const obj = { val: 1 };
const { val: a, val: b, val } = obj;
console.log(a); // -> 1
console.log(b); // -> 1
console.log(val); // ->
<!-- component definition -->
{define badge, bool $show = true, string $title = '', $class = null}
<span class="badge ms-2 font-size-small {$class ?? 'bg-body-secondary text-body'}" n:if="$show" title="{$title}">
{block content}{/block}
</span>
{/define}
<!-- usage -->
{embed badge, $client !== null, 'Uhrazeno'}
<template>
<h1>test</h1>
<component :is="dynamicComponent" />
</template>
<script setup>
import { computed} from 'vue'
const dynamicComponent = computed(() => {