大气
🐂🍺
mac 和 linux 都用过。。一般只用 vim 和浏览器,两者感觉差别不大
https://ruby-china.org/topics/25584 可以参考下这篇文章,针对 ruby 的内存分配与回收做了很好的解释。
先在有网络的地方执行 bundle,然后把 ruby 整个文件夹复制过去覆盖掉原来的,只在 windows 下测试过
显然第一步是要学会使用 google
pusher + slanger
默默地点赞、。。
这样必须要赞一个。。。希望能够组织起来啊
redmine 提供了插件机制,允许插件作者扩展 redmine 的核心。。lz 写出的代码是 view hooks。。 具体参见: http://www.redmine.org/projects/redmine/wiki/Hooks
深表赞同
#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