Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
angeladaddy
@kingguy
Member
NO. 8047 / 2013-07-12

2 Topics / 22 Replies
1 Followers
3 Following
0 Favorites
No GitHub.
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • [深圳] 非 996,硅谷 10 亿美元独角兽 Flexport,寻找有工匠精神的同道中人 (10 名) at May 02, 2019

    大气

  • Learn Rails 5 by Reading Source Code at March 05, 2019

    🐂🍺

  • 一个多年 Linux 用户的 Mac 使用体验 at February 28, 2019

    mac 和 linux 都用过。。一般只用 vim 和浏览器,两者感觉差别不大

  • 记录一次排查 Puma 内存占用过高的问题 at March 14, 2018

    https://ruby-china.org/topics/25584 可以参考下这篇文章,针对 ruby 的内存分配与回收做了很好的解释。

  • 物理隔离的环境如何部署 ROR 项目? at January 07, 2016

    先在有网络的地方执行 bundle,然后把 ruby 整个文件夹复制过去覆盖掉原来的,只在 windows 下测试过

  • 咨询下,有个土木行业的朋友想要转行做 Ruby 程序员,有没有公司能够提供实习的机会呢? at September 26, 2015

    显然第一步是要学会使用 google

  • 请求一个实时推送到浏览器客户端的方案! at September 24, 2015

    pusher + slanger

  • [武汉][2014年9月13号] ThoughtWorks@ 盛安德 联合线下活动开始报名 at September 12, 2014

    默默地点赞、。。

  • [长沙] Ruby 聚会意向调查以及[其他城市]相关请教 at September 12, 2014

    这样必须要赞一个。。。希望能够组织起来啊

  • 项目部署 production 遇到一个问题,请教! at July 17, 2014

    #4 楼 @shin 不是 20140623055658 迁移文件不见了,而是创建“searches”表的这个迁移文件不见了,因此你需要先创建一个“searches”表

  • 好多数据库都支持全文索引,为什么还要自己构建搜索系统? at June 09, 2014

    #1 楼 @Rei 嗯,这确实是一个因素。但是像 Mysql 这样的有中文分词插件支持的数据库呢?

  • 有人熟悉 redmine 里人 call_hook 吗 at May 30, 2014

    redmine 提供了插件机制,允许插件作者扩展 redmine 的核心。。lz 写出的代码是 view hooks。。 具体参见: http://www.redmine.org/projects/redmine/wiki/Hooks

  • 怎样成为一个优秀的初级开发者 at May 20, 2014

    深表赞同

  • 使用 sunspot 建立索引时出现 illegal characters 错误 at May 12, 2014

    #2 楼 @ryancheung 我最开始的方案是找到这个字符,然后直接在数据库里面删除掉。不过后来提交了个缺陷给 sunspot 项目组,有人回复了,解决方案如下: 直接修改 Data Extractor,不过是非官方的。。。。。。

    module Sunspot
      # 
      # DataExtractors present an internal API for the indexer to use to extract
      # field values from models for indexing. They must implement the #value_for
      # method, which takes an object and returns the value extracted from it.
      #
      module DataExtractor #:nodoc: all
        # 
        # AttributeExtractors extract data by simply calling a method on the block.
        #
        class AttributeExtractor
          def initialize(attribute_name)
            @attribute_name = attribute_name
          end
    
          def value_for(object)
            Filter.new( object.send(@attribute_name) ).value
          end
        end
    
        # 
        # BlockExtractors extract data by evaluating a block in the context of the
        # object instance, or if the block takes an argument, by passing the object
        # as the argument to the block. Either way, the return value of the block is
        # the value returned by the extractor.
        #
        class BlockExtractor
          def initialize(&block)
            @block = block
          end
    
          def value_for(object)
            Filter.new( Util.instance_eval_or_call(object, &@block) ).value
          end
        end
    
        # 
        # Constant data extractors simply return the same value for every object.
        #
        class Constant
          def initialize(value)
            @value = value
          end
    
          def value_for(object)
            Filter.new(@value).value
          end
        end
    
        # 
        # A Filter to allow easy value cleaning
        #
        class Filter
          def initialize(value)
            @value = value
          end
          def value
            strip_control_characters @value
          end
          def strip_control_characters(value)
            return value unless value.is_a? String
    
            value.chars.inject("") do |str, char|
              unless char.ascii_only? and (char.ord < 32 or char.ord == 127)
                str << char
              end
              str
            end
    
          end
        end
    
      end
    end
    
  • 基于 ruby on rails 做一个站内搜索 (不基于谷歌百度的站内搜索) at March 27, 2014

    https://github.com/sunspot/sunspot

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