<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>charlie_hsieh (Charlie)</title>
    <link>https://ruby-china.org/charlie_hsieh</link>
    <description>Charlie</description>
    <language>en-us</language>
    <item>
      <title>Devise 超热门，但有可以取代的 gem 吗?</title>
      <description>&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;安全性更高，功能完整 不用东拼西凑，搞出 enterprise 安全功能。&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/janko/rodauth-rails" rel="nofollow" target="_blank"&gt;https://github.com/janko/rodauth-rails&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;一样功能完整，更接近 hey.com&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/lazaronixon/authentication-zero" rel="nofollow" target="_blank"&gt;https://github.com/lazaronixon/authentication-zero&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;上述缺点，就是，使用人数都没有 devise 多。&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;devise + authtrail + devise-security 三个 gems 才能凑出 enterprise 高资安需求。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;请问有没有其他想法或心得可以分享？&lt;/p&gt;</description>
      <author>charlie_hsieh</author>
      <pubDate>Mon, 13 Jun 2022 15:36:02 +0800</pubDate>
      <link>https://ruby-china.org/topics/42454</link>
      <guid>https://ruby-china.org/topics/42454</guid>
    </item>
    <item>
      <title>2022 Ruby on Rails Community Survey Results</title>
      <description>&lt;p&gt;又爱又恨的 devise~~&lt;/p&gt;

&lt;p&gt;&lt;a href="https://rails-hosting.com/2022/" rel="nofollow" target="_blank"&gt;https://rails-hosting.com/2022/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="https://l.ruby-china.com/photo/charlie_hsieh/eddad531-678f-443b-bd2e-a871c70e34bc.png!large" title="" alt=""&gt;&lt;/p&gt;</description>
      <author>charlie_hsieh</author>
      <pubDate>Fri, 10 Jun 2022 09:54:43 +0800</pubDate>
      <link>https://ruby-china.org/topics/42449</link>
      <guid>https://ruby-china.org/topics/42449</guid>
    </item>
    <item>
      <title>dartsass-rails or sprockets-rails... ??</title>
      <description>&lt;p&gt;请问 &lt;code&gt;dartsass-rails&lt;/code&gt;，这个该不会是要来替换掉 sprockets-rails 的吧...??&lt;/p&gt;

&lt;p&gt;&lt;img src="https://l.ruby-china.com/photo/charlie_hsieh/6b0c85bd-4e4d-4ed4-abb4-95017209a684.png!large" title="" alt="dartsass-rails"&gt;&lt;/p&gt;</description>
      <author>charlie_hsieh</author>
      <pubDate>Sat, 22 Jan 2022 15:42:44 +0800</pubDate>
      <link>https://ruby-china.org/topics/42100</link>
      <guid>https://ruby-china.org/topics/42100</guid>
    </item>
    <item>
      <title>(Zeitwerk Mode) DEPRECATION WARNING: Initialization autoloaded the constant ApplicationHelper</title>
      <description>&lt;p&gt;请问有人遇到过这个 warning  ?&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;DEPRECATION WARNING: Initialization autoloaded the constant ApplicationHelper
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;貌似 很多 code 都有受到影响。&lt;/p&gt;

&lt;p&gt;&lt;a href="https://guides.rubyonrails.org/autoloading_and_reloading_constants.html" rel="nofollow" target="_blank"&gt;https://guides.rubyonrails.org/autoloading_and_reloading_constants.html&lt;/a&gt;&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="no"&gt;In&lt;/span&gt; &lt;span class="n"&gt;order&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="nb"&gt;autoload&lt;/span&gt; &lt;span class="n"&gt;safely&lt;/span&gt; &lt;span class="n"&gt;at&lt;/span&gt; &lt;span class="n"&gt;boot&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;please&lt;/span&gt; &lt;span class="n"&gt;wrap&lt;/span&gt; &lt;span class="n"&gt;your&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;reloader&lt;/span&gt;
&lt;span class="n"&gt;callback&lt;/span&gt; &lt;span class="n"&gt;this&lt;/span&gt; &lt;span class="ss"&gt;way:

    &lt;/span&gt;&lt;span class="no"&gt;Rails&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;application&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reloader&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_prepare&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
      &lt;span class="c1"&gt;# Autoload classes and modules needed at boot time here.&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;</description>
      <author>charlie_hsieh</author>
      <pubDate>Thu, 04 Nov 2021 17:21:04 +0800</pubDate>
      <link>https://ruby-china.org/topics/41850</link>
      <guid>https://ruby-china.org/topics/41850</guid>
    </item>
    <item>
      <title>Basecamp 的招聘工资，是不是很吓人……</title>
      <description>&lt;p&gt;&lt;a href="https://apply.workable.com/basecamp/j/4F0031E0AF/" rel="nofollow" target="_blank"&gt;https://apply.workable.com/basecamp/j/4F0031E0AF/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="https://l.ruby-china.com/photo/charlie_hsieh/eb4d1c81-30c2-4947-bfad-a13f87643961.png!large" title="" alt=""&gt;&lt;/p&gt;</description>
      <author>charlie_hsieh</author>
      <pubDate>Thu, 28 Oct 2021 11:18:09 +0800</pubDate>
      <link>https://ruby-china.org/topics/41813</link>
      <guid>https://ruby-china.org/topics/41813</guid>
    </item>
    <item>
      <title>资安工具 gem: rack-attack</title>
      <description>&lt;p&gt;请问，类似 ruby-china 这样大流量的  rails site, 会使用类似这类的  gem: rack-attack 吗？&lt;/p&gt;

&lt;p&gt;还是会依赖阿里云  的 waf solution？&lt;/p&gt;</description>
      <author>charlie_hsieh</author>
      <pubDate>Sat, 23 Oct 2021 18:11:47 +0800</pubDate>
      <link>https://ruby-china.org/topics/41795</link>
      <guid>https://ruby-china.org/topics/41795</guid>
    </item>
    <item>
      <title>CSS: scroll-behavior: smooth + @hotwired/turbo</title>
      <description>&lt;p&gt;我发现
CSS: scroll-behavior: smooth
+
hotwired: turbo&lt;/p&gt;

&lt;p&gt;整个画面，都会滑来滑去，目前的 ruby-china 应该也是这样。
大家会喜欢这样的效果吗？&lt;/p&gt;

&lt;p&gt;还是其实是会眼花撩乱？&lt;/p&gt;

&lt;p&gt;我在抉择，我要不要留着  scroll-behavior:smooth 还是改回去传统 auto，不要让他滑来滑去。&lt;/p&gt;

&lt;p&gt;smooth: 滑来滑去，才有 SPA 的感觉，不会觉得换页面的网页，但是感觉会头晕。&lt;/p&gt;

&lt;p&gt;auto: 不滑来滑去，感觉比较流畅，但是，感觉就少了点 SPA 的感觉。&lt;/p&gt;

&lt;p&gt;大家觉得呢？&lt;/p&gt;</description>
      <author>charlie_hsieh</author>
      <pubDate>Sat, 23 Oct 2021 07:28:53 +0800</pubDate>
      <link>https://ruby-china.org/topics/41792</link>
      <guid>https://ruby-china.org/topics/41792</guid>
    </item>
    <item>
      <title>Stimulus 元件 分享</title>
      <description>&lt;p&gt;今天意外看到这个。觉得太便利了。试用看看&lt;/p&gt;

&lt;p&gt;&lt;a href="https://stimulus-components.netlify.app/docs/stimulus-rails-autosave/" rel="nofollow" target="_blank"&gt;https://stimulus-components.netlify.app/docs/stimulus-rails-autosave/&lt;/a&gt;&lt;/p&gt;</description>
      <author>charlie_hsieh</author>
      <pubDate>Tue, 14 Sep 2021 14:08:49 +0800</pubDate>
      <link>https://ruby-china.org/topics/41684</link>
      <guid>https://ruby-china.org/topics/41684</guid>
    </item>
    <item>
      <title>请教 Carrierwave content_type ImageMagick 问题</title>
      <description>&lt;p&gt;请问有人发现，carrierwave content_type default 是使用 filename extension 来的？
我尝试 &lt;code&gt;mv test.pdf test.jpg&lt;/code&gt;
没想到 test.jpg (pdf file) 居然可以 upload, 即使我有如下的设定&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;content_type_allowlist&lt;/span&gt;
  &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sr"&gt;/image\/(jpg|jpeg|gif|png)+/&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;原始 &lt;code&gt;carrierwave/lib/carrierwave/sanitized_file.rb&lt;/code&gt; 取得 content_type 的顺序，有点奇怪&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;content_type&lt;/span&gt;
  &lt;span class="vi"&gt;@content_type&lt;/span&gt; &lt;span class="o"&gt;||=&lt;/span&gt;
    &lt;span class="n"&gt;existing_content_type&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="n"&gt;marcel_magic_by_mime_type&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="n"&gt;marcel_magic_by_path&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;最终解法，有点丑陋.. 但至少，可以有效防止 ImgeTragick&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ImageUploader&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;CarrierWave&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Uploader&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Base&lt;/span&gt;
  &lt;span class="kp"&gt;include&lt;/span&gt; &lt;span class="no"&gt;CarrierWave&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;MiniMagick&lt;/span&gt;
  &lt;span class="n"&gt;before&lt;/span&gt; &lt;span class="ss"&gt;:process&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:check_file_type_whitelist&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;content_type_allowlist&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sr"&gt;/image\/(jpg|jpeg|gif|png)+/&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;

  &lt;span class="kp"&gt;private&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;check_file_type_whitelist&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;new_file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
       &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;unless&lt;/span&gt; &lt;span class="n"&gt;content_type_allowlist&lt;/span&gt;

      &lt;span class="n"&gt;content_type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Marcel&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;MimeType&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;for&lt;/span&gt; &lt;span class="no"&gt;Pathname&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt; &lt;span class="n"&gt;new_file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;path&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;whitelisted_content_type?&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;content_type&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="no"&gt;CarrierWave&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;IntegrityError&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;I18n&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;translate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:"errors.messages.content_type_whitelist_error"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;content_type: &lt;/span&gt;&lt;span class="n"&gt;content_type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="ss"&gt;allowed_types: &lt;/span&gt;&lt;span class="no"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;content_type_allowlist&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;", "&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="ss"&gt;default: :"errors.messages.content_type_allowlist_error"&lt;/span&gt;&lt;span class="p"&gt;)&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;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;以上不知道，我有没有哪里理解错误？&lt;/p&gt;</description>
      <author>charlie_hsieh</author>
      <pubDate>Sun, 12 Sep 2021 20:44:37 +0800</pubDate>
      <link>https://ruby-china.org/topics/41676</link>
      <guid>https://ruby-china.org/topics/41676</guid>
    </item>
    <item>
      <title>hotwire 开发者 github Commits count</title>
      <description>&lt;p&gt;刚刚试着 count contributors，发现，Sam Stephenson 贡献了大部分的 hotwire 代码。&lt;/p&gt;

&lt;p&gt;Basecamp 这样可以说是痛失英才了～～??&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;turbo (main) (14 hours ago) Ⓡ ✔
# git shortlog -s -n --no-merges | head -10
   266  Sam Stephenson
    48  Jeffrey Hardy
    47  David Heinemeier Hansson
    46  sstephenson
    43  Sean Doyle
    41  Javan Makhmali
    17  Kirill Platonov
    13  Dom Christie
     7  Nate Berkopec
     5  Sjors Baltus
&lt;/code&gt;&lt;/pre&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;stimulus (main) (5 days ago) Ⓡ ✔
# git shortlog -s -n --no-merges | head -10
   399  Sam Stephenson
   301  Javan Makhmali
    27  Adrien Poly
    21  Marco Roth
    19  dependabot[bot]
    14  David Heinemeier Hansson
     8  Matt Swanson
     4  Matthew Lindfield Seager
     3  Jeremy Daer
     2  Alex Ghiculescu
&lt;/code&gt;&lt;/pre&gt;</description>
      <author>charlie_hsieh</author>
      <pubDate>Wed, 08 Sep 2021 16:48:41 +0800</pubDate>
      <link>https://ruby-china.org/topics/41665</link>
      <guid>https://ruby-china.org/topics/41665</guid>
    </item>
    <item>
      <title>Awesome Rails Gems</title>
      <description>&lt;p&gt;请问，在这种前后端分裂的时代 (&lt;a href="https://chloerei.com/2018/01/07/front-end-split/" rel="nofollow" target="_blank"&gt;https://chloerei.com/2018/01/07/front-end-split/&lt;/a&gt;)，&lt;br&gt;
还有人在花时间探索好用的 Rails Gems (&lt;a href="https://github.com/hothero/awesome-rails-gem" rel="nofollow" target="_blank"&gt;https://github.com/hothero/awesome-rails-gem&lt;/a&gt;) 吗？&lt;br&gt;
感觉，原本的共享 Gems 优良传统，正在逐步消退，挺可惜的。 &lt;br&gt;
取而代之，各自在前后端分离世界重新打造自己的轮子。&lt;/p&gt;</description>
      <author>charlie_hsieh</author>
      <pubDate>Mon, 07 Sep 2020 10:56:55 +0800</pubDate>
      <link>https://ruby-china.org/topics/40374</link>
      <guid>https://ruby-china.org/topics/40374</guid>
    </item>
    <item>
      <title>Redmine 還是一個好工具？</title>
      <description>&lt;p&gt;請問大家，現在 
自架設一個 redmine 還是個好選擇嗎？
redmine 還是一個好工具嗎？
就 PM 或者 ticket system，大家還會推薦 redmine 嗎？還是大家都用雲服務了，redmine 純粹參考 redmine 的 coding design pattern？&lt;/p&gt;</description>
      <author>charlie_hsieh</author>
      <pubDate>Thu, 12 Dec 2019 12:31:45 +0800</pubDate>
      <link>https://ruby-china.org/topics/39322</link>
      <guid>https://ruby-china.org/topics/39322</guid>
    </item>
    <item>
      <title>Basecamp Personal: limited, but free</title>
      <description>&lt;p&gt;不知道有没有人试用过 basecamp 个人版&lt;/p&gt;

&lt;p&gt;&lt;img src="https://l.ruby-china.com/photo/2019/fe6d266f-0733-4f09-8412-88913782fb3b.png!large" title="" alt=""&gt;&lt;/p&gt;</description>
      <author>charlie_hsieh</author>
      <pubDate>Thu, 14 Nov 2019 16:28:04 +0800</pubDate>
      <link>https://ruby-china.org/topics/39251</link>
      <guid>https://ruby-china.org/topics/39251</guid>
    </item>
  </channel>
</rss>
