Skip to content

Instantly share code, notes, and snippets.

@unrevised6419
unrevised6419 / youtube-transcript.js
Last active June 6, 2025 09:15
youtube transcript
javascript: (() => {
/* First open YT Transcript Panel, then copy paste this snippet into the console */
let linesEl = [...document.querySelector('#segments-container').children];
let linesTextIrregular = linesEl.map(el => el.textContent.trim());
let linesText = linesTextIrregular.map(l => l.split('\n').map(s => s.trim()).filter(Boolean).join(' '));
let paragraph = linesText.join('\n');
navigator.clipboard.writeText(paragraph);
})();
@unrevised6419
unrevised6419 / README.md
Last active May 22, 2025 20:11
Support `exactOptionalPropertyTypes` compiler flag in TypeScript

Note

This is a generic issue template to raise awareness about exactOptionalPropertyTypes support across TypeScript libraries.

Summary

This package's types are not fully compatible with TypeScript's exactOptionalPropertyTypes compiler flag (tsconfig.json).

Problem

With exactOptionalPropertyTypes: true, optional properties behave differently — they can’t be assigned undefined unless it's explicitly part of the type. Currently, this library's types treat optional properties as implicitly allowing undefined, which causes type errors in strict setups.

@unrevised6419
unrevised6419 / InlineSvg.vue
Last active January 25, 2025 11:19
Vue InlineSvg Implementation
<template>
<component :is="vnode" />
</template>
<script setup lang="ts">
import {
h,
onServerPrefetch,
shallowRef,
watch,
@unrevised6419
unrevised6419 / useStartTransition.tsx
Last active December 6, 2024 19:39
React startTransition wrapper
"use client";
import { startTransition, type TransitionFunction } from "react";
function useStartTransition<Args extends unknown[]>(
cb: (...args: Args) => ReturnType<TransitionFunction>,
) {
return (...args: Args) => startTransition(() => cb(...args));
}
  • npm init
  • git ignore
  • ni ts
  • add tsconfig.json, tsconfig.1.json, tsconfig2.json (+ schema)
  • add file.ts, file1.ts, file2.ts with params example
  • run from terminal, show IDE
  • add TS Config no property index
  • run from terminal, show IDE
  • Fix
  • run from terminal, show IDE
@unrevised6419
unrevised6419 / tsconfig.json
Last active November 21, 2024 18:39
Strict tsconfig.json
{
"compilerOptions": {
"strict": true,
"noEmitOnError": false,
"useUnknownInCatchVariables": false,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"exactOptionalPropertyTypes": true,
@unrevised6419
unrevised6419 / portal-provider.ts
Created November 19, 2024 11:49
Vue Portal Provider that nests/recurse
import {
inject,
provide,
type InjectionKey,
type SlotsType,
type ComputedRef,
computed,
toRef,
defineComponent,
} from 'vue';
@unrevised6419
unrevised6419 / App.vue
Last active October 23, 2024 08:22
Vue Local Scope
<script setup>
import LocalScope from './LocalScope.vue'
</script>
<template>
<LocalScope item-classes="rounded p-3 bg-blue-500" #default="{ itemClasses }">
<div :class="itemClasses">
No Data
</div>
let key = document.querySelector(`[data-testid="issue.views.issue-base.foundation.breadcrumbs.current-issue.item"]`).textContent;
let title = document.querySelector(`[data-testid="issue.views.issue-base.foundation.summary.heading"]`).textContent;
let link = document.querySelector(`[data-testid="issue.views.issue-base.foundation.breadcrumbs.current-issue.item"]`).href;
let date = new Date().toLocaleDateString('it-IT');
let textMessage = `🔵 [${key}] - ${title} - ${date}`;
let htmlMessage = `🔵 [<a href="${link}">${key}</a>] - ${title} - ${date}`;
let textBlob = new Blob([textMessage], { type: 'text/plain' });
let htmlBlob = new Blob([htmlMessage], { type: 'text/html' });
let clipboardItem = new ClipboardItem({ [textBlob.type]: textBlob, [htmlBlob.type]: htmlBlob });
globalThis.navigator.clipboard.write([clipboardItem]);
const cacheControlDirective = new GraphQLDirective({
name: 'cacheControl',
locations: [
DirectiveLocation.FIELD_DEFINITION,
DirectiveLocation.OBJECT,
DirectiveLocation.INTERFACE,
DirectiveLocation.UNION,
],
args: {
maxAge: {