Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
Cantin
@cantin
高级会员
第 353 位会员 / 2011-12-01

广州
3 篇帖子 / 213 条回帖
1 关注者
0 正在关注
3 收藏
GitHub Public Repos
  • dotfiles 2

  • mtouch 2

  • cantin.github.com 1

    cantin's blog

  • cap_deployer 1

    cap deploy helper

  • d-render.js 1

    A lightweight hotwired-compatible lib with directive programming in HTML

  • merit 1

    Reputation system Rails engine.

  • floatThead 1

    Fixed table headers, without custom html/css

  • shu 1

    something just for practice

  • vim-closer 0

    Closes brackets

  • animegan2-pytorch 0

    PyTorch implementation of AnimeGANv2

More on GitHub
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • [小题大作微公益] 我的公益 gap year,还缺一个 rubyist 的你 at 2012年08月15日

    兼职是在北京还是说可以远程?

  • what ‘s the meaning of "try" at 2012年08月09日

    rails 的 api 中找找

  • 怎么获取如 abc.tar.gz 文件的文件名 abc at 2012年07月26日

    另一个版本

    a = %w{ .tar .gz .txt }
    def basename(file_name, arr)
      file_name = File.basename file_name
      while(true)
        name = file_name.scan(/\.\w+$/).first
        arr.include?(name) ? file_name.gsub!(name, '') : break
      end
    
      file_name
    end
    puts basename('/User/abc.tar.gz', a)
    puts basename('abc.v1.tar.gz', a)
    
  • 怎么获取如 abc.tar.gz 文件的文件名 abc at 2012年07月26日
    a = %w{ tar gz txt }
    
    def basename(file_name, arr)
      names = file_name.split('.')
      name = File.basename(names.shift)
    
      ts = names.select { |x| not arr.include? x }
      ts.empty? ? name : name + '.' + ts.join('.')
    end
    
    puts basename('abc.tar.gz', a)
    puts basename('abc.v1.tar.gz', a)
    

    代码应该可以再简洁的

  • 关于 coffescript 的诡异问题。 at 2012年07月14日

    把生成的 js 代码替换掉 coffee 的,然后看一下是否正常。 如果不正常的话应该是 js 执行的时机不对吧。

  • Screencast: ctags at 2012年06月20日

    不错不错,顶一下

  • Ruby Tuesday 很久没更新了额 at 2012年06月19日

    那小子泡妞去了,哈哈 #2 楼 @stc

  • assets 编译速度太慢 at 2012年06月15日

    #4 楼 @Zernel 我是不会告诉你我现在是不用滴

  • assets 编译速度太慢 at 2012年06月15日

    本地编译再传上去 换个更好的服务器 换个更好的 compressor

  • 如何优化,多条件判断?! at 2012年06月08日
    def parse_sales(data, field = :num, round = 0)
        total = data[:total][field].round(round) if data.has_key?(:total)
    
        sale = special_sale_tag(data, field, round) if data.has_key?(:sale)
    
        return content_tag(:a, (sale + total), rel: 'tooltip', title: "#{total} + 特买(#{sale})") if total and sale
    
        return sale if sale
    
        total
    end
    
    def special_sale_tag(data, field = :num, round = 0)
      sale = data[:sale][field].round(round)
      sale_tag = content_tag(:font, sale, style: 'color: #F89406;')
    end
    

    #2 楼 @mimosa 这样你觉得如何?有什么不妥的地方吗?

  • 第三方引入 js 后 production 下报未编译的错误 at 2012年06月07日

    guides 里面有说,jquery-rails 就是一个很好的例子,应该可以研究一下

  • 让人吐血的 Ruby `元编程' 特性. at 2012年05月25日

    还有

    #A.class_eval的current_class应该是A这个class,下面是定义实例方法
    A.class_eval { def say_hello; puts "hello"; end }
    
    #A.instance_eval的current_class应该是A的singleton_class,下面是定义类方法
    A.instance_eval { def say_hello; puts "hello"; end }
    
    #define_method是Module的方法,定义实例方法
    A.instance_eval { define_method(:say_hello) { puts "hello" } }
    A.class_eval { define_method(:say_hello) { puts "hello" } }
    
  • 有哪位大侠实现过获取 msn 或 Gmail 联系的功能? at 2012年05月23日

    这些应该是要调用到 google 或者 msn 他们的 api 吧,就像微博应用一样,如果找不到的话,只能自己去看文档咯

  • 初学者连载系列之十一:Rails 应用目录结构 at 2012年05月19日

    #1 楼 @zw963 同意,赞一个

  • 在控制器中输入中文字符会错误 at 2012年05月19日

    #4 楼 @willmouse 谢谢,还有没有关于 rails3 的编码资料呢?

  • 在控制器中输入中文字符会错误 at 2012年05月19日

    个人理解,application 里面的 utf-8 是指程序的编码,比如前台传过来的参数的编码,而在.rb 文件上面是文件的编码,告诉 ruby 使用何种编码解析该文件。 求深入,求资料·····

  • 今天遇到了一位蛮值得敬佩的应聘者 at 2012年05月19日

    支持一下,不知道几年后的自己会是怎么样的

  • 新手请教 rails 定时器问题 at 2012年05月19日

    刚看了一点东西,这些 remote_method 在 rails3 中已经被大幅度的删除 Rails 3 forces developers to have a deeper JavaScript knowledge than in the past http://www.simonecarletti.com/blog/2010/06/unobtrusive-javascript-in-rails-3/

  • 新手请教 rails 定时器问题 at 2012年05月18日

    建议看比较新的书籍,rails2 与 rails3 有很大的不同。 可参考:http://stackoverflow.com/questions/3661967/rails-3-equivalent-for-periodically-call-remote

  • 第一期 Railscasts-china live show 视频 with @huacnlee (第二期也已发布) at 2012年05月18日

    顶一个先,支持支持

  • 扯会儿淡,探讨下这个站点的设计 at 2012年05月17日

    rails 下面的 input 的 name 一般是"user[name]",而这个网站不是这样子。 个人认为是 rails 的可能性比较小吧

  • Rails 下怎么实现根据浏览器自动加载适应尺寸的图片? at 2012年05月17日

    #8 楼 @Zernel 你老板又不给我钱,小心你的楼歪了。。。哇哈哈

  • Rails 下怎么实现根据浏览器自动加载适应尺寸的图片? at 2012年05月17日

    #5 楼 @Zernel 你居然忽略我这个正确答案。。。。

  • 如何优化,多条件判断?! at 2012年05月17日

    童鞋,如果说觉得代码不好,需要重构的话,那可不可以贴出你的业务逻辑出来,而不单单是代码。 毕竟连作者都觉得代码有点累赘,我们要看的懂更要费力气啦。

  • Rails 下怎么实现根据浏览器自动加载适应尺寸的图片? at 2012年05月17日

    是根据显示器的分辨率吧。 上面那个网站应该是把分辨率记录在 cookie 里面滴

  • 还是受不了 gem open,我觉得这样就够了 at 2012年05月17日

    gem 有 open 这个命令吗? 我使用的是 bundle open,使用 janus 辅助下的 vim 打开后是 gem 的目录

  • 新手请教 Rails FTP 读取远程文件的方法 at 2012年05月17日

    童鞋,上个帖子@huacnlee 也说过啦,请把代码贴好点,就算不用 markdown 也可以有点缩进吧。

  • [广州] 第六次聚会:今天晚上 7:30! at 2012年05月17日

    #5 楼 @AlphaLiu 木有要求,只是一群爱好相同的人聚一聚而已,很轻松滴 希望下次能见到你,大家一起交流交流,哈哈

  • ruby 新手问题:请教关于 ruby 的 db:migrate at 2012年05月17日
    @goods= Good.find :conditions=>"seq=#{商品编码}"
    

    这里写错了,find 后面要加上 conditions 选项时,前面需要加上:first,:last,:all 其中之一。

    @goods= Good.find :all, :conditions=>"seq=#{商品编码}"
    

    详细的可以参考 API @sunsonavaj

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