Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
Eric-Guo
@ericguo
VIP
NO. 1665 / 2012-03-31

[email protected]
天华建筑设计
上海
47 Topics / 1393 Replies
181 Followers
245 Following
75 Favorites
Codex PR & commit submitter, specialist on Rails and React.
GitHub Public Repos
  • wechat 1334

    API, command and message handling for WeChat in Rails

  • wechat-starter 351

    WeChat web app with wx_pay in rails

  • tailwindcss-jit-stimulus 19

    A template with Rails 7.1, Shakapacker 7.2, TailwindCSS 3 and Stimulus 3.0

  • pgac_demo 15

    Rails 7.2 Action Cable chat room using AnyCable as backend

  • coreui4-rails-starter 12

    The CoreUI 4 Rails starter

  • product_hunt 5

    Demonstrate new Rails 5.1 feature: Assets on Yarn, System tests with Capybara and unified form_wi...

  • openproject 3

    OpenProject is the leading open source project management software.

  • homeland 1

    :circus_tent: An open source forum/community system based on Rails, developed based on Ruby China.

  • rails 1

    Ruby on Rails

  • ruby 1

    The Ruby Programming Language [mirror]

More on GitHub
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • 生产环境下,rake assets:precompile 后出现 TypeError: unknown filter type 错误 at November 01, 2015

    #2 楼 @zorajiang 其实应该使用这个分支:https://github.com/javyliu/rails_kindeditor,不过看起来这个编辑器好久没人更新了。。

  • React vs Ember by Alex Matchneer at EmberNYC meetup at November 01, 2015

    #2 楼 @aidewoode 同意,你的这篇vue.js 使用感受写的不错。

  • 在 Model 中使用 routes helper at October 30, 2015

    #5 楼 @billy 准确的说是 foo_url(@some_model),不过坑爹的是 url routes helper 无法在 model 里面使用。

  • Ruby 菜鸟代码拍砖 at October 29, 2015

    write 部分可以简化一点吧?

    def magic_change(file)
      # read file
      return unless File.exist? file
      original_string = IO.read(file, encoding: 'GBK').encode!('UTF-8')
      # deduplicate characters
      original_string = original_string.gsub(/([\S]{4,})\1/) { Regexp.last_match[1] }
      # write file
      File.write('b.txt', original_string, external_encoding: Encoding::UTF_16LE)
    rescue => error
      p error
    end
    
    magic_change ARGV[0]
    
  • 在 Model 中使用 routes helper at October 29, 2015

    #1 楼 @billy 还是有场景的,比如模型里面写发邮件的方法,邮件里面希望使用链接。

  • Volt 可以应用的生产环境吗? at October 27, 2015

    好像还不支持连接数据库?这样怎么用于生产啊。。

  • [上海][2015年10月27日] Ruby 聚会召集 at October 27, 2015

    @ibachue 的how-to-exec-shell-in-ruby 真不错,学到很多。

  • 新手关于 Ruby 的一个疑问 at October 26, 2015

    #1 楼 @although13 正解。

    [3] pry(main)> show-source File#open
    
    From: io.c (C Method):
    Owner: Kernel
    Visibility: private
    Number of lines: 36
    
    static VALUE
    rb_f_open(int argc, VALUE *argv)
    {
        ID to_open = 0;
        int redirect = FALSE;
    
        if (argc >= 1) {
            CONST_ID(to_open, "to_open");
            if (rb_respond_to(argv[0], to_open)) {
                redirect = TRUE;
            }
            else {
                VALUE tmp = argv[0];
                FilePathValue(tmp);
                if (NIL_P(tmp)) {
                    redirect = TRUE;
                }
                else {
                    VALUE cmd = check_pipe_command(tmp);
                    if (!NIL_P(cmd)) {
                        argv[0] = cmd;
                        return rb_io_s_popen(argc, argv, rb_cIO);
                    }
                }
            }
        }
        if (redirect) {
            VALUE io = rb_funcall2(argv[0], to_open, argc-1, argv+1);
    
            if (rb_block_given_p()) {
                return rb_ensure(rb_yield, io, io_close, io);
            }
            return io;
        }
        return rb_io_s_open(argc, argv, rb_cFile);
    }
    
  • 為什麼要 Bundle Update? at October 13, 2015

    #11 楼 @winstonyw 我就是天天 bundle update,但是,恩,恕我直言,感觉 deppbot 这门生意很难收到钱,因为无法帮助我了解每个 gems 的更改情况,升级了,我肯定还是会第一时间看 gem 的 changelog,然后按照相应指示改代码或者跑测试(实际上是开发时候顺便跑),总之,真的不觉得麻烦,还能顺便刷个论坛呢。。

  • Rails 如何调用.NET 的 WCF 接口 at October 13, 2015

    #8 楼 @psvr grape好像有人说过单单 host 比和 rails 还慢,还有目前 intridea 又不维护,看来看去还是 AMS 靠谱点,不知道你怎么看。 #14 楼 @mumu 你也问得太 general 了吧,这样的问题感觉就是伸手党,ruby 社区不欢迎这样的提问方式。

  • Rails 如何调用.NET 的 WCF 接口 at October 13, 2015

    #12 楼 @mumu jbuilder是 gem,Borland JBuilder 都不知道死了多少年了。。

  • Rails 如何创建 WebService 接口,提供给 .NET 程序调用 at October 13, 2015

    另外现在语言和平台之间的互操作协议,json 相比 SOAP 早就一统江湖啦,唯一的争议是到底 json 格式语义如何定义,GraphQL/jsonapi,其实就是选 react 还是 ember.js,但无论如何前后端分离肯定是趋势,如果喜欢 Rails 的话 Rails 5 API 里面推荐的官方 gem 是AWS,其实换句话说,Rails 官方也给你选了,就是 jsonapi+ember.js 的方案。

    所以我现在 focus 这两个技术,一个就是 ember.js,另外就是 rails 5。其他 wdsl, Thrift, Protobuf 特定场合特定技术吧,未来 Rails 主流应该还是 jsonapi。

  • Rails 如何创建 WebService 接口,提供给 .NET 程序调用 at October 13, 2015

    #9 楼 @jimrokliu 同意,如果是 rails 的话,应该提供 json 格式的 restful 风格的 API 给其他平台调用,提供 web service 简直是扬短避长,.NET 这边调用 json 的话,虽然麻烦点,但也能接受,比如这样:

    using (WebClient client = new WebClient())
    {
        string url = string.Format("http://10.71.5.88/forms/real_time_broadcasts/{0}/confirm_speaked.json", say.confirm_speaked_id);
    
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
    
        request.Method = "POST";
        request.Timeout = 5000;
        request.ReadWriteTimeout = 10000;
    
        request.Accept = "application/json";
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();
        StreamReader reader = new StreamReader(response.GetResponseStream());
        string htmldoc = reader.ReadToEnd();
        response.Close();
    }
    
  • Rails 如何调用.NET 的 WCF 接口 at October 12, 2015

    #6 楼 @mumu 最官方的是用 jbuilder,返回 json 对象给.NET/Java 使用。

    using Newtonsoft.Json;
    
    string strlot = jsonLotInfo("M1516M8177");
    var lot = JsonConvert.DeserializeObject<dynamic>(strlot);
    Console.WriteLine(string.Format("Product: {0}", lot.product.product_name));
    Console.WriteLine(string.Format("POD: {0}", lot.product.package_of_drawing.name));
    foreach (var wfs in lot.workflow.workflowsteps)
    {
        Console.WriteLine(string.Format("  Step: {0}", wfs.workflowstepname));
    }
    
    private static string jsonLotInfo(string lot_no)
    {
        String ret = String.Empty;
    
        HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create(new Uri(string.Format("http://mesview.sandisk.com/lots/{0}.json", lot_no)));
        webReq.ContentType = "application/json; charset=UTF-8";
        webReq.Accept = "application/json";
        webReq.Timeout = 30000;
        HttpWebResponse response = (HttpWebResponse)webReq.GetResponse();
        StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.Default);
        ret = sr.ReadToEnd();
        sr.Close();
        response.Close();
    
        return ret;
    }
    
  • 為什麼要 Bundle Update? at October 12, 2015

    #5 楼 @billy 这太夸张了,我和你完全相反,每天都做 bundle update,因为应用始终跑在最新版。。

  • Rails 如何调用.NET 的 WCF 接口 at October 08, 2015

    用 savon,别用内置的 soap/wsdlDriver,这个在 Ruby 新版本已经去除了

  • 使用 RubyGems 安装 DBI 问题 at October 06, 2015

    现在一般都用 mysql2 了。

  • Spree 扩展机制分析 at October 05, 2015

    virtual_path 概念能具体说一下么,这个和i18n里面的有关联么?

  • 有用 Spree Commerce 的吗?真心慢啊 at October 05, 2015

    #5 楼 @tini8 #6 楼 @beiersi 生产模式可以跑下面命令预编译 deface 替换的模板,这个才是提速的关键。

    rake deface:precompile
    
  • - at October 04, 2015

    可以参考这个帖

  • 。。。这算黑吗??? at October 02, 2015

    varchar255 性能和 varchar10 性能几乎是一样的,和线上系统因为用户名字大于预期,造成错误和商业损失相比,简直不值一提。

    注意过多细节会导致重要事项的注意力缺失,这正是诸如 Rails 这样的框架的核心价值所在。

  • [上海] 噗印--个性化电商团队招聘 Ruby 开发工程师 (薪酬、福利优厚) at September 30, 2015

    React-native 写错了

  • 有一个似乎是很常见的需求,但是没发现简洁优雅的实现方式:如何结束 ping x.x.x.x -t 命令? at September 28, 2015

    用net-ping,还需要装一下win32-security

    测试可用。

    c:\git>irb
    irb(main):001:0> require 'net/ping'
    => true
    irb(main):002:0> pt = Net::Ping::TCP.new('cvpmesip01')
    => #<Net::Ping::TCP:0x193eee8 @host="cvpmesip01", @port=7, @timeout=5, @exception=nil, @warning=nil, @duration=nil>
    irb(main):003:0> pt.ping
    => false
    irb(main):004:0> pt = Net::Ping::TCP.new('cvpmesip01',2881)
    => #<Net::Ping::TCP:0x2a798f0 @host="cvpmesip01", @port=2881, @timeout=5, @exception=nil, @warning=nil, @duration=nil>
    irb(main):005:0> pt.ping
    => true
    irb(main):006:0> pt = Net::Ping::TCP.new('cvpmesip01',80)
    => #<Net::Ping::TCP:0x2b18b90 @host="cvpmesip01", @port=80, @timeout=5, @exception=nil, @warning=nil, @duration=nil>
    irb(main):007:0> pt.ping
    => true
    
  • Rails 里微信公众号相关开发能本地测试吗? at September 22, 2015

    其实正确的姿势是用wechat gem,还有官方调试工具。。。

  • [Autodesk] 参与分享,回馈社区 at September 22, 2015

    棒!

  • Rails 中有没有作业调度的框架? at September 22, 2015

    whenever?

  • Rails 5 的 where.or 在 Rails 4.2 上也可以使用了。 at September 18, 2015

    #10 楼 @martin91 承认,所以我举了一个生产的例子,我就料到爱美的 rubyist 肯定要喷这个简单例子不漂亮。 😄

  • 书不在多,精读才行 at September 17, 2015

    其实guides.rubyonrails.org,官方 guide 真的值得细读,更何况还是免费的。

  • Rails 5 的 where.or 在 Rails 4.2 上也可以使用了。 at September 17, 2015

    #6 楼 @roclv 你这样写目前 rails 5/where-or 里面都是不工作的。

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