Skip to content

Instantly share code, notes, and snippets.

View mrmartineau's full-sized avatar
👋
Aho Young Warrior

Zander Martineau mrmartineau

👋
Aho Young Warrior
View GitHub Profile
@j4w8n
j4w8n / implement-user-api-keys-with-supabase.md
Last active October 16, 2024 12:05
Implement user API keys with Supabase

Implement user API keys with Supabase

This is pretty much my first crack at this. I'm sure things could be improved or done differently.

Rationale

JWTs are at the heart of Supabase authorization, but sometimes we wanna build an app that also gives users access via API keys; or perhaps only exclusively via API keys. As you may know, using JWTs as API keys makes them difficult to revoke and therefore a security issue.

We also want to ensure this doesn't significantly add to RLS polices, if at all.

Finally, we'd love to have this handled by Supabase and do as little as possible in our framework. This simplifies our code and reduces third-party libraries.

@SKaplanOfficial
SKaplanOfficial / RaycastAIPrompts.md
Created April 4, 2023 20:04
My ad-hoc prompts for Raycast AI

Raycast AI Prompts

Content Generation

Title Prompt
Brainstorm Ideas Based On This Brainstorm 5 project ideas based on this text:
Create Action Items Generate a markdown list of action items to complete based on the following text, using a unique identifier for each item as bold headings. If there are any errors in the text, make actions items to fix them. In a sublist of each item, provide a description, priority, estimated level of difficulty, and a reasonable duration for the task. Here is the text:
Create Flashcards Create 3 Anki flashcards based on the following text. Format the response as markdown with the bold questions and plaintext answers. Separate each entry with ‘—‘. Here’s the text:
Generate Cheatsheet Generate a concise cheatsheet for the concepts in this text. Add additional details based on your own knowledge of the topic.
@maggie44
maggie44 / electron-sign-process.md
Last active October 21, 2024 10:09
Apple and Windows Electron signing and notarising via Electron Builder and GitHub Actions.

Electron Builder Signing and Notarising Process via GitHub Actions (Apple and Windows)

This gist provides details of how to build, sign and notarize Electron apps for macOS and Windows using Electron Builder via a GitHub Action.

Step 1: Add Electron Builder aftersign process

Electron Builder takes care of a lot of the signing process. But part of the process to notarize the app with Apple involves submitting the app to Apple for review. This is done through the electron-notarize package. Add the following code to your repository as afterSignHook.js.

"use strict";
@zachleat
zachleat / README.md
Last active July 6, 2024 00:09 — forked from pspeter3/.eleventyignore
Eleventy 11ty.js Extensions

Remix's useFetcher doesn't return a Promise for any of its methods (like fetcher.submit()) because Remix doesn't want you to explicitly await anything so they can handle things like cancellation for you. Instead, they recommend adding a useEffect and performing whatever logic you need to after the fetcher is in a particular state.

I found using an effect to run some logic after a submission to be too indirect, and there seem to be plenty of cases where you want to submit a form and then perform some other work on the client (sometimes async, like requesting the user's permission for their location), and I'd rather just do that after a submission in the event handler rather than an effect.

So here's a proof of concept hook that wraps Remix's useFetcher and returns a version of submit that is a promise, and resolves with the data from the action:

function useFetcherWithPromise() {
  let resolveRef = useRef();
  let promiseRef = useRef();
@DaveMDS
DaveMDS / get-docker.sh
Last active November 14, 2024 07:37 — forked from ta264/get-docker.sh
Install docker on arm64 synology
#!/bin/bash
set -e
ARCH=aarch64
DOCKER_VERSION=20.10.9
COMPOSE_VERSION=2.5.1
DOCKER_DIR=/volume1/@docker
echo "Downloading docker $DOCKER_VERSION-$ARCH"
curl "https://download.docker.com/linux/static/stable/$ARCH/docker-$DOCKER_VERSION.tgz" | tar -xz -C /usr/local/bin --strip-components=1
@amerryma
amerryma / TestComponent-nock.test.tsx
Created May 19, 2022 15:55
Supabase Mocking (Regular Mocking vs API Nock)
import '@testing-library/jest-dom'
import { render } from '@testing-library/react'
import { renderHook } from '@testing-library/react-hooks'
import nock from 'nock'
import TestComponent from './TestComponent'
const mockResultData = [
{
@zats
zats / REMAP_M1_KEYS.MD
Last active December 23, 2023 20:32
Apple M1 MacBook Do Not Disturb Key remapping

Following is a sample of LaungAgent that remaps do not disturb key to Siri (I am using Type to Siri)

This is a lightweight solution not relying on external apps.

Setting up

  1. Create ~/Library/LaunchAgents/com.local.KeyRemapping.plist
  2. Edit it to have following content
@sindresorhus
sindresorhus / esm-package.md
Last active November 14, 2024 05:44
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.

⚠️ Warning: this document is out of date.

For the most recent webpack5 instructions see MIGRATION.md.

Storybook experimental Webpack 5 support

Storybook 6.2 includes experimental Webpack 5 support. Webpack 5 brings a variety of performance improvements, as well as exciting new features like module federation. Here's a quick guide to get you going.

Intro