Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
Zete
@luikore
VIP
NO. 2880 / 2012-07-16

55 Topics / 3422 Replies
245 Followers
6 Following
32 Favorites
GitHub Public Repos
  • triez 140

    fast, efficient, unicode aware HAT trie with prefix / suffix support for Ruby

  • rsec 78

    Parser / Regexp Combinator For Ruby

  • regexp_optimized_union 11

    Regexp.optimized_union(word_list, regexp_options) generates optimized regexp for matching union o...

  • zscan 9

    Improved string scanner

  • stimulus-bind 9

    Enable simple data binding for stimulusjs

  • vscode-hypertab 3

    The Missing Tab Completion for VS Code

  • property-list 1

    Property list (plist) library with all formats support

  • keycap 1

    1.5u keycap for Kailh low profile switch

  • ffi-clang 0

    Ruby FFI bindings for libclang 3.4+.

  • llvm-node 0

    Node LLVM 4.0+ Bindings

More on GitHub
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • ruby 正则死循环了怎么破? at May 03, 2013

    @ultragtx sorry, #8 楼 回的用 *+ 没法匹配,已经删了..

  • ruby 正则死循环了怎么破? at May 03, 2013

    #11 楼 @bhuztez re2 功能太弱,光速度快解决不了问题没用啊...

  • ruby 正则死循环了怎么破? at May 03, 2013

    刚以为 possessive qualifier 可以解决问题兴奋的加了一回复,但实验了一下匹配不了...

  • Ruby 2.0 中增加了将 nil 转成哈希对象的方法 nil.to_h at May 03, 2013

    2.0 这样挺好的

    然后兼容旧版本可以这样:

    unless nil.respond_to?(:to_h)
      class NilClass
        def to_h
          {}
        end
      end
    end
    
  • 发现还是 IT 人安全啊 at May 03, 2013

    学什么的都有独门杀人手段,少见多怪才能上新闻,正好说明学医、学生物、学化学都很安全...

  • 有没有比较好的 HTML5 的 Chart 推荐啊? at May 02, 2013

    d3js.org

    例子一览: https://github.com/mbostock/d3/wiki/Gallery

  • 是否有人发布 Mac App 到 Mac Apple Store 的时候还带上了 Sparkle 的? at May 02, 2013

    没弄懂为什么会有 ppc 的... 自己编译 sparkle 还会带么...

  • ubuntu at May 02, 2013

    #8 楼 @zhangjinzhu you ke neng ta de xi tong mei you zhong wen zi ti, xian shi bu liao a

  • 为获取该格式 (2013-04-28 22:22:53) 的时间,js 这般写发是不是太麻烦了? 请问有其他简便方法吗? at May 01, 2013

    或者用 i18n-js

    i18n-js 和 moment 的区别是,i18n-js 用的 unix date 时间格式,配合 rails i18n 只用维护一种时间格式...

  • 学习 Rails 的一点看法 at April 30, 2013

    @nightire @lgn21st 其实很多格斗里 combo 伤害是有阻尼系数的吴倩莲总伤害还是有限的 XD

  • 学习 Rails 的一点看法 at April 30, 2013

    坚持很重要。谚语有云:

    Penetrate a stone with infinite combos. 用无限连招打穿石头。

  • 求助,super 引发的对象销毁问题。 at April 30, 2013

    这代码看不出来是想闹哪样... 不如删掉 def get(...) 算了:

    def logout
      data = @get_header.merge "Content-Type" => "application/x-www-form-urlencoded"
      data.delete "x-requested-with"
      ret = get("/src/acloglogin.php?in=1&logout=1&" + data.to_param, {})
      ATT::KeyLog.info "logout query ret:#{ret}"
    end
    
  • 炮哥的遗产 at April 30, 2013

  • ubuntu at April 30, 2013

    刚才我又把上一帖的命令修改了下..

  • ubuntu at April 30, 2013

    You don't need sudo for the install command.

    sudo rvm remove ruby-1.9.3-p392
    sudo rvm requirements
    rvm autolibs 0
    rvm install ruby-1.9.3-p392
    
  • ubuntu at April 30, 2013

    That means there's no precompiled-binary distribution, so rvm falls back to install ruby from source.

  • ruby send_data 问题 at April 30, 2013

    和 send_data 完全没联系吧。就是基本的文件读写

    File.open 'report.pdf', 'wb' do |f|
      f << response
    end
    
  • ruby 正则死循环了怎么破? at April 30, 2013

    #6 楼 @xiongmao86

    呃... 是 n power 不是 nondeterministic polynomial problem...

    例子可以简化如下 (是否贪婪对是否卡住没影响...):

    '-' + ' ' * 41 =~ /-(.|\s)*-/
    

    注意正则最后还要匹配 -, 必须要回溯。选择支的两边 . 和 \s 都匹配空格,所以都在回溯的范围中,这个字符串中有 41 个空格,回溯的深度达到了 41, 要做 2 ** 41 次匹配,于是就 N Power 了 (n 为字符串长度). (这里略过了不少细节... 如果你按照正则的逻辑自己写一个这样的 parser 就会明白了...)

    括号里如果用原子组 (?>) 的话,也能避免不必要的回溯:

    text =~ /<!--(?>.|\s)*?-->/
    

    还有个修正方法是让选择支两边没有交集:

    text =~ /<!--(.|\n)*?-->/
    
  • 是否有人发布 Mac App 到 Mac Apple Store 的时候还带上了 Sparkle 的? at April 30, 2013

    #4 楼 @hlxwell 不可能的,用户的处理器是 ppc 的话是不能从 app store 下载这个版本的... 如果你要兼容 ppc 的话,就另外 build 一个 ppc 专用的,把 x86 的 binary 都删掉...

  • 是否有人发布 Mac App 到 Mac Apple Store 的时候还带上了 Sparkle 的? at April 30, 2013

    把 ppc 的 binary 都去掉就好了?

  • 请教一下,如何写出能通过 rdoc 生成文档的 attr_accessor 注释 at April 29, 2013

    又看了下 http://rdoc.rubyforge.org/RDoc/Markup.html , 加了注释就会出现在 attributes 栏了

    class A
      # 这行注释会显示在 rdoc 中
      attr_accessor :hello
    end
    

    如果有多个 attribute 要加 rdoc, 就要分开多行写了

  • Knewone 和 writings.io 中 HTML 的压缩是如何实现的? at April 29, 2013

    用 slim 就行,生成出来的就是去空格的,少一道压缩工序,速度更快

  • 请教一下,如何写出能通过 rdoc 生成文档的 attr_accessor 注释 at April 28, 2013

    attr_accessor 一般也不需要 rdoc 吧... 名字已经体现做什么了

  • RubyConfChina 2013 计划 at April 28, 2013

    #91 楼 @Koz 期待,awesome!

  • Prev
  • 1
  • 2
  • …
  • 82
  • 83
  • 84
  • 85
  • 86
  • …
  • 111
  • 112
  • Next
关于 / RubyConf / Ruby 镜像 / RubyGems 镜像 / 活跃会员 / 组织 / API / 贡献者
由众多爱好者共同维护的 Ruby 中文社区,本站使用 Homeland 构建,并采用 Docker 部署。
服务器由 赞助 CDN 由 赞助
iOS 客户端 / Android 客户端 简体中文 / English