Skip to content

Instantly share code, notes, and snippets.

View mouse-lin's full-sized avatar

mouseshi mouse-lin

View GitHub Profile
@mouse-lin
mouse-lin / Rails forum gems
Created August 9, 2012 08:42
introduce useful Rails forum gems
(非关系性数据库的forum全部直接滤过了)
#communityengine
简介:一个将你现有的应用程序,包括用户、博客、照片、剪报、收藏,以及更多基于社交能力的功能集合到一起。
官网: http://www.communityengine.org
github(rails3)地址: https://github.com/bborn/communityengine/tree/rails3
优点: 功能多、多Rails版本支持,界面比较丰富,开发者贡献者多到目前还再维持更新中,wiki比较齐全
缺点: 当不需要用到那么多功能时,庞大功能配置将会是很麻烦,
forum-monster
简介: forum-monster是在Rails 3
@mouse-lin
mouse-lin / yml
Created March 5, 2013 12:01
load yml
module Settings
def self.get key
val = data.fetch(Rails.env, nil).try(:[], ENV["PLATFORM"]).try(:[], key)
raise "value nil in #{ Rails.en }" if val.nil? && Rails.env != "test"
val
end
def self.data
@data ||= YAML.load_file File.join(Rails.root, "config/settings.yml")
end
@mouse-lin
mouse-lin / gist:6431429
Created September 4, 2013 00:38
use redis to store autocomplete feature
require "redis"
redis = Redis.new
def get_prefixes word
Array.new(word.length) do |i|
if i == word.length - 1
"#{ word }*"
else
word[0..i]