Skip to content

Instantly share code, notes, and snippets.

View mxmzb's full-sized avatar
🍜
Probably eating

Maxim mxmzb

🍜
Probably eating
View GitHub Profile
const findSumInArray = (arr, sum) => {
let needle = [];
let tmpSum = 0;
for(let i = 0; i < arr.length; i++) {
tmpSum = tmpSum + arr[i];
needle.push(arr[i]);
if(sum === tmpSum) {
return needle;

Implement user API keys with Supabase

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.

Solution

@mxmzb
mxmzb / CPU.main.1725747854069.cpuprofile
Last active September 7, 2024 22:41
next.js hot reload
This file has been truncated, but you can view the full file.
{"nodes":[{"id":1,"callFrame":{"functionName":"(root)","scriptId":"0","url":"","lineNumber":-1,"columnNumber":-1},"hitCount":0,"children":[2,112,161,162,298,310,324,342,356,358,359,375,396,2419,2449,2489,2491,2502,2507]},{"id":2,"callFrame":{"functionName":"run","scriptId":"241","url":"node:internal/modules/esm/module_job","lineNumber":212,"columnNumber":11},"hitCount":0,"children":[3]},{"id":3,"callFrame":{"functionName":"evaluate","scriptId":"0","url":"","lineNumber":-1,"columnNumber":-1},"hitCount":0,"children":[4,790,2400,2401,2415]},{"id":4,"callFrame":{"functionName":"","scriptId":"89","url":"node:internal/modules/esm/translators","lineNumber":289,"columnNumber":66},"hitCount":1,"children":[5],"positionTicks":[{"line":312,"ticks":1}]},{"id":5,"callFrame":{"functionName":"cjsLoader","scriptId":"89","url":"node:internal/modules/esm/translators","lineNumber":341,"columnNumber":37},"hitCount":0,"children":[6]},{"id":6,"callFrame":{"functionName":"Module._load","scriptId":"63","url":"node:internal/modules/cj
@mxmzb
mxmzb / workflow.json
Created November 16, 2025 01:07
Collect workflows that reference a subworkflow
{
"nodes": [
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
0,
0
],