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

huacnlee@gmail.com
长桥证券 (Longbridge)
成都
502 Topics / 9058 Replies
959 Followers
53 Following
105 Favorites
Reward
GitHub Public Repos
  • autocorrect 1402

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

  • rails-settings-cached 1100

    Global settings for your Rails application.

  • rucaptcha 695

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

  • zed-theme-macos-classic 94

    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-gradient 5

    Generate a Gradient like CSS

  • gpui-workspace 4

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

More on GitHub
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • Ruby China 要有小弟妹啦 at March 30, 2015

    #11 楼 @zlfera

    Go 基本上许多工作都要重头开始实现,确实非常快,开发过程,执行过程都是很快,这个让人感觉特别舒服,如丝般顺滑。

    但是由于语言特性的限制,很多 Ruby 里面的实现方式都得放弃,用一些土方法搞,到目前为止依然没找到好的方式,感觉代码结构很挫,别扭。

    Mediom 这个项目可以作为 Rails 工程师跨入 Go 的门槛,里面有很多 Rails 以及 Ruby 的实现方案

  • Ruby China 要有小弟妹啦 at March 30, 2015

    #14 楼 @lips

    cd $GOPATH/src
    git clone https://github.com/huacnlee/mediom.git
    cd github.com/huacnlee/mediom
    go get
    go get github.com/revel/cmd/revel
    revel run github.com/huacnlee/mediom
    
  • Ruby China 要有小弟妹啦 at March 30, 2015

    #16 楼 @yukihiro_matz Go 不需要包管理,自带的 go get 命令能自动检测到代码里面依赖的三方库,自动下载,编译

  • Ruby China 要有小弟妹啦 at March 30, 2015

    演示地址: http://115.29.238.54/

  • Ruby China 要有小弟妹啦 at March 30, 2015

    顺便贴了个图

  • Ruby China 要有小弟妹啦 at March 29, 2015

    😄 功能还差得远

  • Ruby 有没有类似 Python 中 ImageFilter 的 gem 包 at March 23, 2015

    mini_magick

  • 发布一个 Gem —— ActiveService,给 Rails 添加一个 Service 层 at March 22, 2015

    用来做什么?

  • 使用 Unicorn 的 ROR 项目,提供文件下载的问题 at March 18, 2015

    文件的问题,交给 Nginx 处理

  • [杭州] 阿里巴巴招两名 Ruby 工程师 at March 16, 2015

    面试都是先电话聊的

  • 我部署了 rubychina 的源码,发现访问时有报错,是哪里弄错了吗? at March 15, 2015

    因为 Ruby China 的代码是给 Ruby China 用的,后面的一些功能直接写死的

  • 关于阅读 / 查看 「动态语言」源代码,这个问题怎么解决? at March 14, 2015

    调用一下就知道了,再说,一般文档都有写的

  • Google Code 今日起将逐步关停服务 at March 13, 2015

    好多年没用过了,早该关了

  • [已解决] review 代码的要点是什么? at March 12, 2015
    • 是否存在性能问题
    • 异常捕捉是否足够
    • 是否存在安全漏洞
    • 是否存在优化空间
    • 代码是否足够简洁
    • 是否有足够抽象度
  • 慎用 mongoid_auto_increment_id 这个 Gem at March 10, 2015

    已经根据你的需求实现了,请用 0.7.0 版本

    gem 'mongoid_auto_increment_id', '0.7.0'
    

    然后配置

    # cache_store 建议放在 MemoryStore 里面,避免其他缓存区域的 Write Lock
    # 但 MemoryStore 带来的问题是进程之间无法共享,最终会导致 ID 不再是有序的了,无法用于排序
    # 另外, 重启进程 Cache 丢了没关系,实现是先在 MongoDB 里面把一定的长度占用了,再缓存的,也就是丢弃了一批编号而已
    Mongoid::AutoIncrementId.cache_store = ActiveSupport::Cache::MemoryStore.new
    Mongoid::AutoIncrementId.seq_cache_size = 500
    
  • 慎用 mongoid_auto_increment_id 这个 Gem at March 10, 2015

    mongoid_auto_increment_id 是根据 MongoDB 官方的这篇文章来实现的《Create an Auto-Incrementing Sequence Field》,起初的设计目的是为了要一个简洁的主键,便于应用到 URL 里面,使 URL 更加简洁、优雅

    目的:

    1. 简化 ID,以便在 URL 里面使用
    2. 便于用来排序
    3. 便于维护(比如在后台查某些数据,纯数字要比 ObjectId 简单许多)
    4. 利于后期迁移到其他类型的库

    其实类似的做法,在我们公司的 MySQL 也有,由于数据量大,我们需要将大量数据划分在多个库,多个表里面,由此带来的问题是 MySQL 的自增编号就无法使用了。

    类似的自行维护的方案就不得不用起来


    你需要多大的吞度量?


    其实有很简单方法来减少自增表的 Write 动作,提高吞吐量的,就是让 generate_id 改成支持批量生成,一次生成 100 - 1000 个,根据实际需求调整,放在内存里面,后面的调用都是内存里面 Array 的 shift 动作,用完了再调用数据库,重新占用一批

    也可以配合 Rails.cache 用来存储生产出来的 ID 以便多进程、多机器之间共享

  • has_many through 的 uniq 设定 at March 09, 2015

    #8 楼 @redemption

    类似的问题还在 find_or_create_by

    Please note this method is not atomic, it runs first a SELECT, and if there are no results an INSERT is attempted. If there are other threads or processes there is a race condition between both calls and it could be the case that you end up with two similar records.

    http://api.rubyonrails.org/classes/ActiveRecord/Relation.html#method-i-find_or_create_by

    Using this validation method in conjunction with ActiveRecord::Validations#save does not guarantee the absence of duplicate record insertions, because uniqueness checks on the application level are inherently prone to race conditions.

    http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#method-i-validates_uniqueness_of

  • has_many through 的 uniq 设定 at March 09, 2015

    应该要数据库增加唯一索引,光靠 ActiveRecord 的 validation 在并发出现的时候,会不靠谱的

  • Puma 源代码分析 - 集群模式 at March 09, 2015

    了解 Ruby App Server 的机制,可以看《Unicorn Unix Magic Tricks》简单易懂

  • 如何禁用 Rack Cache 呢? at March 06, 2015

    middleware delete 就好了

  • 利用 GFW 屏蔽网站 at March 06, 2015

    那是你自己访问不了

  • 用 rvm 安装 ruby 出错 at March 05, 2015
    sudo yum install -y patch libyaml-devel autoconf patch readline-devel libffi-devel openssl-devel automake libtool bison sqlite-devel
    

    手动调用这个试试

  • Rails MySQL 添加 ‘utf8mb4' 字符集错误 at March 05, 2015

    Rails 不用设置编码的 只需要 MySQL 修改好就行了

  • Ruby 如何调用 net/ftp 接口实现查看 FTP 服务器上的文件列表 at March 05, 2015

    用 Linux 跑一下先,避免遇到 Windows 的问题

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