Archive of

网友语录 - 第37期 - 人们会忘记你说过的话,会忘记你做过的事,但永远不会忘记你带给他们的感受

这里记录我的一周分享,通常在周六发布。


西瓦 “更令人担心的是,还有很多人没有看清问题的本质。实际上,教育的目的与升学率和考试分数无关,教育的目的是帮助人们收获人生的果实,教育的责任是挖掘人的潜力,教育的使命是提升人的尊严。”


heepst @heepst.bsky.social

Uh-oh.

There's a saying in the Baltic region - it's one of those dark jokes with at least a kernel of truth - that you don't need to start worrying until the Kremlin denies it.

(扶额.

波罗的海地区有句老话——既是黑色幽默又颇真实:“不用太早担心,除非克里姆林宫开始否认这件事”)


Shi De Sheng 人在疲惫的时候,什么事都做不成。精神和身体保持健康状态,才是一切的开始。

生命是一次又一次的循环。好好吃饭,好好睡觉,认真记录,就是对生命最隆重的赞美

归根结底人生有两条路:要么销售,要么创造。

不被爱只是不走运,而不会爱是种不幸。–阿尔贝·加缪《局外人》

生命的意义不在于发现自我,而在于塑造自我。这的确是两回事。

人们会忘记你说过的话,会忘记你做过的事,但永远不会忘记你带给他们的感受

“爱是这样一种状态:另一个人的幸福对你自己的幸福至关重要。” ― Robert A. Heinlein。

https://shidesheng.wordpress.com/2025/06/08/2025年5月/

…more

Running Claude Code on Windows Without WSL

This post is out-dated. Claude code has now officially supported GitBash, see https://docs.anthropic.com/en/docs/claude-code/setup for detail.

Got a Windows dev VM where you can't install WSL? Here's how to get Claude Code working with just Git Bash.

The Fix

Add these to your .bashrc:

export NPM_CONFIG_IGNORE_SCRIPTS=true
export SHELL=/c/Program\ Files/Git/bin/bash.exe

Then:

source ~/.bashrc
npm install -g @anthropic-ai/claude-code

Done.

Why It Works

Git Bash provides enough Unix-like environment for Claude Code. The SHELL export tells it where to find bash, and NPM_CONFIG_IGNORE_SCRIPTS prevents install script issues.

Caveats

This is a workaround, not official support. Works fine in my vm, let me know if it also works on your machine!

Tested on Windows Server 2022 with Git for Windows 2.50.0.windows.1

Solving Flutter Web Image Rendering Issues: A Cross-Platform Approach

If you've ever tried to display images in a Flutter app that needs to work seamlessly across web and mobile platforms, you've probably run into some frustrating limitations. Recently, I tackled this exact problem when our markdown image renderer started choking on web deployments due to CORS restrictions and lack of proper zoom functionality.

The Problem

Our original implementation was painfully simple - just Image.network(src) wrapped in a GestureDetector. This worked fine on mobile, or on web with --web-renderer html. However, the HTML web renderer is obsolete and will be removed shortly. We needed a more reliable solution.

The Solution: Platform-Specific Implementations

The key insight was to leverage Flutter's conditional imports to create platform-specific implementations while maintaining a clean, unified API.

Setting Up Conditional Imports

// Conditional imports for web
import 'web_image_stub.dart'
    if (dart.library.html) 'web_image_impl.dart';

This pattern lets you have different implementations for web vs mobile while keeping your main code clean. The stub file handles non-web platforms, while the implementation file contains the web-specific logic.

Web Implementation: HTML Elements to the Rescue

For web, I ditched Flutter's built-in image widgets entirely and went straight to HTML elements using HtmlElementView. This bypasses CORS issues since the browser handles the image loading directly.

final imgElement = html.ImageElement()
  ..src = src
  ..style.width = '100%'
  ..style.objectFit = 'contain'
  ..style.cursor = 'pointer';

The magic happens when you register this as a platform view. Flutter treats it like any other widget, but under the hood, it's pure HTML - which means it plays nicely with browser security policies.

Adding Zoom Functionality

The fullscreen implementation includes both mouse wheel and touch gesture zoom:

// Mouse wheel zoom
imgElement.onWheel.listen((event) {
  event.preventDefault();
  scale += event.deltaY > 0 ? -0.1 : 0.1;
  scale = scale.clamp(0.5, 3.0);
  imgElement.style.transform = 'scale($scale)';
});

For touch devices, I implemented pinch-to-zoom by tracking multiple touch points and calculating the distance between them. It's more complex than the mouse wheel version, but it gives web users the same intuitive zoom experience they expect.

Mobile Implementation: Keep It Simple

For mobile platforms, I stuck with the tried-and-true approach but improved the UX:

Dialog.fullscreen(
  backgroundColor: Colors.black,
  child: Stack(
    children: [
      Center(
        child: PhotoView(
          imageProvider: NetworkImage(url),
          minScale: PhotoViewComputedScale.contained,
          maxScale: PhotoViewComputedScale.covered * 4,
        ),
      ),
      // Close button positioned in top-right
    ],
  ),
)

The key improvements were switching to Dialog.fullscreen instead of a regular dialog and adding a proper close button with consistent styling.

Key Takeaways

  1. Conditional imports are your friend - They let you maintain clean separation between platform-specific code without cluttering your main logic.

  2. HTML elements can solve web-specific problems - When Flutter widgets don't cut it on web, dropping down to HTML often provides better browser compatibility.

  3. Consistent UX matters - Users expect zoom functionality on images, especially in fullscreen mode. Don't skimp on these details.

  4. Don't fight the platform - Web and mobile have different strengths. Embrace them instead of trying to force a one-size-fits-all solution.

The Result

After implementing these changes, our image handling works consistently across platforms. Web users get smooth zoom functionality without CORS headaches, mobile users get the native experience they expect, and the codebase remains maintainable with clear separation of concerns.

Sometimes the best solution isn't the most elegant one - it's the one that actually works for your users across all the platforms they're using.

网友语录 - 第36期 - 朋友是自己选择的家人

这里记录我的一周分享,通常在周六发布。


郝靠谱 朋友是自己选择的家人


Cherie It's not a holiday unless there is no to do list. (照着清单去度假不是度假)


steedhorse 有些事你可能琢磨了很久,但还是在真正做了之后,才尝透了其中的的滋味。(思考和行动是完全不同的体验)


水瓶 我们年轻的时候总是忙着赶路。现在想想才知道,沿途的风景也许比目的地更重要。(生命是一个过程,我们应该享受过程)


金先生答道:“越是把注意力放在疼痛上,我就越会觉得疼。谈论疼痛就像给植物施肥一样。所以我很多年以前就改掉了抱怨的习惯。”


咖啡因馥郁 虽说人生怎么选都是错,但是人生怎么选都有它的美好。


mywaiting Q 诚实守信为什么是最重要的品质?
A 因为这能最大化降低双方交易成本和彼此心智负担


要想过更幸福、更满意的生活,人就得改变自身。这和钱无关,金钱本身既不会使人幸福,也不会带来不幸。金钱是中性的,既不好,也不坏。只有当钱属于某一个人的时候,它才会对这个人产生好的影响或者坏的影响。钱可以被用于好的用途,也可以被用于坏的用途。一个幸福的人有了钱会更幸福;而一个悲观忧虑的人,钱越多,烦恼就越多。


猪小宝 那天听了一个讲佛教的视频,感觉我有一点开窍。 就说啊,如果现在 ChatGPT 跟你说,它自己很苦恼很痛苦很迷惘,你会怎么想?你知道它其实不存在,它只是一些算法代码,一些显卡,一拔电源就啥也不是。这种怎么可能会苦恼呢?这不是搞笑嘛。
在觉悟者看来,我们的苦恼也差不多。没钱没势,生老病死,人生七苦,我们的这些苦恼其实都像 GPT 说它自己苦恼差不多。都是虚妄


Rumi said: "As you start to walk on the way, the way appears." Clarity doesn't come before action. It comes from action.


希然kimmy 起床,先冥想🧘‍♀️,然后做事,起床的痛苦也没有了。


Marskay 有一段时间,我感到孤独就是一种惩罚,就像把一个孩子关在一间黑屋子里,而成年人在另外一间屋里谈笑风生。后来,有一天我们也长成了成年人,这才知道,孤独是人生中一种自觉的独处,而不是惩罚,不是受伤者和患病者的退隐,也不是怪癖,而是作为一个人生活里的唯一真正的存在状态


对孩子的过度关怀与对孩子采取棍棒教育其后果是相似的,都是对孩子的不尊重,都是对孩子权利的剥夺。棍棒教育伤害的是从身体到心灵,而过度关怀的伤害是从心灵到身体

网友语录 - 第35期 - 你走过的每一条弯路,其实都是必经之路

这里记录我的一周分享,通常在周六发布。


胡適:“(我是)不可救藥的樂觀主義者,...有時我自稱爲歷史家,有時又稱爲思想史家,但我從未自稱我是哲學家,或是其他各行的什麽專家”。


胡适于1930年5月19日辞去中国公学校长,由马君武继任。马君武是胡适的老师,1906年胡适考进中国公学时便是他亲手拔取的。6月初间,我已到胡适家。那时马君武正接任,每天上午11时后便赶到胡适家商谈,吃了午饭回去。有一天,马君武走后,胡适对我说:“马先生是孙中山同盟会的秘书长,地位很高。只是脾气不好,一言不合,就用鞋底打宋教仁的巴掌。他不肯信任人,事事要自己抓,连倒痰孟也不放心,要去看过。不肯信任人,人便不敢负责;事事自己去抓,便行不通。”果然不到一两个月,中国公学大风潮又起来了。教职员不拥护他,学生分为拥马派与倒马派,两派甚至发生了械斗。不久,马君武就被赶走了。胡适主持中国公学的领导方法,恰恰与马君武相反。


去,践履躬行你力所能及的一切。如果你不去,那你在犯错。只要你充满生机活力,那你干什么并不重要。如果缺少了生机,你还拥有什么呢?……失去活力的你什么都不拥有……好时光便是一个人依然幸福的拥有生命活力的时候。

--亨利 詹姆斯《大使们》


福姬:你走过的每一条弯路,其实都是必经之路。你永远都无法借别人的翅膀,飞上自己的天空。

…more