Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
Kai
@_kaichen
高级会员
第 178 位会员 / 2011-11-22

简阅科技
杭州
5 篇帖子 / 170 条回帖
43 关注者
16 正在关注
8 收藏
不会吧,靠
GitHub Public Repos
  • chrome-builtin-ai-ext 17

    Make a demo using chrome built-in Gemini Nano.

  • mcp-local-router 12

    An MCP (Model Context Protocol) local router that serves as an aggregation proxy for MCP servers.

  • mcp-config-editor 11

    A simple GUI for managing MCP servers, for easy toggle mcp servers.

  • kaichen.github.com 7

    this is kaichen's personal website

  • adventofcode2019 3

  • mcp-apple-productive-s... 3

  • parity-log-parser 2

    A parity log file parser, and analysize rpc requests.

  • imkey-portal 2

    React app for imKey integration testing

  • mcp-client-demo 2

    MCP客户端演示项目,使用OpenAI和Model Context Protocol

  • examples 2

    Kubernetes application example tutorials

More on GitHub
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • RAILS API TO BE PART OF RAILS 5 at 2015年08月16日

    #60 楼 @camel 那你们现在对于打包前端文件是通过什么来完成的?webpack ?

  • acts_as_taggable_on + simple_form + select2 只有最后一个标签被保存 [已解决] at 2015年08月11日

    f.input 里要把 multiple: true 传进去。

    不然构造出来的参数就是 category_list 而不是正确的 category_list[] ,如 Log 所示 Rails 会将它处理为 "category_list"=>"第二条评论" 。

  • controller_name 可以在 View 中使用,这是怎么来的? at 2015年08月11日

    其实就是有个 Helper 里定义了 Delegation,把 Controller 里的一些方法都 delegate 到 View Helper 里。

    delegate :request_forgery_protection_token, :params, :session, :cookies, :response, :headers,
                   :flash, :action_name, :controller_name, :controller_path, :to => :controller
    

    ref https://github.com/rails/rails/blob/4-2-stable/actionview/lib/action_view/helpers/controller_helper.rb

    如果你要问为什么这里会拿到 controller,原因是 view 和 controller 互相持有引用,并且 view 的上下文就是由 controller 决定的,所以你能拿到 controller 里设置的实例变量。

    实际上要取到 Controller 的名字也可以通过 params[:controller] 来拿到,这个是由路由产生的,同时可以拿到的还有 params[:action] 。

  • 征集大家意见,关于回帖用树形方式展示,类似 HackerNews at 2015年08月10日

    👎

  • 关于 rspec 中 its 的功能的疑问 at 2014年11月02日

    在 3.x 的时候已经被拆出一个单独的 Rubygem,如果你需要用可以在 Gemfile 里加上

    gem "rspec-its"
    

    Github 地址 https://github.com/rspec/rspec-its

  • RubyConf 吐槽贴 at 2014年11月01日

    听半小时广告能换来一次自助餐还是值得的

  • 组团上京参加 Rubyconf,起点杭州 at 2014年10月26日

    #19 楼 @ylt 加我微信吧 kaichenxyz 到时车站见

  • 一个贴读懂 RubyConf China 2014 at 2014年10月22日

    #18 楼 @chairy11 我去问问 SegmentFault,为什么没有回复。

  • 组团上京参加 Rubyconf,起点杭州 at 2014年10月22日

    #16 楼 @ylt 回程坐的飞机,3 号的 CA1702,可以买同一班一起走。去的时候火车票买同一班的也可以一起行动。

  • 组团上京参加 Rubyconf,起点杭州 at 2014年10月21日

    #12 楼 @ylt #14 楼 @jun1st

    刚买了票,我们买了周五下午 14:37 的 G166,11 车

  • 组团上京参加 Rubyconf,起点杭州 at 2014年10月20日

    我们暂定是 31 号 14:37 的车走,还有其他小伙伴加入吗?明天我们就买票了

  • 组团上京参加 Rubyconf,起点杭州 at 2014年10月20日

    #8 楼 @fsword 微信私聊

  • 组团上京参加 Rubyconf,起点杭州 at 2014年10月20日

    #6 楼 @fsword 你不和 @huacnlee 一伙的?

    我想 31 号走,周五。一块去?

  • 组团上京参加 Rubyconf,起点杭州 at 2014年10月20日

    #2 楼 @huacnlee 坐个飞机来回机场太久,还是倾向于坐火车

  • Install Ruby The "Postmodern" Way at 2014年07月09日

    #7 楼 @hooopo 不需要在服务器上做 rehash,项目里用到的可执行文件,最好都binstubs(power by bundler)出来,这样在哪调用都可以正确地引用到对应的 Gemfile。

  • 帮忙看下这段代码是否有更好的实现方式 at 2014年07月09日

    看到大家的回帖急死我了,楼上的同学都没认真读过 Sidekiq 的文档。

    @loveltyoic 这里最合适的做法应该是使用 Sidekiq 提供的Server Middleware

    Server Middleware 的类似 Rack Middleware,它是在一个 Worker 执行 Job 时,提供外层注入一些逻辑。Sidekiq 基于此实现了

    在我们公司的一个项目是里加入了这样一个 Middleware

    module Middleware
      class JobMonitor
        def call worker, msg, queue
          ActiveSupport::Notifications.instrument("background_job.process", msg.dup) do
            yield
          end
        end
      end
    end
    

    这里通过 AS::Notifications 把这里发生的事情发布出去,然后另外一个地方会进行 subscribe,负责发送 Job 的执行情况到我们的数据收集系统里。

    楼主你的代码可以简单实现成这样,Job 那部分不用改动

    # lib/job_logger.rb
    class YourJob
      def call worker, msg, queue
        yield
        put_your_log_opertation_here
      end
    end
    
    # config/initializers/sidekiq.rb
    Sidekiq.configure_server do |config|
      config.server_middleware do |chain|
        chain.add JobLogger
      end
    end
    
  • 36kr 上,Fengche.co 打算开始 A 轮融资了 at 2014年07月07日

    @liuhui998 @chairy11 @xieren58

    见 http://www.peat.io/#team 最后一排右边

  • Swift 和 Ruby 差别还是挺大的... at 2014年06月05日

    与 Array 类似的情况

    var a = "abc"
    var b = a
    
    a = a + "d" // "abcd"
    b // "abc"
    a // "abcd"
    
  • [已解决] 如何创建 PostgreSQL 的数据库 at 2014年05月09日

    需要为你当前用户赋予创建数据库的权限

    alter role {your_username} createdb

    如果你用的是 Mac,通过PostgresApp安装的话,你连用户名密码权限啥都不用指定。

  • [杭州] 皮匠游戏招聘 Web 开发工程师一枚 和大牛一起工作哦 at 2014年05月06日

    强力推荐

  • 关于 AR 中,serialized 属性的查询 at 2014年03月19日

    这种情况很适合用 bitmask

    https://github.com/joelmoss/bitmask_attributes

  • 还有类似 Railscasts, Nsscreencasts, Laracasts 的短而精的视频推荐吗? at 2014年03月11日

    http://www.rubytapas.com/ http://elixirsips.com/ http://vimcasts.org/ https://www.destroyallsoftware.com/screencasts http://www.watchmecode.net/

  • Rails 4 升级 加载多个路由的配置问题 at 2014年03月10日

    的确是个 Bug :plus1:

    这个改动被 https://github.com/rails/rails/commit/5e7d6bba79393de0279917f93b82f3b7b176f4b5 干掉了,但是没弄干净。在 railties/lib/rails/engine/configuration.rb 里没有把这句 Revert 回来。

    paths.add "config/routes.rb"
    #=> paths.add "config/routes"
    

    大哥,去提交一个 Pull Request 吧,然后你就是 Rails 的 Committer 了。

  • Rails 4 升级 加载多个路由的配置问题 at 2014年03月10日

    #3 楼 @meeasyhappy

    这个更新就是给出一个方法去调用,然后加载配置文件。与你在 Rails 3 里写的等价的效果是

    draw :admin
    draw :books
    

    config/routes.rb也是一个配置文件,为什么要纠结于自己修改paths['config/routes']来处理这个事情呢?

  • Rails 4 升级 加载多个路由的配置问题 at 2014年03月10日

    新的版本里官方加了加载某个路由文件的功能,具体用法如下

    draw :admin #=> 加载 config/routes/admin.rb
    

    这个改动其实早在 2012 就 Commit 进去,但好像是 Rails 4 才合并进来。改动地址如下

    https://github.com/rails/rails/commit/6acebb38bc0637bc05c19d87f8767f16ce79189b

    链接到 Github 文件的某一行可以点击文件的行号,浏览器的地址栏就会加上行号的锚点。

  • 关于 middleware 的疑问. at 2014年03月09日

    加一些判断在 Middleware 中,比如通过 URL 判断env['PATH_INFO']

  • [杭州][2014年2月23日] 杭州 RubySunday 线下活动召集 (周日) at 2014年02月18日

    #3 楼 @liwei78 这周末气温会回升一些,周日白天应该有个 10 度以上。

  • Mongid time gt query ? at 2013年10月08日

    类型的问题,丢个 String 进去会查不到东西的

    User.last.c_at.class #=> ActiveSupport::TimeWithZone
    User.last.c_at.iso8601.class #=> String
    

    查询的方法也有点问题,应该是这样

    User.where(:c_at.gt => Time.parse(User.last.c_at.iso8601))
    

    这样就对了。

  • 上一页
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 下一页
关于 / RubyConf / Ruby 镜像 / RubyGems 镜像 / 活跃会员 / 组织 / API / 贡献者
由众多爱好者共同维护的 Ruby 中文社区,本站使用 Homeland 构建,并采用 Docker 部署。
服务器由 赞助 CDN 由 赞助
iOS 客户端 / Android 客户端 简体中文 / English