Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
Zheng Piaodan
@zhengpd
Member
NO. 21370 / 2015-09-30

自由职业
Guangdong
8 Topics / 157 Replies
12 Followers
0 Following
2 Favorites
GitHub Public Repos
  • cape 0

    🦸cape.el - Completion At Point Extensions

  • modus-themes.nvim 0

    Highly accessible themes for Neovim, conforming with the highest standard for color contrast betw...

  • zenbones.nvim 0

    🪨 A collection of contrast-based Vim/Neovim colorschemes

  • toggleterm.nvim 0

    A neovim lua plugin to help easily manage multiple terminal windows

  • nvim-lspconfig 0

    Quickstart configs for Nvim LSP

  • bamboo.nvim 0

    Warm Green Theme for Neovim and Beyond

  • trim.nvim 0

    This plugin trims trailing whitespace and lines.

  • Gogh 0

    Gogh is a collection of color schemes for various terminal emulators, including Gnome Terminal, P...

  • monokai-pro.nvim 0

    Monokai Pro theme for Neovim written in Lua, with multiple filters: Pro, Classic, Machine, Octago...

  • per-directory-history 0

    Per directory history for zsh, as well as global history, and the ability to toggle between them ...

More on GitHub
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • [北京] 墨刀 2020 前后端招聘 [15 - 30k] at May 12, 2020

    有远程吗

  • Ruby 和 Python 中对中文的处理 at May 12, 2020

    2.7.1 多了两个逗号

    space: a string that is put after, a : or , delimiter (default: '')

    https://ruby-doc.org/stdlib-2.7.1/libdoc/json/rdoc/JSON.html#method-i-generate

  • Ruby 和 Python 中对中文的处理 at May 12, 2020

    刚醒悟过来你们说的可能是 kv 与 kv 间隔的逗号而不是数组里的逗号。

    space 选项不知道是文档没写好还是代码没写好,我看了下 ruby 逻辑,目前是只对 : 生效的。

    https://github.com/ruby/ruby/blob/ruby_2_5/ext/json/generator/generator.c#L923

    看 github 代码 state->space 只是 append 到 object_delim2 (:),没有 append 到 object_delim (,) 和 array_delim (,) 。

  • Ruby 和 Python 中对中文的处理 at May 12, 2020

    ruby 确实没有提供选项可以把 [1,2,3] => [1, 2, 3],有个 array_nl 不过会在方括号内侧也加上空格:

    irb(main):004:0> JSON.generate({ "key": [1, 2, 3] }, ascii_only: true, space: ' ')
    "{\"key\": [1,2,3]}"
    irb(main):005:0> JSON.generate({ "key": [1, 2, 3] }, ascii_only: true, space: ' ', array_nl: ' ')
    "{\"key\": [ 1, 2, 3 ]}"
    

    这样与 python 结果还是不一样。

    gsub(',', ', ') 是个简单可行的办法,前提是不考虑对内容本身自带 , 的影响。

  • 求两层循环之间跳转语句的简化 at May 12, 2020
    list1.each do |a|
      next if list2.any?{ |b| a.include?(b) }
      # 后续操作
    end
    
  • Ruby 和 Python 中对中文的处理 at May 12, 2020

    @Rei 的方法可以

    irb(main):032:0> Digest::SHA256.hexdigest JSON.generate({ "key": '爱你' }, ascii_only: true, space: ' ')
    "981727d14419aedca58b2e719b4a9ff94cf20ef91e02c9cd22e7ee6f5744f630"
    
  • 请问如何生成形如 “V2UJY1FlBzdTbVI9” 这样的字符串来作为主键? at April 18, 2020
    loop do
      key = generate_unique_key
      break key if db_not_exists?(key)
    end
    

    简单粗暴

  • 公司电脑不给上外网,我这样下载会不会被发现 at April 18, 2020

    通常渠道不是申请后经同意才安装么?

  • 请问如何给官方提建议?期待 Ruby 更加美好 at April 18, 2020

    有想法可以在 ruby issues 提交 proposal https://bugs.ruby-lang.org/issues

  • - at April 13, 2020

    开源中国不是在深圳吗?

  • gems.ruby-china.com 挂了 at April 13, 2020

    清华的可能是基于 gem mirror 的全量镜像 https://github.com/tuna/issues/issues/41

  • Draw ERD online at April 13, 2020

    xmind 就是一个典型的脑图工具,简单好用,macos 用 xmind zen/2020 版本纵享丝滑。对于新项目设计 model 结构还是很方便的。对于历史项目导入 sql 结构这部分倒是没有研究过。另外 xmind 不支持团队协作编辑。

    drawerd 对标的更像是 https://processon.com 。

    setapp 是个好东西,可惜只有 xmind 8,没有 xmind zen。setapp 如果用到其中五个以上应用一般都值回订阅费用了。https://setapp.com/apps

  • 书籍出售 at March 22, 2020

    建议多抓鱼回收,省事。回收价格一般在定价的一两折,以及有些书不收。

  • Demystify Ruby Class Variables Lookup at March 20, 2020

    概括起来其实就三点 (ST = Bar.singleton_class):

    • Bar extend Foo 把 Foo 放在了 Bar.singleton_class.ancestors 里
    • ST.class_variables 在 2.6 遍历 ST 和 ST.ancestors
    • ST.class_variables 在 2.7 遍历 Bar 和 Bar.ancestors
  • 类 extend module 后,类变量的查询问题 at March 19, 2020

    Ruby 2.7.0 修改了 A.singleton_class.class_variables 的逻辑。我针对类变量查找做了些研究,总结较长,单独发了一个帖子在 https://ruby-china.org/topics/39628

  • Python 学习初级编程实例(一) at March 17, 2020

    源码没排版好。缩进错乱的 Python 代码是没有生命的。

  • 搜索结果与实际链接不相符 at March 11, 2020

    试了下单独搜索“服”或“务”字皆可重现

  • gem 安装好后,如何导出给另一相同环境但没有网络的系统使用? at March 05, 2020

    试试在有网络的环境上使用 rbenv gem install 完,然后把整个 ~/.rbenv 目录复制过去。我自己没这样处理过,不知道 build native extension 的 gem 会不会有问题。

    最好的方法当然是接上网络。

  • [深圳][15k-35k] 欢迎各位热爱技术的小伙伴们加入我们团队~ at March 03, 2020

    排版不兼容,可能用了带自定义语法的 markdown 编辑器

  • [Remote] Looking for experienced remote Web/App engineers at February 25, 2020

    @jonathanforley97 No offence, but how do you get to do site advertisting at here?

  • 关于 docker 的问题 at February 24, 2020

    没留意到是 buster,你把 printf 那行的 stretch 全部替换成 buster 试试

  • 关于 docker 的问题 at February 24, 2020

    试试在 apt-get update 前修改为国内的 debian mirror:

    RUN cp /etc/apt/sources.list /etc/apt/sources.list.backup
    RUN printf "deb http://mirrors.aliyun.com/debian stretch main \ndeb http://mirrors.aliyun.com/debian stretch-updates main \ndeb http://mirrors.aliyun.com/debian-security stretch/updates main\n" | cat - /etc/apt/sources.list.backup > /etc/apt/sources.list
    

    以上代码未在 docker 测试,仅供参考思路

  • 在数组的循环内删除数组元素的问题? at February 23, 2020

    在 names.each 内原位移除 names 元素 X 会导致下一个元素 Y 位置发生前移而导致元素 Y 被跳过,ruby 对这种场景不会提示错误。

    例一里 王八 被 reject! 后,王九 成了 x[0] ,李大 成了 x[1],所以 王八 之后的下次循环处理的是 李大 ,王九 被保留下来。

    例二里看起来正确是因为 delete 2 后跳过了 3 刚好又处理到 4,所以 2 和 4 都被删除了。如果用 [1, 2, 4, 3, 5] 测试,结果会是 [1,4,3,5] 。

    一个可行的写法是 illegit_surnames = ['王', '李']; names.reject! { |x| illegit_surnames.include?(x[0]) }

  • Rails 数据库相关问题 at February 19, 2020

    PG 获取一年的开始可以用 date_trunc('year', now()),应该是没有 date 函数。

    线上环境跟开发环境最好用同样的数据库,避免掉类似的兼容性问题

  • 求网站的搜索功能 at February 16, 2020

    这个站内搜索基于 Elasticsearch 做的。参考 PR: https://github.com/ruby-china/homeland/pull/531/files

  • 有远程 Ruby 岗位招人不 at February 11, 2020

    汉语或者英语都没问题,两种语言都有过远程协作经验

  • 求推荐!!!Rails 环境下 ElasticSearch 搜索引擎使用 elasticsearch-rails 还是 chewy。 at February 09, 2020

    searchkick 集成和使用比较简单

  • 如何将锁定 rails 版本的项目降级 at February 03, 2020

    把 Gemfile 里的 rails 改成 5.2,然后 bundle update rails,应该会出错,根据出错信息再修改相关 gem 的版本,继续 bundle update,继续修改,如此继续……

    看了下 sqlserver gem 的 6-0-dev 分支是 draft 状态,也好几个月没更新了,不知道是不是可用的代码

  • 有远程 Ruby 岗位招人不 at February 03, 2020

    目前想找有中国成员的团队

  • 有远程 Ruby 岗位招人不 at February 02, 2020

    谢谢,已投。

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