豆芽丝 https://douyasi.com/ zh-CN 即使再渺小,也要不顾一切地成长 Sat, 06 Dec 2025 22:18:00 +0800 Sat, 06 Dec 2025 22:18:00 +0800 快速适应 AI 辅助编程时代 https://douyasi.com/default/ai_vibe_coding.html https://douyasi.com/default/ai_vibe_coding.html Sat, 06 Dec 2025 22:18:00 +0800 douyasi

作者申明:部分内容由 AI 创作。

我现在写代码的状态,只有两个字可以形容:vibing

不是那种端着咖啡假装高雅的 vibe,而是真·躺平·爽到飞起的 vibe ——我敲两行提示词,AI 给我吐出一段比我手动写还干净 10 倍的代码;我懒得想变量名,直接让它整个项目用《攻壳机动队》里的人名;测试写不出来?让 Claude 直接给我红绿双队大战。我整个人就像躺在 AI 做的云端沙发上,翘着二郎腿看它干活。

这不是炫耀,这是 2025 年的基本操作。

从“被取代恐惧症” 到 “AI 是我最牛的 pair programmer”

2023 年那会儿,大家还慌得一批:“ChatGPT 要抢程序员饭碗了!”
2025 年的我只想笑。你见过有人怕自己的外设显示器抢了自己工作吗?

AI 不是要取代你,它是把你从 70% 的重复劳动里解放出来,让你只干那最爽的 30%:设计系统、想黑魔法、和产品撕逼、取好听的变量名。

真正牛的程序员,不是会写最多代码的人,而是会“指挥”最多 AI 的人。

如何才能真正 vibing,而不是被 AI vibe

很多人用 AI 还是“求着它写代码”,这就输了。

正确姿势是:你得学会当“导演”,而不是“求助的小学生”。
黄金提示词模板(我自己用的):

你现在是一个有 10 年经验的 {语言} 毒舌高级工程师,你讨厌重复代码、讨厌 bad smell、喜欢函数式和抽象。
请帮我重构下面这段代码,要求:
1. 性能提升至少 30%
2. 可读性拉满,后辈看了会默默流泪
3. 加上详细但不啰嗦的注释
4. 用最优雅的方式处理所有 edge case
5. 变量命名要有文学素养

代码:
{paste}

你把这段话存在 Snippet 里,每次直接调用,AI 立刻进入“癫公”状态,写出来的东西比你自己高两段位。

AI 时代真正的分水岭

2025 年的程序员已经分化成三类:

  • 还在手敲 CRUD 的
  • 会用 Copilot 补全的
  • 能指挥一个 AI 军团、20 分钟出一个完整功能、代码质量还爆高的

你想当哪一类,自己选。

演示

以下2个项目由我当指挥官,全程 AI 协助下完成。

]]>
0 https://douyasi.com/default/ai_vibe_coding.html#comments https://douyasi.com/feed/default/ai_vibe_coding.html
使用 golang 写的一些小玩意 https://douyasi.com/golang/some-small-tools.html https://douyasi.com/golang/some-small-tools.html Tue, 05 Jan 2021 23:11:46 +0800 douyasi 贵金属价格悬浮提示工具

近 2 年贵金属波动大,受到一些投资者的追捧,像我们这些散户玩家可能需要一款小窗口价格提醒工具。
PriceReminder 就是这样一款工具,由本人采用 Golang 编写,支持自定义悬浮窗位置。

金银数据采集自新浪财经。特别注意:投资需谨慎。

link:

Playground

有时候,可能需要编写或测试一小段代码(某种语言),可是当前电脑没有该语言环境。那么您就可能需要这样一个应用:
playground 一个托盘应用,可快速链接到某种或多种语言的在线 playground (演练场)地址。

link:

]]>
0 https://douyasi.com/golang/some-small-tools.html#comments https://douyasi.com/feed/golang/some-small-tools.html
Golang 中如何获取当前路径,它们之间有啥差异 https://douyasi.com/golang/go-path-test.html https://douyasi.com/golang/go-path-test.html Tue, 29 Dec 2020 22:59:00 +0800 douyasi see article detail 文章:
https://learnku.com/articles/53099

github source link 源码:
https://github.com/ycrao/learning_golang/tree/main/go-path-test

]]>
0 https://douyasi.com/golang/go-path-test.html#comments https://douyasi.com/feed/golang/go-path-test.html
RabbitMQ 多运行模式简介 https://douyasi.com/php/rabbitmq_intro.html https://douyasi.com/php/rabbitmq_intro.html Sat, 30 Mar 2019 18:29:00 +0800 douyasi RabbitMQ 提供了 6 种模式,分别是 SimpleWorker(或称 Work Queue)、 Publish/SubscribeRoutingTopic(s)RPC Request/Reply。下面传送门仓库详细讲述了前 5 种,并给出代码实现和思路(主动拉取模式属于消费端一种模式,不在此列,一般场景下均为推模式),其中 Publish/SubscribeRoutingTopics 三种模式可以统一归为 Exchange 模式,只是创建时交换机的类型不一样,分别是 fanoutdirecttopic

传送门:

https://github.com/ycrao/rabbitmq-examples

]]>
0 https://douyasi.com/php/rabbitmq_intro.html#comments https://douyasi.com/feed/php/rabbitmq_intro.html
Vue 实现父子组件双向绑定最正确的做法 https://douyasi.com/javascript/vue-bindings.html https://douyasi.com/javascript/vue-bindings.html Sat, 14 Jul 2018 00:43:00 +0800 douyasi 最近在学习 vue ,遇到了父子组件数据绑定的问题。Vue 官方文档有这样一段话:

所有的 prop 都使得其父子 prop 之间形成了一个单向下行绑定:父级 prop 的更新会向下流动到子组件中,但是反过来则不行。这样会防止从子组件意外改变父级组件的状态,从而导致你的应用的数据流向难以理解。

但这并不是说父页面就不能跟子组件双向通讯,不过就是麻烦了一点。在 Google 了诸多之后,尝试了网络上一些破碎零星的代码(什么计算属性,侦听器等)之后,终于找到了最佳的做法:prop.sync

完整代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Prop 双向绑定的实现</title>
    <script src="dist/vue.js"></script>
</head>
<body>
<div id="app">
    <h1>父组件数据</h1>
    <table>
        <tr>
            <th>姓名</th>
            <th>年龄</th>
        </tr>
        <tr>
            <td>{{ name }} <input type="text" v-model="name" /></td>
            <td>{{ age }} <input type="number" v-model.number="age" /></td>
        </tr>
    </table>
    <!--
      v-bind:my-name
      v-on:update:my-name="my-name = $event"
    参考文档
      https://cn.vuejs.org/v2/guide/components-custom-events.html
    -->
    <user-table
      v-bind:my-name.sync="name"
      v-bind:my-age="age"
      v-on:change-age="age = $event"
    ></user-table>
</div>
<template id="userTable">
    <div>
        <h2>子组件数据</h2>
        <table>
            <tr>
                <th>姓名</th>
                <th>年龄</th>
            </tr>
            <tr>
                <td>{{ myName }} <input type="text" :value="myName" @input="updateName" /></td>
                <td>{{ myAge }} <input type="number" :value="myAge" @input="updateAge" /></td>
            </tr>
        </table>
    </div>
</template>
<style>
table, td, th {
    border-collapse: collapse;
    border-spacing: 0
}
table {
    margin: 20px;
}
td, th {
    border: 1px solid #bcbcbc;
    padding: 5px 10px
}
th {
    background: #42b983;
    font-weight: 400;
    color: #fff;
    cursor: pointer
}
</style>
<script>
var UserTable = {
  props: {
    myName: String,
    myAge: Number
  },
  template: '#userTable',
  watch: {
    myName: function (val) {
      console.log('child-component watch fater-component name:' + val)
    },
    myAge: function (val) {
      console.log('child-component watch father-component age:' + val)
    }
  },
  methods: {
    updateName (evt) {
      console.log(evt)
      console.log('_name value:' + this.myName)
      console.log('evt.target.value:' + evt.target.value)
      this.$emit('update:myName', evt.target.value)
      console.log('child-component myName:' + this.myName)
    },
    updateAge (evt) {
      console.log(evt)
      console.log('_name value:' + this.myAge)
      console.log('evt.target.value:' + evt.target.value)
      // 自定义 change-age 事件
      this.$emit('change-age', Number(evt.target.value))
      console.log('child-component myAge:' + this.myAge)
    }
  }
}
new Vue({
  el: '#app',
  data: {
    name: '张三',
    age: 20
  },
  components: {
    'user-table': UserTable
  },
  mounted() {
    const vm = this
    setInterval(() => { console.log('name', this.name, 'age', this.age); }, 3000);
  }
})
</script>
</body>
</html>

使用 Event-Emit 方式实现的示例(请随意在输入框中输入数据,观察数据文本变化):

https://raoyc.com/learning_vue/example/cp_2.html

传送门:

vue 学习笔记仓库

参考文档和资料:

官方文档:自定义事件
总结性比较好的一篇博文:Vue2.x 中实现父子组件间的双向绑定

]]>
0 https://douyasi.com/javascript/vue-bindings.html#comments https://douyasi.com/feed/javascript/vue-bindings.html
解决响应首行输出一行空白问题 https://douyasi.com/php/phptags-tidier.html https://douyasi.com/php/phptags-tidier.html Thu, 15 Mar 2018 16:11:51 +0800 douyasi 最近在开发过程中,发现页面 响应在首行都会输出一行空白,这个问题初步搜索说是 UTF-8 BOM 问题。人工一个一个文件排查是很耗时的,一“翻”谷歌之后,发现了一款检测神奇 phptags tag tidier

解决办法如下(似乎直接下载 phptags-1.2.phar 使用不行):

# 直接下载 phptags 源码
wget http://include-once.org/p/phptags/phptags
# 追加可写权限
chmod +x phptags
# /php/project/folder 项目文件夹目录
php phptags --whitespace /php/project/folder

官网提供了更多的使用示例:

usage examples
phptags --whitespace *.php cleans up spaces or UTF-8 BOM issues before opening and after close tags
phptags --warn directory/ searches through a directory and just warns about whitespace issues
phptags --close --long --tokenizer *.php adds close tags, converts open tags into long form <?php and uses the more reliable --tokenizer mode (instead of --regex)
phptags --unclosed --shortall dir/ ../*.tpl includes/ converts all tags into short forms, and strips close tags of a document (it's advised to rather have whitespace issues fixed than keep using the newcomer workaround)
]]>
0 https://douyasi.com/php/phptags-tidier.html#comments https://douyasi.com/feed/php/phptags-tidier.html
使用gogs搭建自己的私有代码仓库 https://douyasi.com/linux/gogs_private_git_repositories.html https://douyasi.com/linux/gogs_private_git_repositories.html Sat, 03 Mar 2018 12:32:00 +0800 douyasi 以前钟爱的 http://coding.com 在收费的道路上越走越远,下定决心自己搭建一个私有代码仓库服务。
有之前安装 gitlab 各种依赖配置不便之处,此次决定使用 gogs 搭建自己的私有代码仓库

安装参考官方文档即可成功,比搭建 gitlab 要简单多了。

https://gogs.io/ (官方网站访问不稳定,多试试)

为了安全起见,搭建好的私有仓库服务地址暂时不放出。

]]>
0 https://douyasi.com/linux/gogs_private_git_repositories.html#comments https://douyasi.com/feed/linux/gogs_private_git_repositories.html
开始关注虚拟币 https://douyasi.com/financing/bitcoin.html https://douyasi.com/financing/bitcoin.html Tue, 19 Dec 2017 23:30:00 +0800 douyasi

来自 https://www.zhihu.com/question/21478404/

  • 怎样选择使用比特币钱包? 日常使用的额度通常小于10个币,可以存放在电脑或手机App中。通常存放1个币以下是比较保险的,丢了不太心疼嘛
  • 持有几十、几百个币的,可以选择http://BlockChain.Info等在线钱包。其也可以当做日常钱包使用。
  • 持有上千甚至数万的,应该分开存储,并隔离存放。使用离线电脑生产密钥,打印出来托管至银行等高安全场所存储,并销毁现有密钥。同时还需要多份隔离存储,甚至对密钥进行加密。

密钥即一切,如不慎弄丢钱包,便永远失去这笔比特币。所以钱包需要小心妥善保管,不在自己的PC或者手机App中存储大量比特币,丢失的风险太高,病毒木马、硬件损坏、手机丢失等均造成无法挽救的损失。俗话讲鸡蛋不要搁在一个篮子里,多种方式存储也是降低风险的有效方式。目前丢失的比特币或有数百万BTC之巨。

常见钱包

  • Bitcoin-Qt – 官方客户端,基于C++/Qt,全平台,完全数据。
  • Electrum – 著名轻钱包
  • Armory – 基于Python,含有诸多特性的轻钱包
  • BlockChain.info – 非常著名在线钱包
]]>
0 https://douyasi.com/financing/bitcoin.html#comments https://douyasi.com/feed/financing/bitcoin.html
可能是最好的第三方宝付 SDK ! https://douyasi.com/php/baofoo_sdk.html https://douyasi.com/php/baofoo_sdk.html Thu, 21 Sep 2017 13:54:00 +0800 douyasi 最近公司项目需要接入宝付支付,结合官方文档我写了个宝付 sdk 第三方包,可以 composer 引入,有需要的同学可以试一试,可以很方便快捷地接入宝付。

目前本 sdk 支持以下交易子类:

  • 01 直接绑卡类交易
  • 02 解除绑定关系类交易
  • 03 查询绑定关系类交易
  • 11 预绑卡类交易
  • 12 确认绑卡类交易
  • 15 预支付交易(发送短信)
  • 16 支付确认交易
  • 31 交易状态查询类交易
    以上 8 个接口都支持传入以下可选项:
    // 'additional_info' => '测试',  // 附加字段,可以不传或留空
    // 'req_reserved' => '保留字段',  // 请求方保留域,可以不传或留空

传送门:https://github.com/douyasi/baofoo

]]>
0 https://douyasi.com/php/baofoo_sdk.html#comments https://douyasi.com/feed/php/baofoo_sdk.html
数据库字典生成脚本 https://douyasi.com/php/db-dict-generator.html https://douyasi.com/php/db-dict-generator.html Mon, 19 Jun 2017 11:22:00 +0800 douyasi 传送门:

https://github.com/douyasi/db-dict

支持生成 markdownhtml 两种格式。

页面样式预览:

dict.png

]]>
0 https://douyasi.com/php/db-dict-generator.html#comments https://douyasi.com/feed/php/db-dict-generator.html