Skip to content

Instantly share code, notes, and snippets.

View trozzelle's full-sized avatar

Torin Rozzelle trozzelle

View GitHub Profile
@trozzelle
trozzelle / data-testid bookmarklet
Last active February 13, 2024 15:43 — forked from XC3S/bookmark
Bookmarklet to highlight data-testid for elements
javascript:(function(){ var dataId="data-testid",selector="["+dataId+"]";function createLabels(){var e=document.getElementById("data-id-canvas").getContext("2d");e.canvas.width=window.innerWidth,e.canvas.height=window.innerHeight,e.clearRect(0,0,e.canvas.width,e.canvas.height),document.querySelectorAll(selector).forEach(function(t,a,n){var i=t.getBoundingClientRect(),d=t.getAttribute(dataId);e.beginPath(),e.lineWidth="1",e.strokeStyle="red",e.rect(i.left,i.top,i.width,i.height),e.stroke(),e.font="12px consolas",e.beginPath(),e.lineWidth="1",e.fillStyle="red",e.rect(i.left,i.top-16,e.measureText(d).width+10,16),e.fill(),e.fillStyle="white",e.fillText(d,i.left+5,i.top-3)}),requestAnimationFrame(createLabels)}requestAnimationFrame(createLabels);var canvas=document.createElement("canvas");canvas.id="data-id-canvas",canvas.style="position: fixed;left: 0;top: 0; pointer-events: none;z-index: 9999999",document.getElementsByTagName("body")[0].appendChild(canvas); })()
@trozzelle
trozzelle / openapi.yaml
Created May 15, 2023 16:49
Bluesky OpenAPI Spec for ChatGPT
openapi: 3.0.0
info:
description: Unofficial OpenAPI specification for the Bluesky API endpoints.
version: '1.0'
title: Bluesky API
contact:
email: torin@imp.sh
license:
name: MIT
url: 'https://opensource.org/license/mit/'
@trozzelle
trozzelle / deleteBlocks.js
Created May 13, 2023 05:36
Delete all blocks
import {authenticateBsky, getBlocks, deleteBlock} from "./api.js";
const user =
const pass =
async function main() {
const agent = await authenticateBsky()
const {data: {did}} = await agent.resolveHandle({handle:user})
@trozzelle
trozzelle / atproto_image.js
Created April 18, 2023 15:45
Image upload code for making a Bluesky post.
// Provide a uint8array of image data and set MIME type.
// Bluesky only supports jpg and png at the moment.
const testUpload = await agent.uploadBlob(testPng, {encoding: "image/png"})
// The response contains a BlobRef object, which is what
// agent.post expects.
const result = await agent.post({
text: 'Post Text',
reply: {
parent: {
@trozzelle
trozzelle / AnimatedCounter.tsx
Created April 6, 2023 15:59
Countdown Component for Framer Hosted
import { useEffect, useRef } from "react"
import { motion, useInView, useMotionValue, useSpring } from "framer-motion"
import type { ComponentType } from "react"
import { addPropertyControls, ControlType } from "framer"
/**
* These annotations control how your component sizes
* Learn more: https://www.framer.com/docs/guides/auto-sizing
*
* @framerSupportedLayoutWidth auto