Skip to content

Instantly share code, notes, and snippets.

View jackbkennedy's full-sized avatar
🤟
Stoked

Jack Kennedy jackbkennedy

🤟
Stoked
View GitHub Profile
@jackbkennedy
jackbkennedy / ZoomableImage.tsx
Created November 2, 2023 09:49
A react image component that focuses an image in the middle of the page and zooms in to make it easier to see.
import React, { useEffect, useRef, useState } from 'react';
import ReactDOM from 'react-dom';
type ZoomableImageProps = {
url: string;
style?: React.CSSProperties; // for custom styles
className?: string; // to allow custom classes
};
/*
@jackbkennedy
jackbkennedy / code.gs
Last active November 2, 2023 17:41
Google Sheet AI Content Generation
// This function runs automatically when the Google Sheet is opened.
function onOpen() {
// Obtain the user interface of the Google Spreadsheet.
var ui = SpreadsheetApp.getUi();
// Create a custom menu titled 'AI Content Generation' in the Spreadsheet's menu bar.
ui.createMenu('AI Content Generation')
// Add a menu item 'Generate All Values' that when clicked, will run the function 'generateAllValues'.
.addItem('Generate All Values', 'generateAllValues')
// Add another menu item 'Update Missing Only' that when clicked, will run the function 'updateMissingValues'.
@jackbkennedy
jackbkennedy / stitches-spinner.tsx
Last active May 24, 2023 14:31
stitches-spinner
// Full code - https://github.com/jackbkennedy/stitches-spinner
import { styled, keyframes } from "../stitches.config";
const spinner = keyframes({
to: {
transform: "rotate(360deg)",
},
});
export const Spinner = styled("div", {
@jackbkennedy
jackbkennedy / useCapslock.ts
Last active August 12, 2023 14:35
useCapslock
import {useState, useEffect, useCallback} from 'react';
const EVENT_KEY_DOWN = 'keydown';
const EVENT_KEY_UP = 'keyup';
/* Hook to verify state of Caps Lock */
export function useCaplocks(): boolean {
/* State for keeping track of whether caps lock is on */
const [isCaplocksActive, setIsCapLocksActive] = useState<boolean>(false);