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
  • 为什么 erubis 不更新了呢? at May 21, 2013

    erb 效率确实挺高的,慢的是 rails 的 helper

  • Command+Tab 中 Option 键的妙用 at May 21, 2013

    其实很多菜单按了 option 都会出隐藏选项...

  • RSpec or Minitest? at May 21, 2013

    #17 楼 @hooopo 那为什么没有 before_tests ... 另外经常需要 context 下的 before :all 和 after :all ...

  • One Assertion Per Test & DAMP Not DRY at May 20, 2013

    补充一点点.. 有的矩阵测试 DRY 了会写成这样:

    it "..." do
      array.each do |e|
        assert...
      end
    end
    

    把循环放外面就更容易看出是哪一步出的错:

    array.each do |e|
      it "... #{e}" do
        assert...
      end
    end
    
  • Rails 系统间的跨进程通信用什么好,我研究了一下 Thrift,avro 和 Google Protocol Buffer,大家有什么好的建议? at May 20, 2013

    如果机器都在你管辖下,可以用 0mq

    如果是异系统的机器,就用 rest + json 好了

    thrift 如果你不用 cassandra 就不要用了... protobuf 编译都很难...

    二进制协议的话可以考虑 bson

  • 感觉看到图形编程的未来了 at May 19, 2013

    #5 楼 @reus windows?

  • RSpec or Minitest? at May 19, 2013

    #12 楼 @zgm 项目时间长了,测试多了,会不小心写同名的啊... 另外 block style dsl 可以让测试框架警告写重复的,def 重复就什么提示都没自动覆盖了

  • 感觉看到图形编程的未来了 at May 19, 2013

    那只是 demo... 其实很多运算都是 O(C^n) 的机器再过 100 年都跑不动就这样

  • RSpec or Minitest? at May 19, 2013

    minitest 的 setup 和 teardown 两个方法名总是要查一下才确定... 不像 rspec before :each, before :all, after :each, after :all 那么顺手... 而且 minitest 没有全局 setup 和 teardown

    rspec 的组织方式是比较好的,def test_xxx 没有标识一个字符串意思清楚。就是顶层不能用 context 比较蛋疼... 我也是觉得 assert 比 should 好些,rspec 设置一下就可以了:

    RSpec.configure do |config|
      config.expect_with :stdlib
    end
    

    it "xxx" 的另一个好处是同名了也没关系 (minitest 会覆盖 -_-), def test_xxx 起个同名测试就覆盖掉了。

    还有就是 minitest 的 before 会生成一个 setup 方法,要小心...

  • 请教一个关于 Ruby 取模的问题? at May 19, 2013
    $ ri Integer.%
    ...
    See Numeric#divmod.
    $ ri Numeric.divmod
    ...
    The quotient is rounded toward -infinity.
    

    商总是向负无穷方向取整,那余数都是按这个规则算出来的

  • Windows 7 下 Ruby 2.0.0-p353 挺好用的…… at May 18, 2013

    @zlfera 64 位的选 mingw64-64 好了

  • 异步 IO 在 EventMachine 和 NodeJS 的写法对比 at May 18, 2013

    #23 楼 @ShiningRay 嗯嗯,最近想用 sinatra-synchrony + pg 写点东西,但是就不能用 activerecord 了?

    https://gist.github.com/apeckham/3955222

    还没尝试和 AR 一起用的 https://github.com/leftbee/em-postgresql-adapter

  • [杭州][2013年5月16日] Ruby Tuesday 活动召集 - 朴灵讲 nodejs at May 18, 2013

    #84 楼 @JacksonTian 我的机器上

    $ node -v
    v0.10.6
    
    # list.forEach(function(e){
    1.76s user 0.02s system 100% cpu 1.770 total
    
    # for(var j=0; j < list.length; j++)
    2.22s user 0.02s system 100% cpu 2.236 total
    
    # var len=list.length; for(var i=0;i<len;i++)
    1.77s user 0.02s system 100% cpu 1.777 total
    

    而 ruby slim 还是略快

    $ ruby -v
    ruby 2.1.0dev (2013-04-25) [x86_64-darwin12.3.0]
    
    1.48s user 0.01s system 99% cpu 1.497 total
    

    之前和 handlebars 比较过也是 slim 快。

    另外 slim 不是 ruby 里最快的模板引擎,它的性能比起 erb 还是略慢。

  • [杭州][2013年5月16日] Ruby Tuesday 活动召集 - 朴灵讲 nodejs at May 17, 2013

    话说我做了 EJS 和 slim 的性能比较,还是 slim 速度快

    ruby 版 http://ruby-china.org/topics/7957#reply18

    js 版

    ejs = require('ejs')
    
    template = "<div>"+
      "<h1 class='header'><%= header %></h1>" +
      "<h2 class='header2'><%= header2 %></h2>" +
      "<h3 class='header3'><%= header3 %></h3>" +
      "<h4 class='header4'><%= header4 %></h4>" +
      "<h5 class='header5'><%= header5 %></h5>" +
      "<h6 class='header6'><%= header6 %></h6>" +
      "<ul class='list'>" +
      "<% list.forEach(function(e){ %>" +
        "<li class='item'><%= e %></li>" +
      "<% }) %>" +
      "</ul>" +
      "</div>"
    
    t = ejs.compile(template)
    env = {
      header: "Header",
      header2: "Header2",
      header3: "Header3",
      header4: "Header4",
      header5: "Header5",
      header6: "Header6",
      list: ['1000000000', '2', '3', '4', '5', '6', '7', '8', '9', '10']
    }
    
    console.log(t(env))
    
    for (var i=0; i < 100000; i++) {
      t(env)
    }
    

    看来 rails 的瓶颈就是 activerecord =_=

  • 异步 IO 在 EventMachine 和 NodeJS 的写法对比 at May 17, 2013

    #21 楼 @krazy

    很久以前一个工程写到 4k 行左右编译时间就受不了了... 还有各种各样的问题归根是语言设计贪大求全造成的... 不用写 java 谁还用 scala 啊

  • 写一个 Gem 需要哪些知识? at May 17, 2013

    节操 gem

    https://rubygems.org/gems/rubygems-bundler

  • 异步 IO 在 EventMachine 和 NodeJS 的写法对比 at May 17, 2013

    #15 楼 @bhuztez 话说 erlang 是有内建 API 可以把 lambda 的 AST 直接取出来搞的么?

  • 异步 IO 在 EventMachine 和 NodeJS 的写法对比 at May 17, 2013

    #16 楼 @krazy scala 启动和编译太慢了函数签名就和 C++ boost 模板库一样变态,还要各种用 java 的库 (java 库的 API 你懂的), 还要考虑线程安全 (和库的线程安全) 的问题,eventmachine/nodejs 单线程完全不用管,erlang/haskell 没有 mutable state 的问题也完全不用管

    再说,任何内建 XML 语法的语言都应该被踩...

  • 异步 IO 在 EventMachine 和 NodeJS 的写法对比 at May 17, 2013

    #12 楼 @bhuztez 但 haskell 可以说是 multi-paradigm 的,do-notation 里可以写 state 什么的很舒服...

  • 异步 IO 在 EventMachine 和 NodeJS 的写法对比 at May 17, 2013

    #12 楼 @bhuztez 性能看情况吧,我用 ruby 写的 parser combinator 比 haskell parsec 快...

  • 异步 IO 在 EventMachine 和 NodeJS 的写法对比 at May 17, 2013

    #10 楼 @bhuztez 是的,学习 erlang 的动力大增 XD

  • 异步 IO 在 EventMachine 和 NodeJS 的写法对比 at May 17, 2013

    不过感觉就是,这么强调异步的话,框架选 haskell 才对... 数据依赖不用手动管理世界都清净了,还有个小小优点是单进程能解决并行问题。

  • 异步 IO 在 EventMachine 和 NodeJS 的写法对比 at May 17, 2013

    #5 楼 @bhuztez 好吧,可以用 js-coroutine

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