Skip to content

Instantly share code, notes, and snippets.

View reggi's full-sized avatar
🌺
Learning

Thomas Reggi reggi

🌺
Learning
View GitHub Profile
---
import { createHash } from 'node:crypto';
import fs from 'node:fs/promises';
import path from 'node:path';
type Props = {
src: string,
alt?: string,
class?: string,
}
const { src, alt, class: className } = Astro.props
@reggi
reggi / alpha.js
Created November 26, 2023 06:25
Example
console.log('hello world')
// ==UserScript==
// @name Hide LinkedIn Posts
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Hide posts with MongoDB as the employer on LinkedIn
// @author You
// @match *://www.linkedin.com/*
// @grant none
// ==/UserScript==
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"name": {
"type": "string"
}
},
"required": ["name"]
}
// ==UserScript==
// @name mastodon-bigger-input-box
// @version 1.0.0
// @description Modify the CSS of a specific element on page load
// @author Thomas Reggi
// @match https://indieweb.social/*
// @grant none
// ==/UserScript==
(function() {
class Guard<T> {
constructor(public value: T) {}
isNotArray(): Guard<T extends any[] ? never : T> {
return Array.isArray(this.value) ? new Guard<never>(undefined as never) : this as unknown as Guard<T extends any[] ? never : T>;
}
isNotUndefined(): Guard<Exclude<T, undefined>> {
return this.value === undefined ? new Guard<never>(undefined as never) : this as unknown as Guard<Exclude<T, undefined>>;
}
isNotBoolean(): Guard<Exclude<T, boolean>> {
return typeof this.value === 'boolean' ? new Guard<never>(undefined as never) : this as unknown as Guard<Exclude<T, boolean>>;
export const reservedPathPatterns = [
new URLPattern({ pathname: '/favicon.ico' }),
new URLPattern({ pathname: '/robots.txt' }),
new URLPattern({ pathname: '/sitemap.xml' }),
new URLPattern({ pathname: '/ads.txt' }),
new URLPattern({ pathname: '/security.txt' }),
new URLPattern({ pathname: '/.well-known/*' }),
new URLPattern({ pathname: '/apple-touch-icon.png' }),
new URLPattern({ pathname: '/apple-touch-icon-:size1(\\d+)x:size2.png' }),
@reggi
reggi / question-nestjs-graphql-nested-resolvers.md
Last active July 10, 2023 14:11
How do I have nested resolvers in nestjs / type-graphql?

I am trying to find a way that a resolver can essentially return another resolver using [nest.js][1] for creating [Resolvers][2], and [type-graphql][3] to create [object types][4].

Here's an example with the star-wars graphql api

{
  allVehicles(first: 1, last: 100) {
    vehicles {
      name
<template id="wc-simplemde-template">
<style>
@import 'https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css';
@import 'https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css';
:host {
--mainViewMenuHeight: 0
}
.wc-simplemde-container {
width: 50%;
/** @jsx h */
/** @jsxFrag Fragment */
import { VNode, h, Fragment } from "https://esm.sh/preact@10.13.2";
import { renderToString } from "https://esm.sh/preact-render-to-string@6.0.3?deps=preact@10.13.2";
import { serve } from "https://deno.land/std@0.184.0/http/server.ts";
class Next {}
type Route = (req: Request) => Promise<Next | Response>