Skip to content

Instantly share code, notes, and snippets.

View sjelfull's full-sized avatar
💭
👶

Fred Carlsen sjelfull

💭
👶
View GitHub Profile
@sjelfull
sjelfull / linear-way
Created April 3, 2026 20:46 — forked from ksaa/linear-way
linear-way skill for Linear agent
Act like a Linear product teammate, not a request-taking assistant. Linear is a AI Supported issue tracking/project management/product building tool. All analyzing should take that in to account.
For every input, start by identifying the underlying problem instead of accepting the proposed solution at face value. Treat customer requests as signals about unmet needs, not instructions to implement literally. Infer what is unsaid, look for patterns across feedback, and explain the deeper need in clear language.
Before suggesting work, evaluate:
what problem is actually being expressed
who is affected
@sjelfull
sjelfull / anthropic.ts
Created April 25, 2024 20:46 — forked from CallumVass/anthropic.ts
Haiku structured data - My own implementation of instructor for Haiku
import Anthropic from "@anthropic-ai/sdk";
import type { MessageParam } from "@anthropic-ai/sdk/resources";
import dotenv from "dotenv";
import { Instructor } from "./instructor";
import type { z } from "zod";
dotenv.config();
function sendToClaude<T>(message: MessageParam, schema: z.Schema<T>) {
const anthropicClient = new Anthropic({
<?
# MIT license, do whatever you want with it
#
# This is my invoice.php page which I use to make invoices that customers want,
# with their address on it and which are easily printable. I love Stripe but
# their invoices and receipts were too wild for my customers on Remote OK
#
require_once(__DIR__.'/../vendor/autoload.php');
import { GetServerSideProps } from "next";
import Head from "next/head";
import { useEffect, useRef, useState } from "react";
// I suggest to create a read-only Stripe key with access to invoices + customers for this)
const stripe = require("stripe")(process.env.STRIPE_SECRET_KEY_INVOICE_GENERATOR);
export default function InvoicePage(props) {
const invoice = props.invoice;
@sjelfull
sjelfull / removeContent.js
Created October 2, 2022 21:30 — forked from RiFi2k/removeContent.js
Cloudflare Worker Function to find and replace content on a page
addEventListener("fetch", event => {
event.respondWith(handle(event.request))
})
async function handle(request) {
// Fetch from origin server.
let response = await fetch(request)
// Make sure we only modify text, not images.
let type = response.headers.get("Content-Type") || ""
@sjelfull
sjelfull / index.js
Last active August 25, 2022 13:36 — forked from zkat/index.js
npx is cool
#!/usr/bin/env node
const isNpx = process.argv.some((segment) => segment.includes('_npx') || segment.includes('npx'))
console.log('yay gist');
console.log(process.argv, process.argv0);
console.log(`${isNpx ? 'likely npx' : 'not likely to be npx'}`)
console.log(process.env)
console.log(['env._ ends with npx', process.env._.endsWith('/npx')])
@sjelfull
sjelfull / pane.js
Created September 25, 2020 07:34 — forked from runeb/pane.js
Custom control over Desk pane menu items based on user group membership
import React, {
useEffect, useState
} from 'react'
import DefaultPane from '@sanity/components/lib/panes/DefaultPane'
import client from 'part:@sanity/base/client'
const CustomPane = (props) => {
const [groups, setGroups] = useState([])
useEffect(() => {
import * as React from "react";
import { useMousePosition } from "~/hooks/useMousePosition";
/** Component to cover the area between the mouse cursor and the sub-menu, to allow moving cursor to lower parts of sub-menu without the sub-menu disappearing. */
export function MouseSafeArea(props: { parentRef: React.RefObject<HTMLDivElement> }) {
const { x = 0, y = 0, height: h = 0, width: w = 0 } = props.parentRef.current?.getBoundingClientRect() || {};
const [mouseX, mouseY] = useMousePosition();
const positions = { x, y, h, w, mouseX, mouseY };
return (
<div
@sjelfull
sjelfull / php-pools.md
Created August 25, 2020 21:13 — forked from holmberd/php-pools.md
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@sjelfull
sjelfull / initialValueTemplates.js
Last active May 5, 2020 14:58 — forked from kmelve/initialValueTemplates.js
Initial Value Templates Commynity Digest Example for Sanity.io
import T from '@sanity/base/initial-value-template-builder'
import client from 'part:@sanity/base/client'
const getNextDigestTitle = async () => {
const titles = await client.fetch(`*[
_type == "post" &&
title match "Community Digest*"
].title
`)