Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
@lululau
VIP
NO. 549 / 2011-12-22

11 Topics / 183 Replies
4 Followers
5 Following
16 Favorites
GitHub Public Repos
  • dot_files 5

    My config files.

  • neogit-ai-commit.nvim 2

  • tmux-config 2

    :green_book: Example tmux configuration - screen + vim key-bindings, system stat, cpu load bar.

  • spacezsh 2

  • spacemacs 1

    Emacs advanced Kit focused on Evil: The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!

  • oh-my-zsh 1

    A community-driven framework for managing your zsh configuration. Includes 120+ optional plugins ...

  • bin 1

  • webook 0

  • macos-wechat-emacs 0

  • flowt 0

More on GitHub
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • 显示转换二进制字符串怎么用前导 0 补齐 at August 24, 2015
    "abcd123".each_byte do |byte |
    
      printf(" %08b", byte)
    
    end 
    
  • d at August 05, 2015

    终端设置里改下 option 键的映射

  • zsh_stats 查看你命令使用频率 at July 28, 2015
     1  1362  13.6214%   g
     2  929   9.29093%   cd
     3  608   6.08061%   ack
     4  525   5.25053%   cat
     5  388   3.88039%   vim
     6  343   3.43034%   echo
     7  266   2.66027%   http
     8  264   2.64026%   mm
     9  256   2.56026%   ls
    10  195   1.9502%    cp
    11  160   1.60016%   pbpaste
    12  141   1.41014%   sudo
    13  138   1.38014%   mv
    14  130   1.30013%   j
    15  127   1.27013%   perl
    16  127   1.27013%   brew
    17  119   1.19012%   open
    18  99    0.990099%  ping
    19  92    0.920092%  curl
    20  89    0.890089%  find
    
  • Ruby 中的 @ 符号在定义 method 里是什么意思? at July 09, 2015

    表示它所修饰的那个操作符是个一元操作符

  • Ruby 怎么在 汉字 和 Unicode 码之间互相转换 at June 24, 2015
    1. eval("\"\\u{#{str}}\"")

    2. '' << str.hex

    3. [str.hex].pack('U')

  • Rack 在整个 Ruby Web 系统中处于什么位置? at June 17, 2015

    我的理解:作为“Ruby Webserver Interface”来讲,Rack 是 Web 应用服务器和 Web 应用之间的一个协议,等价物应该是 CGI/Java Servlet 规范/WSGI

  • Enumerable#each (with no block given) 和 Enumerable#map (with no block given) 有什么区别 at June 12, 2015

    自己搜到答案了:

    [238] pry(main)> x = [1, 2, 3, 4]
    => [1, 2, 3, 4]
    [239] pry(main)> ea = x.each
    => #<Enumerator: ...>
    [240] pry(main)> ea.each { |e| e }
    => [1, 2, 3, 4]
    [241] pry(main)> eb = x.map
    => #<Enumerator: ...>
    [242] pry(main)> eb.each { |e| e * 2}
    => [2, 4, 6, 8]
    [243] pry(main)> ec = x.select
    => #<Enumerator: ...>
    [244] pry(main)> ec.each { |e| e == 2}
    => [2]
    [245] pry(main)> eb.each { |e| e == 2}
    => [false, true, false, false]
    

    http://blog.carbonfive.com/2012/10/02/enumerator-rubys-versatile-iterator/

  • Linux shell 问题,求解 at June 04, 2015

    用 exit builtin 或者在函数里面可以用 return

    #!/bin/bash
    
    if something is ok; then
      exit 0
    else
      exit 1 # any non-zero integer, which is less than 128
    fi
    

    如果你安装有 MySQL,可以使用命令 perror <n> 来查看通常惯用的错误代码的含义

  • Mongo BSON 注入漏洞 at June 04, 2015

    #2 楼 @zhangrentian Ruby 的 m 标识,是 DOTALL 的意思,这两个地方和 pcre 是有出入的:

    http://lululau.gitcafe.io/regexp/ruby/perl/python/2014/03/10/regular-expression-multiline-dotall-logo.html

  • Mongo BSON 注入漏洞 at June 04, 2015

    thx, patch 已打

  • Tmux + Emacs Ctrl+L 冲突 at June 03, 2015

    用 Terminal.app 在 tmux 零配置的情况下试了一下,没问题的,所以估计是你的 tmux 的配置问题

  • 一些 proc 的魔法 at June 03, 2015

    BasicObject#instance_exec

  • 新出 Ruby China 的 Markdown 使用教程 at June 02, 2015

    👍

  • [已解决]Ruby 字符串的处理方法? at May 28, 2015

    1 while str.sub!(/(\b[^;]+;)(.*)(\1)/, '\1\2')

  • 基础 Ruby 中 Include, Extend, Load, Require 的使用区别 at May 22, 2015

    被标题的 import 引进来了

  • 新手请教一个简单的 ruby 问题——字符串输出某列 at May 15, 2015
    rs.scan(/\s(\d+)\s(\d+)$/)
    
  • 请教一下.vimrc 配置问题 at April 29, 2015

    你在 shell 里 source vim 配置文件?

  • [解决] tap 为何无法修改参数呢? at April 26, 2015
    x = 1
    def succ_it(x); x+=1; end
    succ_it(x)
    p x
    
  • 新手求助,数据格式转换【已解决】 at April 14, 2015

    render :json => result

  • 新手求助,数据格式转换【已解决】 at April 14, 2015

    map { |label, data| {label: label, data: data} }

  • [已解决] 在 Pry 里面设置默认编辑器为 Sublime Text 3 失败 at April 11, 2015

    我猜你一定用了 oh-my-zsh,如果是这样的话,去掉 oh-my-zsh 的 sublime 插件,然后给 /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl 在某个 $PATH 目录下建个符号链接

    然后 Pry.editor = 'subl' 就 OK 了

  • 新主题上线 at April 05, 2015

    👍

  • 判断变量是否是数组或其它 at April 03, 2015

    Array === a

  • 当访问到特定端口的时候,启动对应的服务 at April 02, 2015

    launchd

  • File 创建新文件,如何赋予最大权限 at March 20, 2015

    File.umask

  • 请教懂 Python 和 Ruby 高手,关于整数转换成网络上可以传输的 byte 流的(已解决) at March 10, 2015

    你就给转成一个字节,还考虑什么字节序啊

  • SSH 跳板主机如何配置(也许叫法不对) at February 16, 2015

    #2 楼 @xu_xiang_yang 把跳板机的公钥放到目标机器上不就行了。如果你希望针对不同用户不同目标机器做不同的登陆权限控制,估计 ssh 实现不了,你需要的是一个 ssh 登陆权限的管理系统

  • SSH 跳板主机如何配置(也许叫法不对) at February 16, 2015

    只见过不希望将私钥上传到 B 上的需求,那么可以用 ssh -A。LZ 的需求没见过,为什么不喜欢上传公钥到 C 上?

  • Rails 如何正则匹配全角字符? at February 10, 2015

    “匹配全角字符的正则怎么写”这个问题的本质就是“什么是全角字符”,让提需求的给出所谓“全角字符”的定义,相应的正则表达式自然也就出来了

  • Rails 如何正则匹配全角字符? at February 10, 2015

    str =~ /【/ 这样?

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