Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
子不语
@42thcoder
高级会员
第 6764 位会员 / 2013-04-18

[email protected]
杭州
17 篇帖子 / 327 条回帖
41 关注者
107 正在关注
96 收藏
未来的不可知, 是前进的原动力
GitHub Public Repos
  • dotfiles 1

    A set of vim, zsh, git, and tmux configuration files.

  • block_yundun 1

    Rack middleware to block requests issued by aliyun yundun

  • dust 1

    A dead simple scripting language. Not perl, not ruby, not even rock. It's just dust.

  • 42thcoder.github.com 1

    My blog

  • twitterbio 0

    Generate your Twitter bio with OpenAI and Vercel Edge Functions.

  • alipay 0

    支付宝 AliPay SDK for Go, 集成简单,功能完善,持续更新,支持公钥证书和普通公钥进行签名和验签。

  • rocketmq-client-ruby 0

  • feeds 0

    Example repository for creating your own RSS feeds using Feed me up, Scotty!

  • ransack 0

    Object-based searching.

  • lottery 0

    🎉🌟✨🎈年会抽奖程序,基于 Express + Three.js的 3D 球体抽奖程序,奖品🧧🎁,文字,图片,抽奖规则均可配置,😜抽奖人员信息Excel一键导入😍,抽奖结果Excel导出😎,给你...

More on GitHub
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • 做个调查,大家对窗口管理工具有需求吗? at 2015年02月06日

    4

    室友写了一个,蛮好用,可惜 10.10 一出就抓瞎了~

  • 用 Kindle 看技术书籍靠谱么? at 2015年02月03日

    多看能买得到的书,看起来感觉很爽

  • 如何选择 JavaScript 模板? at 2015年01月23日

    以前试过一圈,doT很快,Mustache Handlebars 表达能力很强,用得人非常多,jquery-tmpl 轻量级。

    其他算了吧

  • [已解决] 你们真的会用 DigitalOcean5 美元的方案吗? at 2015年01月21日

    #10 楼 @merlinran 我这也是 ssh 慢到怀疑人生

  • rails 中如何创建相关联的下拉菜单? at 2015年01月14日

    搜索关键字 级联菜单 js

  • 类似 Ruby Grape 项目的 Elixir RESTFul 框架 Maru at 2015年01月11日

    👍

  • 我发现 macbook 一旦开始使用虚拟内存就没那么流畅了 at 2015年01月08日

    最近抹盘重装,快了一天又卡成狗了

  • [译] Ruby 2.0 Works Hard So You Can Be Lazy at 2015年01月08日

    图挂了好多

  • Redis MySQL 混用的最佳实践 at 2015年01月06日

    #6 楼 @vincent thks a lot

  • Redis MySQL 混用的最佳实践 at 2015年01月05日

    #1 楼 @jasonliu 点击数这种东西更新十分频繁,放在 redis 里面也不合适么

  • 经过半 at 2015年01月04日

    这是纠结了整整一年么

  • 转几本 ruby 书 at 2015年01月03日

    #5 楼 @besfan 抢到了拿给我看,哈哈

  • 开发 app 的后台,用 ror 或者 Sinatra 能否合适? at 2014年12月30日

    用的是 grape + rails, 踩完坑之后感觉还是很好用的

  • Float 型相加结果是多为小数 at 2014年12月24日

    float 类型计算有问题的,这应该算是编程常识。

    相关讨论:https://ruby-china.org/topics/5650

  • 【请教】如何定制从新手到高手的技术及能力路线图? at 2014年12月02日

    #3 楼 @freedom_fish 亚马逊能直邮,网上应该能下到,可以给作者打钱

  • 龟速的测试, 求解救 at 2014年11月30日

    #7 楼 @CocaColaCat 用了。按您给的建议,修改了strategy, 耗时很正常了。

    第一次跑 spring rspec, 耗时情况:

    spring rspec  7.72s user 2.81s system 38% cpu 27.257 total
    

    第二次跑spring rspec, 基本上能做到秒刷,耗时:

    spring rspec  0.66s user 0.15s system 8% cpu 9.009 total
    

    太谢谢啦~

  • 【请教】如何定制从新手到高手的技术及能力路线图? at 2014年11月28日

    有本书叫 Rails 4 Application Development

  • 龟速的测试, 求解救 at 2014年11月28日

    #4 楼 @Shadow thks

  • 龟速的测试, 求解救 at 2014年11月27日

    #1 楼 @serco 没啊,我只写了 model 的测试, factory_girls 倒是用了很多

  • 是否考虑加入 RubyMotion 节点 at 2014年11月25日

    期待经验分享

  • 求推荐个键盘,有经验的朋友帮帮忙 at 2014年11月15日

    http://ipn.li/kernelpanic/2/

  • token 有什么用,求实际的例子和用途 at 2014年11月10日

    www.ruanyifeng.com/blog/2014/05/oauth_2_0.html

  • 求 grape-entity 使用经验分享 at 2014年11月06日

    @iBachue pry 真是神器,谢谢~

    文件已经加载了,但没找到类。

    [25] pry(V1::App::Entity):3> $LOADED_FEATURES.select{|file| file.include? 'entity' }
    => ["/Users/hacker/.rvm/gems/[email protected]/gems/pry-0.10.1/lib/pry/commands/ls/ls_entity.rb",
     "/Users/hacker/work/app/api/v1/app/entity.rb"]
    [26] pry(V1::App::Entity):3> ls
    constants:  Product
    locals: _  __  _dir_  _ex_  _file_  _in_  _out_  _pry_
    

    /Users/hacker/work/app/api/v1/app/entity.rb 这个文件是对的. 找到那个类Product, 是在 API 文件products.rb中直接定义的。

  • 求 grape-entity 使用经验分享 at 2014年11月06日

    #9 楼 @iBachue 也是不行的,我在 rails console 中做过各种实验,打印 V1::App::Entity.constants V1::App::Entity::User 之类的,有时可以找到,有时候找不到,十分神奇。

    百思不得其解,整个人都不好了

    我现在把代码写到models/user.rb中,就可以了,类似这样:

    class User < ActiveRecord::Base
      include Grape::Entity::DSL
    
      entity :id, :nick, :avatar do
        root 'authors', 'author'
      end
    end
    
  • 求 grape-entity 使用经验分享 at 2014年11月06日

    #7 楼 @iBachue

    32 行就是下面代码中的 present user, with: Entity::User

    require_relative "entity"
    
    module V1
      module App
        class Works < Grape::API
          user = User.first
    
          present user, with: Entity::User
        end
      end
    end
    
  • 求 grape-entity 使用经验分享 at 2014年11月05日

    #5 楼 @iBachue

    NameError (uninitialized constant V1::App::Entity::User):
      /Users/hacker/work/app/api/v1/app/works.rb:32:in `block (2 levels) in <class:Works>'
      /Users/hacker/.rvm/gems/[email protected]/gems/grape-0.9.0/lib/grape/endpoint.rb:45:in `call'
      /Users/hacke/.rvm/gems/[email protected]/gems/grape-0.9.0/lib/grape/endpoint.rb:45:in `block in generate_api_method'
      # 剩下的删掉了, 基本上没啥用
    
  • 求 grape-entity 使用经验分享 at 2014年11月04日

    #3 楼 @iBachue 谢谢回复~

    endpoint 定义在 users.rb 文件中,大致的逻辑是这样的:

    require_relative "entity"
    
    module V1
      module App
        class Works < Grape::API
          user = User.first
    
          present user, with: Entity::User
        end
      end
    end
    

    在 entity.rb 文件中定义了许多 entity, 大概像这样:

    module V1
      module App
        module Entity
          # 商家
          class MerchantSummary < Grape::Entity
            expose :id, :name, :address, :logo_path
          end
    
          class Merchant < MerchantSummary
            expose :rating
          end
    
    
          # 用户
          class UserSummary < Grape::Entity
            expose :id, :nick, :avatar
          end
    
          class User < UserSummary
            expose :created_at
          end
    
        end
      end
    end
    
  • 求 grape-entity 使用经验分享 at 2014年11月04日

    #1 楼 @iBachue

    频繁报 NameError (uninitialized constant V1::App::Entity::User) 这样的错误。

    在 entity.rb 里面定义了

    module V1
      module App
        module Entity
    
          # 用户
          class User < Grape::Entity
            expose :id, :nick, :avatar
          end
    
        end
    end
    
  • 怎样使用 websocket 建立 one to one 的聊天,类似 ruby-china 的推送 at 2014年11月03日

    #4 楼 @flowerwrong

    websocket-rails 中可以这样写:

    WebsocketRails.users[receiver.id].send_message :new_message, { content: 'Hey there~' }
    
  • 怎样使用 websocket 建立 one to one 的聊天,类似 ruby-china 的推送 at 2014年11月03日

    #4 楼 @flowerwrong 维护一个在线用户列表,每个用户可能有多个 connection. 转发给 B, 就是往 B 的所有 connection 中发消息. 可以看源码,文档未必有写清楚。

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