Skip to content

Instantly share code, notes, and snippets.

View LinusBorg's full-sized avatar
I may be slow to respond.

Thorsten Lünborg LinusBorg

I may be slow to respond.
View GitHub Profile
@LinusBorg
LinusBorg / Form.vue
Last active June 24, 2019 11:04
Consuming function-based plugin in object-based Vue component
<template>
<form>
<input type="text" v-model="data.name" />
<span v-if="errors.name">{errors.name.msg{</span>
<span v-else>{{capsName}}</span>
<input type="number" v-model.number="data.age" />
<span v-if="errors.age">{errors.age.msg{</span>
</form>
</template>
@LinusBorg
LinusBorg / machine.js
Last active March 30, 2020 12:40
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@LinusBorg
LinusBorg / machine.js
Created April 11, 2020 11:14
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@LinusBorg
LinusBorg / machine.js
Last active July 10, 2020 13:48
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@LinusBorg
LinusBorg / machine.js
Last active October 30, 2020 11:45
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@LinusBorg
LinusBorg / 0-vue3-typescript-caveats.md
Last active November 1, 2021 08:35
Vue 3 Typescript Caveats

About this collection

This gist is a work in progress. It's goal is to collect information about possible pitfalls when using Vue 3's proxy-base reactivity and Typescript, including solutions/remedies/workarounds.

Ultimately, the goal is to turn this into a part of the Vue documentation.

TOC

  1. Leaking this from the constructor, i.e. in async operations.
  2. ref()/reactive() unwrapping loses private fields type information
@LinusBorg
LinusBorg / UnReadOnly.ts
Last active March 7, 2022 10:36
Experimenting with how to deeply un-readonly a type
type Primitive = string | number | boolean | bigint | symbol | undefined | null
type Builtin = Primitive | Function | Date | Error | RegExp
type UnReadOnly<T> = {
-readonly [K in keyof T]:
T[K] extends Builtin
? T[K]
: T[K] extends Ref<infer U>
? Ref<UnReadOnly<U>>
@LinusBorg
LinusBorg / !Git hooks for NPM projects
Created July 26, 2022 20:49 — forked from taurus227/!Git hooks for NPM projects
git hook to run `npm install` after git pull, merge, rebase or checkout if package.json was changed
# The name for this gist (starts with exclamation mark, because the name of the gist is the name of the first file in ASCIIbetical order)