Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
Jianqiu Xiao
@swordray
会员
第 6291 位会员 / 2013-03-23

北京
24 篇帖子 / 557 条回帖
22 关注者
3 正在关注
0 收藏
打赏作者
GitHub Public Repos
  • ruby-china-ios 159

    Ruby China app for iOS

  • ispinner 54

    Pure CSS spinner like iOS UIActivityIndicatorView

  • modular_migration 39

    Rails migration files generate into corresponding modular directories

  • JXWebViewController 29

    An iOS view controller wrapper for WKWebView

  • v2ex-ios 28

    An Unofficial V2EX iOS App

  • JXGradientNavigationBar 18

    Custom UINavigationBar subclass with gradient colors on iOS.

  • JXReviewController 16

    Request rating by 1-5 stars.

  • v2ex-android 15

    A V2EX Android App.

  • rails-cache_control 10

    Autotomicly add HTTP Cache-control header when caches_action expires_in specified

  • sass-lint-webpack 8

    Sass-lint plugin for Webpack 4+

More on GitHub
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • 写了个 ruby-china 的 go 版本的 api 库 at 2015年01月21日

    静态语言处理 JSON 就是很麻烦

  • [北京][猎头] Yottaa 招聘 Senior Engineer-Ruby on Rails 1 名 at 2015年01月14日

    Yotta 技术不错

  • 和为定值的随机数 at 2015年01月12日

    #14 楼 @bluexuemei 判断一下剩下的数的取值范围不会导致和超过 80,这样的话就可以一次性取成功,复杂度为 O(1)。至于不平均的问题倾斜一下概率就好了,不会增加复杂度。

  • 和为定值的随机数 at 2015年01月03日
    a = []; 10.times { |i| a << rand([4, 80 - a.sum - (10 - 1 - i) * 13].max..[13, 80 - a.sum - (10 - 1 - i) * 4].min) }
    

    注意一下随机数不要超过范围就行了

  • 多个 Rails 项目,共用一个库,一般怎么操作 at 2014年12月28日

    合并成一个项目吧

  • 如何权衡 DRY 与可读性 at 2014年12月24日

    可以结合一下

    module ApiHelper
      %w(get post put patch delete).each do |method|
        define_method "api_#{method}" do
          request_send method
        end
      end
    
      def request_send(method)
        # dosometing
      end
    end
    
    
  • 平均分配问题 at 2014年12月21日
    [x + 1] * (y % x) + [x] * (y / x - y % x)
    
  • Rails 4.2 正式版已发布 at 2014年12月20日

    Bravo!

  • 什么浏览器可以关闭 Origin 检查呢? at 2014年12月19日

    nginx

    add_header Access-Control-Allow-Origin *;
    
  • 想用 Rails 独立建博客吗? 试试 WBlog 作为起点吧 at 2014年12月05日

    #61 楼 @WRLin 呵呵,测试一下同事做的 JavaScript 插件 https://github.com/fr0m/background.js

  • 如何计算每个月的第一个星期三的日期 at 2014年09月29日
    (1..12).map { |month| (3 - Date.new(2014, month, 1).wday) % 7 + 1 } # => [1, 5, 5, 2, 7, 4, 2, 6, 3, 1, 5, 3]
    
  • 180 行 ruby 代码搞定游戏 2048 at 2014年08月06日

    Ruby 其实可以写的更简单

    https://gist.github.com/swordray/a04e9fda23107f26f284

    class Game2048
      def initialize
        @array = 4.times.map { [ nil ] * 4 }
        2.times { fill }
      end
    
      def fill
        i, j = rand(4), rand(4)
        return fill if @array[i][j]
        @array[i][j] = [2, 2, 2, 2, 4].shuffle.first
      end
    
      def move(direction)
        @array = @array.transpose if %w[up down].include?(direction)
        @array.each(&:reverse!) if %w[right down].include?(direction)
        4.times do |i|
          a = @array[i].compact
          4.times { |x| a[x], a[x + 1] = a[x] * 2, nil if a[x].to_i == a[x + 1] }
          @array[i] = a.compact.concat([ nil ] * 4)[0..3]
        end
        @array.each(&:reverse!) if %w[right down].include?(direction)
        @array = @array.transpose if %w[up down].include?(direction)
      end
    
      def play
        puts @array.map { |line| "[%5s] " * 4 % line }
        move({ a: 'left', s: 'down', d: 'right', w: 'up' }[gets.strip.to_sym])
        fill && play if @array.flatten.include?(nil)
      end
    end
    
    Game2048.new.play
    
  • 就是 user 表中 有六个字段,任意符合其中两项的就提出来,逻辑怎么写 at 2014年07月31日

    #14 楼 @sjzg001

    fields = %w[a b c d e f]
    fields.map { |a| fields.map { |b| a < b ? "(#{a} != 0 AND #{b} != 0)" : nil } }.inject(&:+).compact.join(" OR ")
    
  • [北京] 大鱼自助游招聘工程师 Ruby/ 前端 /iOS/Android at 2014年07月24日

    👍

  • Rails migration 文件也应该按模块存放 at 2014年07月03日

    感谢主要作者 @mystery from 优众网

  • RoR 后台改为 Swift 来写是否可以 at 2014年07月03日

    何苦呢,何必呢?

  • 淘宝实现前后端分离了?而且还在 Java 和前端 JS 间架了 NodeJS? at 2014年07月03日

    1939年9月,德国军队以保护德裔居民的名义发动闪电战入侵波兰领土,随即导致大英帝国与法国向德国宣战,从而引发第二次世界大战。

    我觉得 JavaScript 前端工程师插手后端开发是非常不冷静的

  • 分享几个部署时解决 ENV 变量问题的方案 at 2014年07月03日

    #19 楼 @Victor 同意,更危险的是变节的系统管理员

  • 在 RubyMine 中, application.js 中的 require 实时提示称找不到文件. at 2014年07月02日

    使用正确的 IDE

  • 你不知道的 New Relic at 2014年06月30日

    #6 楼 @fresh_fish 可以不开启它的浏览器端监控

  • Rails migration 文件也应该按模块存放 at 2014年06月30日

    QA Own 就没办法了

  • Elixir vs Ruby Showdown at 2014年06月30日

    #6 楼 @yukihiro_matz 所有语言都需要考虑性能,只不过性能优化最重要的原则就是不要过早优化

  • Elixir vs Ruby Showdown at 2014年06月30日

    Ruby 好慢啊,吓尿了,立马 rvm uninstall all

  • Lotus Philosophy at 2014年06月30日

    没有了魔法的魔法师,跟普通人又有什么区别?大可用 C++ / Java 来写

  • rails 4.0 运行在 ruby 2.1 上会有问题吗? at 2014年06月30日

    这也问?试试不就知道了

  • Linode 的 $10/mo 的 VPS 在怎么样? at 2014年06月27日

    #5 楼 @diguage 测试工具可以搜索“VPS 探针”。其实不用担心 IP 被封问题,Linode 是独立 IP 不会跟别人共用,万一被封了也可以要求换 IP。

  • Linode 的 $10/mo 的 VPS 在怎么样? at 2014年06月27日

    东京节点在国内 ping 大概 100 ms 左右,应该算是很快了,可以试试我的小站 http://www.shuhai.org/

  • 呵呵,纯粹的移动社交应用 at 2014年06月26日

    呵呵

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