Skip to content

Instantly share code, notes, and snippets.

View andyjessop's full-sized avatar

Andy Jessop andyjessop

View GitHub Profile
@andyjessop
andyjessop / oncall.sh
Created June 27, 2024 08:14
on-call report
#!/bin/bash
echo "On-Call Report - $(date '+%Y-%m-%d %H:%M:%S')"
echo "================================================"
echo -e "\n## Recently Updated PRs"
echo "------------------------"
gh pr list --limit 10 --json number,url,title,updatedAt --jq 'sort_by(.updatedAt) | reverse | .[] | "[\(.updatedAt)] \(.url): \(.title)"' | sed 's/T/ /; s/Z//'
echo -e "\n## Issues Needing Author Response"
@andyjessop
andyjessop / launch.json
Last active June 5, 2024 08:12
Run package tests VSCode debug panel
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Current File",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/.vscode/utils/run-test.js",
"args": ["${file}"],
"console": "integratedTerminal",
@andyjessop
andyjessop / prompt.txt
Created April 20, 2024 07:43
A prompt to categorise and analyse sentiment for GitHub issues
Please analyze the following GitHub issue data, which is provided as a JSON object:
{
"title": "🐛 BUG: WebSocket typing doesn't work in apps that also pull in DOM types",
"body": "Which Cloudflare product(s) does this pertain to?",
}
Provide a response with the following structure:
<json>
@andyjessop
andyjessop / concatenate.ts
Created March 27, 2024 14:33
Concatenate files in folder
import * as fs from "fs";
import * as path from "path";
function readFileContents(filePath: string): string {
return fs.readFileSync(filePath, "utf-8");
}
function processDirectory(dirPath: string, outputString: string): string {
const files = fs.readdirSync(dirPath);
@andyjessop
andyjessop / prompt.txt
Last active March 14, 2024 12:14
A prompt that gives an LLM knowledge of the file structure of a repo
Between the <list> and </list> markers are a list of files in this repo. However, in order to make them shorter, they have been compressed in the following way:
- each file path token (excluding final filename) has been swapped with a short version, and then added to a map.
- the shortened version is inserted into the file path instead of the original token.
For example:
this/is/the/file/path/for/test.ts
this/is/another/path/for/another.ts
@andyjessop
andyjessop / neurflow.md
Created March 8, 2024 09:17
NeurFlow concept

NeurFlow Documentation

Introduction

NeurFlow is a revolutionary new programming language for building complex, dynamic, and reactive user interfaces. Inspired by the structure and function of neural networks, NeurFlow allows you to define your application as a network of interconnected "neurons".

Core Concepts

Neurons

@andyjessop
andyjessop / worker.ts
Last active March 7, 2024 20:30
Cloudflare Worker Auth
import { Hono } from 'hono';
import { jwt } from 'hono/jwt';
import { D1 } from '@cloudflare/workers-types';
import { hash, compare } from 'bcrypt';
import { v4 as uuidv4 } from 'uuid';
import { sendEmail } from './email';
import { isEmail, sanitize } from 'validator';
import { createHash } from 'crypto';
type Env = {
@andyjessop
andyjessop / RandomizedSet.go
Last active February 29, 2024 15:39
An implementation of the RandomizedSet class
type RandomizedSet struct {
Entries map[int]bool
Values []int
Indexes map[int]int
}
func Constructor() *RandomizedSet {
return &RandomizedSet{Entries: make(map[int]bool), Indexes: make(map[int]int)}
}
@andyjessop
andyjessop / prompt.md
Last active February 16, 2024 20:08
Web Component Prompt

Web Component Development Prompt

Overview

Create a web component following best practices for architectural and stylistic elements. The component should be implemented using the lit library, with particular attention to accessibility, customisability, and reusability.

Objectives

  • The component must be fully functional, encapsulating all logic and styles necessary for its operation.
  • Implement static styles using css imported from lit, ensuring all CSS properties are exposed as custom properties on the host element for easy styling customisation.
  • Define slots and CSS parts to allow users to customise the content and style of different component parts.
  • Ensure the component is accessible, including proper ARIA attributes and roles where necessary.
@andyjessop
andyjessop / RouterLink.ts
Last active January 26, 2024 22:46
Link custom element to handle route changes in thepassle/app-tools router