Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Claude Code notification hook for macOS
#
# Setup:
# 1. Save this script to ~/.claude/hooks/notify.sh
# 2. chmod +x ~/.claude/hooks/notify.sh
# 3. brew install terminal-notifier
# 4. System Settings → Privacy & Security → Accessibility:
# - Add terminal-notifier (in /opt/homebrew/bin/ or /usr/local/bin/)
# - Add Cursor and/or VSCode

On reusable components API design

Let’s compare the different ways Space Kit’s is implemented vs Chakra’s .

Starting with the base case:

@cheapsteak
cheapsteak / usePromptState.ts
Created December 30, 2020 21:13
helper for creating prompts that can be awaited on
import { useCallback, useRef, useState } from "react";
export const cancelledSymbol = Symbol("Cancelled");
export function usePromptState<
PromptResults,
PromptFunction extends Function = () => void
>({ stableOnPrompt }: { stableOnPrompt?: PromptFunction } = {}) {
const [isOpen, setIsOpen] = useState<boolean>(false);
const _ = require("lodash");
const got = require("got");
const getHourlyForecast = async () => {
const { body } = await got("https://api.climacell.co/v3/weather/forecast/hourly", {
method: "GET",
searchParams: {
lat: process.env.LAT,
lon: process.env.LON,
unit_system: "si",
const netlifyHost = 'my-app.netlify.app';
const shouldAllowCORS = (origin) => {
if (/http\:\/\/localhost:/.test(origin)) {
return true;
}
if (origin === (`https://${netlifyHost}`) || (new RegExp(`--${netlifyHost.replace(/\./g, '\.')}`)).test(origin)) {
return true;
}
return false;
import React from 'react';
// Create the hook that contains state as you normally would, don't worry about context
// Note that this is _not_ exported
const useSomeState = () => {
const [someState, setSomeState] = React.useState();
return {
someState,
setSomeState,
};
  • Precedence doesn't work as you'd expect (twin.macro and twind solve this)
 const SomeComponent = ({ className }) =>
   <div className={classnames('bg-red', className)} />

 <SomeComponent className="bg-blue"/>

What background color will the component have? The div will end up with class="bg-red bg-blue", so precedence depends on whether the specifiers for .bg-red was generated before or after specifiers for .bg-blue in the css file

  • variants conflicting because you have to specify their order globally in the config, not case-by-case - @JonasKuske (twin.macro and twind solve this)

AWS

Strengths

  • Most popular / "Safest" option
  • 1 year free trial
  • Elastic Beanstalk auto scaling
  • Good platform to learn / have on resume

Weaknesses

  • Time cost from initial configs (including Elastic Beanstalk scaling options, CloudWatch billing alerts)