<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>jun1st (feng qijun)</title>
    <link>https://ruby-china.org/jun1st</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>Ruby Hash Cheatsheet</title>
      <description>&lt;p&gt;&lt;img src="https://l.ruby-china.com/photo/2016/d791d59809b092615f917dc9d1aae911.png" title="" alt=""&gt;&lt;/p&gt;</description>
      <author>jun1st</author>
      <pubDate>Sun, 03 Jul 2016 23:46:03 +0800</pubDate>
      <link>https://ruby-china.org/topics/30437</link>
      <guid>https://ruby-china.org/topics/30437</guid>
    </item>
    <item>
      <title>Turbolinks-iOS 来了</title>
      <description>&lt;p&gt;之前 &lt;a href="https://ruby-china.org/topics/29127" title=""&gt;Turbolinks-Android&lt;/a&gt; 放出来了，现在 iOS 的版本也来了，&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/turbolinks/turbolinks-ios" rel="nofollow" target="_blank"&gt;https://github.com/turbolinks/turbolinks-ios&lt;/a&gt;&lt;/p&gt;</description>
      <author>jun1st</author>
      <pubDate>Thu, 10 Mar 2016 10:40:48 +0800</pubDate>
      <link>https://ruby-china.org/topics/29254</link>
      <guid>https://ruby-china.org/topics/29254</guid>
    </item>
    <item>
      <title>Ruby 将引入 ".?"  Safe navigation operator </title>
      <description>&lt;p&gt;Matz 已经同意了引入 ".?" 作为 Safe navigation operator&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;u&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;User&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;profile&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;thumbnails&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;profiles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;thumbnails&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;large&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;将可以简化为：&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt;&lt;span class="n"&gt;profile&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt;&lt;span class="n"&gt;thumbnails&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt;&lt;span class="n"&gt;large&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;省了好多敲击 LOL&lt;/p&gt;

&lt;p&gt;&lt;a href="https://bugs.ruby-lang.org/issues/11537?utm_source=rubyweekly&amp;amp;utm_medium=email" rel="nofollow" target="_blank"&gt;https://bugs.ruby-lang.org/issues/11537?utm_source=rubyweekly&amp;amp;utm_medium=email&lt;/a&gt;&lt;/p&gt;</description>
      <author>jun1st</author>
      <pubDate>Fri, 23 Oct 2015 09:44:02 +0800</pubDate>
      <link>https://ruby-china.org/topics/27784</link>
      <guid>https://ruby-china.org/topics/27784</guid>
    </item>
    <item>
      <title>[上海 - 静安] NeoNan 招聘 Rails / 前端 工程师</title>
      <description>&lt;p&gt;各位牛人好！我们的公司是牛男网，一个专注帮助男人在健康，职场，情场都成为牛 X 的男人的线上男性杂志，一个男性垂直网站。&lt;/p&gt;

&lt;p&gt;我们的口号是&lt;strong&gt;“成为更好的男人”&lt;/strong&gt;。目前是完成种子轮，开始 A 轮当中，公司人数在 10 人以下的快速成长公司。如果你热爱创业跟创业型办公团队，如果你热爱追求生活上各种进步以及协助他人也达到这个目的，你讨厌日常工作，而是相信你在完成一个有意义的使命，让这世界更好！相信你也会热爱这个公司的。当然，如果你热爱模特美女的话，也会更爱我们的公司的。我们专注融合优质用户体验，社交生态，以及原创视频，为 80 后，90 后男人，提供一个值得信任，伴你成长的大哥。我们公司在上海，但不在意远程办公，年龄，只要你有实力以及付出你最宝贵的时间，我们就期待你的加入一起奋战。#中国男人配得上中国女人#&lt;/p&gt;

&lt;p&gt;什么是牛男？：&lt;a href="http://v.youku.com/v_show/id_XODIyMTA5MTM2.html?qq-pf-to=pcqq.c2c" rel="nofollow" target="_blank"&gt;http://v.youku.com/v_show/id_XODIyMTA5MTM2.html?qq-pf-to=pcqq.c2c&lt;/a&gt;
小小的福利&amp;lt;3：&lt;a href="http://v.youku.com/v_show/id_XODIyMTA5NTAw.html?qq-pf-to=pcqq.c2c" rel="nofollow" target="_blank"&gt;http://v.youku.com/v_show/id_XODIyMTA5NTAw.html?qq-pf-to=pcqq.c2c&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;以上都有加密码，密码是 neonan，是只有给大家的福利哦：）&lt;/p&gt;

&lt;p&gt;前端工程师职位描述：&lt;/p&gt;

&lt;p&gt;希望您具备：
 - 1 年以上 Web 前端开发经验 - 熟悉 Web 开发流程 - 熟练掌握 HTML5, CSS3 开发技术
 - 熟练掌握 Javascript 开发技术
 - Web 标准的基本知识&lt;/p&gt;

&lt;p&gt;有以下相关经验将优先考虑：
 - 了解 photoshop 或 Sketch 基本操作 &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;熟练使用 JQuery 或 Coffeescript
 - 熟练使用 Git 进行版本控制
 - 熟悉 Mac 开发环境
 - Ruby 基础&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ruby on Rails 工程师职位描述：&lt;/p&gt;

&lt;p&gt;希望您具备：
   - 扎实的 Ruby 开发技能 &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;熟悉 Ruby on Rails 开发流程，1 年以上 ROR 开发经验
 - 系统化的计算机工程学分析思考的能力&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;有以下相关经验将优先考虑：
   - 熟悉除 Ruby on Rails 外的其它 Ruby 框架 (如：Sinatra 等) &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;熟悉 Postgresql、MongoDB、Redis &lt;/li&gt;
&lt;li&gt;熟练使用 JQuery 或 Coffeescript &lt;/li&gt;
&lt;li&gt;熟练使用 Git 进行版本控制
 - 熟悉 Mac/Linux 开发环境
 - 熟悉 API 的设计与实现&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;薪资 6k+ 看实力协商&lt;/p&gt;

&lt;p&gt;有兴趣找我，我就是创始人
qq：1460499896 或是 contact@neonan.com &lt;/p&gt;</description>
      <author>jun1st</author>
      <pubDate>Sat, 08 Nov 2014 21:50:36 +0800</pubDate>
      <link>https://ruby-china.org/topics/22561</link>
      <guid>https://ruby-china.org/topics/22561</guid>
    </item>
    <item>
      <title>Rails 4.1.2 Eager Load Doesn't Kill N+1 Query</title>
      <description>&lt;p&gt;原帖地址： &lt;a href="http://stackoverflow.com/questions/25938111/rails-4-1-2-eager-load-doesnt-kill-n1-query#comment40607271_25938111" rel="nofollow" target="_blank"&gt;http://stackoverflow.com/questions/25938111/rails-4-1-2-eager-load-doesnt-kill-n1-query#comment40607271_25938111&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Rails: 4.1.2, Ruby: 2.1.1&lt;/p&gt;

&lt;p&gt;I have an &lt;code&gt;Article&lt;/code&gt; class, which is &lt;code&gt;commentable&lt;/code&gt; and &lt;code&gt;has_many :comments&lt;/code&gt;&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;module&lt;/span&gt; &lt;span class="nn"&gt;Commentable&lt;/span&gt;
   &lt;span class="kp"&gt;extend&lt;/span&gt; &lt;span class="no"&gt;ActiveSupport&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Concern&lt;/span&gt;

   &lt;span class="n"&gt;included&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
     &lt;span class="n"&gt;has_many&lt;/span&gt; &lt;span class="ss"&gt;:comments&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:as&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="ss"&gt;:commentable&lt;/span&gt;
   &lt;span class="k"&gt;end&lt;/span&gt;
 &lt;span class="k"&gt;end&lt;/span&gt;

 &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Comment&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;ActiveRecord&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Base&lt;/span&gt;

   &lt;span class="n"&gt;belongs_to&lt;/span&gt; &lt;span class="ss"&gt;:commentable&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:polymorphic&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kp"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:touch&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kp"&gt;true&lt;/span&gt;
   &lt;span class="n"&gt;belongs_to&lt;/span&gt; &lt;span class="ss"&gt;:user&lt;/span&gt;

   &lt;span class="c1"&gt;#other codes....&lt;/span&gt;
 &lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;when display the article, I'd like to load all releated information&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="vi"&gt;@item&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Article&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:tags&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="ss"&gt;:comments&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="ss"&gt;:user&lt;/span&gt;&lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;id: &lt;/span&gt;&lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:id&lt;/span&gt;&lt;span class="p"&gt;]).&lt;/span&gt;&lt;span class="nf"&gt;first&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and it does preload tags and comments object.&lt;/p&gt;

&lt;p&gt;but when I render &lt;code&gt;comments&lt;/code&gt;, the comments object and user objects get loaded again.&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;render&lt;/span&gt; &lt;span class="vi"&gt;@item.comments&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;from log:&lt;/p&gt;

&lt;p&gt;![development log][1]&lt;/p&gt;

&lt;p&gt;[1]: &lt;a href="http://i.stack.imgur.com/LH98X.png" rel="nofollow" target="_blank"&gt;http://i.stack.imgur.com/LH98X.png&lt;/a&gt;&lt;/p&gt;</description>
      <author>jun1st</author>
      <pubDate>Sat, 20 Sep 2014 23:45:29 +0800</pubDate>
      <link>https://ruby-china.org/topics/21640</link>
      <guid>https://ruby-china.org/topics/21640</guid>
    </item>
    <item>
      <title>从 MySQL 迁移到 PostgreSQL，谁有经验分享一下？</title>
      <description>&lt;p&gt;想要把 Rails App 从 MySQL 迁移到 Postgresql，各位有什么经验可以分享一下吗？&lt;/p&gt;</description>
      <author>jun1st</author>
      <pubDate>Mon, 21 Jul 2014 23:45:31 +0800</pubDate>
      <link>https://ruby-china.org/topics/20616</link>
      <guid>https://ruby-china.org/topics/20616</guid>
    </item>
    <item>
      <title>Rails Console Tips</title>
      <description>&lt;h4 id="清理Console"&gt;清理 Console&lt;/h4&gt;
&lt;p&gt;当输出满屏时，想清理一下，在 bash 里可以用 clear，在 rails console 里，可以用&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id="重新加载rails环境"&gt;重新加载 rails 环境&lt;/h4&gt;
&lt;p&gt;console 环境不会自动加载修改后的文件，怎么办？退出重启？不需要！执行&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;reload!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id="搜索历史纪录"&gt;搜索历史纪录&lt;/h4&gt;
&lt;p&gt;执行的 command 太多，往上可以用 uparrow, 往下可以用 downarrow。但是当执行的命令太多时，上下翻历史记录耗费的时间，比直接输入来的更多。其实 console 有搜索功能，Ctrl+R&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="n"&gt;pry&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;reload!&lt;/span&gt;
&lt;span class="no"&gt;Reloading&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kp"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;reverse&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;search&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="sb"&gt;`r': reload!
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;输入 r 出来 reload! .  第一个匹配的记录&lt;/p&gt;
&lt;h4 id="Tab补全"&gt;Tab 补全&lt;/h4&gt;
&lt;p&gt;tab 补全，属性 bash 的应该对这个都不陌生。&lt;/p&gt;
&lt;h4 id="上一个命名的结果"&gt;上一个命名的结果&lt;/h4&gt;
&lt;p&gt;执行完一条命令&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt;&amp;gt;Article.first
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;但其实你还想对这个返回的 article 对象继续操作。再执行一遍？&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;article&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Article&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;first&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;NO！你可以用&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;article&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;"_"保存着上一条命令返回的结果&lt;/p&gt;
&lt;h4 id="发起HttpRequest"&gt;发起 HttpRequest&lt;/h4&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt; &lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="err"&gt;“&lt;/span&gt;
&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt; &lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;orders&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;
&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;302&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id="Rails沙盒"&gt;Rails 沙盒&lt;/h4&gt;
&lt;p&gt;console 可以已沙盒的模式运行，&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;rails&lt;/span&gt; &lt;span class="n"&gt;console&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;sandbox&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="no"&gt;User&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;destroy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;exit&lt;/span&gt;
     &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="n"&gt;ms&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;rollback&lt;/span&gt; &lt;span class="n"&gt;transaction&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id="Rails环境"&gt;Rails 环境&lt;/h4&gt;
&lt;p&gt;想要 test 环境的 console，除了&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="no"&gt;RAILS_ENV&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;test&lt;/span&gt; &lt;span class="n"&gt;rails&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;更简单的是&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;rails&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;</description>
      <author>jun1st</author>
      <pubDate>Sat, 07 Jun 2014 14:49:44 +0800</pubDate>
      <link>https://ruby-china.org/topics/19806</link>
      <guid>https://ruby-china.org/topics/19806</guid>
    </item>
    <item>
      <title>Is TDD Dead? Join Martin Fowler, Kent Beck and DHH at Google+</title>
      <description>&lt;p&gt;Join us next week for part two w/@martinfowler, &lt;a href="/kentbeck" class="user-mention" title="@kentbeck"&gt;&lt;i&gt;@&lt;/i&gt;kentbeck&lt;/a&gt;&amp;amp;@dhh. Follow us here or &lt;a href="/thoughtworks" class="user-mention" title="@thoughtworks"&gt;&lt;i&gt;@&lt;/i&gt;thoughtworks&lt;/a&gt; for the next invite link. #IsTDDDead&lt;/p&gt;

&lt;p&gt;Google+: &lt;a href="https://plus.google.com/events/ci2g23mk0lh9too9bgbp3rbut0k" rel="nofollow" target="_blank"&gt;https://plus.google.com/events/ci2g23mk0lh9too9bgbp3rbut0k&lt;/a&gt;&lt;/p&gt;</description>
      <author>jun1st</author>
      <pubDate>Sat, 10 May 2014 13:53:29 +0800</pubDate>
      <link>https://ruby-china.org/topics/19150</link>
      <guid>https://ruby-china.org/topics/19150</guid>
    </item>
    <item>
      <title>有人对这个 Macbook Shelf 有兴趣吗？</title>
      <description>&lt;p&gt;超级喜欢这样的笔记本垫和显示器基座
&lt;img src="//l.ruby-china.com/photo/2014/dd2e410bcf7097b78b23cdc1419098ef.jpg" title="" alt="stand 图1"&gt;
&lt;img src="//l.ruby-china.com/photo/2014/651f9a7e0ddf081a24801643d4afe846.jpg" title="" alt="stand 图2"&gt;
&lt;img src="//l.ruby-china.com/photo/2014/4f4f2f425d9dc9c69b3df76886ccd4b6.jpg" title="" alt="shelf 1"&gt;
&lt;img src="//l.ruby-china.com/photo/2014/6cf54e776b858b8ae23d505fb47faefa.jpg" title="" alt="shelf 2"&gt;&lt;/p&gt;

&lt;p&gt;由 nodic appeals 设计，并且售价 130 美刀，&lt;/p&gt;

&lt;p&gt;贵了点，想自己找人定制，不知道有没有有兴趣的？&lt;/p&gt;</description>
      <author>jun1st</author>
      <pubDate>Thu, 03 Apr 2014 22:10:07 +0800</pubDate>
      <link>https://ruby-china.org/topics/18381</link>
      <guid>https://ruby-china.org/topics/18381</guid>
    </item>
    <item>
      <title>image_tag ('', ....) 的问题</title>
      <description>&lt;p&gt;今天碰到了这个问题 &lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;image_tag('')
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;传入一个空 path，在 production 环境下会报错"isn't compiled"&lt;/p&gt;

&lt;p&gt;这个问题在 github rails 上也存在三年多了，貌似只在 4.0 中被修复了
&lt;a href="https://github.com/rails/rails/issues/3080" rel="nofollow" target="_blank"&gt;https://github.com/rails/rails/issues/3080&lt;/a&gt;&lt;/p&gt;</description>
      <author>jun1st</author>
      <pubDate>Fri, 21 Mar 2014 15:56:26 +0800</pubDate>
      <link>https://ruby-china.org/topics/18070</link>
      <guid>https://ruby-china.org/topics/18070</guid>
    </item>
    <item>
      <title>capistrano 3 部署时出现警告，</title>
      <description>&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[a4e2341c] Running /usr/bin/env [ ! -d ~/.rbenv/versions/2.1.0 ] on xxx.xxx.xxx
[a4e2341c] Command: [ ! -d ~/.rbenv/versions/2.1.0 ]
[a4e2341c] Finished in 6.761 seconds with exit status 1 (failed).
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;这个什么意思？是说目录不存在吗？但是这个目录是存在的，&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Running ~/.rbenv/bin/rbenv exec bundle exec rake tmp:cache:clear on www.neonan.com
Command: cd /home/ben/staging/releases/20140305160352 &amp;amp;&amp;amp; ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.0 ~/.rbenv/bin/rbenv exec bundle exec rake tmp:cache:clear )

fatal: Not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;这个什么情况？&lt;/p&gt;</description>
      <author>jun1st</author>
      <pubDate>Thu, 06 Mar 2014 00:16:16 +0800</pubDate>
      <link>https://ruby-china.org/topics/17685</link>
      <guid>https://ruby-china.org/topics/17685</guid>
    </item>
    <item>
      <title>Github 开发的心编辑器 Atom 邀请码</title>
      <description>&lt;p&gt;现在 Atom 还没有公开开放，还处于邀请机制&lt;/p&gt;

&lt;p&gt;刚刚从推特上搞到个邀请码，现在有三个邀请码，想要尝鲜的留下邮箱，&lt;/p&gt;

&lt;p&gt;&lt;img src="//l.ruby-china.com/photo/2014/864c1bc0f10fe6071b553f2a2828f6fb.png" title="" alt=""&gt;&lt;/p&gt;

&lt;p&gt;只有三个&lt;/p&gt;</description>
      <author>jun1st</author>
      <pubDate>Thu, 27 Feb 2014 13:28:44 +0800</pubDate>
      <link>https://ruby-china.org/topics/17529</link>
      <guid>https://ruby-china.org/topics/17529</guid>
    </item>
    <item>
      <title>Ruby 的 object_id 和 Fixnum</title>
      <description>&lt;p&gt;在做 Koan 的&lt;a href="!http://rubykoans.com" title=""&gt;Learn Ruby&lt;/a&gt;的时候，碰到一个挺有意思的练习，&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;test_small_integers_have_fixed_ids&lt;/span&gt;
  &lt;span class="n"&gt;assert_equal&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object_id&lt;/span&gt;
  &lt;span class="n"&gt;assert_equal&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object_id&lt;/span&gt;
  &lt;span class="n"&gt;assert_equal&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object_id&lt;/span&gt;
  &lt;span class="n"&gt;assert_equal&lt;/span&gt; &lt;span class="mi"&gt;201&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object_id&lt;/span&gt;

  &lt;span class="c1"&gt;# THINK ABOUT IT:&lt;/span&gt;
  &lt;span class="c1"&gt;# What pattern do the object IDs for small integers follow?&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;根据这增长的逻辑，可以猜测出来这个 object_id = value * 2 + 1, 但是猜测是不可靠的，还是了解其为什么是这样的才行。&lt;/p&gt;

&lt;p&gt;显示在 stackoverflow 上看到这个&lt;a href="http://stackoverflow.com/questions/3430280/ruby-how-does-object-id-assignment-work" rel="nofollow" target="_blank" title=""&gt;这篇文章&lt;/a&gt;, &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;in MRI the object_id of an object is the same as the VALUE that represents the object on the C level. For most kinds of objects this VALUE is a pointer to a location in memory where the actual object data is stored. Obviously this will be different during multiple runs because it only depends on where the system decided to allocate the memory, not on any property of the object itself.&lt;/p&gt;

&lt;p&gt;However for performance reasons true, false, nil and Fixnums are handled specially. For these objects there isn't actually a struct with the object's data in memory. All of the object's data is encoded in the VALUE itself. As you already figured out the values for false, true, nil and any Fixnum i, are 0, 2, 4 and i*2+1 respectively.&lt;/p&gt;

&lt;p&gt;The reason that this works is that on any systems that MRI runs on, 0, 2, 4 and i*2+1 are never valid addresses for an object on the heap, so there's no overlap with pointers to object data.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;这个可以算是“然”，继续搜索“所以然”&lt;/p&gt;

&lt;p&gt;然后就搜索到了这篇文章，&lt;a href="http://www.oreillynet.com/ruby/blog/2006/01/the_ruby_value_1.html" rel="nofollow" target="_blank" title=""&gt;The Ruby VALUE&lt;/a&gt;. VALUE 就相当于 C 当中的指针，他的值等于对象在内存中的地址，但是对于 true, false, nil 和 Fixnum, 出于性能的考虑用的是不同的算法。&lt;/p&gt;

&lt;p&gt;内存地址是以 4 bytes 为单位的（64 位机器上 8 bytes）,因此，如果当前地址是 0x0000F000, 那下一个地址就是 0x0000F004, 二进制表示低八位就是 00000000 和 00000100，最低的两位永远会是&lt;strong&gt;0&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ruby 利用了这个特性，它保留了最低的 1 位，然后用剩下的 31 位 (63 位) 存储 Fixnum, 其中一位作为符号位，在我的机器上&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;irb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&lt;span class="mo"&gt;001&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="mi"&gt;62&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;class&lt;/span&gt;
&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="no"&gt;Bignum&lt;/span&gt;
&lt;span class="n"&gt;irb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&lt;span class="mo"&gt;002&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="mi"&gt;62&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;class&lt;/span&gt;
&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="no"&gt;Fixnum&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;这下可以解释为什么 object_id = value * 2 + 1 了。以 5 为例，5 的 object_id 是 11，它的二进制表示是 0x0101(仅表示最低的四个 bits)，由于 ruby 保留了最低的一位，因此它对应的 VALUE 值是 0x01011(省略了前面的一堆 0)，0x01011 就是 11。&lt;/p&gt;

&lt;p&gt;知道它是为什么，感觉特别好。&lt;/p&gt;</description>
      <author>jun1st</author>
      <pubDate>Sat, 16 Nov 2013 13:25:29 +0800</pubDate>
      <link>https://ruby-china.org/topics/15581</link>
      <guid>https://ruby-china.org/topics/15581</guid>
    </item>
    <item>
      <title>Joel 大叔非常 Insightful 的评论</title>
      <description>&lt;blockquote&gt;
&lt;p&gt;The only business models I want to work on any more have some mass-market component that is absolutely    free, and a niche companion product that makes money off of the exhaust fumes of the mass-market component.
The last two businesses I started are Stack Overflow, which is free, where the careers business on the side makes money on the small fraction of Stack Overflow users who are looking to get better jobs, and Trello, which is free, but the business of providing administrative tools to large organizations using Trello can sustain the whole business.
This is more than just "freemium" or "advertising-supported." Freemium and Ad-supported business models are special cases of this general model. The real insight is that the free product has a chance to reach an enormous audience which provides distribution/advertising/marketing making it trivial to go to market with your paid product.
What Marco is reporting here is that the old-fashioned "make something and get people to pay for it" business is much harder to pull off and likely to always be left in the dust by someone making the same thing for free, getting 100x the user base, and getting 1% of them to pay for some value added feature.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;来自：&lt;a href="https://news.ycombinator.com/item?id=6462737" rel="nofollow" target="_blank"&gt;https://news.ycombinator.com/item?id=6462737&lt;/a&gt;&lt;/p&gt;</description>
      <author>jun1st</author>
      <pubDate>Sun, 29 Sep 2013 23:34:19 +0800</pubDate>
      <link>https://ruby-china.org/topics/14480</link>
      <guid>https://ruby-china.org/topics/14480</guid>
    </item>
  </channel>
</rss>
