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
  • 鸟枪换炮,4K 显示器到手 at May 11, 2015

    这个能支持 MacBook 的 Retina 显示不?

  • 首页全是招聘。。。 at May 11, 2015

    屏蔽招聘节点就可以了

  • 感觉 Ruby 只是在 Web 方面应用的比较多 at May 11, 2015

    你说那些 Python 的领域你会搞么?所以别想了,没意义。

  • 出 HHKB pro2 - Type-S 一个 at May 08, 2015

    好纠结,一个 MacBook Pro Retina 就够了

  • 处女座问题:本地究竟该用 127.0.0.1 还是 0.0.0.0 还是 localhost 还是 0,想得睡不着觉了 at May 08, 2015

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

  • Grunt 前端自动化构建工具 [方便懒得看英文文档的新同学] at May 07, 2015

    好复杂的配置文件...

  • 关于 Fragment Caching at May 06, 2015

    开发环境得需要 config/environments/development.rb 里面启用 perform_caching 才能让 Fragment Caching 启动的。

    config/environments/development.rb

    config.action_controller.perform_caching = true
    
  • RailsConf 2015 视频 720p at May 05, 2015

    其实可以传到优酷的

  • 类似 “按照最新发布文章时间排序的用户列表” 的优雅的实现方法 at May 04, 2015

    参见 Ruby China 的 Topic model 的 last_active_mark 字段:https://github.com/ruby-china/ruby-china/blob/be74a05c48150cb2dd8d87df15154e0c1b384706/app/models/topic.rb#L32

    原理

    下面是 Mongoid 的源代码示例,ActveRecord 自行脑补

    class User
      field :last_post_at, type: Integer
    
      index :last_post_at
    
      scope :last_actived, -> { order("last_post_at desc") }
    
      def touch_last_active
        self.update_attribute(:last_post_at, Time.now.to_i)
      end
    
    end
    
    class Post
      belongs_to :user
    
      after_create do
        self.user.touch_last_active if self.user
      end
    end
    
    class UsersController
      def activities
        @users = User.last_actived.limit(50)
      end
    end
    
  • Mongoid 中的 callback 陷阱 at May 04, 2015

    callback 关联的函数,如果返回了 false,保存都是会失败的,这个在 ActiveRecord 里面也是这样的。 所以你应该确保 callback 相关的函数不会返回 false(别忘了 Ruby 默认最后行的值是作为返回值的)


    另外今年的 RubyConf 也有讲过这个事情 Better Callbacks in Rails 5

    还给 Rails 提交了新的 callback 处理错误的实现:rails/rails#17227

    Current

    before_save do
      return false if foo != bar
    end
    

    Rails 5 will be

    before_save do
      throw :abort if foo != bar
    end
    
  • time_select 显示 time_zone 问题 at May 04, 2015

    第一个没明白你的意思,好绕,说实际场景,为何要那么做

    第二个:MySQL 用 TIMESTAMP 作为日期字段的类型, TIMESTAMP 保存的时候,MySQL 会转换成 UTC 来存储:

    MySQL converts TIMESTAMP values from the current time zone to UTC for storage, and back from UTC to the current time zone for retrieval. (This does not occur for other types such as DATETIME.)

  • InfluxDB + Grafana 快速搭建自己的 NewRelic,分析应用运行情况 at May 02, 2015

    #53 楼 @jasontang168 得在 Grafana 上面写查询语句

  • Ruby 中的函数式编程 at April 30, 2015

    代码可以着色

  • Visual Studio Code for Mac, Linux 来了 at April 30, 2015

    Mac OS X 下面如果要想在 Termal 里面实现像 TextMate -> mate, Sublime Text -> subl 那样的命令,可以这样:

    在 ~/.bash_profile 里面增加

    code () {
        if [[ $# = 0 ]]
        then
            open -a "Visual Studio Code"
        else
            [[ $1 = /* ]] && F="$1" || F="$PWD/${1#./}"
            open -a "Visual Studio Code" --args "$F"
        fi
    }
    

    然后就可以在 Termal 下面执行 code 命令来启动 Visual Studio Code 来打开文件了 比如:

    $ cd ruby-china
    $ code .
    

    Linux 参见:https://code.visualstudio.com/Docs/setup

  • Visual Studio Code for Mac, Linux 来了 at April 30, 2015

    已实际用过了,写 Ruby 还是可以的,其实这也就是算 Editor,不是 IDE

  • 新主题上线 at April 30, 2015

    #86 楼 @kyoyk 我也就用了事件绑定的功能

  • Ruby 中 load 文件的原理是什么? at April 30, 2015

    执行字符串的 Ruby 源代码啊

  • Visual Studio Code for Mac, Linux 来了 at April 30, 2015

    基于 Atom 实现

  • Ruby 中 load 文件的原理是什么? at April 30, 2015

    简单来说

    require 'foo' =

    eval(File.read('foo'))
    
  • Prev
  • 1
  • 2
  • …
  • 86
  • 87
  • 88
  • 89
  • 90
  • …
  • 264
  • 265
  • Next
关于 / RubyConf / Ruby 镜像 / RubyGems 镜像 / 活跃会员 / 组织 / API / 贡献者
由众多爱好者共同维护的 Ruby 中文社区,本站使用 Homeland 构建,并采用 Docker 部署。
服务器由 赞助 CDN 由 赞助
iOS 客户端 / Android 客户端 简体中文 / English