Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
Rei
@Rei
管理员
第 1 位会员 / 2011-10-28

[email protected]
深圳
188 篇帖子 / 9160 条回帖
731 关注者
0 正在关注
11 收藏
中下水平 Rails 程序员
打赏作者
GitHub Public Repos
  • writings 941

    [Closed] Source code of writings.io

  • alipay 732

    Unofficial alipay ruby gem

  • code_campo 291

    [Closed] Source code of http://codecampo.com

  • asciidoctor-pdf-cjk-ka... 101

    **no longer maintained**

  • geeknote 34

  • asciidoctor-htmlbook 31

    Asciidoctor HTMLBook is an Asciidoctor backend for converting AsciiDoc documents to HTMLBook docu...

  • material-ui 17

  • rich-text-editor 12

  • htmlrenderer 12

  • rails-chatgpt-demo 8

More on GitHub
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • 现在有人回复我发的帖子没有提醒了吗? at 2012年03月05日

    #6 楼 @camel V2EX 也是有这个提醒的,发帖量大就有用了。

  • 一个小 Bug 引发 github 安全问题泄露。Shit! at 2012年03月05日

    Master 默认白名单了

    https://github.com/rails/rails/commit/641a4f62405cc2765424320932902ed8076b5d38

  • 一个小 Bug 引发 github 安全问题泄露。Shit! at 2012年03月05日

    #15 楼 @zipme #17 楼 @hooopo

    确实有漏洞,现在补上了。大家一定要用 attr_accessible 阿。

  • 一个小 Bug 引发 github 安全问题泄露。Shit! at 2012年03月05日

    #7 楼 @iwinux 用白名单而不要用黑名单

  • [Ruby Quiz] 针对代码片段,提点改进意见吧 at 2012年03月04日

    #10 楼 @race 我是这样跑的

    ruyb -I. terminal_test.rb
    
  • 执行 rails server 报错 Could not find a JavaScript runtime at 2012年03月04日

    #2 楼 @Azon execjs 还需要后端才能处理,想简单解决可以加上这个 Gem

    gem 'therubyracer'
    
  • Chrome 是不是比光速还快? at 2012年03月04日

    为什么要手工管理软件呢

  • 有没有筒子觉得,Ruby 要是不用敲那么多 end,会更优美? at 2012年03月04日

    我觉得有 end 挺好,用 snippets 不用手敲,每次看见 end 会让自己有种安定感,就像开辟一个工作区一样

  • [Ruby Quiz] 针对代码片段,提点改进意见吧 at 2012年03月04日
    class Terminal
      # Example:
      # Terminal.set_pricings({
      #   "A" => {1 => 2.0, 4 => 7.0},
      #   "B" => {1 => 12.0},
      #   "C" => {1 => 1.25, 6 => 6.0},
      #   "D" => {1 => 0.15}
      # })
      def self.set_pricings(pricings)
        @pricings = pricings
      end
    
      def self.pricings
        @pricings
      end
    
      def initialize
        @products = {}
      end
    
      def scan(name)
        @products[name] = @products[name].to_i + 1
      end
    
      def total
        result = 0
        @products.each do |name, number|
          result += self.class.item_cost(name, number)
        end
        result
      end
    
      def self.item_cost(name, number)
        pricings[name].keys.sort.reverse.inject(0) do |sum, package|
          if number / package > 0
            sum += ((number / package) * pricings[name][package])
            number = number % package
          end
          sum
        end
      end
    end
    
    require 'test/unit'
    require 'terminal'
    
    class TerminalTest < Test::Unit::TestCase
      def setup
        Terminal.set_pricings({
          "A" => {1 => 2.0, 4 => 7.0},
          "B" => {1 => 12.0},
          "C" => {1 => 1.25, 6 => 6.0},
          "D" => {1 => 0.15}
        })
      end
    
      def test_should_get_cost
        terminal = Terminal.new
        terminal.scan 'A'
        assert_equal 2.0, terminal.total
        terminal.scan 'A'
        assert_equal 4.0, terminal.total
        2.times{ terminal.scan 'A' }
        assert_equal 7.0, terminal.total
      end
    
      def test_multi_item_cost
        assert_mult_scan_cost_equal 32.40, 'ABCDABAA'
        assert_mult_scan_cost_equal 7.25, 'CCCCCCC'
        assert_mult_scan_cost_equal 15.40, 'ABCD'
      end
    
      def assert_mult_scan_cost_equal(expected, names)
        terminal = Terminal.new
        names.each_char do |name|
          terminal.scan name
        end
        assert_equal expected, terminal.total
      end
    end
    
  • [Ruby Quiz] 针对代码片段,提点改进意见吧 at 2012年03月04日

    eval 得不必要,Hash 就能解决

  • 对最近的过激行为道歉 at 2012年03月04日

    在我看来 @fsword 的言论没有问题。楼主专门发个道歉贴但同时想封别人的嘴真的有意识到问题吗?

  • 请教 ruby 怎么往 MySQL 里插中文 at 2012年03月04日

    String 编码,数据库连接编码,数据库编码,数据库表单编码……

    有编码的地方很多,一个个排除

  • bundle update 和 bundle install 平时大家用哪个? at 2012年03月04日

    我喜欢周末听着音乐冲杯咖啡然后 bundle update

  • bundle update 和 bundle install 平时大家用哪个? at 2012年03月04日

    #9 楼 @soloara 这个上下文不友好的是你

  • 我想给 ruby-china 添加招聘板块,不知道需要么? at 2012年03月03日

    #2 楼 @hooopo 私信打算像 github 那样,弄个 public_email 字段,展示在个人页面

  • 已经将图片存储转移到又拍云存储 at 2012年03月02日

    #10 楼 @clearJiang 对图片不熟,jpeg 还有压缩空间?

  • 已经将图片存储转移到又拍云存储 at 2012年03月02日

    试试看

  • 帖子里能不能把 name 也显示出来呢? at 2012年03月02日

    到 gravatar 上传常用头像

  • 请用一句话证明你用过 ruby on rails! at 2012年03月02日

    => Ctrl-C to shutdown server

  • 大家聊聊近三年 Ruby 社区的进步吧 at 2012年03月02日

    ruby-china 对国内 ruby 发展挺重要的

  • 没有头像的都上传个像吧 at 2012年03月02日

    #22 楼 @feitian124 可以看到历代头像,同时管理多个邮箱,而且随时都能切换回去,这个功能绝大部分自建头像是做不到的~

    现在打开 gravatar 头像列表就想起当时设这个头像的心情。

  • 请教几个关于 gem 依赖的问题 at 2012年03月02日

    #4 楼 @huacnlee refinerycms 是个命令行生成器,看来得用 gemset 了

  • 没有头像的都上传个像吧 at 2012年03月02日

    晒一下历代头像,每个头像背后都有一段记忆

  • 现在有人回复我发的帖子没有提醒了吗? at 2012年03月02日

    现在应该有了

  • rails 中 最近来访 功能的实现 at 2012年03月01日

    #3 楼 @tassandar 不冲突,顺便可以把 cache 放到 redis 上,cache 现在不用以后也要用的

  • rails 中 最近来访 功能的实现 at 2012年03月01日

    #3 楼 @tassandar 不冲突,顺便可以把 cache 放到 redis 上,cache 现在不用以后也要用的

  • rails 中 最近来访 功能的实现 at 2012年03月01日

    #3 楼 @tassandar 不冲突,顺便可以把 cache 放到 redis 上,cache 现在不用以后也要用的

  • rails 中 最近来访 功能的实现 at 2012年03月01日

    系统有 redis 的话,可以弄个 list,插入新的,剔除老的

  • 部署到生产模式的问题 at 2012年03月01日

    #24 楼 @yfeng 我说你新建的项目

  • 弄不明白 Rails 表单的工作流程 at 2012年03月01日

    #19 楼 @tiseheaini puts 输出到标准输出,但是页面不是标准输出,也许到日志去了

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