Author: ClaudeDevs (@ClaudeDevs) Date: 2026-07-06 Source: https://x.com/ClaudeDevs/status/2074208949205881033
Discover gists
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type UserState = | |
| | { status: 'loading' } | |
| | { status: 'success'; data: User } | |
| | { status: 'error'; error: Error } | |
| | { status: 'refreshing'; data: User } // new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function assertNever(value: never): never { | |
| throw new Error(`Unhandled state: ${JSON.stringify(value)}`) | |
| } | |
| function renderUser(state: UserState): string { | |
| switch (state.status) { | |
| case 'loading': | |
| return 'Loading…' | |
| case 'success': | |
| return `Welcome, ${state.data.name}` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type CheckoutState = | |
| | { step: 'cart'; items: CartItem[] } | |
| | { step: 'shipping'; items: CartItem[]; address: Address } | |
| | { step: 'payment'; items: CartItem[]; address: Address; method: PayMethod } | |
| | { step: 'confirmed'; orderId: string } | |
| type CheckoutAction = | |
| | { type: 'addAddress'; address: Address } | |
| | { type: 'addPayment'; method: PayMethod } | |
| | { type: 'confirm'; orderId: string } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Bad: `status` is `string`, so TypeScript can't narrow | |
| interface Loose { status: string; data?: User } | |
| // Good: literal union enables narrowing | |
| type Tight = { status: 'idle' } | { status: 'ready'; data: User } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Reddit Compact CPR | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.3 | |
| // @description Revive Reddit Compact with a site skin | |
| // @author palenerd | |
| // @match https://old.reddit.com/* | |
| // @grant none | |
| // ==/UserScript== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| apiVersion: v1 | |
| kind: Namespace | |
| metadata: | |
| name: castai-agent | |
| --- | |
| apiVersion: source.toolkit.fluxcd.io/v1 | |
| kind: HelmRepository | |
| metadata: | |
| name: castai-helm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 2026-07-09 18:02:11,999 856 [DEBUG] - XmlConfiguration is now operational | |
| 2026-07-09 18:02:13,504 856 [DEBUG] - Adding new type 'CygwinService' for type 'IAlternativeSourceRunner' from assembly 'choco' | |
| 2026-07-09 18:02:13,550 856 [DEBUG] - Adding new type 'CygwinService' for type 'IInstallSourceRunner' from assembly 'choco' | |
| 2026-07-09 18:02:13,578 856 [DEBUG] - Adding new type 'PythonService' for type 'IAlternativeSourceRunner' from assembly 'choco' | |
| 2026-07-09 18:02:13,593 856 [DEBUG] - Adding new type 'PythonService' for type 'IListSourceRunner' from assembly 'choco' | |
| 2026-07-09 18:02:13,625 856 [DEBUG] - Adding new type 'PythonService' for type 'IInstallSourceRunner' from assembly 'choco' | |
| 2026-07-09 18:02:13,640 856 [DEBUG] - Adding new type 'PythonService' for type 'IUninstallSourceRunner' from assembly 'choco' | |
| 2026-07-09 18:02:13,671 856 [DEBUG] - Adding new type 'RubyGemsService' for type 'IAlternativeSourceRunner' from assembly 'choco' | |
| 2026-07-09 18:02:13,736 856 [DEBUG] - Adding new type 'RubyGe |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="zh-CN"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>每日 AI 新闻与 GitHub Trending 报告</title> | |
| <style> | |
| :root { | |
| --bg: #0b1020; | |
| --panel: #111831; |
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="zh-CN"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Alpamayo 1.5 深度解析课程</title> | |
| <!-- Google Fonts: Bricolage Grotesque · DM Sans · JetBrains Mono --> | |
| <link rel="preconnect" href="https://fonts.googleapis.com"> |
