<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>towonzhou (周欢)</title>
    <link>https://ruby-china.org/towonzhou</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>录教学视频比想象中的难</title>
      <description>&lt;p&gt;&lt;span class="embed-responsive embed-responsive-16by9"&gt;&lt;iframe class="embed-responsive-item" src="//player.youku.com/embed/XMjU3OTEyOTg2OA==" allowfullscreen=""&gt;&lt;/iframe&gt;&lt;/span&gt;&lt;/p&gt;</description>
      <author>towonzhou</author>
      <pubDate>Sat, 04 Mar 2017 23:48:44 +0800</pubDate>
      <link>https://ruby-china.org/topics/32445</link>
      <guid>https://ruby-china.org/topics/32445</guid>
    </item>
    <item>
      <title>有谁从 PostgreSQL 迁移到 MySQL 吗？</title>
      <description>&lt;p&gt;现在需要从 postgres 迁移到 mysql，请教下有谁做过，有什么坑吗？？&lt;/p&gt;</description>
      <author>towonzhou</author>
      <pubDate>Thu, 29 Dec 2016 16:35:25 +0800</pubDate>
      <link>https://ruby-china.org/topics/32023</link>
      <guid>https://ruby-china.org/topics/32023</guid>
    </item>
    <item>
      <title>怎么 render partial 使用 vue 的变量？</title>
      <description>&lt;p&gt;如题，比如想 render partial: {{ item.path }}
应该怎么写呢？用的是 haml&lt;/p&gt;</description>
      <author>towonzhou</author>
      <pubDate>Sat, 10 Dec 2016 01:10:32 +0800</pubDate>
      <link>https://ruby-china.org/topics/31864</link>
      <guid>https://ruby-china.org/topics/31864</guid>
    </item>
    <item>
      <title>ruby-china 的源有点慢</title>
      <description>&lt;p&gt;只有我一个人觉得吗？&lt;a href="https://gems.ruby-china.org" rel="nofollow" target="_blank"&gt;https://gems.ruby-china.org&lt;/a&gt; 有点慢啊，还是我的网的问题？&lt;/p&gt;</description>
      <author>towonzhou</author>
      <pubDate>Thu, 04 Aug 2016 19:17:02 +0800</pubDate>
      <link>https://ruby-china.org/topics/30734</link>
      <guid>https://ruby-china.org/topics/30734</guid>
    </item>
    <item>
      <title>sendcloud_rails</title>
      <description>&lt;p&gt;一直用 mailgun 来发邮件，发现对 qq 邮箱的支持不太好，于是换成 sendcloud, 可惜 sendcloud 没有现成的 rails gem，照着 mailgun_rails 写了个 sendcloud_rails&lt;/p&gt;

&lt;p&gt;github 地址 (&lt;a href="https://github.com/towonzhou/sendcloud_rails" rel="nofollow" target="_blank"&gt;https://github.com/towonzhou/sendcloud_rails&lt;/a&gt;)&lt;/p&gt;
&lt;h2 id="Installing"&gt;Installing&lt;/h2&gt;
&lt;p&gt;In your &lt;code&gt;Gemfile&lt;/code&gt;&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;gem&lt;/span&gt; &lt;span class="s1"&gt;'sendcloud_rails'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="Usage"&gt;Usage&lt;/h2&gt;
&lt;p&gt;To configure your sendcloud credentials place the following code in the corresponding environment file (&lt;code&gt;development.rb&lt;/code&gt;, &lt;code&gt;production.rb&lt;/code&gt;...)&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;action_mailer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;delivery_method&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="ss"&gt;:sendcloud&lt;/span&gt;
&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;action_mailer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendcloud_settings&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="ss"&gt;api_user: &lt;/span&gt;&lt;span class="s1"&gt;'&amp;lt;apiUser&amp;gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;api_key: &lt;/span&gt;&lt;span class="s1"&gt;'&amp;lt;apiKey&amp;gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;api_url: &lt;/span&gt;&lt;span class="s1"&gt;'http://api.sendcloud.net/apiv2/mail/send'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now you can send emails using plain Action Mailer:&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mail&lt;/span&gt; &lt;span class="ss"&gt;from: &lt;/span&gt;&lt;span class="s1"&gt;'sender@email.com'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;to: &lt;/span&gt;&lt;span class="s1"&gt;'receiver@email.com'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;subject: &lt;/span&gt;&lt;span class="s1"&gt;'this is an email'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;</description>
      <author>towonzhou</author>
      <pubDate>Wed, 27 Jul 2016 11:01:01 +0800</pubDate>
      <link>https://ruby-china.org/topics/30634</link>
      <guid>https://ruby-china.org/topics/30634</guid>
    </item>
    <item>
      <title>使用 rollbar, slack 做服务器监控和通知</title>
      <description>&lt;h2 id="使用rollbar, slack做服务器监控和通知"&gt;使用 rollbar, slack 做服务器监控和通知&lt;/h2&gt;
&lt;p&gt;公司现在用 rollbar 来做应用异常监控，gitlab 做代码仓库，slack 做通知，挺方便的，分享给大家。&lt;/p&gt;
&lt;h3 id="rollbar"&gt;&lt;a href="http://rollbar.com" rel="nofollow" target="_blank" title=""&gt;rollbar&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;非常强大的错误跟踪工具，有 gem 直接安装，可以跟踪很详细的数据。如下图是 rollbar 的错误详细界面之一.
&lt;img src="http://static.zybuluo.com/towonzhou/e8mbeqab5z1ben170dh5r5yd/image_1aj4024asj94qt71hm91nv8ga11s.png" title="" alt="image_1aj4024asj94qt71hm91nv8ga11s.png-142.8kB"&gt;&lt;/p&gt;

&lt;p&gt;而且还可以区分环境，再配上 slack 做通知。非常方便&lt;/p&gt;

&lt;p&gt;&lt;img src="http://static.zybuluo.com/towonzhou/5ml6pdc63a0own50176o56le/image_1aj3vur78144dlld1av81jgr1ga91f.png" title="" alt="image_1aj3vur78144dlld1av81jgr1ga91f.png-161kB"&gt;&lt;/p&gt;
&lt;h3 id="gitlab"&gt;gitlab&lt;/h3&gt;
&lt;p&gt;顺便提一下 gitlab, gitlab 是什么大家都懂，不用过多介绍，主要介绍一下可以添加 slack 的通知，很方便的知道谁提交了代码和 MR.&lt;/p&gt;</description>
      <author>towonzhou</author>
      <pubDate>Thu, 19 May 2016 15:59:06 +0800</pubDate>
      <link>https://ruby-china.org/topics/30070</link>
      <guid>https://ruby-china.org/topics/30070</guid>
    </item>
    <item>
      <title>material-ui for rails</title>
      <description>&lt;p&gt;&lt;a href="http://www.material-ui.com/#/" rel="nofollow" target="_blank" title=""&gt;material-ui&lt;/a&gt;是一个 react 的框架。
一直想用这个，但没有现成的 gem 包可以使用，本人前端水平也很 low, 还是很多原理搞不懂。
写了一个 gem, 可以在 rails 中应用这个框架，gem 名称 materialUi-rails, &lt;a href="https://github.com/towonzhou/material-ui-rails" rel="nofollow" target="_blank" title=""&gt;github 地址&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="使用方法"&gt;使用方法&lt;/h2&gt;&lt;h5 id="添加gem"&gt;添加 gem&lt;/h5&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gem 'browserify-rails'
gem 'materialUi-rails'
&lt;/code&gt;&lt;/pre&gt;&lt;h5 id="在Rakefile中添加"&gt;在 Rakefile 中添加&lt;/h5&gt;
&lt;p&gt;(不知道为什么 build 成 gem 包的时候，rake task 无法自动加载，需要手动添加下面两行加载，而如果在 Gemfile 里面写 git 地址就会自动加载)&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spec = Gem::Specification.find_by_name 'materialUi-rails'
load "#{spec.gem_dir}/lib/material-ui-rails/tasks/muirails.rake"
&lt;/code&gt;&lt;/pre&gt;&lt;h5 id="运行初始化命令"&gt;运行初始化命令&lt;/h5&gt;
&lt;p&gt;这个命令时间有点长，主要是下载 npm 包&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rake muirails:install
npm install
&lt;/code&gt;&lt;/pre&gt;&lt;h5 id="config/application.rb添加配置"&gt;config/application.rb添加配置&lt;/h5&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# in config/application.rb
config.browserify_rails.commandline_options = ["-t reactify"]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;ok 了，就可以在 js 文件中直接使用了，给个小例子&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var React = require('react'),
mui = require('material-ui'),
RaisedButton = mui.RaisedButton;

$(function(){
  React.render(
    &amp;lt;RaisedButton label="hello" /&amp;gt;,
    document.body
  );
});
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;效果就像这样，例子地址&lt;a href="https://github.com/towonzhou/test_material_ui" rel="nofollow" target="_blank" title=""&gt;https://github.com/towonzhou/test_material_ui&lt;/a&gt;
&lt;img src="https://l.ruby-china.com/photo/2016/6c5a3068fef7be2c6d16122954e34d0e.png" title="" alt=""&gt;&lt;/p&gt;

&lt;p&gt;方法很 low, 欢迎交流&lt;/p&gt;</description>
      <author>towonzhou</author>
      <pubDate>Sun, 21 Feb 2016 19:58:36 +0800</pubDate>
      <link>https://ruby-china.org/topics/29045</link>
      <guid>https://ruby-china.org/topics/29045</guid>
    </item>
    <item>
      <title>[北京] 趣玩贝科技有限公司招聘 Ruby 开发 1 名 (15k-30k)</title>
      <description>&lt;p&gt;&lt;img src="https://l.ruby-china.com/photo/2016/109c0d2a77fdcc96fd96cf27fb889034.png" title="" alt=""&gt;
趣玩贝是一个已经拿到天使轮融资的在线旅行创业型公司，目前团队有 30 人，来自于游心旅行、易道用车、创新工厂、下一站和去哪儿等，方向明确、目标清晰，您将和一群在不同领域非常专业的人士一起工作。公司也会为团队的每一位成员提供最好的待遇、福利和工作环境。我们的愿景是中国出境旅行行业中的境外全交通 B2B 解决方案。&lt;/p&gt;

&lt;p&gt;我们用的语言是 ruby on rails，技术童鞋是会说五种语言的法国哥哥。我们彪悍的商务能力促使着商业化数据越来越有成果，随之而来的就是高效的技术开发需求，我们有着各种折腾的创业经验，如果你愿意加入一个风口上的创业公司，愿意快速的成为旅行行业某细分领域的第一，愿意一起打拼一起加班一起撸串一起收加班红包雨，我们需要你。&lt;/p&gt;
&lt;h2 id="福利"&gt;福利&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;我坚信，一位有职业素养的全栈攻城狮是超过三位一般攻城狮的价钱的，所以如果您是 Star Developer，能向我们目前的法国技术总监一样，一个人完成了数据库的搭建和网站的开发（俗称 Geek)，我不介意不发工资给自己，把您的薪资推到 30k。 &lt;/li&gt;
&lt;li&gt;我希望您可以跟公司共沉浮共加班，所以我们也可以奖励 RSU。 &lt;/li&gt;
&lt;li&gt;只要您需要的设备：机械键盘，巨大的显示屏，乱七八糟的椅子，Macbook...我们都可以配。 &lt;/li&gt;
&lt;li&gt;我们鼓励你尝试不同的新技术，只要你能搞明白都可以。&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="岗位职责"&gt;岗位职责&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;负责公司不同业务模块和数据平台的系统设计和开发 (基于 rails)&lt;/li&gt;
&lt;li&gt;基于需求和设计，使用 Ruby/ROR 完成编程和单元测试工作；&lt;/li&gt;
&lt;li&gt;解决开发过程中出现的技术问题；&lt;/li&gt;
&lt;li&gt;带领开发团队进行产品研发工作，提升开发团队效率和能力。&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="任职要求"&gt;任职要求&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;统招本科及以上学历，计算机、软件相关专业，Rails 相关工作年限 1-2 年。应届毕业生，能力优秀亦可&lt;/li&gt;
&lt;li&gt;有 rails 项目实战经验，和 git 使用经验&lt;/li&gt;
&lt;li&gt;用过这些 Gem：devise, sidekiq,haml simple_form,bootstrap-sass&lt;/li&gt;
&lt;li&gt;学习能力强，对技术有强烈的好奇心，可以快速掌握新知识和新技术，对自己写出的代码有效率和架构上的完美主义倾向&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="加分项"&gt;加分项&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;熟悉 grape，写过 api 接口&lt;/li&gt;
&lt;li&gt;熟悉前端技术和框架，包括 HTML/CSS，Javascript，jQuery/reactjs 等&lt;/li&gt;
&lt;li&gt;有过前端页面经验&lt;/li&gt;
&lt;li&gt;熟悉 AWS/阿里云部署方案；&lt;/li&gt;
&lt;li&gt;有 github 账号&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="工作环境及待遇"&gt;工作环境及待遇&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;薪资 15k-30k&lt;/li&gt;
&lt;li&gt;五险一金、极具竞争力的薪酬以及期权激励；&lt;/li&gt;
&lt;li&gt;工作地点在三元桥，无论你住在哪里，交通都很方便；&lt;/li&gt;
&lt;li&gt;工作环境自由，上下班不打卡，还可以时不时的 work from home；&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;现在我们的产品逻辑已经跑通，市场已经探索完毕。毫不忌讳地说，我们的方案从供需入手帮助旅行行业提升了工作效率，因此现在 40% 的用户第一次见面即表示可以签约试用。公司已经有了真金实银的收入，请将我们与烧钱的公司区别开来^_^&lt;/p&gt;
&lt;h2 id="我们的联系方式"&gt;我们的联系方式&lt;/h2&gt;
&lt;p&gt;邮箱：&lt;a href="mailto:luolan@haihuilai.com" title=""&gt;luolan@haihuilai.com&lt;/a&gt;
电话/微信：13260478687
地址：北京市朝阳区三元桥霞光里 66 号橡树公馆 D 座 2 层&lt;/p&gt;</description>
      <author>towonzhou</author>
      <pubDate>Thu, 28 Jan 2016 10:51:31 +0800</pubDate>
      <link>https://ruby-china.org/topics/28895</link>
      <guid>https://ruby-china.org/topics/28895</guid>
    </item>
    <item>
      <title>地点搜索是怎么做到的呢</title>
      <description>&lt;p&gt;&lt;img src="https://l.ruby-china.com/photo/2016/db199f7fdb9783596b2e5fa81fef2cdc.png" title="" alt=""&gt;&lt;/p&gt;

&lt;p&gt;就像百度地图一样，选定城市之后，可以搜索出这个城市下的地点，是怎么做到的呢&lt;/p&gt;</description>
      <author>towonzhou</author>
      <pubDate>Wed, 27 Jan 2016 15:26:06 +0800</pubDate>
      <link>https://ruby-china.org/topics/28878</link>
      <guid>https://ruby-china.org/topics/28878</guid>
    </item>
    <item>
      <title>React for Rails 入门</title>
      <description>&lt;ol&gt;
&lt;li&gt;新建一个 rails 项目&lt;code&gt;rails new react&lt;/code&gt;&lt;br&gt;
&lt;/li&gt;
&lt;li&gt;添加 gem &lt;code&gt;gem 'react-rails', '~&amp;gt; 1.4.0'&lt;/code&gt;, 然后安装&lt;code&gt;bundle install&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;react-rails 提供了安装命令&lt;code&gt;rails g react:install&lt;/code&gt;&lt;br&gt;
这个命令会在 app/assets/javascripts 目录下，创建一个 components.js 文件和 components 目录，并且会在 application.js 中添加三行&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//= require react
//= require react_ujs
//= require components
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;创建一个名为 resource 的 Record，包含 date, title, amount 三个字段&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rails g resource Record title date:date amount:float
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;然后&lt;code&gt;rake db:create db:migrate&lt;/code&gt;
最后在 console 里面创建两条数据 (也可以用 db/seed)&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Record.create title: 'Record 2', date: Date.today, amount: -100  
Record.create title: 'Record 1', date: Date.today, amount: 500
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;rails s&lt;/code&gt;   ok，基础工作完成了。&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;下面是代码阶段&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;创建一个 controller 和 index action&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# app/controllers/records_controller.rb
class RecordsController &amp;lt; ApplicationController
    def index
        @records = Record.all
    end
end
&lt;/code&gt;&lt;/pre&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;创建 view 文件&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;%# app/views/records/index.html.erb %&amp;gt;

&amp;lt;%= react_component 'Records', { data: @records } %&amp;gt;

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;react-rails 提供了一个 helper 方法，react_component，来渲染 react 组件.
格式为&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;react_component(component_class_name, props={}, html_options={})
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;访问 localhost:3000/records 会看到你的页面中多出了一段 html&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div data-react-class="Records" data-react-props="{...}"&amp;gt;&amp;lt;/div
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;react_ujs 会在这里渲染 react 组件，会附带一些 props 参数，上例中是&lt;a href="/records" class="user-mention" title="@records"&gt;&lt;i&gt;@&lt;/i&gt;records&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;下面创建 react 组件&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# app/assets/javascripts/components/records.js.coffee
@Records = React.createClass
  render: -&amp;gt;
    React.DOM.div
      className: 'records'
      React.DOM.h2
        className: 'title'
        'Records'

&lt;/code&gt;&lt;/pre&gt;
&lt;ol&gt;
&lt;li&gt;ok，再访问 localhost:3000/records 就可以看到结果了。&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;</description>
      <author>towonzhou</author>
      <pubDate>Thu, 05 Nov 2015 11:07:07 +0800</pubDate>
      <link>https://ruby-china.org/topics/27960</link>
      <guid>https://ruby-china.org/topics/27960</guid>
    </item>
    <item>
      <title>安装 therubyracer 0.9.9 的时候报错,</title>
      <description>&lt;p&gt;我的 libv8 版本是 3.3.10.4
gcc48
求指教怎么把 therubyracer 给装上去..&lt;/p&gt;

&lt;p&gt;Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
        ERROR: Failed to build gem native extension.&lt;/p&gt;

&lt;p&gt;/Users/tonyzhou/.rvm/rubies/ruby-1.9.3-p125/bin/ruby -r ./siteconf20141202-23353-1mos9l3.rb extconf.rb
checking for main() in -lobjc... yes
creating Makefile&lt;/p&gt;

&lt;p&gt;make  clean&lt;/p&gt;

&lt;p&gt;make
compiling rr.cpp
clang: warning: argument unused during compilation: '-rdynamic'
rr.cpp:48:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.
compiling v8.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_array.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_callbacks.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_context.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_date.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_debug.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_exception.cpp
clang: warning: argument unused during compilation: '-rdynamic'
v8_exception.cpp:10:16: warning: unused variable 'stack' [-Wunused-variable]
  static void* stack[20];
               ^
1 warning generated.
compiling v8_external.cpp
clang: warning: argument unused during compilation: '-rdynamic'
v8_external.cpp:10:9: warning: unused variable 'references' [-Wunused-variable]
  VALUE references;
        ^
1 warning generated.
compiling v8_function.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_handle.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_locker.cpp
clang: warning: argument unused during compilation: '-rdynamic'
v8_locker.cpp:45:5: warning: control reaches end of non-void function [-Wreturn-type]
    }
    ^
v8_locker.cpp:85:5: warning: control reaches end of non-void function [-Wreturn-type]
    }
    ^
2 warnings generated.
compiling v8_message.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_object.cpp
clang: warning: argument unused during compilation: '-rdynamic'
v8_object.cpp:77:19: warning: unused variable 'proto' [-Wunused-variable]
    Handle proto(rr_rb2v8(prototype));
                  ^
1 warning generated.
compiling v8_script.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_string.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_template.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_try_catch.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_v8.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_value.cpp
clang: warning: argument unused during compilation: '-rdynamic'
v8_value.cpp&lt;img title=":100:" alt="💯" src="https://twemoji.ruby-china.com/2/svg/1f4af.svg" class="twemoji"&gt;9: warning: unused function 'ToInt32' [-Wunused-function]
  VALUE ToInt32(VALUE self) {
        ^
1 warning generated.
compiling v8_weakref.cpp
clang: warning: argument unused during compilation: '-rdynamic'
linking shared-object v8.bundle
ld: library not found for -lv8
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [v8.bundle] Error 1&lt;/p&gt;

&lt;p&gt;make failed, exit code 2&lt;/p&gt;

&lt;p&gt;Gem files will remain installed in /Users/tonyzhou/.rvm/gems/ruby-1.9.3-p125/gems/therubyracer-0.9.9 for inspection.
Results logged to /Users/tonyzhou/.rvm/gems/ruby-1.9.3-p125/extensions/x86_64-darwin-14/1.9.1/therubyracer-0.9.9/gem_make.out&lt;/p&gt;</description>
      <author>towonzhou</author>
      <pubDate>Tue, 02 Dec 2014 18:17:33 +0800</pubDate>
      <link>https://ruby-china.org/topics/22979</link>
      <guid>https://ruby-china.org/topics/22979</guid>
    </item>
    <item>
      <title>memcached 和 redis</title>
      <description>&lt;p&gt;这两个都是用来做缓存的，之前用的是 memcached，然后改成 memcached 和 redis 共存了.
redis 的作者说：&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;由于Redis只使用单核,而Memcached可以使用多核,所以平均每一个核上Redis在存储小数据时比Memcached性能更 高.而在100k以上的数据中,Memcached性能要高于Redis,虽然Redis最近也在存储大数据的性能上进行优化,但是比起 Memcached,还是稍有逊色.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;但个人经验来说，这两者都很快，性能问题对于开发者应该不是很需要考虑的重点。个人偏爱 redis，因为他支持更多的数据类型，而且列表操作很简单&lt;code&gt;redis.keys&lt;/code&gt;即可。 &lt;/p&gt;
&lt;h3 id="先来说memcached, 更多"&gt;先来说 memcached, &lt;a href="https://github.com/mperham/dalli" rel="nofollow" target="_blank" title=""&gt;更多&lt;/a&gt;
&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;安装 memcached 服务&lt;code&gt;brew install memcached&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;安装 gem,&lt;code&gt;gem install dalli&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;运行示例&lt;br&gt;
&lt;img src="https://l.ruby-china.com/photo/2014/2da967529970f94625cf39338f3b375d.png" title="" alt=""&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="再来说redis 更多"&gt;再来说 redis &lt;a href="https://github.com/redis/redis-rb" rel="nofollow" target="_blank" title=""&gt;更多&lt;/a&gt;
&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;安装 redis&lt;br&gt;
&lt;/li&gt;
&lt;li&gt;安装 gem, &lt;code&gt;gem install redis&lt;/code&gt;&lt;br&gt;
&lt;/li&gt;
&lt;li&gt;运行示例&lt;br&gt;
&lt;img src="https://l.ruby-china.com/photo/2014/f4edabdfe64a344a38a9959c72825385.png" title="" alt=""&gt;&lt;br&gt;
redis 支持的数据类型太多了，就不一一介绍了，参考&lt;a href="http://redis.cn/commands.html" rel="nofollow" target="_blank" title=""&gt;这里&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;有人说 redis 会把数据持久化，那样就很慢，其实是有开关让数据不持久化的。但那样重启就丢失了.而且也不慢，因为持久化是 redis 服务在后台运行的。&lt;/p&gt;

&lt;p&gt;发现真实运行的时候 redis 有时候链接抛出异常.
最好是这样&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;value = redis.get(key) rescue value = redis.get(key)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;你要不放心，也可以多取几次。&lt;/p&gt;

&lt;p&gt;以上图片代码&lt;a href="https://github.com/towonzhou/rails-3.2-test/tree/master/test/redis" rel="nofollow" target="_blank" title=""&gt;在这里&lt;/a&gt;&lt;/p&gt;</description>
      <author>towonzhou</author>
      <pubDate>Fri, 07 Nov 2014 12:02:46 +0800</pubDate>
      <link>https://ruby-china.org/topics/22541</link>
      <guid>https://ruby-china.org/topics/22541</guid>
    </item>
    <item>
      <title>全文搜索 sunspot</title>
      <description>&lt;p&gt;搜索是每个 web 都需要的，通常有三种方法。&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;普通青年：sql 的 like 语句&lt;/li&gt;
&lt;li&gt;文艺青年：用 NoSQL 或搜索引擎&lt;/li&gt;
&lt;li&gt;xx 青年   :  从数据库读出数据后，字符串匹配......&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;数量不大的时候 (十万一下),用 like 就可以了，当时当数量在百万级，搜索引擎就是最好的方法。&lt;/p&gt;

&lt;p&gt;简要介绍 Solr 搜索引擎，更多介绍看&lt;a href="http://www.taobaotest.com/blogs/qa?bid=15062" rel="nofollow" target="_blank" title=""&gt;这个&lt;/a&gt;&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;先介绍Lucene:  Lucene是基于JAVA的搜索引擎，能够实现对多字段的搜索，支持过滤器设置、分布式搜索、多样化搜索（多关键字,单/多字段匹配）、结果排序等。Lucen提供一组解读，过滤，分析文件，编排和使用索引的API，它的强大之处除了高效和简单外，是最重要的是使使用者可以随时应自已需要自订其功能。
Solr是基于Lucene二次开发的搜索引擎。扩展了很多特性：局部索引、任意对象索引、支持boolean、Facets等特性。在ROR中有相关gem包sunspot的支持。
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;在 rails 中安装 Sunspot 很简单，Gemfile 中添加 gem 即可&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gem 'sunspot_rails'
gem 'sunspot_solr' # optional pre-packaged Solr distribution for use in development
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;然后就是&lt;code&gt;bundle install&lt;/code&gt;了。&lt;/p&gt;

&lt;p&gt;安装完成之后需要运行一下&lt;code&gt;rails generate sunspot_rails:install&lt;/code&gt;, 会生成&lt;code&gt;config/sunspot.yml&lt;/code&gt;文件，连接 solr 服务的配置文件，solr 服务默认端口是 8983
启动 solr &lt;code&gt;rake sunspot:solr:start&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;ok 准备工作就搞定了&lt;/p&gt;

&lt;p&gt;使用 Sunspot&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;我们先要配置一下你准备搜索的 model
```
class People &amp;lt; ActiveRecord::Base
attr_accessible :age, :name, :dec&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;searchable do
    text :dec
    integer :id
    string :name
  end
end&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;People有三个属性,dec是text的, 主要是searchable方法, text就表示需要全文索引的元素了,而像integer和string是用于scope的.

配置完毕之后,你可以在``rails c``中执行``People.reindex``就把People的内容索引进了solr服务. 你也可以直接``rake sunspot:reindex``

最后一步取出数据
有三个方法可以取出数据,看个人喜欢
1.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;#找出 dec 字段中存在 ruby 的 people
a = People.search { fulltext 'ruby' }&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;#找出 dec 字段中存在 ruby 的 people
a = Sunspot.search(People) { keywords '撒谎'}&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;3.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;sun_spot = Sunspot.new_search(People)
sun_spot.build {keywords '撒谎'}
a = sun_spot.execute&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;输出``a.total``的结果是 ``=&amp;gt; 2``,表示有几条匹配的记录
`a.results`表示结果数组
`a.results.total_pages` 一共有多少页
`a.results.first_page?`  是否第一页

更多方法参见[Sunspot Github](https://github.com/sunspot/sunspot)

&lt;/code&gt;&lt;/pre&gt;</description>
      <author>towonzhou</author>
      <pubDate>Thu, 06 Nov 2014 15:23:15 +0800</pubDate>
      <link>https://ruby-china.org/topics/22531</link>
      <guid>https://ruby-china.org/topics/22531</guid>
    </item>
    <item>
      <title>初次使用 MiniTest</title>
      <description>&lt;p&gt;MiniTest 是在 ruby 1.9 版本中引入的，是 Test::Unit 的改进版本并且兼容 Test::Unit.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;MiniTest 支持 assertions, 并且兼容 Test::Unit, 如果你的测试用例是用 Test::Unit 写的，那么可以平滑的过渡。&lt;/li&gt;
&lt;li&gt;除了断言语法之外，MiniTest 还支持期望式的语法，就像 rspec 一样，并且因为是 ruby 集成的，不需要引入外部库
..... 还有很多吧&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="第一个小例子"&gt;第一个小例子&lt;/h3&gt;
&lt;p&gt;废话不多说，直接来例子吧
1.一个简单的类&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#vim people.rb
class People
  def name
    "towonzhou"
  end
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;2.用 MiniTest 测试了&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#vim people_test.rb
require 'minitest/autorun'
require './people'

class TestPeople &amp;lt; Minitest::Test
  def setup
    @people = People.new
  end

  def test_name_is_towonzhou
    assert_equal "towonzhou", @people.name
  end
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;直接运行 &lt;code&gt;ruby people_test.rb&lt;/code&gt;即可得到结果&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Run options: --seed 10922

# Running:

.

Finished in 0.001302s, 768.0492 runs/s, 768.0492 assertions/s.

1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;ok 搞定。&lt;/p&gt;
&lt;h3 id="用期望语法写测试"&gt;用期望语法写测试&lt;/h3&gt;
&lt;p&gt;前面说过 MiniTest 也支持期望式的语法，语法跟 rspec 很像，也是用 describe 和 it 代码块。&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#vim people_spec.rb
require 'minitest/autorun'
require './people'

describe People do
  before do
    @people = People.new
  end

  describe "#name" do
    it "returns the name of the people" do
      @people.name.must_equal "towonzhou"
    end
  end
end

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;运行结果如下：&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Run options: --seed 38156

# Running:

.

Finished in 0.001585s, 630.9148 runs/s, 630.9148 assertions/s.

1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="支持的断言和期望"&gt;支持的断言和期望&lt;/h3&gt;
&lt;p&gt;列出几个常用的方法吧&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ASSERTION             EXPECTATION
assert_equal                must_equal
assert_instance_of      must_be_instance_of
assert_nil                     must_be_nil
assert_raises               must_raise
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;更多方法参见&lt;a href="http://docs.seattlerb.org/minitest/Minitest/Assertions.html" rel="nofollow" target="_blank" title=""&gt;Assertions&lt;/a&gt;和&lt;a href="http://docs.seattlerb.org/minitest/Minitest/Expectations.html" rel="nofollow" target="_blank" title=""&gt;Expectations&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;下面是大家关心的怎么在 rails 中应用呢
只需要几步就可以了&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;在 Gemfile 中加上&lt;code&gt;gem "minitest-rails"&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;安装他 
&lt;code&gt;
bundle install
rails generate minitest:install
&lt;/code&gt;
3.在&lt;code&gt;config/application.rb&lt;/code&gt; 设置一下
&lt;code&gt;
config.generators do |g|
g.test_framework :minitest, spec: true
end
&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;搞定了，当你再次运行 rails g 命令的时候就会生成 minitest 文件了&lt;/p&gt;

&lt;p&gt;以上的几个例子在&lt;a href="https://github.com/towonzhou/rails-3.2-test/tree/master/test/minitest" rel="nofollow" target="_blank" title=""&gt;github&lt;/a&gt;&lt;/p&gt;</description>
      <author>towonzhou</author>
      <pubDate>Tue, 04 Nov 2014 22:43:11 +0800</pubDate>
      <link>https://ruby-china.org/topics/22476</link>
      <guid>https://ruby-china.org/topics/22476</guid>
    </item>
    <item>
      <title>求推荐一个订单管理的开源项目</title>
      <description>&lt;p&gt;要做一个订单管理的项目，自己从头写太麻烦了，不知道有没有开源项目？
有大的框架就行.....
求推荐.....&lt;/p&gt;</description>
      <author>towonzhou</author>
      <pubDate>Tue, 23 Sep 2014 14:15:40 +0800</pubDate>
      <link>https://ruby-china.org/topics/21684</link>
      <guid>https://ruby-china.org/topics/21684</guid>
    </item>
    <item>
      <title>好奇 ruby-china 最上方的进度条是怎么做出来的?</title>
      <description>&lt;p&gt;如题。&lt;/p&gt;</description>
      <author>towonzhou</author>
      <pubDate>Fri, 18 Jul 2014 13:54:36 +0800</pubDate>
      <link>https://ruby-china.org/topics/20570</link>
      <guid>https://ruby-china.org/topics/20570</guid>
    </item>
    <item>
      <title>求助:sinatra 的 erb 编码问题</title>
      <description>&lt;p&gt;默认设置的 set :default_encoding, "utf-8"
有一个 controller 我需要返回 gbk 编码的页面.
如果我把页面里面的中文 force_encoding("gbk")
就会报错
incompatible character encodings: UTF-8 and GBK&lt;/p&gt;

&lt;p&gt;请问怎么设置那一个界面返回是 gbk 编码的啊？&lt;/p&gt;</description>
      <author>towonzhou</author>
      <pubDate>Sun, 15 Jun 2014 11:35:06 +0800</pubDate>
      <link>https://ruby-china.org/topics/19954</link>
      <guid>https://ruby-china.org/topics/19954</guid>
    </item>
    <item>
      <title>简单介绍一下 sinatra</title>
      <description>
&lt;h2 id="sinatra的使用"&gt;sinatra 的使用&lt;/h2&gt;
&lt;p&gt;用 sinatra 也很长时间了，写一下文章分享一下使用方法.
例子在 &lt;a href="https://github.com/towonzhou/sinatra-test" rel="nofollow" target="_blank"&gt;https://github.com/towonzhou/sinatra-test&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;首先介绍一下 sinatra 和为什么使用 sinatra............(这种高度概括的东西不太好写，酝酿一段时间.)
如果你想做一个移动 app 的后台，那么 sinatra 将是一个很好的选择&lt;/p&gt;

&lt;p&gt;##一。hello world!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;当然是安装 sinatra 的 gem 包了。&lt;br&gt;
&lt;code&gt;gem install sinatra&lt;/code&gt;&lt;br&gt;
&lt;/li&gt;
&lt;li&gt;写一个 hello world 的服务器.
$&amp;gt; vim hello_world.rb
```
require "rubygems"&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="If you're using bundler, you will need to add this"&gt;If you're using bundler, you will need to add this&lt;/h2&gt;
&lt;p&gt;require 'bundler/setup'
require 'sinatra'&lt;/p&gt;

&lt;p&gt;get '/' do
  "Hello world, it's #{Time.now} at the server!"
end&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;搞定,保存. 
3. 运行
  `$&amp;gt; ruby hello_world.rb`
   输出为:
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Sinatra/1.4.4 has taken the stage on 4567 for development with backup from Thin
Thin web server (v1.6.2 codename Doc Brown)
Maximum connections set to 1024
Listening on localhost:4567, CTRL+C to stop&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;可以看到sinatra的默认端口为4567.
  4. 现在可以请求一下看看效果了. 
  `$&amp;gt; curl "localhost:4567"`
  可以看到输出为:
   ``Hello world, it's 2014-03-31 20:55:23 +0800 at the server!``
  5. ok了,你已经有了一个简易的服务器了.

##二.粗略了解sinatra
1. Routing
 sinatra的路由配置相当的灵活.首先支持基本的http方法,get,post,put,delete.
$&amp;gt; vim routing.rb
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;require 'rubygems'&lt;/p&gt;
&lt;h2 id="If you're using bundler, you will need to add this"&gt;If you're using bundler, you will need to add this&lt;/h2&gt;
&lt;p&gt;require 'bundler/setup'&lt;/p&gt;

&lt;p&gt;require 'sinatra'&lt;/p&gt;

&lt;p&gt;get '/get' do
  "That is a get request method, it's #{Time.now} at the server!"
end&lt;/p&gt;

&lt;p&gt;post '/post' do
  "That is a post request method, it's #{Time.now} at the server!"
end&lt;/p&gt;

&lt;p&gt;put '/put' do
  "That is a put request method, it's #{Time.now} at the server!"
end&lt;/p&gt;

&lt;p&gt;delete '/delete' do
  "That is a delete request method, it's #{Time.now} at the server!"
end&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;一样,启动`ruby routing.rb`.
请求一下吧`curl "localhost:4567/get"`,
输出为`That is a get request method, it's 2014-03-31 21:17:00 +0800 at the server!`

继续请求`curl "localhost:4567/post"`,很好你会看到出错了.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;lt;!DOCTYPE html&amp;gt;

&lt;/p&gt;
  
  body { text-align:center;font-family:helvetica,arial;font-size:22px;
    color:#888;margin:20px}
  #c {margin:0 auto;width:500px;text-align:left}
  


  &lt;h2&gt;Sinatra doesn’t know this ditty.&lt;/h2&gt;
  &lt;img src="http://localhost:4567/__sinatra__/404.png"&gt;
  
    Try this:
    &lt;pre&gt;get '/post' do
  "Hello World"
end
&lt;/pre&gt;
  


&lt;pre class="highlight plaintext"&gt;&lt;code&gt;这是因为"/post"路径的方法是post
`curl -d "" "localhost:4567/post"`才是正确滴.
上面只是很简单的关于route的例子,当然他也支持RESTful这种东东了.
想了接更多可以参考http://www.sinatrarb.com/intro#Routes

##三:.Filters
sinatra支持两种filter,分别是before和after.顾名思义,befor就是在所有的请求之前执行.after在所有的请求之后执行.
他们都带一个block.
$&amp;gt; vim filter.rb
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;require 'rubygems'&lt;/p&gt;
&lt;h2 id="If you're using bundler, you will need to add this"&gt;If you're using bundler, you will need to add this&lt;/h2&gt;
&lt;p&gt;require 'bundler/setup'&lt;/p&gt;

&lt;p&gt;require 'sinatra'&lt;/p&gt;

&lt;p&gt;before do
  &lt;a href="/befor" class="user-mention" title="@befor"&gt;&lt;i&gt;@&lt;/i&gt;befor&lt;/a&gt; = "beeeeeeefor"
end&lt;/p&gt;

&lt;p&gt;get '/' do
  "hello, test the #{&lt;a href="/befor" class="user-mention" title="@befor"&gt;&lt;i&gt;@&lt;/i&gt;befor&lt;/a&gt;} filter, it's #{Time.now} at the server!"
end&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;依然是请求一下`curl localhost:4567`
输出为`hello, test the beeeeeeefor filter, it's 2014-03-31 21:39:10 +0800 at the server!`
after类似,就不举例子了.


#####未完待续
&lt;/code&gt;&lt;/pre&gt;
</description>
      <author>towonzhou</author>
      <pubDate>Mon, 31 Mar 2014 21:57:12 +0800</pubDate>
      <link>https://ruby-china.org/topics/18292</link>
      <guid>https://ruby-china.org/topics/18292</guid>
    </item>
    <item>
      <title>Ruby 的可变参数的 C 实现是怎样的？</title>
      <description>&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def fun(*args)
  ........
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;args 是一个数组，请问这是怎么实现的？&lt;/p&gt;</description>
      <author>towonzhou</author>
      <pubDate>Fri, 21 Feb 2014 13:17:42 +0800</pubDate>
      <link>https://ruby-china.org/topics/17395</link>
      <guid>https://ruby-china.org/topics/17395</guid>
    </item>
    <item>
      <title>问: 有没有一个能间隔一秒执行一次的 gem 呢?</title>
      <description>&lt;p&gt;用 goliath 的 plugin 运行的一个周期任务，周期是 1 秒&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module Plugin
  class Query
    include RunQuery
    def initialize(address, port, config, status, logger)
    end

    def run
      EM.add_periodic_timer(1) do
        _run
      end
    end
  end
end

class QueryOrder &amp;lt; Goliath::API
  plugin ::Plugin::Query

  def response(env)
    [200, {}, "query_orders runing"]
  end
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;在_run 中会引用另外一个 gem: A
gem A 中会有异步 http 请求&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;EM.run do
  http = EM::HttpRequest.new(url, connect_options).post(req_options)
  http.callback {......}
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;这样 gem A 就与 goliath 的周期任务冲突了，产生了 EM 的嵌套
有类似的 gem 吗？能够心跳运行，又跟 gem A 中的 EM 不冲突
求解&lt;/p&gt;

&lt;p&gt;报错是&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[:HTTP_ERROR, "connection closed by server"]
&lt;/code&gt;&lt;/pre&gt;</description>
      <author>towonzhou</author>
      <pubDate>Mon, 02 Dec 2013 00:11:24 +0800</pubDate>
      <link>https://ruby-china.org/topics/15929</link>
      <guid>https://ruby-china.org/topics/15929</guid>
    </item>
  </channel>
</rss>
