Wrap indent
Wrapped lines in code blocks keep their indent, capped so deep lines don't squeeze into a sliver on a phone.
Deep nesting
Today
typescriptsrc/pyramid.ts
export function pyramid(a: unknown) {
if (a) {
if (Array.isArray(a)) {
for (const b of a) {
if (typeof b === "object" && b !== null) {
for (const [key, value] of Object.entries(b)) {
if (value) {
try {
if (typeof value === "function") {
return value(() => {
return new Promise((resolve) => {
setTimeout(() => {
resolve({ key, nested: { deeper: { deepest: { stillGoing: "yes, still going" } } } });
}, 0);
});
});
}
} catch {}
}
}
}
}
}
}
}Trial
typescriptsrc/pyramid.ts
export function pyramid(a: unknown) {
if (a) {
if (Array.isArray(a)) {
for (const b of a) {
if (typeof b === "object" && b !== null) {
for (const [key, value] of Object.entries(b)) {
if (value) {
try {
if (typeof value === "function") {
return value(() => {
return new Promise((resolve) => {
setTimeout(() => {
resolve({ key, nested: { deeper: { deepest: { stillGoing: "yes, still going" } } } });
}, 0);
});
});
}
} catch {}
}
}
}
}
}
}
}JSX
Today
tsxsrc/app/settings/page.tsx
export default function SettingsPage({ user, workspaces }: Props) {
return (
<PageLayout>
<section className={styles.section}>
{workspaces.map((workspace) => (
<Card key={workspace.id} className={cn(styles.card, workspace.archived && styles.archived)}>
<CardHeader>
<CardTitle>{workspace.name} · {workspace.members.length} members · created {formatDate(workspace.createdAt)}</CardTitle>
</CardHeader>
<CardContent>
<NotificationPreferences userId={user.id} workspaceId={workspace.id} defaults={workspace.notificationDefaults} />
</CardContent>
</Card>
))}
</section>
</PageLayout>
);
}Trial
tsxsrc/app/settings/page.tsx
export default function SettingsPage({ user, workspaces }: Props) {
return (
<PageLayout>
<section className={styles.section}>
{workspaces.map((workspace) => (
<Card key={workspace.id} className={cn(styles.card, workspace.archived && styles.archived)}>
<CardHeader>
<CardTitle>{workspace.name} · {workspace.members.length} members · created {formatDate(workspace.createdAt)}</CardTitle>
</CardHeader>
<CardContent>
<NotificationPreferences userId={user.id} workspaceId={workspace.id} defaults={workspace.notificationDefaults} />
</CardContent>
</Card>
))}
</section>
</PageLayout>
);
}Python
Today
pythonscripts/report.py
def build_report(rows, *, include_archived=False, group_by="workspace"):
groups = {}
for row in rows:
if row.archived and not include_archived:
continue
for key in (row.workspace_id, row.project_id, row.environment_name):
if key is not None:
groups.setdefault(key, []).append({"id": row.id, "title": row.title, "updated": row.updated_at.isoformat(), "owner": row.owner.email})
if len(groups[key]) > 1000:
raise ValueError(f"group {key} has more than 1000 rows; narrow the query with a date range or a project filter before building the report")
return groupsTrial
pythonscripts/report.py
def build_report(rows, *, include_archived=False, group_by="workspace"):
groups = {}
for row in rows:
if row.archived and not include_archived:
continue
for key in (row.workspace_id, row.project_id, row.environment_name):
if key is not None:
groups.setdefault(key, []).append({"id": row.id, "title": row.title, "updated": row.updated_at.isoformat(), "owner": row.owner.email})
if len(groups[key]) > 1000:
raise ValueError(f"group {key} has more than 1000 rows; narrow the query with a date range or a project filter before building the report")
return groupsNarrow the window to see the cap kick in: on a phone, deep lines stop at 40% instead of squeezing into a sliver.
Related
- Outline smoothing
The byline chips' blue outline drawn seven ways, to see which anti-aliases most smoothly.
- Feed entry styles
Test page for comparing feed-entry separators, shadows and layout treatments across image, post and page examples.
- Spacing
Body text line height, paragraph gaps and list spacing, from today's to tighter, side by side.
- Hover speed
Every hover fade on the site at its current speed, next to instant, 10ms, 50ms and 100ms.