我的知识点

摘要: 语言:Ruby,Javascript框架:Rails前端:Arela.js Jquery Ember.js数据库:Postgresql Redis工具:Ubuntu Git Nginx Unicorn 阅读全文
posted @ 2013-11-14 23:14 唐明星 阅读(132) 评论(0) 推荐(0) 编辑

Discourse:添加中文用户名支持

摘要: URL的encode和decode:Ruby:URI.escape(foo,Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))URI.unescape(val)JavaScript:encodeURIComponent(foo);匹配中文:\u4e00-\u9fa5AURL的encode规则:PATH:space => %20plus => plus/%2BPARAM:space => %20/plusplus => %2B 阅读全文
posted @ 2013-11-03 20:41 唐明星 阅读(318) 评论(0) 推荐(0) 编辑

Semver的表示方法

摘要: 源自:https://github.com/isaacs/node-semverThe following range styles are supported:1.2.3A specific version. When nothing else will do. Note that build metadata is still ignored, so1.2.3+build2012will satisfy this range.>1.2.3Greater than a specific version.=1.2.3Greater than or equal to. Note that 阅读全文
posted @ 2013-10-24 14:35 唐明星 阅读(425) 评论(0) 推荐(0) 编辑

Discourse的优化

摘要: 1.设置nginx的CPU亲缘性(以双核为例)worker_processes 2; worker_cpu_affinity 01 10; 2.讲clockwork作为sidekiq的子线程EMBED_CLOCKWORK=1 bundle exec sidekiq如果使用Capistrano部署,则删去clockwork作业,添加如下:set :sidekiq_cmd, "EMBED_CLOCKWORK=1 #{bundle_cmd} exec sidekiq" 阅读全文
posted @ 2013-08-05 11:42 唐明星 阅读(319) 评论(0) 推荐(0) 编辑

在ubuntu server 12.04上部署Discourse

摘要: 本教程参考http://davidcel.is/blog/2013/05/02/deploying-discourse-with-capistrano/因为网站马上要在阿里云上面运行,所以针对阿里云进行一些特殊操作:比如挂载数据盘,将数据库存放在/data目录下,等等。一、初始化服务器1.创建一个Ubuntu12.04的ECS,用root登录。2.挂载数据盘根据http://help.aliyun.com/origin?spm=0.0.0.0.8QIYDn&helpId=271的步骤,挂载数据盘到/data目录。3.创建普通用户并以普通用户登录adduser sjyytusermod 阅读全文
posted @ 2013-08-01 17:04 唐明星 阅读(586) 评论(0) 推荐(0) 编辑

nginx将服务器转入维护状态(自定义503页面)

摘要: 在nginx配置如下:server { listen 80; server_name www.test3g.com test3g.com; error_page 503 /503.html; location = /503.html { root /root/test3g/test3g; } location / { return 503; }} 阅读全文
posted @ 2013-07-30 17:02 唐明星 阅读(2765) 评论(0) 推荐(0) 编辑

在一个环境中使用不同版本的rails

摘要: 这里是一篇文章:http://stackoverflow.com/questions/3637672/how-can-i-access-rails-2-3-x-commands-when-rails-3-is-installed首先,介绍一下传统的方法,用GEM1)GEM——列出安装的目录;安装;使用特定版本gem list --local railsgem install rails --version 3.2.0rails _3.2.0_ --version2)rvm% rvm gemset create rails2% rvm gemset use rails2% gem install 阅读全文
posted @ 2013-07-16 00:14 唐明星 阅读(333) 评论(0) 推荐(0) 编辑

Ruby on Rails当中的URL编码

摘要: URL编码,对于我们这些不以英语为母语的开发者来说,是一个及其常见的问题。首先,大概解释一下为什么需要编码(也就是转义):在URL当中合法的字符是非常有限的,大致有英文大小写字母,数字,:,/,-,_等。URL当中是不允许出现中文的,我们在浏览器中看到的显示为中文的URL,都是浏览器自动解码显示的,并非真实的URL。这就是编码的第一个目的,把非法字符转义,以便符合URL规范。第二,有些字符在URL当中是合法的,但是在某些特定部分是非法的,比如:,/可以出现在http后面,但是如果作为查询字符串,就是非法的,必须转义,这是编码的第二个目的。URL分为5个部分,协议,主机,URI,参数和锚点。要编 阅读全文
posted @ 2013-07-07 20:10 唐明星 阅读(2458) 评论(0) 推荐(0) 编辑

Web服务器返回空的200结果的情况

摘要: 当目录下有这个文件时,返回的是空的200,没有的时候,返回的是404错误。为什么呢?一般情况下是权限问题,修改文件夹的权限即可。对于在home目录下的文件夹,则chmod 701 user_home。 阅读全文
posted @ 2013-07-04 03:12 唐明星 阅读(299) 评论(0) 推荐(0) 编辑

linux输出重定向

摘要: cmd > file 把 stdout 重定向到 file 文件中;cmd >> file 把 stdout 重定向到 file 文件中(追加);cmd 1> file 把 stdout 重定向到 file 文件中;cmd > file 2>&1 把 stdout 和 stderr 一起重定向到 file 文件中;cmd 2> file 把 stderr 重定向到 file 文件中;cmd 2>> file 把 stderr 重定向到 file 文件中(追加);cmd >> file 2>&1 把 stdo 阅读全文
posted @ 2013-07-03 12:17 唐明星 阅读(407) 评论(0) 推荐(0) 编辑