HackerURLs

一次又一次被重新发现的经典。

同一个链接,相隔一年以上,一次又一次被人重新发现、再次冲上 Hacker News 首页。能经受住这种时间检验的,大多是值得一读再读的文章。每篇附中文标题,讨论最热的那些再加上中文导读和高赞评论翻译。

从名人堂开始
  • 4,700+篇经过时间检验的经典

Hall of fame

名人堂

在经典库里看全部精选

上首页次数最多、而且有中文导读的 30 篇。时间轴上每个黑点是一次上首页,空心点是一次没冲上去的投稿。

  1. 正在载入经典…

Archive

经典库

按第一次上首页的年份分布,点柱子筛选。

排序

    About

    这些经典是怎么挑出来的

    1. 01

      合并同一个链接

      读取 Hacker News 自 2006 年以来的全部链接投稿,把 http/https、www、跟踪参数等写法不同的同一篇文章合并成一条。

    2. 02

      只留经得起时间的

      同一链接至少两次拿到 50 分以上(约等于上首页),而且两次相隔一年以上;再由 AI 剔除状态页、产品首页和新闻事件。

    3. 03

      写导读、译评论

      上首页次数最多的 2,000 篇配上中文导读、"为什么经久不衰",并精选翻译 HN 高赞评论。导读由 AI 生成,可能有误。

    工具与资源github.com

    Ink:用于交互式命令行应用的 React

    Ink: React for interactive CLI apps

    3次上首页
    7年跨度
    352累计得分
    163条评论

    2017 — 2024,它一次次回到首页

    黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。

    导读

    Ink 是一个开源库,让你用 React 的组件化方式来构建交互式命令行界面(CLI)。它把 React 的声明式渲染模型搬到终端里,开发者可以用熟悉的组件和状态管理思路来写终端 UI。项目在 2017、2023、2024 年多次登上 Hacker News 首页。

    为什么经久不衰:它把 React 的心智模型引入终端应用开发,降低了写交互式 CLI 的门槛,多年后仍有活跃生态和讨论价值。

    关键词 ReactCLI终端 UI开源项目

    HN 评论精选

    作者用游戏循环式渲染写终端编辑器,认为自建轻量渲染层比庞大的 curses 更实用,且与 React 方法不同。

    我之前写过一个终端文本编辑器,其中一个挑战是实现渲染器。通常要摆弄 termios、修改终端参数;由于这依赖具体设备,就有了 terminfo 这类数据库和 curses 这类抽象层,提供类似“在 x/y 位置用绿色写这段文字”的 API。但 curses 和 terminfo 很庞大,支持的很多终端早已没人用,所以如果能接受只支持现代终端的 99.9%(而非 curses 的 99.999%),自己实现或改用 termbox 之类的替代品是可行的。它提供简单 API,比如把 Unicode 字符以指定样式写到 x/y 位置,还有一些终端初始化工具函数(比如处理窗口尺寸变化事件)。然后你可以像游戏循环一样写应用:while should_run: render(state); update(state); get_input(state)。这种 API 很好用,和 React 的思路不同,但写文本编辑器这类终端 GUI 效果很好。

    zeptomu查看英文原文

    Some time ago I built a (terminal) text editor and one of the challenges is to implement the renderer which is normally done by messing with termios and changing some terminal parameters - as this is "device"-dependent there exist databases like terminfo and abstraction-layers like curses which give you an API similar to "Write this text at position x/y in green". However curses and terminfo are big programs and most terminals they support are not in use anymore, so if one is OK with supporting just 99.9 (and not 99.999 like curses)% of modern terminals (say xterm, linux-console, st, urxvt, $otherterm), it is feasible to roll your own or use an alternative like e.g. termbox (https://github.com/nsf/termbox). It provides a simple API like "write Unicode-Char to position x/y in specific $style" and some utility functions to setup the terminal (e.g. one has to consider how to react to window-size (== terminal rows/cols size) events). You can then write your app similar to a game-loop like the following: while state['should_run']: render(state) update(state) get_input(state) I think such an API is pretty nice to work with - this is different to the React approach, but for writing terminal GUIs like text editors it worked pretty well for me. Many (native) games use a similar approach when rendering menu's and stuff and although there are terrible ones most menus of games look pretty slick.

    质疑不用 ncurses 时的重绘性能,担心全量重画会慢,想知道是否有更优方案。

    很惊讶它完全没用 ncurses。我本来很希望看到有人把 React 的便利性带到 ncurses 文本界面的构建中。既然不用 ncurses,我怀疑它的重绘方式:最朴素的做法是每次响应式事件都把屏幕上的文字全部重画一遍,这能工作但会很慢;如果它用了更聪明的办法,我很想了解。

    z1mm32m4n查看英文原文

    Surprised to see that this doesn't use ncurses at all. I was really hoping to see something that brought the painlessness of using React to building an ncurses textual interface. Seeing that it doesn't use ncurses, I'm suspicious of how it does re-draws. I'd imagine the naive thing of just redrawing every bit of text on the screen for every reactive event would work, but be pretty slow. Of course, if they're doing something smarter than this, I'd be interested to hear how it's done.

    推荐 react-blessed 作为用真正 React 构建终端界面的替代方案。

    如果有人想用真正的 React 做同样的事,可以看看 react-blessed:https://github.com/Yomguithereal/react-blessed

    lwansbrough查看英文原文

    If anyone is interested in using actual React for the same purposes, check out react-blessed: https://github.com/Yomguithereal/react-blessed

    反思终端应用从文本流转向复杂交互 UI 的趋势,并疑问是否只是 JS 生态的现象。

    终端“应用”作为文本流的日子哪去了?这是只有 JS 生态这样,还是别处也有同样的趋势?

    fovc查看英文原文

    What ever happened to terminal "apps" being streams of text? Is just the JS ecosystem that does this or are others seeing the same trend?

    历次讨论

    同类还值得读

    1. 直接在浏览器中启动 Linux 内核

      Boot a linux kernel right inside your browser.

      Fabrice Bellard 的 JSLinux 页面,用 JavaScript 在浏览器里启动一个 Linux 内核,并提供一个可交互的终端环境。

      工具与资源上首页 5 次 · 2011–2025bellard.org
    2. Hacker News 未公开功能与行为清单(2018)

      A List of Hacker News's Undocumented Features and Behaviors (2018)

      数据科学家 Max Woolf 整理的 Hacker News 未公开功能与行为清单,涵盖投票机制、排名算法、账号惩罚等社区运作细节。

      工具与资源上首页 5 次 · 2019–2025github.com
    3. MapSCII:在终端中用盲文和 ASCII 渲染地图

      MapSCII – Braille and ASCII map renderer for the console

      MapSCII 是一个在命令行终端里渲染地图的开源工具,用盲文字符和 ASCII 字符把地理数据画成可交互浏览的字符地图。

      工具与资源上首页 5 次 · 2017–2025github.com
    4. 顶尖大学的免费在线课程

      Free Online Courses from Top Universities

      Open Culture 整理的一份免费在线课程合集,汇集了全球顶尖大学(如 MIT、斯坦福、耶鲁等)向公众开放的网络课程资源,涵盖音频、视频等多种形式。

      工具与资源上首页 5 次 · 2010–2022openculture.com
    5. 淘气字符串:容易引发用户输入问题的字符串清单

      Naughty Strings: A list of strings likely to cause issues as user-input data

      一个 GitHub 仓库,收录了大量容易让程序出问题的用户输入字符串,如特殊字符、emoji、SQL 注入片段、系统命令等,供开发者用于测试输入处理逻辑。

      工具与资源上首页 4 次 · 2015–2020github.com

    打赏支持

    打赏二维码

    觉得有用,请作者喝杯咖啡。

    WeChat

    关注向阳乔木

    微信公众号「向阳乔木推荐看」

    微信公众号「向阳乔木推荐看」二维码

    微信扫一扫;在微信里打开本页时,长按二维码识别。