Skip to content

Instantly share code, notes, and snippets.

View scvnc's full-sized avatar

Vincent Schramer scvnc

View GitHub Profile
@scvnc
scvnc / StubFieldComponent.ts
Created October 23, 2023 17:07
A way of stubbing out VeeValidate form field
/**
* Stub out the component with this
*/
export const StubFieldComponent = {
props: ["name"],
setup: (props: { name: string }): unknown => {
if (props.name === undefined) {
throw new Error("did not recv props!");
}
const field = useField<unknown>(props.name);
@scvnc
scvnc / normalize-markdown-headers.js
Created October 9, 2023 17:48
Hacktacular script that quashes markdown headers to their highest size, with header-2 being the largest
const fs = require('fs');
// Check if a Markdown file is provided as a command-line argument
const filePath = process.argv[2];
if (!filePath) {
console.error('Please provide a Markdown file as a command-line argument.');
process.exit(1);
}
@scvnc
scvnc / async-itr-vue.ts
Created May 26, 2023 14:55
Fiddle with async iterable or other @bufbuild/connect-web vue binding
import { ConnectError } from '@bufbuild/connect-web';
import { Ref, ref } from 'vue';
const useStreamingCall = <T>(controllerFn: StreamingCallController<T>) => {
const currentData = ref<T | undefined>(); // todo: optionally not make undefined
const cancel = controllerFn(
(data: T) => {
currentData.value = data;
// do something with data
@scvnc
scvnc / REVIEW.MD
Last active April 21, 2023 00:13
Video notes on "Vue NYC - Component Tests with Vue.js - Matt O'Connell"
@scvnc
scvnc / YourApp.ce.vue
Created April 17, 2023 21:44
How to register plugins on a vue CE. You likely will have have to modify accordingly to make compatible for other plugins.
<script setup lang="ts">
import { useCeVueApp } from './useCeVueApp';
import PrimeVue from 'primevue/config'
useCeVueApp(app => {
app.use(PrimeVue);
});
</script>
title description published date tags
Communication Policy
1
2020-03-30 13:35:21 UTC

Communication Policy

@scvnc
scvnc / search_for_faker.js
Created March 27, 2023 15:32
Have chatGPT make a util that detects whether a javascript module eventually imports @faker-js/faker
import fs from 'fs';
import path from 'path';
import * as acorn from 'acorn';
import * as walk from 'acorn-walk';
const getRelativeModuleFilePath = (
moduleFilePath: string,
adjacentModulePath: string
): string | false => {
const adjacentModuleFilePath = path.join(path.dirname(moduleFilePath), adjacentModulePath);
@scvnc
scvnc / azpat.sh
Created December 9, 2022 23:32
Quickly set-up your Azure Devops npm feed on Mac
#!/bin/bash
# Run this script with cURL:
# curl --silent -sLo $TMPDIR/azpat.sh https://gist.githubusercontent.com/scvnc/0567cd25a7f61ad17713b9490d3f4af2/raw/azpat.sh && bash $TMPDIR/azpat.sh
# Follows instructions from
# https://dev.azure.com/${ORG_SLUG}/${PROJECT_NAME}/_packaging?_a=connect&feed=${ORG_SLUG}
# Select npm from the side and select the "Other" tab in the Project Setup section
set -e
@scvnc
scvnc / Alerts.store.ts
Last active July 13, 2022 19:33
An RxJS-only implementation of the AlertStore example during the Pinia demo from VueForge 2022
import { useObservable } from '@/helpers/rxjs-helper';
import { computed } from '@vue/composition-api';
import { BehaviorSubject } from 'rxjs';
interface Alert {
id: number;
text: string;
}
interface AlertsStoreState {
@scvnc
scvnc / kill.ps1
Created April 9, 2021 14:47
Kill some background processes so that vanguard maybe doesnt kick me
$processes = (
"Dropbox*",
"DbxSvc.exe",
"EpicGamesLauncher.exe",
"boinc*",
"OneDrive.exe",
"mDNSResponder.exe",
"Lightshot.exe",
"MoUsoCoreWorker.exe",
"PnkBstrA.exe",