Pieces/Code(22)

Code pieces from Beste UI, drop-in widgets built with shadcn/ui and Tailwind CSS.

Terminal
$ npx shadcn@latest add @beste-ui/hero181
components/hero181.tsx
components/ui/button.tsx
Styles come from your own theme tokens
orielstudio.pt/llms.txt
# Oriel Skin Studio > Facials, brows and skin consultations > in Príncipe Real, Lisbon. ## Pages - [Treatments](https://orielstudio.pt/treatments) - [Shop](https://orielstudio.pt/shop) - [Book](https://orielstudio.pt/book)

Make sync retries configurable

src/sync/retry.ts

In reviewApproved
export function retry(task: Task) {
const max = 3;
const max = config.retries ?? 3;
return run(task, max);
Smiling man in a floral shirt

Leonard Cohen

Nice and small. Maybe call it retryLimit so it reads well in the config? Happy to ship either way.

~/acme-web

$ npx acme deploy

  • Linked to acme/web
  • Installed 214 packages
  • Built 38 pages
  • Uploaded to 12 regions
Live at https://acme.dev41s

deploy.ts

Approved
export async function ship(env: string) {
const url = await build(env);
return publish(url);
const out = await build(env, { cache: true });
return publish(out.url, { preview: true });
}
Smiling man in a floral shirt

Brian Eno

Caching here cuts the cold build in half. Lovely.

Tools
list_pages
update_section
create_page
publish
npx shadcn@latest add https://beste.dev/r/hero181.json
components/hero181.tsx
components/ui/button.tsx
checkout.test.tsRunning
  • renders cart summary
  • applies coupon code
  • calculates shipping
  • charges saved card
pricing.ts
export function total(cart: Cart) {
const sum = cart.lines.reduce(add, 0)
return sum
const discount = coupon(cart, sum)
return sum - discount
}
members.ts
import { Sirius } from '@sirius/sdk'
const client = new Sirius(apiKey)
await client.members.create({ name })
# Database
DATABASE_URL=postgres://localhost/beste
REDIS_URL=redis://localhost:6379
PORT=3000
curl-XPOSThttps://api.beste.co/v1/users
-H"Content-Type: application/json"
-d'{"name": "Nils Frahm"}'
SELECT id, name, email
FROM users
WHERE active = true
ORDER BY created_at DESC
LIMIT 10;
TypeError: Cannot read 'name' of undefined
greet(src/utils.ts:14:12)
handler(src/server.ts:42:8)
processRequest(src/api.ts:88:4)
Open command palette
⌘K
{
"name":"Beste",
"active":true,
"count":42
}
import{useState, useEffect}from"react";
import{Button}from"@/ui/button";
import{cn}from"@/lib/utils";
const user = await fetchUser("42");
function greet(name) {
return 'Hi ' + name;
return `Hello, ${name}!`;
}
bun add @beste/ui
greet.ts
export function greet(name: string) {
return `Hello, ${name}!`;
}
 
console.log(greet("Beste"));
const greeting = "Hello, Beste!";ts
Markdown version