Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
JustQyx
@hz_qiuyuanxin
VIP
NO. 2099 / 2012-05-06

[email protected]
DJI
深圳
22 Topics / 614 Replies
12 Followers
46 Following
195 Favorites
教育的目的,不是培养人们适应传统的世界,不是着眼于实用性的知识和技能,而要去唤醒学生的力量,培养他们自我学习的主动性,抽象的归纳力和理解力,以便使他们在目前无法预料的种种未来局势中,自我做出有意义的选择
Reward
GitHub Public Repos
  • affirm-ruby 1

    Ruby client library for integrating with Affirm financing payments

  • elasticsearch-with-ik 1

    Just some packages, not a project

  • gfwlist 1

    The one and only one gfwlist here

  • aliyun-oss-ruby-sdk 0

    Aliyun OSS SDK for Ruby

  • pdf_handler 0

    Replace text in pdf

  • ruby_torna_sdk 0

  • RSSHub 0

    🍰 Everything is RSSible

  • justqyx.github.io 0

  • node-torna-sdk 0

  • haoel.github.io 0

More on GitHub
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • [Backbone] new collection 问题 at September 25, 2013

    #1 楼 @virgil 木有

    仅仅如此使用而已

    comments = new App.Collections.Comments
    

    然后现在用了一个办法绕过去了,不过始终觉得不好,没有找到其根本所在。

    就是监听 collection 的 add 事件,然后在事件里,判断 comment.id?,大致是:

    addComment: (comment, collection, options) ->
      if !comment.id? then return
    
      # Generate view and render it
      commentView = new App.Views.CommentView({model: comment}).render()
    
      $comments = @$(".comment-list")
    
     # ......
    
  • 开源诚可贵 , 理性价更高 at September 24, 2013

    这个玩笑不太好笑

  • 请问大家有没有使用 Devise+Omniauth 并自定义 “注册 / 绑定” 中间页面的例子? at September 23, 2013

    #8 楼 @howiehu 能否说一下具体的实现方案?

  • 请问大家有没有使用 Devise+Omniauth 并自定义 “注册 / 绑定” 中间页面的例子? at September 22, 2013

    同求,楼主找到方法了么?

  • 在 rails 3.2.3 中加入 ckediter 的详细步骤 at September 16, 2013

    #18 楼 @runup

    你需要把内容转换一下,如:

    # controller 
    @article = Article.first
    
    # View
    <div><%= @article.content.html_safe %></div>
    

    http://thekaiway.com/2013/08/17/actionview-safe-buffer/

  • Rails assets 里的 images 不能放到各个子目录里面吗? at September 04, 2013

    #2 楼 @zealinux 那就把它加入到编译路径呗

  • Rails assets 里的 images 不能放到各个子目录里面吗? at August 29, 2013

    请查阅 Rails Guide

    asset_path("test_1/1.png") # => "/asset/test_1/1.png"
    asset_path("test_2/1.png") # => "/asset/test_2/1.png"
    
  • [又拍云 8 周年大回馈] 分享活动就能拿双重大礼! at August 29, 2013

    #22 楼 @upyun 真不好意思!我发现我已经收到了!抱歉!

  • 百度 PaaS 平台可能要支持 Ruby 啦 at August 29, 2013

    非常支持!!!

  • ruby-china 本地运行 at August 28, 2013

    看一下 routes.rb,基本上就啥都知道了。

  • 下个月正式离职,然后利用三个月时间转型 Ruby on Rails + SOHO,写了个计划,望各路有经验的大牛多提提意见。 at August 28, 2013

    个人不喜欢 SOHO 办公,可能遇到过的不好。。

  • 周末打算写个关于测试的博文,大家想知道些什么? at August 28, 2013

    英文的,大坑,就不能写个中文的么。。

  • [已解决] 使用 omniauth-weibo-oauth2 的问题 at August 28, 2013

    改本地 hosts

    127.0.0.1 yourhost
    

    然后访问:

    yourhost:3000/auth/weibo
    
  • Mongoid::CounterCache,ruby-china 源码 at August 27, 2013

    #1 楼 @brant 我也是菜鸟,你说的 grape 是?

  • Mongoid::CounterCache,ruby-china 源码 at August 27, 2013

    #2 楼 @shatle 不是的,你看清楚,在这里用这个的原因是因为用了 MongoDB,mysql 估计支持这个排序的,MongoDB 文档里并不支持对 embeded document 进行 count 之后的一个排序。

    所以需要所一个字段来做冗余,以做排序用。

  • 初学者连载系列之一:先搞好自己的 Octopress,边学边秀才是正道 at August 15, 2013

    上传的命令根本就是错的!!!

    [email protected]/username/username

    就可以了

  • 一小段代码重构 at August 12, 2013

    mark 一下,评论很给力!

  • 周二去北京,有收沙发客的吗? at August 12, 2013

    #5 楼 @xiaogui 你也得留个联系方式给人家吧。。。

  • 我在社区里面发现了一个不知道是不是 bug 的 bug at August 12, 2013

    哈哈,如 7 楼,有一种东西叫 cache.

  • 利用 OCR 解析,京东商品价格 at August 01, 2013

    这里也有一篇

    可是我遇到的问题,跟 @suxu 一样:

    ruby-2.0.0-p195/gems/rtesseract-0.0.13/lib/rtesseract.rb:150:in `rescue in convert': RTesseract::ConversionError (RTesseract::ConversionError)
    
    
  • 在 rails 3.2.3 中加入 ckediter 的详细步骤 at July 31, 2013

    CKEditor 在 Rails4 目前不能用。

    不过使用其他方法,还是能用。

    http://my.eoe.cn/guanmac/archive/5806.html

  • carrierwave 调用 recreate_versions! 时,裁剪后的图片没有被保存 at July 25, 2013

    @zj0713001 已解决,原来使用 recreate_versions! 时,你需要执行多一次保存。

    class UsersController < ApplicationController
      def crop_update
        current_user.update avatar_params
        current_user.save
        redirect_to :root
      end
    
      private
      def avatar_params
        params.require(:user).permit(:crop_x, :crop_y, :crop_w, :crop_h)
      end
    end
    
  • gem 'carrierwave'简易实用介绍 at July 25, 2013

    为什么我文件裁剪,最后没保存进去!

    class AvatarUploader < CarrierWave::Uploader::Base
      # Include RMagick or MiniMagick support:
      # include CarrierWave::RMagick
      include CarrierWave::MiniMagick
    
      # Choose what kind of storage to use for this uploader:
      storage :file
      # storage :upyun
    
      # Override the directory where uploaded files will be stored.
      # This is a sensible default for uploaders that are meant to be mounted:
      def store_dir
        # "uploads/#{model.class.to_s.underscore}/#{model.id}"
        "#{model.class.to_s.underscore}/#{mounted_as}"
      end
    
      # Provide a default URL as a default if there hasn't been a file uploaded:
      def default_url
        _filename = ["default_avatar", version_name, "png"].join(".")
        # For Rails 3.1+ asset pipeline compatibility:
        return ActionController::Base.helpers.asset_path("fallback/#{_filename}")
    
        "/images/fallback/" + [version_name, "default.png"].compact.join('_')
      end
    
      # Process files as they are uploaded:
      # process :scale => [200, 300]
      #
      # def scale(width, height)
      #   # do something
      # end
    
      # Create different versions of your uploaded files:
    
      process :cropper
    
      version :thumb do
        process resize_to_fit: [50, 50]
      end
    
      version :mid do
        process resize_to_fit: [180, 180]
      end
    
      version :large do
        process resize_to_fit: [300, 300]
      end
    
      def cropper
        if model.crop_x.present?
          manipulate! do |img|
            x = model.crop_x
            y = model.crop_y
            w = model.crop_w
            h = model.crop_h
            img.crop "#{w}x#{h}+#{x}+#{y}"
          end
        end
      end
    
      # Add a white list of extensions which are allowed to be uploaded.
      # For images you might use something like this:
      def extension_white_list
        %w(jpg jpeg gif png)
      end
    
      # Override the filename of the uploaded files:
      # Avoid using model.id or version_name here, see uploader/store.rb for details.
      def filename
        "#{secure_token}.#{file.extension}" if original_filename.present?
      end
    
      protected
      def secure_token(length=16)
        var = :"@#{mounted_as}_secure_token"
        model.instance_variable_get(var) or model.instance_variable_set(var, SecureRandom.hex(length/2))
      end
    end
    
    
  • carrierwave 调用 recreate_versions! 时,裁剪后的图片没有被保存 at July 24, 2013

    #1 楼 @zj0713001 试过了,并不是这个原因。

  • carrierwave-upyun 重建缩略图时出错 at July 24, 2013

    我更衰,crop image 后,竟然啥都没变,我估计是不会自动重新上传。。。

  • redis 的 ruby 客户端哪个更好一些? at July 24, 2013
    gem "redis"
    gem "hiredis"
    gem 'redis-namespace'
    gem 'redis-objects'
    
  • Rails 貌似升级到 RC 2 了 at June 14, 2013

    6 月 25 号

  • Mac OS X 其实已经默认装好了 Vim 了,不需要再安装 MacVim at May 12, 2013

    #2 楼 @u1344408260 现在用 CtrlP 了。

  • Rails 将某些页面静态化,在生成文件时遇到的错误 at April 23, 2013

    #1 楼 @ywjno

    后来找到方法了:f.write(app.response.body.force_encoding("UTF-8")) 就可以了! 你说的那个方法我倒没试过

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