source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
monzo/mondo-ruby
https://github.com/monzo/mondo-ruby
lib/mondo/account.rb
Ruby
mit
46
master
210
module Mondo class Account < Resource attr_accessor :id, :description, :raw_data, :sort_code, :account_number date_accessor :created def balance self.client.balance(id) end end end
github
monzo/mondo-ruby
https://github.com/monzo/mondo-ruby
lib/mondo/feed_item.rb
Ruby
mit
46
master
731
module Mondo class FeedItem < Resource attr_accessor :title, :image_url, :url, # TODO - make me consistent when the Mondo API changes :background_color, :body, :type # temporary fix until the API accepts JSON data in ...
github
monzo/mondo-ruby
https://github.com/monzo/mondo-ruby
lib/mondo/client.rb
Ruby
mit
46
master
8,006
require 'active_support/core_ext/hash' require 'active_support/core_ext/object/to_query' require 'multi_json' require 'oauth2' require 'openssl' require 'uri' require 'cgi' require 'time' require 'base64' require 'money' module Mondo class Client DEFAULT_API_URL = 'https://api.getmondo.co.uk' attr_accessor ...
github
r7kamura/code_hunter
https://github.com/r7kamura/code_hunter
code_hunter.gemspec
Ruby
mit
46
master
1,020
# coding: utf-8 lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "code_hunter/version" Gem::Specification.new do |gem| gem.name = "code_hunter" gem.version = CodeHunter::VERSION gem.authors = ["Ryo Nakamura"] gem.email = ["r...
github
r7kamura/code_hunter
https://github.com/r7kamura/code_hunter
spec/spec_helper.rb
Ruby
mit
46
master
296
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__) require "code_hunter" RSpec.configure do |config| config.treat_symbols_as_metadata_keys_with_true_values = true config.run_all_when_everything_filtered = true config.filter_run :focus end CodeHunter::Config.enable_logger = false
github
r7kamura/code_hunter
https://github.com/r7kamura/code_hunter
spec/code_hunter/pendaxes_spec.rb
Ruby
mit
46
master
796
require "spec_helper" module CodeHunter describe Pendaxes do let(:instance) do described_class.new(:application_path => "./") end before do instance.stub(:` => result) end # Stub the result of pendaxes-oneshot command let(:result) do { :pendings => [ :examp...
github
r7kamura/code_hunter
https://github.com/r7kamura/code_hunter
spec/code_hunter/renderer_spec.rb
Ruby
mit
46
master
1,311
require "spec_helper" require "active_support/core_ext/string/strip" module CodeHunter describe Renderer do describe ".render(warnings, options = {})" do subject do described_class.render(warnings, options) end let(:warnings) do [{ :a => :b }] end let(:options) do ...
github
r7kamura/code_hunter
https://github.com/r7kamura/code_hunter
spec/code_hunter/runner_spec.rb
Ruby
mit
46
master
1,548
require "spec_helper" module CodeHunter describe Runner do let(:instance) do described_class.new(argv) end let(:argv) do [] end describe "#services" do subject(:services) do instance.send(:services) end context "by default" do it "returns all servi...
github
r7kamura/code_hunter
https://github.com/r7kamura/code_hunter
lib/code_hunter.rb
Ruby
mit
46
master
389
require "active_support/all" require "code_hunter/version" require "code_hunter/config" require "code_hunter/method_logger" require "code_hunter/option_parser" require "code_hunter/runner" require "code_hunter/renderer" require "code_hunter/pendaxes" require "code_hunter/brakeman" require "code_hunter/rails_best_pract...
github
r7kamura/code_hunter
https://github.com/r7kamura/code_hunter
lib/code_hunter/pendaxes.rb
Ruby
mit
46
master
688
require "json" module CodeHunter class Pendaxes extend MethodLogger attr_reader :options def initialize(options = {}) @options = options end def run summarize(invoke) end private def invoke `pendaxes-oneshot #{options[:application_path]} --reporter json 2>/dev/n...
github
r7kamura/code_hunter
https://github.com/r7kamura/code_hunter
lib/code_hunter/git_blamer.rb
Ruby
mit
46
master
562
module CodeHunter class GitBlamer def initialize(args) @path = args[:path] @line = args[:line] end def blame result = invoke parse(result) unless result.empty? end def parse(str) { :sha1 => str.lines.to_a[0][/^[0-9a-f]+/], :author => str[...
github
r7kamura/code_hunter
https://github.com/r7kamura/code_hunter
lib/code_hunter/warning.rb
Ruby
mit
46
master
1,428
module CodeHunter class Warning def initialize(attributes) @attributes = attributes end def to_hash { :line => line, :message => message, :path => path, :service => service, :url => url, :sha1 => sha1, ...
github
r7kamura/code_hunter
https://github.com/r7kamura/code_hunter
lib/code_hunter/method_logger.rb
Ruby
mit
46
master
345
module CodeHunter module MethodLogger def log(method_name) define_method("#{method_name}_with_log") do |*args, &block| warn("#{Time.now} #{self.class}##{method_name}") if Config.enable_logger __send__("#{method_name}_without_log", *args, &block) end alias_method_chain method_name...
github
r7kamura/code_hunter
https://github.com/r7kamura/code_hunter
lib/code_hunter/runner.rb
Ruby
mit
46
master
1,074
module CodeHunter class Runner attr_reader :options def self.run(*args) new(*args).run end def initialize(argv = []) @options = OptionParser.parse!(argv) end def run Renderer.render(result, :format => options[:format]) end def result results = services.map(...
github
r7kamura/code_hunter
https://github.com/r7kamura/code_hunter
lib/code_hunter/renderer.rb
Ruby
mit
46
master
773
require "json" require "yaml" module CodeHunter # Render warnings to string with the specified format. # As its format, AVAILABLE_FORMATS are available ("yaml" is default). class Renderer extend MethodLogger AVAILABLE_FORMATS = %w[json yaml] def self.render(*args) new(*args).render end ...
github
r7kamura/code_hunter
https://github.com/r7kamura/code_hunter
lib/code_hunter/rails_best_practices.rb
Ruby
mit
46
master
731
require "code_hunter/rails_best_practices/invoker" require "code_hunter/rails_best_practices/summarizer" require "pathname" require "tmpdir" module CodeHunter class RailsBestPractices TEMPORAL_PATHNAME = Pathname.new("#{Dir.tmpdir}/rails_best_practices.html") attr_reader :options delegate :invoke, :to ...
github
r7kamura/code_hunter
https://github.com/r7kamura/code_hunter
lib/code_hunter/option_parser.rb
Ruby
mit
46
master
1,816
require "optparse" module CodeHunter class OptionParser < ::OptionParser OPTIONS = [ "--application-path=", "(default: ./) rails application root path", "--format=", "(default: yaml) output format (yaml or json)", "--no-brakeman", "(default: false) disable ...
github
r7kamura/code_hunter
https://github.com/r7kamura/code_hunter
lib/code_hunter/brakeman.rb
Ruby
mit
46
master
685
require "code_hunter/brakeman/invoker" require "code_hunter/brakeman/summarizer" require "pathname" require "tmpdir" module CodeHunter class Brakeman TEMPORAL_PATHNAME = Pathname.new("#{Dir.tmpdir}/brakeman.html") attr_reader :options delegate :invoke, :to => :invoker delegate :summarize, :to => :s...
github
r7kamura/code_hunter
https://github.com/r7kamura/code_hunter
lib/code_hunter/brakeman/invoker.rb
Ruby
mit
46
master
404
module CodeHunter class Brakeman class Invoker extend MethodLogger attr_reader :options def initialize(options = {}) @options = options end def invoke system( "brakeman", "--output", Brakeman::TEMPORAL_PATHNAME.to_s, :out => IO::NULL, ...
github
r7kamura/code_hunter
https://github.com/r7kamura/code_hunter
lib/code_hunter/brakeman/summarizer.rb
Ruby
mit
46
master
1,539
require "nokogiri" module CodeHunter class Brakeman class Summarizer attr_reader :options def initialize(options = {}) @options = options end def summarize rows.map do |element| if element.css(".warning_message").any? { :service => "br...
github
r7kamura/code_hunter
https://github.com/r7kamura/code_hunter
lib/code_hunter/rails_best_practices/invoker.rb
Ruby
mit
46
master
471
module CodeHunter class RailsBestPractices class Invoker extend MethodLogger attr_reader :options def initialize(options = {}) @options = options end def invoke system( "rails_best_practices", "--format", "html", "--output-file", Rails...
github
r7kamura/code_hunter
https://github.com/r7kamura/code_hunter
lib/code_hunter/rails_best_practices/summarizer.rb
Ruby
mit
46
master
1,095
require "nokogiri" module CodeHunter class RailsBestPractices class Summarizer attr_reader :options def initialize(options = {}) @options = options end def summarize warning_elements.map do |element| { :service => "rails_best_practices", ...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
Gemfile
Ruby
mit
46
main
2,237
source "https://rubygems.org" ruby file: ".ruby-version" gem "rails", "~> 7.2" gem "mail", "< 2.9.0" group :development, :test do gem "assert_json", "~> 1.0.0", require: false gem "debug", "~> 1.11", platforms: %i[mri] gem "json-schema", "~> 6.0", require: false gem "libxml-ruby", "~> 5.0.5" gem "pry-rails",...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
config.ru
Ruby
mit
46
main
246
# This file is used by Rack-based servers to start the application. require_relative "config/environment" require "rack/canonical_host" use Rack::CanonicalHost, ENV["HOST"] if ENV.key?("HOST") run Rails.application Rails.application.load_server
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
Guardfile
Ruby
mit
46
main
2,004
# Restart puma-dev when application things change guard :shell do watch("Gemfile.lock") { `touch tmp/restart.txt` } watch(%r{^config|lib/.*}) { `touch tmp/restart.txt` } end # Audit dependencies for security issues as they change guard :bundler_audit, run_on_start: false do watch("Gemfile.lock") end # Run tests...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
db/schema.rb
Ruby
mit
46
main
3,628
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `bin/rai...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
db/seeds.rb
Ruby
mit
46
main
758
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }]) # ...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
db/migrate/20220111001317_create_posts.rb
Ruby
mit
46
main
227
class CreatePosts < ActiveRecord::Migration[7.0] def change create_table :posts do |t| t.belongs_to :feed t.json :payload t.string :token, null: false, unique: true t.timestamps end end end
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
db/migrate/20220225083452_add_post_columns.rb
Ruby
mit
46
main
223
class AddPostColumns < ActiveRecord::Migration[7.0] def change change_table :posts, bulk: true do |t| t.string :from t.string :subject t.string :html_body t.string :text_body end end end
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
db/migrate/20240901105920_add_expired_at_to_feeds.rb
Ruby
mit
46
main
231
class AddExpiredAtToFeeds < ActiveRecord::Migration[7.2] def change add_column :feeds, :expired_at, :timestamp Feed.where("fetched_at < ?", 3.months.ago).find_each do |feed| feed.expire_if_stale! end end end
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
db/migrate/20240106023950_add_compressed_columns.rb
Ruby
mit
46
main
206
class AddCompressedColumns < ActiveRecord::Migration[7.1] def change change_table :posts, bulk: true do |t| t.binary :compressed_html_body t.binary :compressed_text_body end end end
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
db/migrate/20220225091921_extract_post_data.rb
Ruby
mit
46
main
421
class ExtractPostData < ActiveRecord::Migration[7.0] class Post < ApplicationRecord; end def change Post.where.not(payload: nil).find_each do |post| from = post.payload.dig("from", "full") post.update!( from: Mail::Address.wrap(from), subject: post.payload["subject"], html_b...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
db/data/20241003074932_decompress_plaintext.rb
Ruby
mit
46
main
835
# frozen_string_literal: true require "progress_bar" module Progress refine Enumerable do define_method :with_progress, ProgressBar::WithProgress.instance_method(:with_progress) end end class DecompressPlaintext < ActiveRecord::Migration[7.2] disable_ddl_transaction! using Progress def up Post.wh...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
spec/spec_helper.rb
Ruby
mit
46
main
1,473
# This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause # this file to always be loaded, without a need to explicitly require ...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
spec/rails_helper.rb
Ruby
mit
46
main
2,953
# This file is copied to spec/ when you run 'rails generate rspec:install' require "spec_helper" ENV["RAILS_ENV"] ||= "test" require File.expand_path("../config/environment", __dir__) # Prevent database truncation if the environment is production abort("The Rails environment is running in production mode!") if Rails.en...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
spec/models/post_spec.rb
Ruby
mit
46
main
3,017
require "rails_helper" RSpec.describe Post, type: :model do subject(:post) { Post.new(feed: Feed.new) } it "has a feed" do expect(post.feed).to be_a(Feed) end it "requires a feed" do post.feed = nil post.valid? expect(post.errors[:feed]).to eq(["must exist"]) end it "generates a token" d...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
spec/models/feed_spec.rb
Ruby
mit
46
main
5,241
require "rails_helper" RSpec.describe Feed, type: :model do subject(:feed) { Feed.new } it "has posts" do expect(feed.posts).to eq([]) end it "generates a token" do expect(feed.token).to be_nil expect { feed.save! }.to change { feed.token } end it "enforces uniqueness on tokens" do feed....
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
spec/mailboxes/post_mailbox_spec.rb
Ruby
mit
46
main
4,913
require "rails_helper" RSpec.describe PostMailbox, type: :mailbox do fixtures :all let(:feed) { feeds(:one) } it "creates a post from a full email sample" do mail = Mail.from_source Rails.root.join("spec/fixtures/files/money_stuff.eml").read expect { process(mail) }.to change { feed.posts.count } end ...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
spec/routing/feeds_routing_spec.rb
Ruby
mit
46
main
496
require "rails_helper" RSpec.describe FeedsController, type: :routing do describe "routing" do it "routes the root to feeds#new" do expect(get: "/").to route_to("feeds#new") end it "routes to #new" do expect(get: "/feeds/new").to route_to("feeds#new") end it "routes to #show" do ...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
spec/routing/posts_routing_spec.rb
Ruby
mit
46
main
324
require "rails_helper" RSpec.describe PostsController, type: :routing do describe "routing" do it "routes to #index" do expect(get: "/feeds/1/posts").to route_to("posts#index", feed_id: "1") end it "routes to #show" do expect(get: "/posts/1").to route_to("posts#show", id: "1") end end ...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
spec/support/validate_feed.rb
Ruby
mit
46
main
1,000
module ValidateFeed extend RSpec::Matchers::DSL matcher :be_valid_atom_feed do match do |body| require "xml/libxml" XML::Document.string(body).validate_relaxng(ValidateFeed.atom_schema) rescue LibXML::XML::Error => e @message = e.message false end failure_message do |actual...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
spec/requests/inbound_emails_spec.rb
Ruby
mit
46
main
4,725
require "rails_helper" RSpec::Matchers.matcher :accept_email do match do |actual| expect { actual.call }.to change { ActionMailbox::InboundEmail.count }.by(1) expect(response).to be_successful end supports_block_expectations end RSpec::Matchers.matcher :reject_email do match do |actual| expect { a...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
spec/requests/feeds_spec.rb
Ruby
mit
46
main
4,209
require "rails_helper" require "support/validate_feed" RSpec.describe "/feeds", type: :request do include ValidateFeed let(:valid_attributes) { {token: "somefeed"} } let(:feed) { Feed.create! valid_attributes } describe "GET /show" do it "renders a successful response" do expect { get feed_u...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
spec/requests/stats_spec.rb
Ruby
mit
46
main
216
require "rails_helper" RSpec.describe "Stats", type: :request do describe "GET /stats" do it "returns http success" do get "/stats" expect(response).to have_http_status(:success) end end end
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
spec/requests/posts_spec.rb
Ruby
mit
46
main
812
require "rails_helper" RSpec.describe "/posts", type: :request do let(:feed) { Feed.create! } let(:valid_attributes) { { feed: feed, payload: { from: { full: "Adora <adora@princess.alliance>", name: "Adora", email: "adora@princess.alliance" }, s...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
spec/views/view_validation_spec.rb
Ruby
mit
46
main
652
require "rails_helper" require "better_html/test_helper/safe_erb_tester" RSpec.describe "view validation" do include BetterHtml::TestHelper::SafeErbTester erb_files = Rails.root.join("app/views") .glob("**/{*.htm,*.html,*.htm.erb,*.html.erb,*.html+*.erb}") erb_files.each do |filename| pathname = filena...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
spec/views/posts/index.html.erb_spec.rb
Ruby
mit
46
main
481
require "rails_helper" RSpec.describe "posts/index", type: :view do fixtures :all let(:post) { posts(:one) } before do assign :feed, feeds(:one) assign :posts, post end it "renders a list of posts" do render assert_select "a[href='/posts/post_token']" do assert_select "p", "post tit...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
spec/views/feeds/show.json.jb_spec.rb
Ruby
mit
46
main
792
require "rails_helper" RSpec.describe "feeds/show.json", type: :view do fixtures :all let(:post) { posts(:one) } before do assign :feed, feeds(:one) end it "renders" do assert_json(render) do has :title, "somefeed" has :home_page_url, "http://test.host/feeds/abc123/posts" has :ico...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
spec/views/feeds/new.html.erb_spec.rb
Ruby
mit
46
main
334
require "rails_helper" RSpec.describe "feeds/new", type: :view do before do assign(:feed, Feed.new) end it "renders new feed form" do render assert_select "form[action=?][method=?]", feeds_path, "post" do assert_select "label[for=feed_name]" assert_select "input[name='feed[name]']" ...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
spec/views/feeds/show.atom.builder_spec.rb
Ruby
mit
46
main
642
require "rails_helper" RSpec.describe "feeds/show.atom", type: :view do fixtures :all let(:feed) { feeds(:one) } before do assign :feed, feed end it "renders" do render assert_select "feed" do assert_select "title", "somefeed" assert_select "icon", "https://icon.horse/icon/princess...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
spec/views/feeds/show.html.erb_spec.rb
Ruby
mit
46
main
364
require "rails_helper" RSpec.describe "feeds/show", type: :view do fixtures :all let(:feed) { feeds(:one) } before { assign :feed, feed } it "renders attributes in <p>" do render assert_select "code", "abc123@test.host" assert_select "code", "http://test.host/feeds/abc123.atom" assert_select...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
config/boot.rb
Ruby
mit
46
main
250
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) ENV["LITESTACK_DATA_PATH"] ||= "./storage" require "bundler/setup" # Set up gems listed in the Gemfile. require "bootsnap/setup" # Speed up boot time by caching expensive operations.
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
config/application.rb
Ruby
mit
46
main
1,918
require_relative "boot" require "rails" # Pick the frameworks you want: require "active_model/railtie" require "active_job/railtie" require "active_record/railtie" # require "active_storage/engine" require "action_controller/railtie" # require "action_mailer/railtie" require "action_mailbox/engine" require "action_tex...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
config/routes.rb
Ruby
mit
46
main
337
Rails.application.routes.draw do resources :posts, only: [:show] resources :feeds, only: [:new, :create, :show] do resources :posts, only: [:index] do collection { get :search } end end resources :stats, only: [:index] resources :requests, only: [:show] get "up" => "rails/health#show" root...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
config/scheduler.rb
Ruby
mit
46
main
221
Rufus::Scheduler.singleton.tap do |s| s.every "1h" do Feed.stale.find_each(&:expire_if_stale!) Feed.unthrottleable.find_each(&:unthrottle!) end s.cron "0 10 * * *" do DatabaseBackup.run! end end.join
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
config/puma.rb
Ruby
mit
46
main
2,030
# Puma can serve each request in a thread from an internal thread pool. # The `threads` method setting takes two numbers: a minimum and maximum. # Any libraries that use thread pools should be configured to match # the maximum value specified for Puma. Default is set to 5 threads for minimum # and maximum; this matches...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
config/environments/production.rb
Ruby
mit
46
main
4,170
require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your applica...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
config/environments/test.rb
Ruby
mit
46
main
2,779
require "active_support/core_ext/integer/time" # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between test runs. Don't rely on the data the...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
config/environments/development.rb
Ruby
mit
46
main
2,656
require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded any time # it changes. This slows down response time but is perfect for developme...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
config/initializers/host.rb
Ruby
mit
46
main
663
if ENV.key?("HOST") Rails.application.config.hosts << ENV["HOST"] Rails.application.config.after_initialize do ApplicationController.renderer.defaults.merge!(http_host: ENV["HOST"], https: true) # This super gross hack is to work around a bug in Rails that doesn't apply the defaults # to existing inst...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
config/initializers/rack_attack.rb
Ruby
mit
46
main
213
# Block requests outside cloudflare (unless they are to the root, allow those for redirection) # Rack::Attack.blocklist("CloudFlare bypass") { |req| req.path != "/" && !req.cloudflare? } if defined?(Rack::Attack)
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
lib/cops/lint/env.rb
Ruby
mit
46
main
1,276
module RuboCop module Cop module Lint # This cops checks for direct usage of ENV variables and # Rails.env class Env < RuboCop::Cop::Base MSG_ENV = "Avoid direct usage of ENV in application code" MSG_RAILS_ENV = "Avoid direct usage of Rails.env in application code" USAGE_...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
lib/tasks/auto_annotate_models.rake
Ruby
mit
46
main
1,758
if Rails.env.development? require "annotate" task set_annotation_options: :environment do Annotate.set_defaults( "active_admin" => "false", "additional_file_patterns" => [], "routes" => "false", "models" => "true", "position_in_routes" => "before", "position_in_class" => "aft...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
app/serializers/brotli_serializer.rb
Ruby
mit
46
main
202
require "brotli" class BrotliSerializer def self.dump(data) data ? Brotli.deflate(data) : nil end def self.load(data) data ? Brotli.inflate(data).force_encoding("UTF-8") : nil end end
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
app/models/feed.rb
Ruby
mit
46
main
3,930
class Feed < ApplicationRecord has_many :posts, -> { order(updated_at: :desc) }, dependent: :destroy, inverse_of: :feed has_many :week_posts, -> { last_week.not_system.order(updated_at: :desc) }, class_name: "Post", dependent: nil, inverse_of: :feed has_one :last_post, -> { order(updated_at: :desc) }, ...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
app/models/post.rb
Ruby
mit
46
main
2,824
class Post < ApplicationRecord belongs_to :feed validates :token, uniqueness: {case_sensitive: false} before_save :ensure_searchable! after_commit -> { feed.warn_if_needed unless system? } scope :last_hour, -> { where("created_at > ?", 1.hour.ago) } scope :last_week, -> { where("created_at > ?", 1.week.a...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
app/controllers/posts_controller.rb
Ruby
mit
46
main
688
class PostsController < ApplicationController def index @feed = Feed.find_by!(token: params[:feed_id]) @posts = @feed.posts end def search return redirect_to feed_posts_path if params[:q].blank? index @posts = @posts.search(params[:q]).to_a render :index rescue ActiveRecord::StatementI...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
app/controllers/requests_controller.rb
Ruby
mit
46
main
983
class RequestsController < ApplicationController def show case params[:id] when "error" raise "oh no" when "headers" render plain: request.headers.to_h.map { |k, v| "#{k}: #{v}" }.sort_by(&:first).join("\n") when "cloudflare" render plain: JSON.pretty_generate( "Rails.configu...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
app/controllers/feeds_controller.rb
Ruby
mit
46
main
704
class FeedsController < ApplicationController def new @feed = Feed.new end def show @feed = Feed.find_by!(token: params[:id]) return if request.format.html? @feed.fetch_or_expire! fresh_when @feed.last_post, public: true if @feed.expired_at? expires_in 100.years, public: true ...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
app/controllers/stats_controller.rb
Ruby
mit
46
main
353
class StatsController < ApplicationController def index @stats = { "Feeds Total" => Feed.count, "Feeds Throttled" => Feed.throttled.count, "Feeds Expired" => Feed.expired.count, "Posts All Time" => Post.count, "Posts Last Week" => Post.last_week.count, "Posts Last Hour" => Post...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
app/controllers/concerns/throttle_by_feed.rb
Ruby
mit
46
main
943
# This concern is included into the ActionMailbox ingress controller for # Postmark. It adds a preprocessing step during the incoming webhook request, # which allows us to return a 403 status to Postmark, signaling that the email # should not be tried again. The email processor runs too late to do that. module Throttle...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
app/mailboxes/post_mailbox.rb
Ruby
mit
46
main
2,601
class PostMailbox < ApplicationMailbox include ActionView::RecordIdentifier def process(token: nil) return if postmark_test? || feed_token.nil? post = Post.create!( feed: feed, token: token, from: mail.from_address, subject: mail.subject, compressed_html_body: html_body, ...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
app/lib/body_formatter.rb
Ruby
mit
46
main
1,163
class BodyFormatter def initialize(html_body) @html_body = html_body end def format(from_name) return if @html_body.blank? case from_name when "Matt Levine" body = @html_body .gsub("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
app/lib/database_backup.rb
Ruby
mit
46
main
362
class DatabaseBackup def self.run! new.run end def run FileUtils.rm_rf backup_path conn.execute "VACUUM INTO #{conn.quote(backup_path.to_s)}" backup_path end private def conn ActiveRecord::Base.connection end def backup_path Rails.root.join("storage", Rails.env, "backup.sqlit...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
app/views/feeds/show.atom.builder
Ruby
mit
46
main
509
cache ["v1", @feed, "atom"] do atom_feed root_url: feed_posts_url(@feed) do |atom| atom.title @feed.name atom.updated @feed.updated_at atom.icon @feed.favicon_url if @feed.favicon_url @feed.posts.limit(25).each do |post| atom.entry(post) do |entry| entry.author do |author| aut...
github
indirect/feedyour.email
https://github.com/indirect/feedyour.email
app/helpers/application_helper.rb
Ruby
mit
46
main
1,717
module ApplicationHelper def page_title if content_for?(:page_title) "#{content_for(:page_title)} — Feed Your Email" else "Feed Your Email".freeze end end def sharing_meta_tags(title: "Feed Your Email") if content_for?(:page_favicon) return if content_for(:page_favicon).nil? ...
github
tigrish/will-paginate-i18n
https://github.com/tigrish/will-paginate-i18n
Rakefile
Ruby
mit
46
master
1,366
# encoding: utf-8 require 'rubygems' require 'bundler' begin Bundler.setup(:default, :development) rescue Bundler::BundlerError => e $stderr.puts e.message $stderr.puts "Run `bundle install` to install missing gems" exit e.status_code end require 'rake' require 'jeweler' Jeweler::Tasks.new do |gem| # gem is...
github
tigrish/will-paginate-i18n
https://github.com/tigrish/will-paginate-i18n
will-paginate-i18n.gemspec
Ruby
mit
46
master
2,604
# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- # stub: will-paginate-i18n 0.1.15 ruby lib Gem::Specification.new do |s| s.name = "will-paginate-i18n" s.version = "0.1.15" s.required_rubygems_version = Gem::Requ...
github
tigrish/will-paginate-i18n
https://github.com/tigrish/will-paginate-i18n
spec/will-paginate-i18n_spec.rb
Ruby
mit
46
master
286
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') Dir.glob('config/locales/*.yml').each do |locale_file| describe 'a locale file' do it_behaves_like 'a valid locale file', locale_file it { locale_file.should be_a_subset_of 'config/locales/en.yml' } end end
github
asciidoctor/asciidoctor-tabs
https://github.com/asciidoctor/asciidoctor-tabs
Gemfile
Ruby
mit
46
main
357
# frozen_string_literal: true source 'https://rubygems.org' gemspec group :coverage do gem 'deep-cover-core', '~> 1.1.0', require: false gem 'simplecov', '~> 0.22.0', require: false end group :lint do gem 'rubocop', '~> 1.68.0', require: false gem 'rubocop-rake', '~> 0.6.0', require: false gem 'rubocop-rs...
github
asciidoctor/asciidoctor-tabs
https://github.com/asciidoctor/asciidoctor-tabs
asciidoctor-tabs.gemspec
Ruby
mit
46
main
1,755
begin require_relative 'lib/asciidoctor/tabs/version' rescue LoadError require 'asciidoctor/tabs/version' end Gem::Specification.new do |s| s.name = 'asciidoctor-tabs' s.version = Asciidoctor::Tabs::VERSION s.summary = 'An Asciidoctor extension that adds a tabs block to the AsciiDoc syntax.' s.description ...
github
asciidoctor/asciidoctor-tabs
https://github.com/asciidoctor/asciidoctor-tabs
tasks/version.rb
Ruby
mit
46
main
1,906
# frozen_string_literal: true require 'time' release_version = ENV['RELEASE_VERSION'] release_gem_version = ENV['RELEASE_GEM_VERSION'] release_date = Time.now.strftime '%Y-%m-%d' release_user = ENV['RELEASE_USER'] version_file = Dir['lib/**/version.rb'].first readme_file = 'README.adoc' changelog_file = 'CHANGELOG.a...
github
asciidoctor/asciidoctor-tabs
https://github.com/asciidoctor/asciidoctor-tabs
tasks/rspec.rake
Ruby
mit
46
main
382
# frozen_string_literal: true begin require 'rspec/core/rake_task' RSpec::Core::RakeTask.new :spec do |t| t.verbose = true t.rspec_opts = [ $VERBOSE || ENV['COVERAGE'] ? '-w' : nil, ENV['CI'] && ENV['COVERAGE'] ? '-fd' : '-fp', ENV['GITHUB_RUN_ID'] ? %(--seed #{ENV['GITHUB_RUN_ID']}) : ni...
github
asciidoctor/asciidoctor-tabs
https://github.com/asciidoctor/asciidoctor-tabs
lib/asciidoctor/tabs/block.rb
Ruby
mit
46
main
4,150
# frozen_string_literal: true module Asciidoctor module Tabs class Block < ::Asciidoctor::Extensions::BlockProcessor use_dsl on_context :example def process parent, reader, attrs doc = parent.document return create_open_block parent, nil, attrs unless doc.attr? 'filetype', 'htm...
github
asciidoctor/asciidoctor-tabs
https://github.com/asciidoctor/asciidoctor-tabs
lib/asciidoctor/tabs/extensions.rb
Ruby
mit
46
main
1,057
# frozen_string_literal: true unless RUBY_ENGINE == 'opal' require_relative 'block' require_relative 'docinfo' end module Asciidoctor module Tabs module Extensions const_set :Block, Block const_set :Docinfo, Docinfo module_function def group proc do block Block, :...
github
asciidoctor/asciidoctor-tabs
https://github.com/asciidoctor/asciidoctor-tabs
lib/asciidoctor/tabs/docinfo.rb
Ruby
mit
46
main
2,058
# frozen_string_literal: true module Asciidoctor module Tabs module Docinfo if RUBY_ENGINE == 'opal' DATA_DIR = ::File.absolute_path '../dist', %x(__dirname) else DATA_DIR = ::File.join (::File.absolute_path '../../..', __dir__), 'data' end class Style < ::Asciidoctor::Ex...
github
asciidoctor/asciidoctor-tabs
https://github.com/asciidoctor/asciidoctor-tabs
spec/spec_helper.rb
Ruby
mit
46
main
1,111
# frozen_string_literal: true case ENV['COVERAGE'] when 'deep' ENV['DEEP_COVER'] = 'true' require 'deep_cover' when 'true' require 'deep_cover/builtin_takeover' require 'simplecov' end require 'asciidoctor' require 'asciidoctor/tabs/extensions' require 'shellwords' RSpec.configure do def create_class super...
github
asciidoctor/asciidoctor-tabs
https://github.com/asciidoctor/asciidoctor-tabs
spec/tabs_spec.rb
Ruby
mit
46
main
37,063
# frozen_string_literal: true describe Asciidoctor::Tabs do let :hello_tabs do <<~'END' [tabs] ==== Hello, World!:: + You're reading text inside a tab. ==== END end let :single_tab do <<~'END' [tabs] ==== Tab A:: + Contents of tab A. ==== END end...
github
davidesantangelo/emailhunter
https://github.com/davidesantangelo/emailhunter
emailhunter.gemspec
Ruby
mit
46
master
1,635
# frozen_string_literal: true # Use require_relative to load the version file require_relative 'lib/email_hunter/version' Gem::Specification.new do |spec| spec.name = 'emailhunter' spec.version = EmailHunter::VERSION spec.authors = ['Davide Santangelo'] spec.email = ['davide.santa...
github
davidesantangelo/emailhunter
https://github.com/davidesantangelo/emailhunter
lib/email_hunter.rb
Ruby
mit
46
master
276
# frozen_string_literal: true require File.expand_path(File.join(File.dirname(__FILE__), 'email_hunter/api')) require File.expand_path(File.join(File.dirname(__FILE__), 'email_hunter/version')) module EmailHunter module_function def new(key) Api.new(key) end end
github
davidesantangelo/emailhunter
https://github.com/davidesantangelo/emailhunter
lib/email_hunter/people.rb
Ruby
mit
46
master
1,420
# frozen_string_literal: true require 'faraday' require 'json' require 'ostruct' module EmailHunter class People API_URL = 'https://api.hunter.io/v2/people/find' attr_reader :email, :key def initialize(email, key) @email = email @key = key end def hunt response_data = fetch_...
github
davidesantangelo/emailhunter
https://github.com/davidesantangelo/emailhunter
lib/email_hunter/discover.rb
Ruby
mit
46
master
1,804
# frozen_string_literal: true require 'faraday' require 'json' module EmailHunter class Discover API_URL = 'https://api.hunter.io/v2/discover' attr_reader :query, :key, :params def initialize(query, key, params = {}) @query = query @key = key @params = params end def hunt ...
github
davidesantangelo/emailhunter
https://github.com/davidesantangelo/emailhunter
lib/email_hunter/company.rb
Ruby
mit
46
master
1,433
# frozen_string_literal: true require 'faraday' require 'json' require 'ostruct' module EmailHunter class Company API_URL = 'https://api.hunter.io/v2/companies/find' attr_reader :domain, :key def initialize(domain, key) @domain = domain @key = key end def hunt response_data ...
github
davidesantangelo/emailhunter
https://github.com/davidesantangelo/emailhunter
lib/email_hunter/leads.rb
Ruby
mit
46
master
3,023
# frozen_string_literal: true require 'faraday' require 'json' require 'ostruct' module EmailHunter class Leads API_URL = 'https://api.hunter.io/v2/leads' attr_reader :key, :params, :action, :lead_id, :data def initialize(key, action: :list, lead_id: nil, data: nil, params: {}) @key = key ...
github
davidesantangelo/emailhunter
https://github.com/davidesantangelo/emailhunter
lib/email_hunter/account.rb
Ruby
mit
46
master
791
# frozen_string_literal: true require 'faraday' require 'json' module EmailHunter class Account API_URL = 'https://api.hunter.io/v2/account' attr_reader :result, :first_name, :last_name, :email, :plan_name, :plan_level, :reset_date, :team_id, :calls, :requests def initialize(key) ...
github
davidesantangelo/emailhunter
https://github.com/davidesantangelo/emailhunter
lib/email_hunter/company_enrichment.rb
Ruby
mit
46
master
1,454
# frozen_string_literal: true require 'faraday' require 'json' require 'ostruct' module EmailHunter class CompanyEnrichment API_URL = 'https://api.hunter.io/v2/companies/find' attr_reader :domain, :key def initialize(domain, key) @domain = domain @key = key end def hunt resp...
github
davidesantangelo/emailhunter
https://github.com/davidesantangelo/emailhunter
lib/email_hunter/combined_enrichment.rb
Ruby
mit
46
master
1,380
# frozen_string_literal: true require 'ostruct' require_relative 'lead_enrichment' require_relative 'company_enrichment' module EmailHunter class CombinedEnrichment attr_reader :key, :email, :linkedin def initialize(key, email: nil, linkedin: nil) @key = key @email = email @linkedin = lin...
github
davidesantangelo/emailhunter
https://github.com/davidesantangelo/emailhunter
lib/email_hunter/verify.rb
Ruby
mit
46
master
741
# frozen_string_literal: true require 'faraday' require 'json' module EmailHunter class Verify API_URL = 'https://api.hunter.io/v2/email-verifier' attr_reader :email, :key def initialize(email, key) @email = email @key = key end def hunt response_data = fetch_verify_data ...
github
davidesantangelo/emailhunter
https://github.com/davidesantangelo/emailhunter
lib/email_hunter/count.rb
Ruby
mit
46
master
698
# frozen_string_literal: true require 'faraday' require 'json' module EmailHunter class Count API_URL = 'https://api.hunter.io/v2/email-count' attr_reader :domain def initialize(domain) @domain = domain end def hunt response_data = fetch_count_data return nil if response_dat...
github
davidesantangelo/emailhunter
https://github.com/davidesantangelo/emailhunter
lib/email_hunter/finder.rb
Ruby
mit
46
master
942
# frozen_string_literal: true require 'faraday' require 'json' module EmailHunter class Finder API_FINDER_URL = 'https://api.hunter.io/v2/email-finder' attr_reader :email, :score, :sources, :domain, :meta, :key, :first_name, :last_name def initialize(domain, first_name, last_name, key) @domain =...