hexsha stringlengths 40 40 | size int64 2 1.01M | content stringlengths 2 1.01M | avg_line_length float64 1.5 100 | max_line_length int64 2 1k | alphanum_fraction float64 0.25 1 |
|---|---|---|---|---|---|
91b22b37c9cd5192858763f9da81a9d87f7452b1 | 1,685 | require 'rails_helper'
RSpec.describe NotifyBillingChanges, type: :service do
let(:organization) { create(:organization_without_groups, active_users_count: active_users_count) }
let(:active_users_initial_count) { 10 }
let(:billable_users_count) { 10 }
let(:active_users_count) { 20 }
subject(:context) do
... | 29.051724 | 101 | 0.67181 |
f7100ca4af945c9a2d128a37fa2cafa91390b363 | 1,215 | # This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# Require this file using `require "spec_helper"` to ensure that it is only
# loaded once.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
requir... | 39.193548 | 92 | 0.745679 |
ed8cfa1a5530594e64f13084a7df411e4ffc7753 | 24 | Pagy::VARS[:items] = 10
| 12 | 23 | 0.625 |
874b25a4f45a51c11269e1596be79f2e7e9bcd2b | 586 | Warden::Manager.after_authentication do |user, auth, options|
if user.respond_to?(:need_two_factor_authentication?)
if auth.session(options[:scope])[:need_two_factor_authentication] = user.need_two_factor_authentication?(auth.request)
tfa_cookie = auth.cookies.signed["tfa_token"]
unless tfa_cookie.pre... | 41.857143 | 122 | 0.749147 |
87ae2fd6cc4ffe5ce568c13f0aefae795c37a02e | 20,837 | # frozen_string_literal: true
RSpec.describe RuboCop::Cop::Layout::RescueEnsureAlignment, :config do
it 'accepts the modifier form' do
expect_no_offenses('test rescue nil')
end
context 'rescue with begin' do
it 'registers an offense' do
expect_offense(<<~RUBY)
begin
something
... | 23.46509 | 98 | 0.484427 |
1c1656219fbf8dc2ecffdc6452cdd0672804af73 | 2,491 | # frozen_string_literal: false
#
# shell/builtin-command.rb -
# $Release Version: 0.7 $
# $Revision: 65505 $
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
#
#
require_relative "filter"
class Shell
class BuiltInCommand < Filter
def wait?
false
end
def active?
true
... | 16.831081 | 68 | 0.549177 |
1a82bb9ffe03c0e45d0af5313f28719086a6e1e9 | 448 | #
class TagCounter
attr_reader :tags_count
def initialize
@tags_count = {}
end
# common_tag - used for ?
def count_tags(file, _common_tag = nil)
SourceReader.new(file).each_card do |tags, _front, _back|
register_tags(tags)
end
file.rewind
@tags_count
end
def register_tags(tag... | 16.592593 | 61 | 0.631696 |
117cbe4e467cd20b2dce5a252fd3fad4a7b1f387 | 1,646 | #
# Be sure to run `pod lib lint JSLabel.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'JSLabel'
s... | 38.27907 | 97 | 0.642163 |
1dd49bd703be300644d27c0eeca35f67a94bb34c | 570 | cask 'unity' do
version '2018.2.5f1,3071d1717b71'
sha256 '831e7109280b20f26ebe3f2562a2ea9590684afb9a38b5cabd61818328628cc7'
url "https://netstorage.unity3d.com/unity/#{version.after_comma}/MacEditorInstaller/Unity.pkg"
appcast 'https://unity3d.com/get-unity/download/archive'
name 'Unity Editor'
homepage 'h... | 33.529412 | 96 | 0.712281 |
7970c462d36fb0adc510b115aff3a21ee9836a2a | 8,221 | class UserMailer < ApplicationMailer
def welcome(user)
if user.email.present?
mail({to: user.email, subject: "Thank you for registering."}) do |format|
format.text
end
end
end
def plan_shopping_completed(user, hbx_enrollment, plan_decorator)
if user.email.present?
mail({to:... | 50.746914 | 193 | 0.720107 |
bfc36538a1553de05b342b99e123ebac161ed13f | 418 | ###
# Copyright (c) 2015, Upnext Technologies Sp. z o.o.
# All rights reserved.
#
# This source code is licensed under the BSD 3-Clause License found in the
# LICENSE.txt file in the root directory of this source tree.
###
class AddCorrelationIdToUsers < ActiveRecord::Migration
def change
add_column :admins, ... | 27.866667 | 74 | 0.729665 |
f72d2696f741f107b16aac87132e2cfc052d0088 | 842 | module Wor
module Paginate
module Adapters
class Base
attr_reader :page
def initialize(content, page, limit)
@content = content
@page = page.to_i
@limit = limit.to_i
raise Wor::Paginate::Exceptions::InvalidPageNumber if @page <= 0
raise Wor:... | 25.515152 | 91 | 0.602138 |
bb1ba3c2e039efe2a4b913c52fbacba1fea5ec15 | 550 | require 'test_helper'
class UserMailerTest < ActionMailer::TestCase
test "account_activation" do
user = users(:michael)
user.activation_token = User.new_token
mail = UserMailer.account_activation(user)
assert_equal "Account activation", mail.subject
assert_equal [user.email], mail.to
assert_e... | 34.375 | 59 | 0.732727 |
9148f5275b6fdae4e6ef5249d972d2634ba12490 | 139 | module ApplicationHelper
def render_errors_for(item)
render partial: 'layouts/shared/form_errors', locals: { item: item }
end
end
| 19.857143 | 72 | 0.748201 |
184b5f42ff8fa3ac6609ce114e6dfedff4bb86f0 | 3,378 | # == Schema Information
#
# Table name: inwork
#
# fnavgwkhrs :decimal(6, 2) default(0.0), not null
# fcpro_id :string(7) default(""), not null, primary key
# fcpro_name :string(16) default(""), not null
# fccomments :string(54) default(""), not null
# fdept ... | 39.741176 | 72 | 0.551214 |
f76fd8f9ab1919b3e4af04f0eecea3229567687a | 531 | module Arboreta
class Statement
attr_accessor :comparison, :subject, :left_method, :right_method
def initialize(args)
@comparison = args['comparison']
@subject = args['subject']
@left_method = args['left_method']
@right_method = args['right_method']
end
def execute!
Arb... | 20.423077 | 72 | 0.661017 |
4a04fa270c2077172ac9a1675368257860912a1e | 6,148 | class ApplicationController < ActionController::Base
protect_from_forgery
helper :pagination
before_filter :reset_current_user
before_filter :set_current_user
after_filter :reset_current_user
before_filter :set_title
before_filter :normalize_search
before_filter :set_started_at_session
before_filter :... | 29.84466 | 224 | 0.657775 |
380e788f16e9ef399f18d1ff5853fff7e1af2199 | 1,819 | =begin
#SendinBlue API
#SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/or... | 43.309524 | 839 | 0.698186 |
5d940c27dc1ced52f426ae22f35908cf1ac595f9 | 504 | # frozen_string_literal: true
require "rails_helper"
RSpec.describe ExampleService, type: :service do
describe "#execute" do
it "returns a ServiceResult" do
service = ExampleService.new("Hello, world!")
result = service.execute
expect(result).to be_a(ServiceResult)
end
it "transforms... | 22.909091 | 51 | 0.684524 |
e24ae91228c4de73e98e1eb270cb1004a0db282c | 427 | class FormFieldBuilder::LabelOnly < FormFieldBuilder::Decorated
def form_field name_for_key, content, css_class, options={ }
defaults = { required: false, id: nil }
options = defaults.merge(options)
label_node = build_label_node name_for_key, options
"<#{tag} class='#{css_class}'>#{label_node}</#{tag}... | 32.846154 | 67 | 0.690867 |
ed59bb98cfc3f66cb050f7a04b7938600bd976ad | 146 | require_relative './collection'
require_relative './digestable_notification'
module Trubl
class DigestableNotifications < Collection
end
end | 18.25 | 44 | 0.821918 |
286b3b999f0f2dfba071a97df79f77385a58b04f | 1,203 | class Goreleaser < Formula
desc "Deliver Go binaries as fast and easily as possible"
homepage "https://goreleaser.com/"
url "https://github.com/goreleaser/goreleaser/archive/v0.93.1.tar.gz"
sha256 "cdb339ced74dc25513e6533e5ec385f41d7b542c57a86ce9d2cc7e1b5c51e8f9"
bottle do
cellar :any_skip_relocation
... | 37.59375 | 93 | 0.738986 |
f76776437189cb658a9f659494556e6d8b1c05e6 | 32 | class Warehouse < Account
end
| 10.666667 | 26 | 0.75 |
4a267d9f31ca21752b2e5618afb11db52dfc820a | 1,258 | require 'segment/analytics'
module Cartodb
# Development info: https://segment.com/docs/libraries/ruby/quickstart
class SegmentTracker
def initialize
@api_key = Cartodb.config[:segment]['api_key']
@analytics = Segment::Analytics.new(write_key: @api_key)
end
def enabled?
!@api_key.bl... | 29.255814 | 115 | 0.504769 |
6a252269946a5c90e97644a447e1c2880e186fe5 | 179 | class AddTimestampsToChanges < ActiveRecord::Migration[5.0]
def change
add_column :changes, :created_at, :datetime
add_column :changes, :updated_at, :datetime
end
end
| 25.571429 | 59 | 0.75419 |
3345845a1710ffa2402108351776b99d5781f648 | 3,247 | module Fastlane
module Actions
class PodPushAction < Action
def self.run(params)
if params[:repo]
repo = params[:repo]
command = "pod repo push #{repo}"
else
command = 'pod trunk push'
end
if params[:path]
command << " '#{params[:path]... | 34.913978 | 155 | 0.440407 |
79c6bfe3fc7e8791e7be555c6d6cdc4c72c49100 | 649 | require 'spec_helper_system'
describe "installation tasks" do
let(:test_path) do
proj_root + 'spec' + 'fixtures' + 'mymodule'
end
it "check puppet_install works" do
puppet_install()
end
it 'check puppet_master_install works' do
puppet_master_install()
puppet_module_install(:source => test... | 20.935484 | 75 | 0.64869 |
4aaf1b544dc54ed0e9fc6ea980760610c9194f12 | 187 | module GoogleSignIn::UrlHelper
def callback_url
GoogleSignIn::Engine.routes.url_helpers.callback_url(
host: request.host_with_port, protocol: request.protocol
)
end
end
| 23.375 | 62 | 0.764706 |
037300db7c40c963f8a2990e05d20497511e3379 | 184 | class UserSerializer
def initialize(user_object)
@user = user_object
end
def to_serialized_json
@user.to_json(:except => [:password_digest, :created_at, :updated_at])
end
end | 18.4 | 72 | 0.76087 |
f77475004f8f32fd75ef3cb815e1e1fff3c7d3b6 | 123 | class Farm < ApplicationRecord
belongs_to :owner
has_one :housing
has_one :food
has_one :bird
has_one :breed
end
| 15.375 | 30 | 0.747967 |
61278e5e6c531524e611f082c8e595617477b5a1 | 630 | require 'router'
module Shig
class Web
module Dispatcher
attr_accessor :router
attr_accessor :base_module_path
def _router
self.router ||= Router.new
end
def connect(path, dest)
self._router.add(path, dest)
end
def base(module_path)
self.base_... | 17.5 | 71 | 0.566667 |
116da6e971b1681f116d9c3553f4895fcdc62b8f | 1,543 | # encoding: UTF-8
class Cabocha < Formula
desc "Yet Another Japanese Dependency Structure Analyzer"
homepage "https://taku910.github.io/cabocha/"
url "https://googledrive.com/host/0B4y35FiV1wh7cGRCUUJHVTNJRnM/cabocha-0.69.tar.bz2"
sha1 "9196098628c5d1f0b83b371a03352b6652c04001"
bottle do
sha1 "c6d6a98de... | 29.113208 | 86 | 0.690214 |
03e36fd35524ab596b9778cfd84c6434e40b6c6d | 1,779 | require 'spec_helper'
require 'nokogiri'
module Gitlab
describe Asciidoc do
let(:input) { '<b>ascii</b>' }
let(:context) { {} }
let(:html) { 'H<sub>2</sub>O' }
context "without project" do
it "should convert the input using Asciidoctor and default options" do
expected_asciidoc_opts =... | 26.954545 | 79 | 0.609331 |
e87e3066802ea2c6677aac0e6457f21cc56bc9bf | 4,350 | # frozen_string_literal: true
module EE
# CI::JobArtifact EE mixin
#
# This module is intended to encapsulate EE-specific model logic
# and be prepended in the `Ci::JobArtifact` model
module Ci::JobArtifact
include ::Gitlab::Utils::StrongMemoize
extend ActiveSupport::Concern
SECURITY_REPORT_FILE... | 36.25 | 161 | 0.731724 |
ff5e1d3bacfa51ab3830078720b6ef8ce4aa1685 | 1,096 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/google_ads/v0/enums/ad_customizer_placeholder_field.proto
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "google.ads.googleads.v0.enums.AdCustomizerPlaceholderFieldEnum" do
end
add_enu... | 35.354839 | 235 | 0.77646 |
bff442b7134394a183a719baf2e678a5a910b019 | 5,398 | #
# Be sure to run `pod spec lint PFPageControl.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see https://guides.cocoapods.org/syntax/podspec.html
# To see working Podspecs in the CocoaPods repo see https://... | 38.557143 | 155 | 0.608559 |
38af2787c133cfebdec58ed2c2496208fe2227ea | 464 | class AccountActivationsController < ApplicationController
def edit
user = User.find_by(email: params[:email])
if user && !user.activated? && user.authenticated?(:activation, params[:id])
user.activate
log_in user
flash[:success] = "Account activated!"
... | 30.933333 | 84 | 0.592672 |
ab6028d984b85ed541f175e593fedb4ad2edebfb | 1,707 | # frozen_string_literal: true
module Operations
# {Liability} is a balance sheet operation
class Liability < Operation
belongs_to :member
validates :member_id, presence: {
if: ->(liability) { liability.account.scope == 'member' }
}
validates :member_id, absence: {
if: ->(liability) { ... | 29.947368 | 86 | 0.611013 |
fffd3b4ba634bdf6661b0b0b9935a62d321031d0 | 1,121 | =begin
#ORY Keto
#A cloud native access control server providing best-practice patterns (RBAC, ABAC, ACL, AWS IAM Policies, Kubernetes Roles, ...) via REST APIs.
The version of the OpenAPI document: v0.0.0-alpha.1
Contact: hi@ory.sh
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.2.2
=end
... | 26.690476 | 144 | 0.749331 |
11484423349afca0567b7ef4ff225e73de5364f6 | 641 | cask 'jaxx' do
version '1.3.9'
sha256 '0e1756d95c68e7d44e4faeba916ba27608584692dd2f67f89aa19d73c5109e05'
# github.com/Jaxx-io/Jaxx was verified as official when first introduced to the cask
url "https://github.com/Jaxx-io/Jaxx/releases/download/v#{version}/Jaxx-#{version}.dmg"
appcast 'https://github.com/Jax... | 33.736842 | 89 | 0.698908 |
b9305fc55a1cfae6bf9fefeba477a1b9dd6c8602 | 121 | class RemoveResumeFromPeople < ActiveRecord::Migration
def change
remove_column :people, :resume, :string
end
end | 24.2 | 54 | 0.77686 |
e24c8a7cef89371c7a37177062abcaee38bfa0c0 | 3,131 | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# This cop enforces consistency when using exponential notation
# for numbers in the code (eg 1.2e4). Different styles are supported:
# - `scientific` which enforces a mantissa between 1 (inclusive)
# and ... | 26.091667 | 76 | 0.499521 |
f7b24433c00493c0f83eda443ad85180524a28c2 | 5,097 | require 'simplecov'
# run coverage when on CI
if ENV['CI']
SimpleCov.start 'rails' do
add_filter '/spec/'
end
end
require 'rubygems'
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path('../config/environment', __dir__)
require 'rspec/... | 31.079268 | 118 | 0.739455 |
1c169e0bb6b3d23dfab193cdbbaac49206109325 | 133 | class AddCurrentPlanToAccount < ActiveRecord::Migration[6.1]
def change
add_column :accounts, :current_plan, :string
end
end
| 22.166667 | 60 | 0.766917 |
61cc1fc3827796b81be94e3ddf36b354968fe3ef | 1,414 | class I386ElfGdb < Formula
desc "GNU debugger for i386-elf cross development"
homepage "https://www.gnu.org/software/gdb/"
url "https://ftp.gnu.org/gnu/gdb/gdb-9.2.tar.xz"
mirror "https://ftpmirror.gnu.org/gdb/gdb-9.2.tar.xz"
sha256 "360cd7ae79b776988e89d8f9a01c985d0b1fa21c767a4295e5f88cb49175c555"
license ... | 28.857143 | 93 | 0.698727 |
114eabacbb229bfe5742450a51d456ee819fbf4a | 371 | cask 'retrobatch' do
version '1.1'
sha256 '22da92a29b4ba4e7cecc3e381b1bf3bc1f753b594ea62bcc5dc507892977d552'
url 'https://flyingmeat.com/download/Retrobatch.zip'
appcast "https://www.flyingmeat.com/download/retrobatch#{version.major}update.xml"
name 'Retrobatch'
homepage 'https://flyingmeat.com/retrobatch/... | 26.5 | 84 | 0.778976 |
1a041a7a697fe680a0a21ee215f278a6f3f5231d | 4,546 | cask "microsoft-office" do
version "16.44.20121301"
sha256 "da1848641fcb8496715d1153ac5398f0cd7303324bb72e6dc568f373f2e4bb34"
url "https://officecdn-microsoft-com.akamaized.net/pr/C1297A47-86C4-4C1F-97FA-950631F94777/MacAutoupdate/Microsoft_Office_#{version}_Installer.pkg",
verified: "officecdn-microsoft-c... | 47.852632 | 150 | 0.721073 |
6185fd266690e7f7157d78dd4e2b7e316f1e494e | 454 | require 'dldinternet/doctl/api/compute'
module DLDInternet
module DOctl
module Compute
module DropletAction
module Rebuild
class Command < DLDInternet::Thor::Command
no_commands do
require 'dldinternet/doctl/compute/droplet-action/rebuild/mixins/no_commands'
inclu... | 21.619048 | 91 | 0.676211 |
26b8673655de9584e80e347447d00f0d94ce5714 | 594 | # encoding: utf-8
# frozen_string_literal: true
module Mail
class ContentDispositionElement # :nodoc:
include Mail::Utilities
def initialize( string )
content_disposition = Mail::Parsers::ContentDispositionParser.new.parse(cleaned(string))
@disposition_type = content_disposition.disposit... | 21.214286 | 94 | 0.659933 |
11599810f0ef883df065da663475b4e49cbde454 | 700 | require 'httparty'
require 'highline/import'
#
class Egi::Fedcloud::Cloudhound::Connector
include HTTParty
#
def initialize(opts = {}, password = nil)
Egi::Fedcloud::Cloudhound::Log.debug "[#{self.class}] Initializing with #{opts.inspect}"
self.class.pem File.read(opts[:credentials]), password
self... | 26.923077 | 108 | 0.688571 |
03801fe178ec289598177fcb40c89e043cc0a80f | 2,191 | # frozen_string_literal: true
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
depends_on :authentication, :errors, :feature_flags
before_action :authenticate_use... | 31.753623 | 106 | 0.735737 |
3341df8d829ceb507aac652d40d05a312ace5676 | 13,448 | module Vanity
module Rails
def self.load!
Vanity.playground.load_path = ::Rails.root + Vanity.playground.load_path
Vanity.playground.logger ||= ::Rails.logger
# Do this at the very end of initialization, allowing you to change
# connection adapter, turn collection on/off, etc.
::Rai... | 36.053619 | 193 | 0.62039 |
e91fb24597b7d713bd3aeb33a54e9216702b6f70 | 307 | require 'api_hammer/rails/halt'
require 'api_hammer/rails/check_required_params'
require 'api_hammer/rails/unmunged_request_params'
module ApiHammer
module Rails
def self.included(klass)
(@on_included || []).each do |included_proc|
included_proc.call(klass)
end
end
end
end
| 21.928571 | 50 | 0.729642 |
33bc732628681fddd13c11cf23930235fffef35f | 367 | # frozen_string_literal: true
module Thredded
# Defines a moderation_state enum
# Requires an integer moderation_state column on the including class.
module ModerationState
extend ActiveSupport::Concern
included do
enum moderation_state: %i(pending_moderation approved blocked)
validates :mode... | 26.214286 | 71 | 0.768392 |
18dc8e9f3a00c30a9cdad40cfa161bf8396e010e | 389 | class CreateOfferingMentorQuestions < ActiveRecord::Migration
def self.up
create_table :offering_mentor_questions do |t|
t.integer :offering_id
t.text :question
t.boolean :required
t.boolean :must_be_number
t.string :display_as
t.integer :size
t.timestamps
end
end
... | 20.473684 | 61 | 0.699229 |
f7c43f750805750ad09f30fa5bdaeafc9d11fb42 | 649 | require_relative './sas_data'
class RubyOlm::SAS
METHODS = %i[decimal emoji]
def generate(method, info)
method = method.to_sym
raise ArgumentError, "Unknown SAS method: #{method}" unless METHODS.include? method
send method, info
end
protected
def decimal(info)
bytes = generate_bytes(5, in... | 22.37931 | 87 | 0.66718 |
ab315bdfeaab0fdd0d6eb7beb13947a4f4ca0577 | 40 | module Agentify
VERSION = "0.1.0"
end
| 10 | 19 | 0.675 |
6ab8a0d91e1f8e31d8152acad7edeef2622e1db3 | 122 | require 'test_helper'
class AssigneeTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 15.25 | 44 | 0.704918 |
abbb0b99644db34a98efd53b46fccc1b90e1ee3b | 1,817 | # frozen_string_literal: true
class ApplicationController < ActionController::API
class AuthError < StandardError; end
before_action :authenticate, :authenticate!
attr_reader :current_user
rescue_from AuthError, with: :handle_access_denied
rescue_from ActiveRecord::RecordInvalid, with: :handle_invalid_reco... | 31.877193 | 85 | 0.729224 |
2634152bf42a68cd1e730fd34675811cde7b03d9 | 1,632 | require 'spec_helper'
describe Anvil::Cli do
# before {FakeFS.deactivate!}
describe '#run' do
let(:dummy_task) { DummyTask }
let(:argv) { %w[dummy arg1 arg2 --argument value] }
context 'with a task name' do
before do
expect(dummy_task).to receive(:new)
.with('arg1', 'arg2... | 29.672727 | 77 | 0.598652 |
f756a23bdd1ce9dacba18914b8c8fb636fff3495 | 189 | RSpec.describe GemChallenge do
it "has a version number" do
expect(GemChallenge::VERSION).not_to be nil
end
it "does something useful" do
expect(false).to eq(true)
end
end
| 18.9 | 47 | 0.714286 |
ab60e47adc8e7d0b539a286eb9a7a534b89fd182 | 333 | # frozen_string_literal: true
module Root
module Factions
module Mice
# Bases for cats, they get 3 bases and this handles their operations
class Base < Pieces::Building
include Miceable
attr_reader :suit
def initialize(suit)
@suit = suit
end
end
e... | 17.526316 | 74 | 0.618619 |
edaf55fbda7260e7f3bed13ad15ce5f290187f42 | 281 | module Caboose
class ShippingPackageMethod < ActiveRecord::Base
self.table_name = 'store_shipping_package_methods'
belongs_to :shipping_package
belongs_to :shipping_method
attr_accessible :id,
:shipping_package_id,
:shipping_method_id
end
end
| 21.615385 | 54 | 0.747331 |
e8d89f8428dae05dab0d91b84d3e9212b116aab6 | 2,146 | # -*- encoding: utf-8 -*-
# stub: jaro_winkler 1.5.1 ruby lib
# stub: ext/jaro_winkler/extconf.rb
Gem::Specification.new do |s|
s.name = "jaro_winkler".freeze
s.version = "1.5.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["... | 47.688889 | 351 | 0.681733 |
ed31299a0e553a0443934a559a228f09bfd49a59 | 121 | class AddActiveToResources < ActiveRecord::Migration
def change
add_column :resources, :active, :boolean
end
end
| 20.166667 | 52 | 0.768595 |
bb4332aca0b86ac6a67c4baf67153f9b6ab30ab8 | 1,221 | class Zssh < Formula
desc "Interactive file transfers over SSH"
homepage "https://zssh.sourceforge.io/"
url "https://downloads.sourceforge.net/project/zssh/zssh/1.5/zssh-1.5c.tgz"
sha256 "a2e840f82590690d27ea1ea1141af509ee34681fede897e58ae8d354701ce71b"
bottle do
cellar :any_skip_relocation
sha256 "0... | 42.103448 | 95 | 0.776413 |
01ac84ff7dfe037eb5ac1341cbfaf03d2384e832 | 250 | require 'spec_helper'
describe Canaid do
it 'has a version number' do
expect(Canaid::VERSION).not_to be nil
end
describe 'configuration' do
it 'has configuration' do
expect(Canaid::Configuration).not_to be nil
end
end
end | 17.857143 | 49 | 0.704 |
3838a5951512c23402e55fe5951ddf96cfbd8713 | 1,520 | class PasswordResetsController < ApplicationController
before_action :get_user, only: [:edit, :update]
before_action :valid_user, only: [:edit, :update]
before_action :check_expiration, only: [:edit, :update]
def new
end
def create
@user = User.find_by(email: params[:password_reset][:email].downcase)
... | 23.384615 | 73 | 0.669737 |
1a06acd1b02be2a879dac46099f66d937ce91559 | 271 | # frozen_string_literal: true
FactoryBot.define do
factory :repository_git_extra do
git_http { 0 }
default_branch { 'master' }
association :repository, factory: :repository_gitolite
key { RedmineGitHosting::Utils::Crypto.generate_secret 64 }
end
end
| 24.636364 | 63 | 0.745387 |
d5f0490058ecd65a2b1d8363b53d9bfdc7e881f0 | 1,899 | class OauthController < ApplicationController
before_filter :login_required, :except => [:request_token, :access_token, :test_request]
before_filter :login_or_oauth_required, :only => [:test_request]
before_filter :verify_oauth_consumer_signature, :only => [:request_token]
before_filter :verify_oauth_request_to... | 30.142857 | 90 | 0.663507 |
627d5f73ec59ba47d90c67a8c0a312478d7fc5b1 | 441 | class User < ApplicationRecord
before_save { email.downcase! }
validates :name, presence: true,length: { maximum: 50 }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, length: { maximum: 255 },
format: { with: VALID_EMAIL_REGEX },
uniqueness: { c... | 29.4 | 62 | 0.632653 |
188e6791504d5803b5639096dc004322a53b5d27 | 793 | class MatchController < ApplicationController
def artworks
query = params.require(:query)
response = ArtworkSearchService.call(query: query)
render json: response
end
def genes
term = params.require(:term)
genes = Gene.match term: term, size: 5
render json: genes
end
def tags
ter... | 20.868421 | 54 | 0.664565 |
d59448735ade41d7d8acb155031d8f0bbf425ee4 | 2,175 | class Ccache < Formula
desc "Object-file caching compiler wrapper"
homepage "https://ccache.dev/"
url "https://github.com/ccache/ccache/releases/download/v3.7.1/ccache-3.7.1.tar.xz"
sha256 "66fc121a2a33968f9ec428e02f48ff4b8896fbabb759e9c09352267014dcbe65"
bottle do
cellar :any_skip_relocation
sha256 ... | 33.461538 | 117 | 0.661609 |
f7dbe963bc37c1c0e5ff1edc37e85f13116d6a9d | 135 | # Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_Wld_session'
| 33.75 | 73 | 0.8 |
ac1dc5823437920973518562ee030b0d905851b5 | 461 | class User < ApplicationRecord
has_many :courses
has_many :enrollments
has_many :enrolled_courses, through: :enrollments, source: :course
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
... | 28.8125 | 68 | 0.759219 |
33634c606fa9a7696cc165858e6913e51fe707ad | 140 | class Product < ApplicationRecord
attribute :quantity, :integer, default: 1
validates :quantity, presence: true
has_many :orders
end
| 20 | 43 | 0.764286 |
21e8299b3ff43231548f4c6b63c7a27175a77886 | 524 | # encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require(:default, Rails.env) if defined?(Bundler)
module RpmTestApp
... | 27.578947 | 93 | 0.746183 |
f70b58483aea9497180938c231147aa678fdee85 | 488 | name 'trusted_certificate'
maintainer 'Chef Software, Inc.'
maintainer_email 'cookbooks@chef.io'
license 'Apache-2.0'
description 'Manages adding certificates to the OS trust store'
version '3.3.0'
%w(ubuntu debian redhat centos suse opensuse opensuseleap scientific oracle amazon zlinux).each do |os|
supports os
en... | 30.5 | 103 | 0.797131 |
1ad776c5219902e7bd156867462675de72249987 | 1,268 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
Gem::Specification.new do |spec|
spec.name = 'aws-sdk-s3'
spec.vers... | 38.424242 | 135 | 0.660095 |
5db86652f669edb7548fefc006cf8e8123acfd29 | 913 | # ------------------------------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------------------------------
class DaprCliAT100Rc5 < Formula
desc "Client for Dapr."
homepage "https://dapr.io"
version '1.0.0-rc.5'
url "htt... | 30.433333 | 115 | 0.611172 |
aca3f5a3b5e056feccf2c3c76374265786c75240 | 1,071 | require 'formula'
class ErlangInstalled < Requirement
fatal true
default_formula 'erlang'
env :userpaths
satisfy {
erl = which('erl') and begin
`#{erl} -noshell -eval 'io:fwrite("~s~n", [erlang:system_info(otp_release)]).' -s erlang halt | grep -q '^R1[6789]'`
$?.exitstatus == 0
end
}
... | 21.42 | 122 | 0.644258 |
b98c6f7a0ee8a0a4b157ef5cc88efcd7b7dc342f | 1,267 | # -*- encoding: utf-8 -*-
require File.expand_path("../lib/resque_scheduler/version", __FILE__)
Gem::Specification.new do |s|
s.name = "resque-mongo-scheduler"
s.version = ResqueScheduler::Version
s.platform = Gem::Platform::RUBY
s.authors = ['Ben VandenBos', 'Nicolas Fouché']
s.email ... | 42.233333 | 91 | 0.657459 |
acabd74895abbcc4d99a710ccfd69d532dbd849b | 142 | class AddTimezoneToUserPreferences < ActiveRecord::Migration[5.1]
def change
add_column :user_preferences, :timezone, :string
end
end
| 23.666667 | 65 | 0.78169 |
e9c759aa50f875946da608cb24e8268cbc1e6ce8 | 584 | # frozen_string_literal: true
require 'test_helper'
require 'compeon/rack_tools/pipes/parse_env'
module Compeon
module RackTools
module Pipes
class ParseEnvTest < Minitest::Test
def env
Rack::MockRequest.env_for('', input: 'foobar', method: 'POST')
end
def test_parser
... | 22.461538 | 72 | 0.648973 |
330bff64f42cf8ec38c34375ba3c544f62879380 | 1,699 | require 'rails_helper'
RSpec.feature 'Admin users can' do
context 'when there are suppliers' do
before do
FactoryBot.create(:supplier, name: 'First Supplier')
FactoryBot.create_list(:supplier, 24)
FactoryBot.create(:supplier, name: 'Last Supplier')
sign_in_as_admin
end
scenario '... | 30.890909 | 78 | 0.683932 |
26b7d49893840700d1186916d162b4627bcd5e41 | 1,954 | # frozen_string_literal: true
RSpec.describe Qbert::Client do
let(:client) { double(send_message: {}, receive_message: {}, delete_message: {}) }
let(:queue_url) { "thisisaqurl" }
subject { Qbert::Client.new }
before do
Qbert.configure { |config| config.queue_url = queue_url }
allow(Aws::SQS::Client).... | 31.516129 | 96 | 0.69652 |
1c7d708f2147e2939cff2b8a9be6c0605cdaf4fc | 1,581 | # Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 38.560976 | 80 | 0.745731 |
61d46a58036f158374da6abfa3a34d9d553892a6 | 381 | class Clock
def initialize(hour, minute)
@hour = (hour + minute / 60) % 24
@minute = minute % 60
end
def self.at(hour, minute)
new(hour, minute)
end
def to_s
format('%02d:%02d', @hour, @minute)
end
def +(other)
self.class.new(@hour, @minute + other)
end
def ==(other)
to_s =... | 14.111111 | 42 | 0.598425 |
62a7b7e459e1a8e79a274ccb13e13221633b4f1c | 1,857 | # frozen_string_literal: true
class Tag < ApplicationRecord
belongs_to :blog
has_and_belongs_to_many :contents, order: "created_at DESC"
validates :name, uniqueness: { scope: :blog_id }
validates :blog, presence: true
validates :name, presence: true
before_validation :ensure_naming_conventions
attr_ac... | 25.791667 | 89 | 0.662897 |
391fab15aeba4faa7ba2bdf14573db1321e5dc1c | 153 | class CreateUsers < ActiveRecord::Migration[5.2]
def change
create_table :users do |t|
t.string :username
end
end
end | 21.857143 | 48 | 0.601307 |
6acfa8346d2f9e2bc96878e908ba9f9889ab5b67 | 317 | # Copyright 2011-2012 Rice University. Licensed under the Affero General Public
# License version 3 or later. See the COPYRIGHT file for details.
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :assignment_plan_topic do
assignment_plan
topic
end
end
| 26.416667 | 80 | 0.782334 |
08727ef5077093c57efccdca69c388d567d7b806 | 90 | class CardUserSerializer < ActiveModel::Serializer
attributes :id, :count, :card_id
end
| 22.5 | 50 | 0.788889 |
7aab86cafa4bb0f317852b227d26a3451f98cbe8 | 170 | #require Rails.root.join('app/controllers/errors_controller.rb')
#Rails.application.configure do
# config.exceptions_app = ErrorsController.action(:exceptions_app)
#end
| 34 | 67 | 0.817647 |
79cbc7fd5180d05888aed9afced7e49c93a3d5fe | 907 | ENV['RAILS_ENV'] ||= 'test'
require_relative '../config/environment'
require 'rails/test_help'
require "minitest/reporters"
Minitest::Reporters.use!
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
include ApplicationHelper
# Add more... | 27.484848 | 82 | 0.657111 |
62bf7a78906787f164f01c113cdb6291019c1250 | 356 | class CreateRestaurants < ActiveRecord::Migration[6.0]
def change
create_table :restaurants do |t|
t.string :name
t.text :address
t.boolean :carryout
t.boolean :outdoor_dining
t.boolean :indoor_dining
t.boolean :follows_rules
t.belongs_to :author, :class_name => "User"
... | 22.25 | 54 | 0.657303 |
d51214bacac0111f831ffbdff7025de1070e31de | 3,737 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core/auxiliary/jtr'
class MetasploitModule < Msf::Auxiliary
include Msf::Auxiliary::JohnTheRipper
def initialize
super(
'Name' => 'John the Rip... | 33.366071 | 116 | 0.670591 |
d5fdd0fde14de3655717ee09f24b37567dc8a7e9 | 7,231 | =begin
#Hydrogen Nucleus API
#The Hydrogen Nucleus API
OpenAPI spec version: 1.9.5
Contact: info@hydrogenplatform.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.19
=end
require 'date'
module NucleusApi
# Page Object
class PagePortfolioTransaction
attr_acce... | 27.811538 | 107 | 0.598949 |
f853bb1a45550e426ff2509311b3d37029fef368 | 505 | require_relative "InfoLogger"
require_relative "WarningLogger"
require_relative "ErrorLogger"
require_relative "LoggerType"
class LoggerFactory
def create(type)
case type
when LoggerType::InfoLoggerType
return InfoLogger.new
when LoggerType::WarningLoggerType
... | 26.578947 | 46 | 0.629703 |
282239f28bba4471a89a46a7e6e0b4592446bdf0 | 152 | # frozen_string_literal: true
class ExtensionColocatedTask < ColocatedTask
def self.label
Constants.CO_LOCATED_ADMIN_ACTIONS.extension
end
end
| 19 | 48 | 0.822368 |
9158634afa4c7d30f9084e6cf3b10b7072ba0f0e | 6,158 | # frozen_string_literal: true
module RuboCop
module Cop
module Style
#
# This cop looks for uses of Perl-style global variables.
#
# @example EnforcedStyle: use_english_names (default)
# # good
# puts $LOAD_PATH
# puts $LOADED_FEATURES
# puts $PROGRAM_NAME
... | 29.605769 | 94 | 0.501949 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.