Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
Neo-J
@neo
Member
NO. 7915 / 2013-07-04

[email protected]
11 Topics / 40 Replies
1 Followers
0 Following
3 Favorites
No GitHub.
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • Ruby + GTK 3 实现经典小游戏,坦克大战 at June 17, 2017

    看到这个帖子不禁让我联想到

    这是一个与时代脱节的手艺人 (不会使用 git) 纯靠着自己的手艺 (ruby) 雕刻出一件精美的艺术品 (坦克大战)

    这才是程序员应该保有的匠心精神啊!!👍

  • [新手指南] Ruby 的 Block 以及 Proc.new 与 Lambda 的区别 at April 20, 2015

    如果我没记错的话 block:匿名代码块 Proc:可复用代码块 lambda:匿名方法

  • 毕业设计选题,求指教 at December 19, 2013

    #10 楼 @wangping 不清楚呀,所以还在纠结,做个简单的爬虫什么的肯定是不行的。。。

  • 毕业设计选题,求指教 at December 19, 2013

    #8 楼 @wangping 也在纠结中,还没定,明天去找导师商量,但是导师是搞网络方面的,不懂 ruby,我在想是不是可以用 ruby 做些网络方面的什么东西,还在查阅资料,不过毕竟自己没把握,还是应用开发把握大一点。。。

  • 毕业设计选题,求指教 at December 19, 2013

    #6 楼 @wangping 和楼主一样的情况,最近也在忙着论文开题,也想做 rails 相关的东西

  • Jekyll • 简单的静态博客网站 [中文站] at November 18, 2013

    之前翻译了一些,最近忙了,没怎么看,帮顶👍

  • 用 Ruby Koans 学习 Ruby,其中一道题,到 stackoverflow 上一看,高下立判啊! at November 18, 2013

    #57 楼 @Kabie 恩,是这样。但是如果是我来写这个三角形类的话我会另外写个方法来判断是否是直角,而不是写在这里面,这样应该更方便重用。

  • 用 Ruby Koans 学习 Ruby,其中一道题,到 stackoverflow 上一看,高下立判啊! at November 18, 2013

    #55 楼 @rasefon 是这样,后面要对数组做好几次遍历,但是这么小的数据量本来就无所谓,语法糖的使用反而能让代码看起来更赏心悦目。

  • 用 Ruby Koans 学习 Ruby,其中一道题,到 stackoverflow 上一看,高下立判啊! at November 17, 2013

    #53 楼 @zsxywz0928 饿。。。没看懂你是怎么个醍醐灌顶的= =

  • 并行赋值的使用场景 at November 14, 2013

    最简单的,变量值互换

    a,b = b,a
    
  • 松本行弘的新书《关于 mRuby 的一切》 at November 13, 2013

    👍

  • 用 Ruby Koans 学习 Ruby,其中一道题,到 stackoverflow 上一看,高下立判啊! at November 13, 2013

    #43 楼 @xds2000 要不要那么高端= =

  • 用 Ruby Koans 学习 Ruby,其中一道题,到 stackoverflow 上一看,高下立判啊! at November 12, 2013

    #29 楼 @luikore ORZ

  • 用 Ruby Koans 学习 Ruby,其中一道题,到 stackoverflow 上一看,高下立判啊! at November 12, 2013

    #26 楼 @datty258 那是得多蛋疼= =

  • 用 Ruby Koans 学习 Ruby,其中一道题,到 stackoverflow 上一看,高下立判啊! at November 12, 2013

    #19 楼 @reus 你要说算法复杂度那就另算了,我本来就不是来说算法的,请不要钻牛角尖

  • 用 Ruby Koans 学习 Ruby,其中一道题,到 stackoverflow 上一看,高下立判啊! at November 12, 2013

    #16 楼 @reus 好吧,每个人感觉不一样,至少我看到这一大堆操作符的消失感觉很爽

  • 用 Ruby Koans 学习 Ruby,其中一道题,到 stackoverflow 上一看,高下立判啊! at November 12, 2013

    #15 楼 @bhuztez 好冷。。。 😓

  • 用 Ruby Koans 学习 Ruby,其中一道题,到 stackoverflow 上一看,高下立判啊! at November 12, 2013

    #7 楼 @Teddy #12 楼 @wcp1231 我也感觉最后一行没问题,而且我主要就是看到了这一行概括了那么多行所以才感到牛逼,你只要稍微有点编程基础应该都没有可读性问题。

  • 用 Ruby Koans 学习 Ruby,其中一道题,到 stackoverflow 上一看,高下立判啊! at November 12, 2013

    #9 楼 @quakewang 好像 ruby 的代码风格不推荐三目运算符嵌套三目的吧?

  • [已解决] rails 编译 css,js 为空,一个奇怪的问题大家遇到过吗? at October 24, 2013

    不行的话就用 nginx 来管理静态文件

  • [日本] 宣传下我现在就职的公司:日本 COOKPAD at October 15, 2013

    楼上同问!

  • production 模式下怎样才能连接到 /public 下的文件? at September 03, 2013

    第一行 user 改成自己试试?

  • 右下角 go_top 按钮无法显示的问题 at August 29, 2013

    #3 楼 @reyesyang 我尝试着在首页加了一个轮播特效,但是在非登陆的情况下,无法显示轮播特效,只有普通图片切换,但是登陆后一切正常。。。要疯掉了。。。

  • 右下角 go_top 按钮无法显示的问题 at August 29, 2013

    #3 楼 @reyesyang 我不是说现在的 ruby-china,我是拿开源代码去学习的,但是碰到了这个问题

  • 右下角 go_top 按钮无法显示的问题 at August 29, 2013

    #1 楼 @reyesyang 不是,我试过把页面弄到需要滚轮的长度了

  • unexpected INDENT 错误求破 at August 23, 2013

    #9 楼 @huacnlee 原来的写法编译的时候没有问题啊?版本的问题?

    # 绑定 @ 回复功能
      atReplyable : (el, logins) ->
        return if logins.length == 0
        $(el).atWho "@"
          data : logins
          tpl : "<li data-value='${login}'>${login} <small>${name}</small></li>"
    
  • unexpected INDENT 错误求破 at August 23, 2013

    #6 楼 @x290431695 哇,厉害!!!谢谢~~~是原来的缩进有问题么?

  • unexpected INDENT 错误求破 at August 23, 2013

    #4 楼 @x290431695

    #= require jquery
    #= require jquery_ujs
    #= require bootstrap-transition
    #= require bootstrap-alert
    #= require bootstrap-modal
    #= require bootstrap-dropdown
    #= require bootstrap-tab
    #= require bootstrap-tooltip
    #= require bootstrap-button
    #= require bootstrap-carousel 
    #= require will_paginate
    #= require jquery.timeago
    #= require jquery.timeago.settings
    #= require jquery.hotkeys
    #= require jquery.chosen
    #= require jquery.autogrow-textarea
    #= require jquery.html5-fileupload
    #= require social-share-button
    #= require jquery.atwho
    #= require emoji_list
    #= require faye
    #= require notifier
    #= require sisyphus
    #= require_self
    window.App =
      notifier : null,
    
      loading : () ->
        console.log "loading..."
    
      fixUrlDash : (url) ->
        url.replace(/\/\//g,"/").replace(/:\//,"://")
    
      # 警告信息显示, to 显示在那个dom前(可以用 css selector)
      alert : (msg,to) ->
        $(".alert").remove()
        $(to).before("<div class='alert'><a class='close' href='#' data-dismiss='alert'>X</a>#{msg}</div>")
    
      # 成功信息显示, to 显示在那个dom前(可以用 css selector)
      notice : (msg,to) ->
        $(".alert").remove()
        $(to).before("<div class='alert alert-success'><a class='close' data-dismiss='alert' href='#'>X</a>#{msg}</div>")
    
      openUrl : (url) ->
        window.open(url)
    
      # Use this method to redirect so that it can be stubbed in test
      gotoUrl: (url) ->
        window.location = url
    
      likeable : (el) ->
        $el = $(el)
        likeable_type = $el.data("type")
        likeable_id = $el.data("id")
        likes_count = parseInt($el.data("count"))
        if $el.data("state") != "liked"
          $.ajax
            url : "/likes"
            type : "POST"
            data :
              type : likeable_type
              id : likeable_id
    
          likes_count += 1
          $el.data('count', likes_count)
          App.likeableAsLiked(el)
        else
          $.ajax
            url : "/likes/#{likeable_id}"
            type : "DELETE"
            data :
              type : likeable_type
          if likes_count > 0
            likes_count -= 1
          $el.data("state","").data('count', likes_count).attr("title", "喜欢")
          if likes_count == 0
            $('span',el).text("喜欢")
          else
            $('span',el).text("#{likes_count}人喜欢")
          $("i.icon",el).attr("class","icon small_like")
        false
    
      likeableAsLiked : (el) ->
        likes_count = $(el).data("count")
        $(el).data("state","liked").attr("title", "取消喜欢")
        $('span',el).text("#{likes_count}人喜欢")
        $("i.icon",el).attr("class","icon small_liked")
    
      # 绑定 @ 回复功能
      atReplyable : (el, logins) ->
        return if logins.length == 0
        $(el).atWho "@"
          data : logins
          tpl : "<li data-value='${login}'>${login} <small>${name}</small></li>"
    
      initForDesktopView : () ->
        return if typeof(app_mobile) != "undefined"
        $("a[rel=twipsy]").tooltip()
    
        # CommentAble @ 回复功能
        commenters = App.scanLogins($(".cell_comments .comment .info .name a"))
        commenters = ({login: k, name: v} for k, v of commenters)
        App.atReplyable(".cell_comments_new textarea", commenters)
    
      # scan logins in jQuery collection and returns as a object,
      # which key is login, and value is the name.
      scanLogins: (query) ->
        result = {}
        for e in query
          $e = $(e)
          result[$e.text()] = $e.attr('data-name')
    
        result
    
      initNotificationSubscribe : () ->
        faye = new Faye.Client(FAYE_SERVER_URL)
        notification_subscription = faye.subscribe "/notifications_count/#{CURRENT_USER_ACCESS_TOKEN}",(json) ->
          span = $("#user_notifications_count span")
          new_title = $(document).attr("title").replace(/\(\d+\) /,'')
          if json.count > 0
            span.addClass("badge-error")
            new_title = "(#{json.count}) #{new_title}"
            url = App.fixUrlDash("#{ROOT_URL}#{json.content_path}")
            console.log url
            $.notifier.notify("",json.title,json.content,url)
          else
            span.removeClass("badge-error")
          span.text(json.count)
          $(document).attr("title", new_title)
        true  
    
    $(document).ready ->
      App.initForDesktopView()
    
      $("abbr.timeago").timeago()
      $(".alert").alert()
      $('.dropdown-toggle').dropdown()
    
      App.initNotificationSubscribe() if FAYE_SERVER_URL?
    
      $('form.new_topic,form.new_reply,form.new_note,form.new_page').sisyphus
        timeout : 2
        excludeFields : $('input[name=utf8], input[name=_method], input[name=authenticity_token]')
      $('form a.reset').click ->
        $.sisyphus().manuallyReleaseData()
    
    
      # 绑定评论框 Ctrl+Enter 提交事件
      $(".cell_comments_new textarea").bind "keydown","ctrl+return",(el) ->
        if $(el.target).val().trim().length > 0
          $(el.target).parent().parent().submit()
        return false
    
      # Choose 样式
      $("select").chosen()
    
      # Go Top
      $("a.go_top").click () ->
        $('html, body').animate({ scrollTop: 0 },300);
        return false
    
      $(window).bind 'scroll resize', ->
        scroll_from_top = $(window).scrollTop()
        if scroll_from_top >= 1
          $("a.go_top").show()
        else
          $("a.go_top").hide()
    
  • 1
  • 2
  • Next
关于 / RubyConf / Ruby 镜像 / RubyGems 镜像 / 活跃会员 / 组织 / API / 贡献者
由众多爱好者共同维护的 Ruby 中文社区,本站使用 Homeland 构建,并采用 Docker 部署。
服务器由 赞助 CDN 由 赞助
iOS 客户端 / Android 客户端 简体中文 / English