Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
Marble Wu<活靶子.NET>
@huobazi
VIP
NO. 15 / 2011-10-31

西安
110 Topics / 1709 Replies
51 Followers
97 Following
128 Favorites
请叫我靶子哥哥. :D
GitHub Public Repos
  • carrierwave-qiniu 177

    Qiniu Storage support for CarrierWave

  • ajax-upload-with-carri... 42

    使用 AjaxUpload 和 Carrierwave 在 Rails && Mongoid 中批量上传图片

  • dackup 23

    Dackup is a free, open source, backup client for your files and database to Cloud

  • vuejs-with-rails-api-a... 11

    Vue.js example with rails-api and JWT

  • carrierwave-qiniu-example 9

    This a example project for carrierwave-qiniu

  • vimrc 6

    my vim settings

  • huobazi.github.com 2

    huobazi.github.com

  • dotfiles 2

    My dotfiles

  • indicator_button 2

    A Flutter button with indicates progress on iOS and Android

  • ruby-china 1

    ruby-china.org website source code.

More on GitHub
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • [远程] FeedMob - 初级软件开发工程师 at September 07, 2020

    说的是美元还是英镑?

  • 看懂的人,都会明白,哈哈哈 at September 03, 2020

    很形象

  • 解决因 Author 中有特殊字符引起的 push 失败 at September 02, 2020

    @lanzhiheng 啊,我八年前在线 commit 的那条记录还影响 push 啊,按你的分析,这个要不要给 github 提个 issue 让他们搞呢,毕竟是他们的在线编辑工具 push 后引起 的,这么想来,他们的 在线编辑器修改后 push 是在服务器上运行的,那他们的服务器上的 push 和 我们 client 看来还是有差别的。

  • 使用 Vue 开发 App 的流畅度怎么样 at September 01, 2020

    flutter 大法好

  • RubyConf China 2020 SSR 参会指南 at September 01, 2020

    好哇好哇,欢迎来骚 😆

  • RubyConf China 2020 SSR 参会指南 at September 01, 2020

    @BenX ben 买了情侣装哈 👍 售后处理了,记得秀一下,

  • Stimulus 简介 - 谦虚的前端框架 at August 28, 2020

    用了几年 Turbolinks 了,这么说,我在路上也好几年了 😁 😁

  • Rails UJS + Stimulusjs + Turbolinks 5 = ❤️ at August 28, 2020

    学着起来其实很快,两年前我试了下 vue,很快就能搬砖了。

    不过很久没搬,现在好像又忘记了 😂 ,脑子里忘不掉的就是 jQuery 大法,这个太根深蒂固了,估计忘不了了😅

  • 在 Rails 中集成第三方登录 at August 19, 2020

    对对,微信 QQ 甚至是微博 也许比 支付宝更合适这个场景

  • 在 Rails 中集成第三方登录 at August 18, 2020

    呼吁贡献回 homeland,这样 ruby-china 也可以绑定 微信和支付宝登陆了

  • Ruby 里面 @topic.node&.name 这里的 & 是干什么用的? at August 14, 2020

    等效与 c# 的

    topic?.node?.name
    
  • Github 的 Action 背后运行的容器性能不错 at August 11, 2020

    是吗?要是老碰到那样,就要考虑使用 阿里云的 code 那里的 Q 外服务器构建了

  • 官方是不是 可以考虑弄一些 插件平台 类似 discuz 那样 at August 09, 2020

    可以搞一个 marketplace

  • 偿试在 Windows 7 下用 Ruby 2.7 开发桌面应用程序框架,寻求 ruby-core 技术支持 at August 06, 2020

    C# WinForm/WPF 不香吗?

  • Codable - 更好的使用 code 字段 at August 06, 2020

    GitHub Actions 真不错,主要是提供的虚机性能超级棒,打个 image, Docker Hub 自己拉去 Build 所用的时间是用 GitHub Action 这边 build 后 push 过去 的三倍以上,中间顺带还 push 到了 GitHub 自己的 package 服务

  • Docker 发版本 跟传统的 Capistrano mina 发版本 有啥 优缺点么 谢谢大家 不吝赐教!!!! at August 04, 2020

    挖坟有益 😁 https://ruby-china.org/topics/38038

  • 请问大家的 CI/CD 方案 (测试 / 部署方案) 使用的是什么流程?Docker+Drone+Swarm? at August 04, 2020

    好赞的讨论帖 👍

  • Docker 发版本 跟传统的 Capistrano mina 发版本 有啥 优缺点么 谢谢大家 不吝赐教!!!! at August 03, 2020

    好处是有很多别人已经做好了的基础镜像,拿来就能用,比如 https://github.com/ledermann/docker-rails-base 真香!😁

  • 想知道 Ruby China 目前服务器配置情况 at July 18, 2020

    就服你的手快 👍 👏 👏

  • 想知道 Ruby China 目前服务器配置情况 at July 17, 2020

    @hooopo @huacnlee 我用了这个帖子里的 里的 pg search 部分。

    感觉不用 Lucene/ES/Solor 等,部署简单的多

    分词用的 pg_jieba 和 jieba_rb

    可以内容搜索、相关帖子、搜索用户

  • Rails 没落了吗?为什么我们的社区如此冷清? at July 02, 2020

    有一部分人相信换 go 得永生

  • 把 Rails 项目中的 PostgreSQL 替换成 MySQL,需要做哪些工作? at June 30, 2020

    🚄 换 🚌

  • Twitter 上被 Hey 刷屏了 at June 24, 2020

    @honglix @lazybios 求码求码

  • 真的有无法使用自动化工具爬取数据的网站吗? at June 11, 2020

    说个思路吧,

    我以前搞过一个,超级难爬,实在没法,换 javascript 写 chrome 插件,run 在 chrome 里。

    打开浏览器,登陆目标网站,call 出插件,显示个 button ,点击,该爬的都爬到了,组织好数据,post 到自己的 api 上。

    done.

    多买几个运营妹子点按钮 😄

  • 不知道大家有没有试过直接 cmd 输入 ruby 然后可以输入东西,不过这个有什么用? at May 22, 2020

    ruby abc.ruby

  • 敏感词过滤实现 at May 14, 2020

    贴一个我的吧

    # frozen_string_literal: true
    # DFA 算法实现敏感词扫描
    module Yfxs
      class SensitiveWords
        @@sensitiveMap = Hash.new
        class << SensitiveWords
          def addWord(word)
            nowMap = @@sensitiveMap
    
            for i in 0..word.strip.length - 1
              c = word[i].chr
              if nowMap.has_key? c
                nowMap = nowMap[c]
              else
                child        = Hash.new
                child["end"] = 0
                nowMap[c]    = child
                nowMap       = nowMap[c]
              end
            end
            nowMap["end"] = 1
          end
    
          def initWordMap
    
            return true if @@sensitiveMap.size > 0
    
            stop_words = Setting.stop_words.uniq
            stop_words.each_with_index do |word, index|
              addWord word
            end
            true
          end
    
          def p
            initWordMap
            @@sensitiveMap.size
          end
    
          def scan(word)
    
            initWordMap
    
            word = word.to_s
            words = Array.new
            for i in 0..word.length - 1
              c = word[i]
              if @@sensitiveMap.has_key? c
                theword = "".freeze
                nowMap = @@sensitiveMap
                for j in i..word.length - 1
                  c = word[j]
                  if nowMap.has_key? c
                    theword += c
                    nowMap = nowMap[c]
                    if nowMap['end'] == 1
                      words.push theword
                    end
                  else
                    break
                  end
                end
              end
            end
            return words
          end
        end
      end
    end
    

    在 rails 内写个 自定义的 validates 丢到 concern 用起来更顺手

    # frozen_string_literal: true
    module WithSensitiveWords
      extend ActiveSupport::Concern
      module ClassMethods
        def sensitive_words_safe(*args)
          args.each do |key|
            define_method("#{key.to_s}_without_stopwords") do
              Yfxs::Stopword.safe self[key]
            end
          end
        end
    
        def sensitive_words_validates(*args)
          validates_each args do |record, attr, value|
            # record.errors.add(attr, '包含不允许出现的词语') if Yfxs::SensitiveWords.scan(value).length > 0
            if Yfxs::SensitiveWords.scan(value.to_s).length > 0
              record.errors[:base] << "请不要发布会给我们带来伤害的内容"
              record.errors.add(attr, "包含不允许出现的词语")
            end
          end
        end
      end
    end
    
    # frozen_string_literal: true
    
    module Yfxs
      class Stopword
        def self.safe(text)
          words = SensitiveWords.scan text
          if words.present?
            words.each_with_index do |word, index|
              text = text.gsub(/#{word}/, "***")
            end
          end
          text
        end
      end
    end
    
    # frozen_string_literal: true
    
    class Comment < ApplicationRecord
      include WithSensitiveWords
    
      belongs_to :commentable, polymorphic: true
      belongs_to :user, optional: true
    
      sensitive_words_safe :title
      sensitive_words_validates :body
    end
    
  • 本地测试 homeland 发现用户可以自行删帖而引发的思考 at March 28, 2020

    see: https://github.com/ruby-china/homeland/blob/master/app/models/ability.rb#L68

  • 最近在用 VS Code 玩儿 Flutter,在跑 Ruby on Rails 的时候总觉的非常不顺手 at March 12, 2020

    Android studio 香!

  • 在数组的循环内删除数组元素的问题? at February 23, 2020

    这是个经典问题了。正向遍历的过程中改变了集合的长度

    一边从桶里舀水出来,一边把桶高锯掉一些。

    这种情况类 for 循环需要倒着遍历,或者用 while … do 这样的循环

  • 我听到有人在说:「?????:??」 at February 12, 2020

    过过过儿过过的生活?

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