Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
@kenshin54
高级会员
第 165 位会员 / 2011-11-22

上海
22 篇帖子 / 550 条回帖
38 关注者
0 正在关注
0 收藏
GitHub Public Repos
  • popline 1059

    Popline is an HTML5 Rich-Text-Editor Toolbar

  • crane 14

    A mini linux container.

  • aws-simple-mfa 4

    Use AWS CLI with MFA enabled, but no Assume Role required.

  • firebase-admin-go 0

    Firebase Admin Go SDK

  • lilliput 0

    Resize images and animated GIFs in Go

  • gh-ost 0

    GitHub's Online Schema Migrations for MySQL

  • gifsicle 0

    Gifsicle is a suite of programs for manipulating GIF images and animations.

  • vim-snippets 0

    vim-snipmate default snippets (Previously snipmate-snippets)

  • minigc 0

    minimum gc

More on GitHub
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • [上海][2012年03月27日] Ruby Tuesday 活动公告 at 2012年03月27日

    签到

  • [上海][2012年03月27日] Ruby Tuesday 活动公告 at 2012年03月26日

    我们项目也正在用 Rails::Engine,一定去

  • Bootstrap Themes at 2012年03月20日

    不错

  • [上海][2012年03月13日] RubyTuesday 活动公告 at 2012年03月13日

    留下低调的足迹

  • 今天听了一天豆瓣 FM Café 频道 at 2012年03月12日

    豆瓣 FM 的确越往后推荐的越不好,不然就是集中在某几首歌,不然就是你不喜欢的。现在用它的 Muggy 来听。

  • rails 3.2.2 和 jquery 的 ajax 请求问题 at 2012年03月07日

    #7 楼 @quakewang 谢谢 刚刚没想到 已经全部改掉了

  • rails 3.2.2 和 jquery 的 ajax 请求问题 at 2012年03月07日

    还是检查了遍,全部加上了。

  • rails 3.2.2 和 jquery 的 ajax 请求问题 at 2012年03月07日

    #1 楼 @ywencn 不是,如果不指定 datatype 会有问题,指定成 text 是好的,现在的问题是我们已经写了好多 js 的代码,如果没有别的办法,就要把 js 全部检查一般,把 datatype 加上。

  • [Ruby Quiz] 针对代码片段,提点改进意见吧 at 2012年03月04日

    #6 楼 @race 哈哈 我写完的时候还在想,要不要写个测试,最后还是算了

  • 请教 ruby 怎么往 MySQL 里插中文 at 2012年03月04日

    #4 楼 @huacnlee 昨晚还遇到了由于 cache 引起的这个问题,本地 dev 和 production 都好的,到服务器上 dev 好的,production 就是报错,最后发现是 memcached 的缓存问题。

    这个问题我通常会在页面 render 的时候遇到,我一般这么查:

    • mysql 中通过 show variables like 'char%'; 确保是 utf8 的
    • 确保 ruby 文件加上了 # encoding: utf-8
    • 确保 Encoding.default_external,Encoding.default_internal 都是 Encoding::UTF_8
    • 如果有缓存,尝试清除缓存看看是否能解决
  • 有没有筒子觉得,Ruby 要是不用敲那么多 end,会更优美? at 2012年03月04日

    #2 楼 @nil 同意

  • [Ruby Quiz] 针对代码片段,提点改进意见吧 at 2012年03月04日
    class Terminal
      def initialize
        @total, @sequence, @products = 0, "", Hash.new(0)
      end
    
      def set_pricing(pricings)
        @pricings = pricings
      end
    
      def scan(product)
        return if @pricings[product] == nil
        @products[product] += 1
        @sequence << product
        if reach_packing?(product)
          @total += @pricings[product][:pack][:money]
          @products[product] = 0
        end
      end
    
      def result
        @products.each {|k, v| @total += @pricings[k][:each] * v}
        p "Scan these items in this order: #@sequence; Verify the total price is $#@total."
      end
    
      private
      def reach_packing?(product)
        @pricings[product][:pack] && @pricings[product][:pack][:count] == @products[product]
      end
    end
    
    terminal = Terminal.new
    terminal.set_pricing({
      "A" => {:each => 2.0, :pack => {:count => 4, :money => 7.0}},
      "B" => {:each => 12.0},
      "C" => {:each => 1.25, :pack => {:count => 6, :money => 6.0}},
      "D" => {:each => 0.15}
    })
    
    terminal.scan("A")
    terminal.scan("B")
    terminal.scan("C")
    terminal.scan("D")
    terminal.scan("A")
    terminal.scan("B")
    terminal.scan("A")
    terminal.scan("A")
    terminal.result
    

    贴个代码,虚心求教

  • [Ruby Quiz] 针对代码片段,提点改进意见吧 at 2012年03月04日

    如果是我的话,快速解决问题,不会动用那么多类,毕竟这是面试。

  • Ruby 和元编程的故事 - 第 2 回:类与模块,Ruby 的绝代双骄 at 2012年03月04日

    写的不错,赞。每次都看看副标题会有什么新意。

  • 发起一个讨论 有关 block 的用途. at 2012年03月04日

    写 helper 来包页面内容时还挺常用的,配合 capture

  • 怎么卸载用 make install 编译安装的软件 at 2012年02月29日

    你可以看看生成的 Makefile,有的里面会带 make clear,或者你在./configure 用--prefix 安装到你制定的目录

  • 图片如何批量生成缩略图和加水印的 Gem at 2012年02月28日

    直接赋值,不是赋字符串,github 上就有写啊

    u = User.new
    u.avatar = File.open('somewhere')
    u.save!
    u.avatar.url # => '/url/to/file.png'
    u.avatar.current_path # => 'path/to/file.png'
    u.avatar.identifier # => 'file.png'
    

    在 uploader 里加上 version,保存时就会生成生成缩略图

    version :thumb do
       process :resize_to_fill => [200,200]
    end
    

    水印的话,在 uploader 里加个 process,用 mini_magick 的 api 加一下就好。 google 搜一下,很多的

  • Ruby1.9 数组,哈希,枚举,集合的迭代器方法归纳与比较 at 2012年02月28日

    @messiahxu 试了啊 inject 0.098785 reduce 0.097086

  • 高兴,Ruby 元编程终于到了。 at 2012年02月28日

    我也是在当当买的,等了半个月。

  • Ruby1.9 数组,哈希,枚举,集合的迭代器方法归纳与比较 at 2012年02月28日

    这 2 个不是同一个方法么,刚刚试了下,没发现 reduce 快很多。

  • [上海][2012年02月21日] RubyTuesday 活动公告 at 2012年02月22日

    签到

  • 来看看平面版本的 Ruby China Logo at 2012年02月21日

    这个平面 logo 感觉还是很立体

  • Ruby 和元编程的故事 - 第 1 回: 色色空空,万物皆为对象 at 2012年02月21日

    好文 对 meta-programming 非常有兴趣

  • @ 自动匹配用户名功能上线 at 2012年02月03日

    cool

  • 组织大年初四去打乒乓 at 2012年01月23日

    积极响应组织号召 我来

  • "<=" "=>" 混啦混啦,有木有? at 2011年12月07日

    向左走 向右走

  • [上海][2011 年 11 月 29 日] RubyTuesday 活动 at 2011年11月29日

    签到

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