Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
李华顺
@huacnlee
管理员
第 2 位会员 / 2011-10-28

[email protected]
长桥证券 (Longbridge)
成都
502 篇帖子 / 9058 条回帖
959 关注者
53 正在关注
105 收藏
打赏作者
GitHub Public Repos
  • autocorrect 1412

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

  • rails-settings-cached 1104

    Global settings for your Rails application.

  • rucaptcha 697

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

  • zed-theme-macos-classic 97

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

  • vscode-macos-classic.t... 22

    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
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • 利用 Nginx 的 ngx_http_image_filter_module 做实时的图片缩略图 at 2016年11月14日

    关于 Cache-Control 和 Pragma 在这种场景的意义:

    当客户端 Request Headers 带有以上两个参数 Cache-Control: no-cache 或 Pragma: no-cache 的时候,Nginx 会直接忽略 Proxy Cache 请求原始的服务器,重新下载新的图片。

    Cache-Control 和 Pragma 的含义是相同的,区别是 Cache-Control 不支持 HTTP 1.0

    这种 Request Headers 在浏览器 强制 刷新的时候会发出。

    Request Headers:
      :authority:ruby-china-files.b0.upaiyun.com
      :method:GET
      :path:/user/avatar/2.jpg!md
      :scheme:https
      accept-encoding:gzip, deflate, sdch, br
      cache-control:no-cache
      pragma:no-cache
      ...
    
  • 站内页面禁用了 crxMouse chrome gestures 插件吗?怎么实现的? at 2016年11月11日

    你说 Ruby China?

  • ActiveRecord includes 的源码在哪里? at 2016年11月10日

    #3 楼 @liaozhong API 那个链接,后面有源代码的链接

  • ActiveRecord includes 的源码在哪里? at 2016年11月10日
    • Active Record Query Interface - Eager Loading Associations
    • ActiveRecord::QueryMethods
  • Rails 如何根据多国语言 cache 页面? at 2016年11月09日

    为支持 Fragment caching 需要覆盖 cache helper:

    module ApplicationHelper
      # Override cache helper for support multiple I18n locale
      def cache(name = {}, options = {}, &block)
        options ||= {}
        super([I18n.locale, name], options, &block)
      end
    end
    
  • Rails 中 views 里的 HTML 页面,是否可以不通过 controller 的 action 而直接互相之间跳转呢? at 2016年11月09日
    location.href
    

    Rails 不是万能的,多想想什么事情应该在什么地方做

  • Rails 如何做到每小时限制访问 60 次这种效果? at 2016年11月08日

    https://github.com/kickstarter/rack-attack

    Rack::Attack.throttle('req/ip', limit: 60, period: 1.hour) do |req|
      req.ip
    end
    
  • 如何正确阻挡有人不断尝试登入? at 2016年11月08日

    第一个问题:

    • Request and Response Behavior for Custom Origins
    • Locations and IP Address Ranges of CloudFront Edge Servers
    • https://gist.github.com/jonasbjork/2e9c32158bfb7546ee0a

    Nginx 得先得到 RealIP 并打到日志中。

    第二个,修改 Nginx access_log 的 log_format 增加 $host:

    log_format my_log '$http_x_forwarded_for - $remote_user [$time_local] "$host" "$request" '
                '$status $body_bytes_sent "$http_referer" '
                '"$http_user_agent" $request_time';
    access_log /var/log/nginx/access.log my_log;
    
  • Ruby China 2016 纪念拉链帽衫 at 2016年11月08日

    衣服品质(应该说款式和细节)不是太好,我也是才收到不久,不建议大家买 😣

  • undefined method `prepend' for RuCaptcha::Captcha:Class at 2016年11月08日

    已修复 https://github.com/huacnlee/rucaptcha/commit/ae8a30e819e003060d134753e57b9efcc19031b7

  • 貌似发现了个论坛搜索的 Bug at 2016年11月08日

    https://github.com/ruby-china/homeland/issues/786

  • undefined method `prepend' for RuCaptcha::Captcha:Class at 2016年11月07日

    下次得在 Gem 里面申明版本

  • undefined method `prepend' for RuCaptcha::Captcha:Class at 2016年11月07日

    Ruby 版本太低了

  • 如何知道调用 Ruby 的某函数会抛出哪些异常? at 2016年11月07日

    此外,像 Net::HTTP.get_response 你不需要了解到到底有哪些异常吧,你只需要处理正确的场景,异常统一打印日志就好了。

    你不需要知道异常出来是什么类型,因为返回出来的都是继承自 Exception 的类型,所以:

    除非你需要特性的处理,比如 Timeout,这个时候需要查查了

    begin
      Net::HTTP.get_response('https://ruby-china.org')
    rescue => e
      # e 是一个 Exception 类型 
      # https://ruby-doc.org/core-2.2.0/Exception.html
      puts e.message
    end
    

    另外,你可以阅读以下这篇文章:

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

  • 如何知道调用 Ruby 的某函数会抛出哪些异常? at 2016年11月07日

    一般 Ruby 的各种库 API 文档的位置都有源代码的链接或源代码附带,里面一看就知道哪个函数会有什么异常可能抛出了

  • 如何知道调用 Ruby 的某函数会抛出哪些异常? at 2016年11月07日

    Java 也没法告诉你所有的异常类型吧?例如 A -> B -> C -> D 这样基层的函数调用,D 函数要抛出的异常你没法知道吧?

  • 利用 Nginx 的 ngx_http_image_filter_module 做实时的图片缩略图 at 2016年11月07日

    其实还有一个适用场景:

    当你购买的云存储没有提供图片缩略图功能的时候,可以用这种方式搭建。

  • rails server 端口被 Puma 占用了 at 2016年11月07日
    ps aux | grep puma
    

    然后找到进程编号

    sudo kill -9 进程编号
    
  • 阿里云上装了 homeland,开发模式可以发邮件,生产环境不行。 at 2016年11月06日

    开发环境不是异步的,为了调试

    你的问题信息太少 看不出原因

  • Ruby China 2016 纪念拉链帽衫 at 2016年11月04日

    #65 楼 @jasl T 恤可以穿里面

  • 利用 Nginx 的 ngx_http_image_filter_module 做实时的图片缩略图 at 2016年11月03日

    #10 楼 @kgen 固定尺寸了的,每个尺寸都有 Cache

  • 利用 Nginx 的 ngx_http_image_filter_module 做实时的图片缩略图 at 2016年11月03日

    #4 楼 @serho 那个修好了

  • 如何给对象新增属性? at 2016年11月03日

    属性已经加成功了,只是 inspect 没有输出而已,这个不用担心

  • 想安装 Rails 5.0.0.1 结果提示需要升级 Ruby 2.2 版本以上,使用 rvm reinstall 出错了。。 at 2016年11月03日

    https://ruby-china.org/wiki/ruby-mirror

  • Web 中文字体应用指南 at 2016年11月02日

    Ruby China 最新的设置:

    body {
      font-family: Helvetica, Arial, "PingFang SC", "Noto Sans", Roboto, "Microsoft Yahei", sans-serif;
      letter-spacing: .03em;
    }
    
  • 上一页
  • 1
  • 2
  • …
  • 39
  • 40
  • 41
  • 42
  • 43
  • …
  • 264
  • 265
  • 下一页
关于 / RubyConf / Ruby 镜像 / RubyGems 镜像 / 活跃会员 / 组织 / API / 贡献者
由众多爱好者共同维护的 Ruby 中文社区,本站使用 Homeland 构建,并采用 Docker 部署。
服务器由 赞助 CDN 由 赞助
iOS 客户端 / Android 客户端 简体中文 / English