rack-attack是用于阻止和限制恶意滥用Web请求的Rack中间件,可以保护您的Rails和Rack应用程序免受恶意客户的侵害。Rack :: Attack可让您根据请求的属性轻松决定何时允许,阻止和限制。 请参阅介绍Rack :: Attack的Backing&Hacking博客文章。https://www.kickstarter.com/backing-and-hacking/rack-attack-protection-from-abusive-clients 或访问https://github.com/kickstarter/rack-attack Getting started Installing Add this line to your application’s Gemfile: # In your Gemfile gem ‘rack-attack’ And then execute: $ bundle Or install it yourself as: $ gem install rack-attack Plugging into the application Then tell your ruby web application to use rack-attack… Continue Reading Ruby Gem – kickstarter/rack-attack: Rack middleware for blocking & throttling

Scenic在Rails中版本化数据库视图脚本。它为ActiveRecord :: Migration添加方法,以在Rails中用Migration版本方式来创建和管理数据库视图。 https://github.com/scenic-views/scenic 使用Scenic,您可以: 将SQL视图的强大功能带到Rails应用程序,而无需将架构格式切换为SQL。 作为额外的好处,您可以在SQL文件中定义视图的结构,这意味着您可以在您选择的编辑器中获得完整的SQL语法突出显示,并且可以在开发期间轻松地在数据库控制台中测试SQL。 提供了版本控制视图的约定,可使您的迁移历史记录在多个环境中保持一致且可逆,并避免在迁移过程中复制SQL字符串或者遗漏执行视图脚本。 Scenic内置适配器支持PostgreSQL。 其他关系型数据库适配器是可配置的(参见Scenic :: Configuration),并且具有其他gem可以提供的最小接口(参见Scenic :: Adapters :: Postgres)。 官方README.md文档介绍如何创建视图脚本,更新或回滚视图,也介绍如何创建和使用view-backed models,以及使用过程中的常见问题(视图缺少主键、定义过期失效等)。最后说明内置PostgreSQL适配器的原因,同时推荐其他关系型数据库适配器。 下面是一个简单的使用例子: 假如想要创建一个名为search_results的视图,您可以使用以下命令创建迁移和相应的视图定义文件: $ rails generate scenic:view search_results create db/views/search_results_v01.sql create db/migrate/[TIMESTAMP]_create_search_results.rb 编辑 db/views/search_results_v01.sql文件,用SQL语句定义您的视图。比如: SELECT statuses.id AS searchable_id, ‘Status’ AS searchable_type, comments.body AS term FROM statuses JOIN comments ON statuses.id = comments.status_id UNION SELECT… Continue Reading Ruby Gem – scenic-views/scenic: Versioned database views for Rails

Original: https://github.com/digaev/stale_options StaleOptions    A gem for caching HTTP responses. The gem was built with an idea to implement a class which will create options for ActionController::ConditionalGet#stale? method. It allows to cache any kind of object, not only record or collection (unlike of #stale?). Installation Usage Caching options Examples Controller helpers Contributing License Installation… Continue Reading [Reproduce]Ruby Gem – digaev/stale_options: A Ruby gem for caching HTTP responses

Original: https://github.com/janko-m/down Down Down is a utility tool for streaming, flexible and safe downloading of remote files. It can use open-uri + Net::HTTP, HTTP.rb or wget as the backend HTTP library. Installation gem “down”, “~> 4.4” Downloading The primary method is Down.download, which downloads the remote file into a Tempfile: require “down” tempfile = Down.download(“http://example.com/nature.jpg”) tempfile #=> #<Tempfile:/var/folders/k7/6zx6dx6x7ys3rv3srh0nyfj00000gn/T/20150925-55456-z7vxqz.jpg> Metadata… Continue Reading Ruby Gem – janko-m/down: Streaming downloads using net/http, http.rb or wget

When testing Rails applications, two of the most significant performance bottlenecks are accessing the database and loading Rails itself. RSpec Mocks and other mocking frameworks give us the tools to avoid these bottlenecks by allowing us to mock our Rails models, but doing so can be tedious. 1. ActiveMocker ActiveMocker… Continue Reading Ruby Gem – zeisler/active_mocker

A small gem to lubricate your testing workflow with prettier than usual diffs. Enable fancy colored diffs in your minitest assertions https://github.com/angelkar/pretty-diffs 1. Motivation When you make assertions between large strings with Minitest, for example JSON responses, it is laborious to identify what has changed. The usual workflow involves copy-pasting… Continue Reading Ruby Gem – angelkar/pretty-diffs

ComfortableMexicanSofa ComfortableMexicanSofa is a powerful Ruby on Rails 5.2+ CMS (Content Management System) Engine      Features Simple drop-in integration with Rails 5.2+ apps with minimal configuration CMS stays away from the rest of your application Powerful page templating capability using Content Tags Multiple Sites from a single installation Multi-Language Support (i18n) (ca,… Continue Reading Ruby Gem – comfy/comfortable-mexican-sofa: ComfortableMexicanSofa is a powerful Ruby on Rails 5.2+ CMS (Content Management System) Engine

Original: https://github.com/hspazio/elastic_notifier ElasticNotifier    ElasticNotifier gem provides a simple API to send error notifications to an Elastic Search instance. It can also be used as plug-in for exception_notification gem to send error notifications caught by the Rack middleware. Installation Add this line to your application’s Gemfile: gem ‘elastic_notifier’ And then execute: $ bundle… Continue Reading Ruby Gem – hspazio/elastic_notifier: A Ruby exception notifier for ElasticSearch

feedparser library – Read Web Feeds in XML, HTML, JSON, TXT and More; Build Your Own News Reader from Scratch in Twenty Lines feedparser/feedparser: feedparser gem – (universal) web feed parser and normalizer (XML w/ Atom or RSS, JSON Feed, HTML w/ Microformats e.g. h-entry/h-feed or Feed.HTML, Feed.TXT w/ YAML,… Continue Reading Ruby Gem – feedparser/feedparser

Packing your Ruby application into a single executable. http://enclose.io 1. Ruby Packer Packing your Ruby application into a single executable. 1.1 Features Works on Linux, Mac and Windows Creates a binary distribution of your application Supports natively any form of require and load, including dynamic ones (e.g. load(my_path + ‘x.rb’) Features… Continue Reading Ruby Gem – pmq20/ruby-packer