still-free.openapps.xyz

Source

This app’s code and revision history are public. Download a copy or explore the files below.

Public
The app’s code and revision history are public.
Owned app · rev 0fa0e84d537b
Run it yourself
Take the whole tree and run it on your own machine. The download needs no account. Cloning needs a sign-in.
Download .zip
bounded clone a8c677472ab5691741798a3d
A copy you download is not bounded. The guarantees this app runs under - declared egress, proven invariants, writes that fail closed - live in the runtime serving this page, not in the files. What you get is auditable source you can read and run, with no runtime guarantees attached.
← All files
src/content/patterns.ts
// Breathing patterns. Each phase is in seconds: breathe in, hold, breathe out, hold.
export type Pattern = { slug: string; name: string; short: string; about: string; phases: [number, number, number, number] };

export const PATTERNS: Pattern[] = [
  {
    slug: "box",
    name: "Box breathing",
    short: "4 in, 4 hold, 4 out, 4 hold",
    about: "Four even sides: breathe in for four, hold for four, breathe out for four, hold for four. Steadying when you feel on edge, and easy to remember.",
    phases: [4, 4, 4, 4],
  },
  {
    slug: "4-7-8",
    name: "4-7-8 breathing",
    short: "4 in, 7 hold, 8 out",
    about: "Breathe in for four, hold for seven, and breathe out slowly for eight. The long breath out helps you wind down, and many people use it to fall asleep.",
    phases: [4, 7, 8, 0],
  },
  {
    slug: "coherent",
    name: "Coherent breathing",
    short: "5.5 in, 5.5 out",
    about: "Slow, even breaths of five and a half seconds in and out, about five and a half breaths a minute. Calm and balanced, good for any time of day.",
    phases: [5.5, 0, 5.5, 0],
  },
  {
    slug: "custom",
    name: "Your own pattern",
    short: "Set each part yourself",
    about: "Choose how long to breathe in, hold, breathe out and hold. Try a longer breath out than in to relax.",
    phases: [4, 2, 6, 0],
  },
];

export const LENGTHS = [1, 2, 3, 5, 10, 15, 20];

/** Reads a custom pattern from a link: ?pattern=4-2-6-0 */
export function parsePattern(value: string | null): [number, number, number, number] | null {
  const parts = (value ?? "").split("-").map(Number);
  if (parts.length < 2 || parts.length > 4 || parts.some((n) => !Number.isFinite(n))) return null;
  const [i, h1 = 0, o = 0, h2 = 0] = parts.length === 2 ? [parts[0], 0, parts[1], 0] : parts;
  const clamp = (n: number, min: number) => Math.min(20, Math.max(min, Math.round(n * 2) / 2));
  return [clamp(i, 1), clamp(h1, 0), clamp(o, 1), clamp(h2, 0)];
}

Change history

Link to OpenApps pages and add a contribution strip
0fa0e84d53 · 19 hours ago
Bind the agent address in the policy
6f3baa1c72 · 1 day ago
Add favicon.ico so browsers that ask for it stop getting a 404
1a004fe0e3 · 1 day ago
Bounded source sync
afe642fe50 · 2 days ago
Bounded source sync
2c581f55ea · 2 days ago
Bounded source sync
375934c28b · 2 days ago
Bounded source sync
74ff37d51a · 2 days ago