Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
qinfanpeng
@qinfanpeng
高级会员
第 3790 位会员 / 2012-09-27

金数据(https://jinshuju.net/)
成都
55 篇帖子 / 572 条回帖
38 关注者
32 正在关注
34 收藏
GitHub Public Repos
  • echart_subway_demo 0

  • subway_demo 0

  • spike-mysql 0

    spike insert 1000w data to mysql

  • merchin_learning_in_ac... 0

    merchin_learning_in_action paractice

  • qinfanpeng.github.io 0

  • gold-miner 0

    掘金翻译计划,翻译掘金上优质的英文文章

  • tooltipster 0

    A jQuery tooltip plugin

  • bootstrapx-clickover 0

    Bootstrap Extension for Click managed popovers

  • english_usage 0

  • decorator_pattern_shape 0

    Demo for decorator pattern

More on GitHub
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • 分享一点 Rails 开发时遇到的代码问题 at 2016年07月11日

    也感觉第 4 点是不成立的。

  • [测试] 这些方法属于 Ruby 还是 Rails ? at 2016年07月08日

    有点意思,地址是这个 http://railshurts.com/quiz/

  • Ruby Hash Cheatsheet at 2016年07月05日

    其中的 default 和 default_proc 一般用得少,但关键时刻还是挺好使的。

  • Ruby Hash Cheatsheet at 2016年07月05日

    不错,用 x-mind 画的图哇?

  • Rails 里 &. 这样的用法是什么意思 at 2016年06月30日

    About The Safe Navigation Operator(&.)

    There're similar when something is nil

    account = Account.new(owner: nil) # account without an owner
    
    account.owner.address
    # => NoMethodError: undefined method `address' for nil:NilClass
    
    account && account.owner && account.owner.address
    # => nil
    
    account.try(:owner).try(:address)
    # => nil
    
    account&.owner&.address
    # => nil
    
    

    &. operator only skips nil but recognizes false!

    account = Account.new(owner: false)
    
    account.owner.address
    # => NoMethodError: undefined method `address' for false:FalseClass `
    
    account && account.owner && account.owner.address
    # => false
    
    account.try(:owner).try(:address)
    # => nil
    
    account&.owner&.address
    # => undefined method `address' for false:FalseClass`
    
    

    When use try, whatch out misspelling!

    account = Account.new(owner: Object.new)
    
    account.owner.address
    # => NoMethodError: undefined method `address' for #<Object:0x00559996b5bde8>
    
    account && account.owner && account.owner.address
    # => NoMethodError: undefined method `address' for #<Object:0x00559996b5bde8>`
    
    account.try(:owner).try(:address)
    # => nil
    
    account&.owner&.address
    # => NoMethodError: undefined method `address' for #<Object:0x00559996b5bde8>`
    
    # There's a stricter version of try - try! for you:
    
    account.try!(:owner).try!(:address)
    # => NoMethodError: undefined method `address' for #<Object:0x00559996b5bde8>`
    
  • 一个逗号引发的血案 at 2016年06月30日

    可以考虑引入 Rubocop 等类似的代码检测、分析工具,减少人为犯错。

  • 在运行 bundle install 出现问题 at 2016年06月29日

    先运行 gem install nokogiri -v '1.6.8' 就可以看到具体的错误,然后 Google 上一搜,应该还好解决的。

  • 探秘模块混入 (include Module) 背后的故事 at 2016年06月28日

    #3 楼 @mulderlover 用的是 Chrome 的离线应用(免费),貌似也有 web 版的。

  • 探秘模块混入 (include Module) 背后的故事 at 2016年06月27日

    #1 楼 @catherine 😅 ,我也是带着问题去思考,收获多一些。

  • GitHub 上开源的后台模板列表,让后台页面也漂亮一点 at 2016年06月27日

    不错,很适合做些后台管理工具。

  • CoffeeScript 中当前对象怎么获取? at 2016年06月27日

    还有就是建议尽量上点示例代码,这样大家容易看懂,从而更易帮助到你。

  • 微信开发者工具 Linux 版 at 2016年06月21日

    赞一个

  • 发现一个神奇的 i18n 的管理工具 at 2016年06月21日

    不错,

  • 我的下一个十年编程语言 at 2016年06月16日

    分析得有道理

  • GitHub 权限校验失败给我的启发 at 2016年06月16日

    enjoy 解决问题的过程才是重点 😀

  • Mongoid inverse_of not work as well as active_records at 2016年06月15日

    #6 楼 @pathbox 个人感觉不是,mongoid 为啥这样设计,我是没想明白。

  • Mongoid inverse_of not work as well as active_records at 2016年06月14日

    #3 楼 @pathbox 基本没啥用得。

  • Mongoid inverse_of not work as well as active_records at 2016年06月14日

    #1 楼 @catherine Memory Optimization Associated Object 这点好理解点。

  • rails console 里面的输出怎么重定向输出到某文件中? at 2016年06月08日

    你应该是嫌 log 太长,干扰你。感觉可以通过调整 log.level 来实现。

  • Grape on Rails + Puma 线程安全性的讨论? at 2016年06月06日

    #21 楼 @pathbox 我们没细看最上面的帖子,不过这里貌似可以更简洁:

    return @current_user if @current_user
    
  • Ruby 中的多进程与多线程 at 2016年06月04日

    #8 楼 @xjz19901211 😄

  • Ruby 中的多进程与多线程 at 2016年06月04日

    #5 楼 @pathbox 这让我想起来一位前辈曾经说的“技术无用论”,即是在业务分析阶段,别给我扯啥技术实现,业务才是王道,营收才是王道。

  • 关于样式覆盖问题有没有什么好的解决办法? at 2016年06月04日

    #2 楼 @lzm420241 推荐看上面 rei 说的那个连接,我们团队也推广这套命名规范。

  • Ruby 中的多进程与多线程 at 2016年06月04日

    不错,不过文档中的排版序号没弄对(连续多处都用的是 1)

  • 测试一下 HTTP 和 HTTPs referer at 2016年06月03日

    很有用,

  • 关于 included 方法的问题 at 2016年06月01日

    #10 楼 @runup 感觉你想得太多,反而把自己绕晕了。

  • submit 不支持传入 block? at 2016年05月30日

    试试 f.submit '<i class="fa fa-search"></i>', name: 'commit', class: 'btn btn-flat'

  • 懵逼了,求帮助,有谁遇到过这个问题么?「in `require': incompatible library version」 at 2016年05月27日

    #2 楼 @brucewzp 很高兴能帮到你,不过建议是一个项目对应一个gemset而非都用 global 这个 gemset,这样可以确保每个项目相互独立,互不影响。你可在项目根目录下建立以来两个文件,一般来说命令行会自动帮你切换:

    # .ruby-version
    ruby-2.2.2  # 指定版本
    
    # .ruby-gemset
    project_name  # 指定gemset
    
  • 懵逼了,求帮助,有谁遇到过这个问题么?「in `require': incompatible library version」 at 2016年05月27日

    一般都是 gem 版本、ruby 版本不兼容所致。分别看下如下输出,看看是否是你想要的: rvm list rvm gemset list

  • 请教一下 String 的 delete 方法是怎么用啊?英文不好看不懂 at 2016年05月27日

    #5 楼 @ajfg93 大家一起努力,以后看类似的,就能猜到啥意思了。就这个问题而言,若打算单独搜索“^e”确实不好弄。

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