Grilled Cheese

ExploreLog inSign up
Terms of UsePrivacy PolicyCommunity StandardsHelpGet the app

Grilled Cheese is a product of Village Compute

Version devBuilt at: 2026-12-03 22:42:33 EST

PhotosVideosAllPeople
LatestRanked
Photo, no description
Photo, no description
Photo, no description
Photo, no description
Photo, no description
Day 024: Stack with arrays
Day 024: Async/await
Photo, no description
Photo, no description
Photo, no description
Photo, no description
JavaScript code example using the Compression Streams API to compress and decompress data streams. Includes a function to zip data with 'CompressionStream' and another to unzip with 'DecompressionStream'.
Tab shows the help hint beside the focused button.
Photo, no description
Angular code in broadcast-signal.ts. First, export function broadcastSignal<T>(name: string, initial: T). Inside: const channel = new BroadcastChannel(name); const synced = signal(initial); const value = linkedSignal(() => synced()). Then channel.onmessage = (event: MessageEvent<T>) => synced.set(event.data); and inject(DestroyRef).onDestroy(() => channel.close()). Then an effect: if (value() !== synced()) { channel.postMessage(value()); synced.set(value()); }, and the function returns value. Next, an @Service() class Auth with readonly user = broadcastSignal<User | null>('user', readSession()); and private readonly router = inject(Router). Its constructor runs an effect: if (!this.user()) { this.router.navigate(['/login']); }. Its logout() method calls this.user.set(null). The postMessage line, the navigate line and the this.user.set(null) line are highlighted.
Photo, no description
TypeScript code in roles.ts. const ROLES = ['admin', 'editor', 'viewer'] as const; type Role = (typeof ROLES)[number]; const role = new URLSearchParams(location.search).get('role') ?? 'viewer'. A comment says "Error: 'string' is not assignable to 'admin' | 'editor' | 'viewer'" above the highlighted line ROLES.includes(role). A second comment says "Fix: widen the array for the check, narrow the value with a type guard", followed by function isRole(value: string): value is Role { return (ROLES as readonly string[]).includes(value); }, with the return line highlighted. Last: if (isRole(role)) { openDashboard(role); } with the comment "role is Role here".
Photo, no description
Photo, no description
Photo, no description
Load more