Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
Larry Zhao
@larryzhao
高级会员
第 2408 位会员 / 2012-06-04

[email protected]
简书 www.jianshu.com
上海
23 篇帖子 / 390 条回帖
15 关注者
7 正在关注
29 收藏
GitHub Public Repos
  • taxon-idea-plugin 1

  • goex 1

  • plannic 0

  • v2up 0

  • glossagator 0

  • goterm 0

    Advanced terminal output in Go

  • mockery 0

    A mock code autogenerator for Golang

  • testify 0

    A toolkit with common assertions and mocks that plays nicely with the standard library

  • vite-plugin-copy-manifest 0

    a vite plugin to copy manifest json file to destination.

  • factory-go 0

    A library for setting up Golang objects inspired by factory_bot.

More on GitHub
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • 在 linode tokyo 做微博登陆 at 2012年08月23日

    @quakewang 求教

    $ mtr --report api.weibo.com HOST: vienna Loss% Snt Last Avg Best Wrst StDev 1.|-- 106.187.33.2 0.0% 10 5.7 4.1 0.4 22.7 7.1 2.|-- 124.215.199.121 0.0% 10 1.6 5.6 0.5 13.3 4.6 3.|-- 59.128.4.121 0.0% 10 1.6 1.7 1.6 2.7 0.3 4.|-- tr-ote124.kddnet.ad.jp 0.0% 10 2.0 2.1 1.8 2.2 0.1 5.|-- 118.155.194.178 0.0% 10 182.1 171.3 160.0 182.1 6.1 6.|-- 202.97.33.6 0.0% 10 184.5 171.8 162.7 184.5 6.5 7.|-- 202.97.35.97 0.0% 10 183.1 172.8 161.7 183.1 6.1 8.|-- 202.97.33.9 0.0% 10 184.8 173.4 166.2 184.8 6.2 9.|-- 202.97.34.133 0.0% 10 221.8 199.5 191.8 221.8 9.1 10.|-- 180.149.128.26 0.0% 10 204.5 201.3 189.4 212.3 7.9 11.|-- 180.149.128.46 0.0% 10 205.5 199.0 191.2 211.0 6.2 12.|-- 180.149.129.10 10.0% 10 208.6 196.4 190.5 208.6 5.2 13.|-- 180.149.135.230 10.0% 10 205.1 195.8 188.0 205.1 4.9

  • Capistrano - Bundler::GemNotFound: Could not find rake-0.9.2.2 in any of the sources at 2012年07月02日

    此问题已经解决,具体请看我 blog: http://larryzhao.com/blog/bundler-gemnotfound-deploying-with-capistrano-and-rvm-to-a-jruby-enviroment/, 或是这个 github issue: https://github.com/wayneeseguin/rvm-capistrano/issues/20

  • Capistrano - Bundler::GemNotFound: Could not find rake-0.9.2.2 in any of the sources at 2012年06月28日

    #1 楼 @HungYuHei 都用到了,我之前信息可能给的不够,现在编辑了,信息都在主贴的 gist 里

  • 请教:ruby 如何截取 140 个字,中英文逗号啥的都有 at 2012年06月07日

    回完发现@Rei 之前已经提到了,spammer 了..

  • 请教:ruby 如何截取 140 个字,中英文逗号啥的都有 at 2012年06月07日

    我觉得楼主可以查看一下twitter-text-rb这个项目https://github.com/twitter/twitter-text-rb

    之前用到过一下,里面 twitter 计算混合字符长度是用ActiveSupport::Multibyte::Chars来做的,

    项目之余简单做了一下实验,不知道如下是不是可以帮助到楼主 (ActiveSupport::Multibyte::Chars这个类的 truncate 自动添加了...):

    jruby-1.6.7 :019 > text1 = "\u6c34some??\u6d52\u4f20"
     => "水some??浒传" 
    jruby-1.6.7 :020 > text2 = ActiveSupport::Multibyte::Chars.new(text1).normalize(:c)
     => #<ActiveSupport::Multibyte::Chars:0x458176ff @wrapped_string="水some??浒传"> 
    jruby-1.6.7 :021 > text2.length
     => 9 
    jruby-1.6.7 :022 > text2.truncate(5)
     => #<ActiveSupport::Multibyte::Chars:0x4717e412 @wrapped_string="水s..."> 
    

    可以看到中英混在一起可以正确的计算出长度,然后按照你给出的长度进行截取后会自动补全...,还是挺方便的吧

  • Code 2 Themes 页面,很帅气 at 2012年06月07日

    一直在 subl 的怀抱中

  • 是否应该开个新手专区呢?近来新手问题似乎越来越多了 at 2012年06月07日

    相当支持@Rei 和@fsword 的说法。

  • mongoid 3 应该怎样切换数据库连接? at 2012年06月05日

    @rubyonme 那看来可以猜出来哪个是你了~

  • 是不是可以在 iPad 上搭建 Rails? at 2012年06月04日

    Rails 倒是不必了,一直希望可以有个 local 的 irb, 在外面可以玩玩...穷人版只有 wifi..

  • mongoid 3 应该怎样切换数据库连接? at 2012年06月04日

    我自己还没有用过,不过通过最近 mongoid 邮件组里,Durran 回答别人的邮件可以大致看出来应该怎么做:

    You need to define a session for each one you want in your mongoid.yml, and then you can tell the models which session to persist to or at runtime you can change it.
    
    The basics are here:
    
    http://mongoid.org/en/mongoid/docs/persistence.html#custom
    
    A session represents your connection to the server (or servers in the case of a replica set). If you want to change the session at runtime you use with #with method:
    
    Model.with(session: "main").create
    
    If you want a model to always persist to a specific session use .store_in:
    
    class Model
      include Mongoid::Document
      store_in session: "secondary"
    end
    
    

    但是根据他后续的邮件,疑似这个还有些问题。你可以注册 mongoid 邮件组来关注进展。

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