Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
李华顺
@huacnlee
Admin
NO. 2 / 2011-10-28

[email protected]
长桥证券 (Longbridge)
成都
502 Topics / 9058 Replies
959 Followers
53 Following
105 Favorites
Reward
GitHub Public Repos
  • autocorrect 1410

    A linter and formatter to help you to improve copywriting, correct spaces, words, and punctuation...

  • rails-settings-cached 1101

    Global settings for your Rails application.

  • rucaptcha 696

    Captcha Gem for Rails, which generates captcha image by Rust.

  • zed-theme-macos-classic 95

    A macOS native style theme for Zed, let it same like native app in macOS.

  • vscode-macos-classic.t... 21

    macOS Classic theme for Visual Studio Code

  • zed-extension-action 19

    GitHub Action for automatically bump Zed Extensions version after a release.

  • autocorrect-action 11

    GitHub action for use AutoCorrect as lint

  • zed-autocorrect 6

    AutoCorrect for Zed

  • gpui-workspace 4

    Dock layout UI component for GPUI, that extracted from Zed project.

  • zed-lalrpop 3

    LALRPOP parser grammar support for Zed.

More on GitHub
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • JS 判断移动端 APP 是否安装 at July 06, 2018
    <meta name="apple-itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL">
    

    https://stackoverflow.com/a/47175604/83558

    http://smartappbanners.com

  • Chrome 7 月 大限将至,广大在野站长面临艰难选择 at July 04, 2018

    Let's Encrypt 了解一下

  • Grape on Rails + Puma 线程安全性的讨论? at July 02, 2018

    这个事情今天正好又有人来邮件问我,电话 @wxianfeng 聊了一下。

    结果是后面他又分析了两周,最终发现不是 Grape 引起的,而是由其他 Gem(一个 Fork 版本的 ActiveModel::Serializer)引起的。不是 current_user 那个点的问题。

  • 注意 Rails.cache.increment 设定有效期的问题 at June 30, 2018

    🤦🏻‍♂️ 已改正

  • 请问 Rails 5 在 Windows 下面开发,页面渲染特别慢,有没有相同经历和解决办法? at June 27, 2018

    都什么年代了,为何不看看 Windows 10 的公告!!

    用 Windows Subsystem for Linux

    你将完美解决 Ruby 在 Windows 系统上运行的问题,会有一个完整的 Ubuntu 子系统安装在 Windows 10 里面。所有 Linux 上能搞的事情几乎都能在上面正常运行。同时你也不需要放弃 Windows 的使用习惯。

    就是目前 Windows 那个“终端”太弱了,难用死了。

    • Install the Windows Subsystem for Linux

  • 想系统的看一下 Rails 的源码,有什么好的阅读方式吗? at June 25, 2018

    可以先从 http://api.rubyonrails.org 看起,先简单的看部分感兴趣的功能或函数

  • RSS 订阅中出现大量垃圾帖子 at June 22, 2018

    https://ruby-china.org/topics/36992

  • 怎么防这些发广告的 at June 20, 2018

    确实是有个 Bug,每小时的发帖量没生效,已经修复了

  • 怎么防这些发广告的 at June 20, 2018

    额,有个频率限制功能的,貌似没生效,我检查看看

  • Rails Server 大量 CLOST_WAIT,进程卡死,服务器无响应 at June 15, 2018

    根源是你把 App Server 直接暴露给了客户端,这种叫 Slow Client。

    以 Unicorn 部署为例:

    你可以这么看,后端在处理完成以后需要将 Response 返回给客户端,或接受来自客户端的 Request 信息。这个过程如果 Client 的传输速度低,传输的这个过程将会堵塞住 Unicorn 的处理通道。

    这些持久性的连接会导致 Unicorn worker 会把大量的时间花在保持连接上(或者什么都没做)。这个时候如果连接多,Unicorn 就堵塞住了。然而在这个时候 Unicorn 处理能力实际上是有的,只是因为连接通道用完了。

    所以你需要在 Unicorn(包括 Puma, Passenger)前面加 Nginx 之类的来解决问题。这样才前面说到的传输过程(WAIT 阶段),可以由 Nginx 来保持连接和传输,Nginx 可以保持连接,同时又能接收其他新进来的请求,交给后面的 Unicorn 来处理。而 Unicorn <-> Nginx 之间因为局域网的原因,传输速度稳定且快,所以不存在 Slow Client 问题。

    详见 Unicorn 设计文档的 Slow Client 部分:

    https://github.com/ruby-china/unicorn/blob/master/PHILOSOPHY-zh-CN

  • 好像 Markdown 的标题解析有点问题 at June 13, 2018

    已修复

  • 命令行工具:在浏览器预览 Markdown 文档 at June 13, 2018

    这种工具,你用 Ruby 来写,反而麻烦了

  • 我们 Ruby China 什么时候能出一个 GoCN 那种的每日新闻 at June 13, 2018

    没人来做这个事情,再者其实按天没那么多新闻。

    你可以看看 Ruby Weekly

  • Unicorn 进程如何保证平滑重启? at June 12, 2018

    稍后修复

  • Rails 如何实现多态继承 at June 12, 2018

    http://api.rubyonrails.org/classes/ActiveRecord/Inheritance.html

    表结构:

    • id: int
    • type: string
    class User < ActiveRecord::Base
    end
    
    class Group < User
    end
    
    group = Group.create
    group.type
    => "Group"
    
    user = User.create
    user.type
    => "User"
    
  • 如何获取输入框控件值,放入控制器参数中,求标准语法? at June 11, 2018

    然后就是 Rails 不是万能药,别以为你用了 Rails,基础的 HTML / JavaScript 就不需要了,做这些事情的时候你该用什么用什么,别什么都依赖 Rails

  • 如何获取输入框控件值,放入控制器参数中,求标准语法? at June 11, 2018

    如果不会的话,建议使用最简单的 HTML

    <form action="/resources/search" method="GET">
      Search For: <input name="search_id" value="<%= params[:search_id] %> />
      类型: <select name="resourcetype_id">
       <option value="2" <%= "selected" if params[:resourcetype_id] == "2" %>>2</option>
     </select>
      <button type="submit">搜索</button>
    </form>
    
  • 关于 ActiveStorage 的几个问题 at June 08, 2018

    你理解有误,搜索 Context-Disposition 看看这是干嘛用的!

    用户上传的时候完全可以生成一个随机的 URL,你不需要把文件名放 URL 里面

    例如:

    https://l.ruby-china.com/photo/2016/c309db0b49cab85a32f756541ea0e2b0.png

    设定 disposition: :attachment, filename: "Foo Bar 中文.jpg",这个 URL 下载会得到 Foo Bar 中文.jpg

  • 关于 ActiveStorage 的几个问题 at June 08, 2018

    ..... 怎么这么死板,有何区别?结果都一样的

  • 关于 ActiveStorage 的几个问题 at June 08, 2018
    post.image.service_url(filename: "post-#{post.id}-#{post.created_at}")
    
  • 关于 ActiveStorage 的几个问题 at June 08, 2018

    请问怎么自定义文件名?

    ActiveStorage 的设计是上传的时候存储文件名在数据,下载(生成下载 URL)的时候指定 disposition 参数:

    attachment.file.service_url(disposition: :attachment)
    

    这样会告诉 S3 用之前数据库里面存储的文件名来实现 disposition 下载。

    也就是能达到你要的得到原始文件名的效果。

    怎样在展示上传图片时修改 url 指定自定义路径?

    https://github.com/rails/rails/blob/master/activestorage/lib/active_storage/service/s3_service.rb#L67

    Amazon S3 的实现貌似没有支持。

    我做的 Aliyun 的就做过类似事情,实际上是在 service_url 生成的时候做了小动作。

    https://github.com/huacnlee/activestorage-aliyun#use-for-image-url

    N+1 问题怎么解决?

    描述不清楚,查询的时候 includes 搞不了?

  • Unicode 可以做标识符有时候也会带来麻烦 at June 07, 2018

    中文用户的烦恼

  • [长沙] 诚聘 Ruby 精英! at June 07, 2018

    招过去当老师吗

  • 最近谁部署过 Peatio 貔貅交易所 at June 06, 2018

    部署都搞不定你还是不要碰这个项目了!

    你应该找几个专业的 Rails 工程师

  • 大家都是怎么做快速开发的?毕竟很多项目都有很多共性功能 (发帖,点赞,评论,注册登录) at June 06, 2018

    https://github.com/rails-engine

    你是想要的东西

  • Ruby 原生日志分割已经解决多进程问题? at June 01, 2018

    其实现在 Docker 化部署,以及各类其他工具的出现,这个问题似乎已经不再那么重要。

  • 网站反映慢,经常出现卡死 at May 31, 2018

    我估计是 Action Cable 你没配置对,你可以试试把那个屏蔽了

  • 网站反映慢,经常出现卡死 at May 31, 2018

    卡死是怎么个卡死?描述更细致一些

  • 5.2 生成不了项目。。。 at May 30, 2018

    Windows 10 安装 https://docs.microsoft.com/en-us/windows/wsl/install-win10

    然后在 Linux 环境下玩

  • Prev
  • 1
  • 2
  • …
  • 13
  • 14
  • 15
  • 16
  • 17
  • …
  • 264
  • 265
  • Next
关于 / RubyConf / Ruby 镜像 / RubyGems 镜像 / 活跃会员 / 组织 / API / 贡献者
由众多爱好者共同维护的 Ruby 中文社区,本站使用 Homeland 构建,并采用 Docker 部署。
服务器由 赞助 CDN 由 赞助
iOS 客户端 / Android 客户端 简体中文 / English