Skip to content

Instantly share code, notes, and snippets.

View wadez's full-sized avatar

Wade Zimmerman wadez

View GitHub Profile
@wadez
wadez / Vue:Define-Refs-Usage.vue
Last active October 15, 2022 13:20
Vue Define Refs Usage
<script setup>
import { defineRefs } from '@/helpers'
const inputs = defineRefs(['f1', 'f2', 'f3'])
//...
</script>
@wadez
wadez / Lodash:Vue:Define-refs.js
Last active October 15, 2022 13:18
Lodash Define Refs for Vue
function defineRefs(refs) {
return _.chain(refs).keyBy().mapValues(ref).value();
}
@wadez
wadez / Vue3:Dynamic-Refs.vue
Created October 15, 2022 13:13
Vue3 Dynamic Refs
<script setup>
import { ref } from 'vue';
const inputs = {
f1: ref(),
f2: ref(),
f3: ref(),
}
function clickMe(refId) {
@wadez
wadez / Vue2:Dynamic-Refs.vue
Last active October 15, 2022 13:11
Vue2: Dynamic Refs
<template>
<div @click="clickMe('f1')">
<input ref="f1" />
<Icon/>
</div>
<div @click="clickMe('f2')">
<input ref="f2" />
<Icon/>
</div>
<div @click="clickMe('f3')">
@wadez
wadez / deep_flatten.js
Created July 30, 2022 20:31
Deeply flatten array
/*
* Subscribe to my YouTube
* https://shorturl.at/anuV2
*/
const flatten = list => list.reduce((c, v) => {
return c.concat(Array.isArray(v) ? flatten(v) : v)
}, [])
module.exports = {
theme: {
extend: {
aspectRatio: {
'4/3': '4 / 3',
'banner': '1500/500'
},
},
},
plugins: [],
<iframe class="w-full aspect-video ..."
src="https://www.youtube.com/ ...">
</iframe>
@wadez
wadez / tailwind-aspect.html
Created December 19, 2021 02:08
create an aspect ratio perfect video with TailwindCSS
<iframe class="w-full aspect-video ..."
src="https://www.youtube.com/ ...">
</iframe>
@wadez
wadez / tailwind-inset.html
Created December 19, 2021 02:05
inset positioning tailwind
<!-- Pin to top left corner -->
<div class="relative aspect-square ...">
<div class="absolute left-0 top-0 h-1/2 w-1/2 ...">01</div>
</div>
<!-- Span top edge -->
<div class="relative aspect-square ...">
<div class="absolute inset-x-0 top-0 h-1/2 ...">02</div>
</div>
@wadez
wadez / tailwind-divide.html
Created December 19, 2021 01:59
how to get boostrap list with tailwind
<ul class="divide-y border">
<li class="p-3">a</li>
<li class="p-3">b</li>
<li class="p-3">c</li>
<li class="p-3">d</li>
</ul>