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 |
|---|---|---|---|---|---|
ab848e5bef866d9a19fbc31c7370b71294a467aa | 1,300 | oneGB = 1 * 1000 * 1000 # in KB
$testbed = Proc.new do
{
"name" => "vic-iscsi-cluster",
"version" => 3,
"esx" => (0..1).map do | idx |
{
"name" => "esx.#{idx}",
"vc" => "vc.0",
'cpus' => 8,
'cpuReservation' => 2400,
"style" => "fullInstall",
"desired... | 23.636364 | 101 | 0.437692 |
aca02bf4810bec7bb30011913bef97d737dd3c8c | 1,075 | # This migration comes from alchemy (originally 20160927205604)
class AddForeignKeyIndicesAndNullConstraints < ActiveRecord::Migration[4.2]
def change
change_column_null :alchemy_cells, :page_id, false, 0
change_column_null :alchemy_contents, :element_id, false, 0
change_column_null :alchemy_contents, :es... | 48.863636 | 86 | 0.782326 |
0892da26d1fe986249457d79694fbdfa970494ef | 1,189 | module RockRMS
class Error < StandardError; end
class BadRequest < Error; end
class Forbidden < Error; end
class GatewayTimeout < Error; end
class InternalServerError < Error; end
class NotFound < Error; end
class ServiceUnavailable < Error; end
class Unauthorized < Error; end
end
require 'faraday'
mod... | 26.422222 | 62 | 0.679563 |
620ed3f1d5fbf3dd83dd3ede5a6befbd11c382e4 | 1,753 | # Encoding: BINARY
require 'spec_helper'
require 'zippo'
module Zippo
describe ZipFile do
let(:file) { test_file "test.zip" }
let(:member_data) { "The quick brown fox jumps over the lazy dog.\n" }
let(:zip) { Zippo::ZipFile.open(file) }
describe "when reading a zip file" do
after(:each) do
... | 30.754386 | 80 | 0.559042 |
38bffd4b849043313ba99cfea42367674f0c93d4 | 18,908 | require 'test_helper'
# Clase para probar el modelo "ConclusionFinalReview"
class ConclusionFinalReviewTest < ActiveSupport::TestCase
fixtures :conclusion_reviews
# Función para inicializar las variables utilizadas en las pruebas
setup do
@conclusion_review = ConclusionFinalReview.find(
conclusion_rev... | 36.501931 | 109 | 0.687857 |
4a39b8c0d4c66e6f31619585667345ff61d6eddc | 852 | require_relative 'generic'
require_relative '../data'
module Discordrb::Events
# Raised when a role is created on a server
class GuildRoleCreateEvent
attr_reader :role, :server
def initialize(data, bot)
@server = bot.server(data['guild_id'].to_i)
return unless @server
role_id = data['ro... | 23.666667 | 61 | 0.61385 |
d5fb747c51343ee635701d6ddde706a03912d81a | 294 | require 'spec_helper'
RSpec.describe Methodist do
it { expect(Methodist).to be_instance_of(Module) }
it { expect(Methodist::Interactor).to be_instance_of(Class) }
it { expect(Methodist::Observer).to be_instance_of(Class) }
it { expect(Methodist::Builder).to be_instance_of(Class) }
end | 36.75 | 63 | 0.758503 |
03a567f98fb388e6dab59e5426c8daea2b641788 | 92 | class AdminController < ApplicationController
layout "admin"
def index
end
end
| 10.222222 | 45 | 0.717391 |
e2b367c4d53c3b5b35718bc06042ef5055f1757c | 1,459 | # frozen_string_literal: true
module PipelineSteps
module Singularity
class Builder
def initialize(pipeline, name, parameter_values, parameters = [])
@pipeline = pipeline
@name = name
@parameter_values = safe_parameter_values(parameter_values, parameters)
@parameters = param... | 31.042553 | 98 | 0.629198 |
e8944c96985193d82713e8718dce1b500ec962a1 | 1,466 | class PostsController < ApplicationController
before_action :set_post, only: [:show, :edit, :update, :destroy]
# GET /posts
def index
@posts = Post.all
@view = view(Post::Index)
@view.populate(@posts, Post::Show)
end
# GET /posts/1
def show
@view = view(Post::Show)
@view.populate(@po... | 17.878049 | 73 | 0.623465 |
7afa3df4dd1554aa7517e0b8f0e03b435bce02a2 | 1,788 | module DeviseGoogleAuthenticator::Patches
# patch Sessions controller to check that the OTP is accurate
module CheckGA
extend ActiveSupport::Concern
included do
# here the patch
alias_method :create_original, :create
define_method :checkga_resource_path_name do |resource, id|
name ... | 44.7 | 157 | 0.705257 |
117040e117c48baa49d16287c8df36405fa9575f | 1,079 | class UsersController < ApplicationController
enable :sessions
get '/signup' do
if !logged_in?
erb :'users/signup'
else
redirect to "/tweets"
end
end
get '/login' do
if logged_in?
redirect to "/tweets"
else
erb :... | 22.020408 | 85 | 0.506951 |
21cdfec18f02276ed90cf39ee0712b5c951fb5a4 | 241 | require 'rails_helper'
RSpec.describe Statistic::BroadcastsController, type: :controller do
describe 'GET #index' do
it 'returns http success' do
get :index
expect(response).to have_http_status(:success)
end
end
end
| 21.909091 | 68 | 0.717842 |
2184ba3bde18ee8abc85d714d02a91a00a696198 | 828 | # == Schema Information
#
# Table name: accounts
#
# id :integer not null, primary key
# type :string(255) default("Account"), not null
# description :string(255) default(""), not null
# currency :string(255) default("USD"), ... | 29.571429 | 73 | 0.556763 |
b97cc403337266f1ea19700221047accaafaeb64 | 162 | module Admin::Teams::ProjectsHelper
def assigned_since(team, project)
team.user_team_project_relationships.find_by_project_id(project).created_at
end
end
| 27 | 79 | 0.82716 |
91d025f251c20bb90fb16ff4e56caaa6dea8fe62 | 539 | module TeacherTrainingAdviser::Steps
class GcseMathsEnglish < Wizard::Step
attribute :has_gcse_maths_and_english_id, :integer
validates :has_gcse_maths_and_english_id, pick_list_items: { method: :get_candidate_retake_gcse_status }
OPTIONS = Crm::OPTIONS
def reviewable_answers
super.tap do |an... | 26.95 | 109 | 0.751391 |
62264ea1dbfa47cc117fcb484e3d3b5b47942a94 | 515 | class TranslationsController < ApplicationController
# GET /translations
def index
respond_to do |format|
format.json { render :json => session[:__translations].to_json, :status => :ok }
end
end
# POST /translations/save
def save
# TODO should accept locale from params?
I18n.backend.sto... | 27.105263 | 86 | 0.667961 |
d56125b8d69e415b711142f6bf7d4ccc5407e426 | 4,244 | RSpec.describe AggregationMixin do
let(:cpu_speed) { 2_999 * 8 }
let(:memory) { 2_048 }
let(:hardware_args) do
{
:cpu_sockets => 2,
:cpu_cores_per_socket => 4,
:cpu_total_cores => 8,
:cpu_speed => 2_999,
:disk_capacity => 40,
:memory_mb ... | 32.151515 | 88 | 0.683553 |
61c4d1726d110562a8d5e6af2698fcd476763636 | 1,159 | # coding: utf-8
require File.expand_path('../lib/mongoid/relations_dirty_tracking/version', __FILE__)
Gem::Specification.new do |spec|
spec.name = "mongoid_relations_dirty_tracking"
spec.version = Mongoid::RelationsDirtyTracking::VERSION
spec.authors = ["David Sevcik"]
spec.email =... | 42.925926 | 85 | 0.695427 |
115b87d32934026ace68724d9d38290c7f9aec20 | 73,232 | #------------------------------------------------------------------------
# (The MIT License)
#
# Copyright (c) 2008-2011 Rhomobile, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software w... | 34.510839 | 175 | 0.598113 |
03b3951b5b45df19d3b2601d520b6a5ab482bc86 | 174 | class EnlargePromiseBody < ActiveRecord::Migration
def up
change_column :promises, :body, :text
end
def down
change_column :promises, :body, :string
end
end
| 17.4 | 50 | 0.718391 |
18ee4d645206dab00ae7b7cbaf13fdc7641dc52a | 1,529 | # -*- encoding : utf-8 -*-
class Entry::General < Entry::Base
belongs_to :deal,
:class_name => 'Deal::General',
:foreign_key => 'deal_id'
belongs_to :settlement
belongs_to :result_settlement, :class_name => 'Settlement', :foreign_key => 'result_settlement_id'
include ::Entry
valida... | 37.292683 | 208 | 0.725311 |
4ab0ad3d9ac84bc8ab475b9e7d473bc2fe6d3607 | 1,861 | # frozen_string_literal: true
# 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 mini... | 38.770833 | 85 | 0.777539 |
08860f7fd1aa215cd8fe8e774d47071c6f021ceb | 1,694 | # Copyright (c) 2017-present, Facebook, Inc. All rights reserved.
#
# You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
# copy, modify, and distribute this software in source code or binary form for use
# in connection with the web services and APIs provided by Facebook.
#
# As with any so... | 37.644444 | 82 | 0.749705 |
2853947cedc82cda19662e1166852b524966a8c1 | 2,832 | ##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
# http://metasploit.com/projects/framework/
##
require 'msf/core'
require 'drb/drb'
class Metasploit3 < Msf::E... | 27.495146 | 94 | 0.629237 |
1d30658d144deea894dc1f6ae36c77ba65704c93 | 590 | # frozen_string_literal: true
class RecommendationIndicatorPolicy < ApplicationPolicy
def permitted_attributes
[:recommendation_id, :indicator_id]
end
# TODO pretty sure we don't actually need this now as I've excluded the route. But, consistency? Could remove from other policies and add `except: [:update]`... | 29.5 | 185 | 0.740678 |
3843f877cf8bfcf3f38ff1ffbe50e7b67bd18988 | 670 | require 'rails_helper'
RSpec.describe "api_resources/index", type: :view do
before(:each) do
assign(:api_resources, [
ApiResource.create!(
:name => "Name",
:description => "Description",
:access_key => "Access Key"
),
ApiResource.create!(
:name => "Name2",
... | 25.769231 | 67 | 0.579104 |
0196053694b35bcfbfeb03ac33f349d9e855b98f | 4,583 | # frozen_string_literal: true
require 'rails_helper'
describe Table do
fixtures :all
context 'Validation' do
it 'table cannot be online unless event.online?' do
session = sessions(:morning)
scenario = scenarios(:scenario_one_five)
table = Table.new
table.scenario = scenario
tab... | 25.461111 | 64 | 0.664412 |
21a51b6b28842fca6fb9433205667c3e5e3861bf | 3,135 | # frozen_string_literal: true
class Fisk
module Instructions
# Instruction VPMOVUSQB: Down Convert Packed Quadword Values to Byte Values with Unsigned Saturation
VPMOVUSQB = Instruction.new("VPMOVUSQB", [
# vpmovusqb: xmm{k}{z}, xmm
Form.new([
OPERAND_TYPES[57],
OPERAND_TYPES[24],
... | 27.991071 | 104 | 0.498565 |
1c2ef3fd7d1b52c96247d8cc22a95d89dbddb1ba | 96 | class Country < ApplicationRecord
has_many :states
has_many :counties, through: :states
end
| 19.2 | 38 | 0.78125 |
38c38d4bf6e865356b462d16d8cae9476bd6b99d | 7,924 | require 'system_spec_helper'
require 'httparty'
RESTORE_BINARY = '/var/vcap/jobs/redis-backups/bin/restore'
DUMP_FIXTURE_PATH = 'spec/fixtures/moaning-dump.rdb'
BACKUP_PATH = '/var/vcap/store/dump.rdb'
TEMP_COPY_PATH = '/tmp/moaning-dump.rdb'
shared_examples 'it errors when run as non-root user' do |plan|
before(:a... | 35.693694 | 124 | 0.723877 |
d535a620a8e12d2dd5456738359d025ee36bdddc | 6,324 | class MoltenVk < Formula
desc "Implementation of the Vulkan graphics and compute API on top of Metal"
homepage "https://github.com/KhronosGroup/MoltenVK"
url "https://github.com/KhronosGroup/MoltenVK/archive/v1.0.41.tar.gz"
sha256 "a11208f3bc2eb5cd6cfebbc0bc09ac2af8ecbe5cc3e57cde817bc8bc96d2cc33"
license "Apa... | 41.880795 | 111 | 0.716161 |
ab49cf6b39e49980b12f704c7b077489be0efd42 | 26 | require "./app"
run(App)
| 6.5 | 15 | 0.615385 |
6ab154c377593dbcfd917e1ae0966781226f3842 | 636 | module AthenaHealth
class Client
def initialize(version:, key:, secret:, token: nil)
@api = AthenaHealth::Connection.new(
version: version,
key: key,
secret: secret,
token: token,
)
end
include Endpoints::Practices
include Endpoints::Departments
include... | 25.44 | 55 | 0.694969 |
6a987918e7da51b068ae017efae8cdd4742f87e2 | 3,003 | class Tinyxml < Formula
desc "XML parser"
homepage "http://www.grinninglizard.com/tinyxml/"
url "https://downloads.sourceforge.net/project/tinyxml/tinyxml/2.6.2/tinyxml_2_6_2.tar.gz"
sha256 "15bdfdcec58a7da30adc87ac2b078e4417dbe5392f3afb719f9ba6d062645593"
bottle do
cellar :any
sha256 "ec0f83018a9ff9... | 37.5375 | 131 | 0.741925 |
1a43c9860d809595aa0c14d9576ffc7082264fe6 | 2,153 | # frozen_string_literal: true
require File.expand_path('../test_helper', File.dirname(__FILE__))
require 'rack'
class FullStackTest < Minitest::Test
REDIS_STORAGE_FORMAT_VERSION = Coverband::Adapters::RedisStore::REDIS_STORAGE_FORMAT_VERSION
TEST_RACK_APP = '../fake_app/basic_rack.rb'
RELATIVE_FILE = './fake_ap... | 34.725806 | 112 | 0.723177 |
bb16f802589802ada8e5526aec43bebfdc14d65a | 924 | default[:laboard][:app_name] = 'laboard'
default[:laboard][:app_user] = 'laboard'
default[:laboard][:git_sync] = true
default[:laboard][:git_repository] = 'https://github.com/jubianchi/laboard.git'
default[:laboard][:git_revision] = 'master'
default[:laboard][:app_dir] = "/home/#{node[:labo... | 48.631579 | 102 | 0.622294 |
1832f4eac61591b3d70127f34931c047260f0986 | 494 | cask 'cozy-drive' do
version '3.15.1'
sha256 '9b2d16b5b05399243118adf81bcc750a1459bcab85e5f763fd418bc0af7ecf89'
# nuts.cozycloud.cc was verified as official when first introduced to the cask
url "https://nuts.cozycloud.cc/download/channel/stable/CozyDrive-#{version}.dmg"
appcast 'https://macupdater.net/cgi-b... | 38 | 134 | 0.773279 |
5d2cacea40566c501dfe2013200b70075f6fee7a | 545 | require_relative '../../spec_helper'
require 'ostruct'
describe "OpenStruct.new when passed [Hash]" do
before :each do
@os = OpenStruct.new(name: "John Smith", age: 70, pension: 300)
end
it "creates an attribute for each key of the passed Hash" do
@os.age.should eql(70)
@os.pension.should eql(300)
... | 25.952381 | 67 | 0.699083 |
b9d5a0618e67d329004d99c970ae0021096a3199 | 1,223 | # frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'asciidoctor_plantuml/version'
Gem::Specification.new do |s|
s.name = 'asciidoctor-plantuml'
s.version = Asciidoctor::PlantUML::VERSION
s.authors = ['Horacio ... | 39.451613 | 75 | 0.662306 |
3884994c7e3f0951437abd94611f33a8b875cafd | 2,565 | # encoding: UTF-8
require 'rbconfig'
require 'cgi'
module Pod
module UserInterface
module ErrorReport
class << self
def report(exception)
return <<-EOS
#{'――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――'.reversed}
### Report
* What did you do?
* What... | 24.902913 | 104 | 0.564912 |
1a5ba26d21a4b03517c95ada784547edb64e1fd7 | 1,151 | # encoding: utf-8
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
module MsRest
#
# Class which handles retry policy.
#
class RetryPolicyMiddleware < Faraday::Response::Middleware
#
# Initializes ... | 25.577778 | 115 | 0.614248 |
4afaf660e051aa32ca459e164bedf0292fe14cd7 | 954 | # -*- encoding: utf-8 -*-
# stub: ethon 0.14.0 ruby lib
Gem::Specification.new do |s|
s.name = "ethon".freeze
s.version = "0.14.0"
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.6".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Hans Hasselberg... | 30.774194 | 116 | 0.684486 |
bb8e91866b0a4232ccadbe6fab18ef5a4c8840b4 | 1,563 | class ScriptError < Exception; end
class NotImplementedError < ScriptError; end
class SyntaxError < ScriptError; end
class StandardError < Exception; end
class ArgumentError < StandardError; end
class EncodingError < StandardError; end
class FiberError < StandardError; end
class IndexError < StandardError;... | 27.421053 | 90 | 0.705694 |
ffceeb68f20e1bd7878e38f90896778bc9b07b18 | 2,269 | # frozen_string_literal: true
require 'yaml'
require 'set'
module Gitlab
module SidekiqConfig
QUEUE_CONFIG_PATHS = begin
result = %w[app/workers/all_queues.yml]
result << 'ee/app/workers/all_queues.yml' if Gitlab.ee?
result
end.freeze
# This method is called by `ee/bin/sidekiq-cluster... | 28.721519 | 103 | 0.644337 |
5d08056d4c59043b8b9b40c4e7331cb0cc5e05ba | 189 | Covers 'facets/string/rewrite'
Case String do
Unit :rewrite do
s = "HELLO TOMMY!"
rules = [[ /TOMMY/, 'MAN' ]]
r = s.rewrite(rules)
r.assert == "HELLO MAN!"
end
end
| 13.5 | 32 | 0.57672 |
bb069e2f63172eeac42d9e1ed23c9ab841105015 | 395 | class User < ActiveRecord::Base
has_many :posts
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
def image
Base64.encode64(File.... | 32.916667 | 89 | 0.739241 |
edbc3c211749ea08691a4f92c5f9e2d6f0d7f2b8 | 91,448 | # frozen_string_literal: true
require "isolation/abstract_unit"
require "rack/test"
require "env_helpers"
require "set"
class ::MyMailInterceptor
def self.delivering_email(email); email; end
end
class ::MyOtherMailInterceptor < ::MyMailInterceptor; end
class ::MyPreviewMailInterceptor
def self.previewing_email(... | 31.030879 | 170 | 0.684061 |
e8c79d5c9e66b13e1cfec9e563c9afb76a263e33 | 2,251 | # -*- encoding: utf-8 -*-
# stub: guard 2.12.5 ruby lib
Gem::Specification.new do |s|
s.name = "guard"
s.version = "2.12.5"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"]
s.authors = ["Thibaud Guillaume-Gentil"]
s.date = "2... | 39.491228 | 105 | 0.609063 |
33f7ee03a3c80963977b48719baac2de16c7a595 | 12,376 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::EXE
def initialize(info = {})
supe... | 38.197531 | 180 | 0.62395 |
b93206e24371d51a64561ed696223e9e18f20ea6 | 1,954 | class Libxpm < Formula
desc "X.Org: X Pixmap (XPM) image file format library"
homepage "https://www.x.org/"
url "https://www.x.org/archive/individual/lib/libXpm-3.5.13.tar.bz2"
sha256 "9cd1da57588b6cb71450eff2273ef6b657537a9ac4d02d0014228845b935ac25"
license "MIT"
bottle do
sha256 cellar: :any, ... | 37.576923 | 123 | 0.681679 |
799994903f96eef7f6724ba6e6c2a743dd01b8bd | 198,917 | # Copyright 2020 Google LLC
#
# 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, ... | 46.936527 | 142 | 0.64909 |
e988a2e81369e4856fe4d4d38954e85812ba5788 | 458 | # frozen_string_literal: true
module Platform
module Enums
GistOrderField = GraphQL8::EnumType.define do
name "GistOrderField"
description "Properties by which gist connections can be ordered."
value "CREATED_AT", "Order gists by creation time", value: "created_at"
value "UPDATED_AT", "O... | 30.533333 | 77 | 0.707424 |
0880dbac15b774256abb69f3d5eb0b1882ab417b | 7,045 | require "spec_helper"
describe Mongoid::Relations::Accessors do
before do
[ Book, Movie, Rating, Person, Preference, Game ].each(&:delete_all)
end
describe "\#{getter}" do
context "when the relation is not polymorphic" do
let(:person) do
Person.create(:ssn => "666-66-6666")
end
... | 20.967262 | 72 | 0.538112 |
3887c20fd0eadcdd727d26cb43a4f2266a6ab194 | 730 | class IpAddressesController < ApplicationController
respond_to :html, :xml, :json
def index
@ip_addresses = authorize IpAddress.visible(CurrentUser.user).paginated_search(params)
if search_params[:group_by] == "ip_addr"
@ip_addresses = @ip_addresses.group_by_ip_addr(search_params[:ipv4_masklen], sea... | 30.416667 | 112 | 0.730137 |
bbe81a8bc0aae4d5332380e861e25e80157d5bf4 | 737 | module QRDA
module Cat1
class PatientCareExperienceImporter < SectionImporter
def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.48']"))
super(entry_finder)
@id_xpath = './cda:id'
@code_xpath = '... | 36.85 | 153 | 0.68521 |
387cb8169a19ad48fde6dead7e14084514b0ddb5 | 269 | require_relative 'loader'
module JSONRecord
class Base < JSONRecord::JSONHash
extend JSONRecord
include JSONRecord
def initialize(args={})
initialize_columns
args.each{|column| self[column.first.to_s] = column.last }
end
end
end
| 19.214286 | 64 | 0.687732 |
ac8dc99d76d2c0300c607c298be8e38a11a742d4 | 985 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'better_logging/version'
Gem::Specification.new do |spec|
spec.name = "better_logging"
spec.version = BetterLogging::VERSION
spec.authors = ["Tim Cooper"]
spec.email ... | 33.965517 | 74 | 0.659898 |
1d0459d48f7ba87246f6af4eb6a688eeb71d4bf3 | 1,037 | module BenefitSponsors
module BenefitPackages
module EmployeeRenewals
class DomainValidator < ::BenefitSponsors::BaseDomainValidator
schema do
required(:benefit_package_id).value(:filled?)
required(:census_employee_id).value(:filled?)
end
rule(:benefit_package_id... | 28.805556 | 110 | 0.512054 |
91a61c2a608a13b0604e753c152b544067cc5b8c | 797 | # Example test class for coercion
#
# UnitOne behaves as Unit(1) when added to a Unit, and as 1 when added to anything else.
class UnitOne
def coerce(other)
case other
when Unit
[other, Unit(1)]
else
[other, 1]
end
end
def +(other)
apply_through_coercion(other, __method__)
end
... | 16.957447 | 88 | 0.65872 |
910f95d90419ba05adbee021cfbce17c5af80ed8 | 204 | require "rails_helper"
describe Review do
it { should belong_to :product }
it { should belong_to :user }
it { should validate_presence_of :content }
it { should validate_presence_of :rating }
end | 25.5 | 45 | 0.745098 |
bb9fe3b041b2da4978fdf5f1fdbcf9d18db2a28b | 80 | require 'spec_helper'
require 'stapfen/client'
describe Stapfen::Client do
end
| 13.333333 | 27 | 0.8 |
798a0b156ef7082ea850048f71ff6aeb0454174a | 1,023 | #
# Be sure to run `pod spec lint pod-auth-swift.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 http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://git... | 35.275862 | 91 | 0.657869 |
38658d95c0895771129a57abb505f441ef3ac951 | 462 | class User < ApplicationRecord
before_save { self.email = 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 },
... | 38.5 | 61 | 0.623377 |
ff0319df7f0d931d0fe1acf9286fe4703589f50f | 149 | class NameIdentifierImportByMonthJob < ApplicationJob
queue_as :levriero
def perform(options = {})
NameIdentifier.import(options)
end
end
| 18.625 | 53 | 0.771812 |
26ee70ad89e58a8c9ca91b39e818639c77f5a4eb | 421 | require "test_helper"
require "ar_helper"
class AssociationRelationTest < ActiveSupport::TestCase
test "first_or_initialize does not raise ArgumentError" do
assert_nothing_raised { Group.new.memberships.where("1=1").first_or_initialize }
end
test "first_or_create does not raise ArgumentError" do
group =... | 30.071429 | 84 | 0.781473 |
874d996162645f840d594d6cba5817c913daf0a9 | 712 | class AddClearanceToUsers < ActiveRecord::Migration[5.2]
def self.up
change_table :users do |t|
t.string :encrypted_password, limit: 128
t.string :confirmation_token, limit: 128
t.string :remember_token, limit: 128
end
add_index :users, :email
add_index :users, :remember_token
... | 24.551724 | 75 | 0.654494 |
912ebef40841194bdb578b26c512fa11068d9091 | 1,641 | class MadX < Formula
desc "Methodical Accelerator Design"
homepage "https://cern.ch/mad"
url "http://svn.cern.ch/guest/madx/tags/5.02.12/madX/"
head "http://svn.cern.ch/guest/madx/trunk/madX/"
bottle do
cellar :any
sha256 "47118481abb0e82d5c1a5daf6634ff3627147536877e77c7cd0d4bfc36649fd4" => :sierra
... | 26.901639 | 92 | 0.717246 |
08ea2f54523fa9f387a81c4b45be809c23497b9d | 5,959 | ##
# This code was generated by
# \ / _ _ _| _ _
# | (_)\/(_)(_|\/| |(/_ v1.0.0
# / /
#
# frozen_string_literal: true
require 'spec_helper.rb'
describe 'AssignedAddOnExtension' do
it "can fetch" do
@holodeck.mock(Twilio::Response.new(500, ''))
expect {
@client.api.v2010.accounts(... | 44.140741 | 250 | 0.657157 |
f737169c9f3caf0fec8a8c3a8f0550a483a572a5 | 573 | require 'wordpress/wxr/directory_listing'
module Wordpress
class WXR
class DirectoryListings
include Enumerable
attr_reader :document, :wxr
private :document, :wxr
def initialize(document, wxr)
@document = document
@wxr = wxr
end
def each
return enum... | 17.90625 | 60 | 0.602094 |
ac19713d3bf0dd05f4eaa3620ac2e59796e09520 | 1,262 | require 'spec_helper'
require 'thegarage/gitx/cli/cleanup_command'
describe Thegarage::Gitx::Cli::CleanupCommand do
let(:args) { [] }
let(:options) { {} }
let(:config) do
{
pretend: true
}
end
let(:cli) { Thegarage::Gitx::Cli::CleanupCommand.new(args, options, config) }
let(:branch) { double(... | 33.210526 | 113 | 0.679873 |
0135c03026c6dcb84c318acdd74504f4b3c82c8e | 433 | # frozen_string_literal: true
module Groups
module Settings
class PackagesAndRegistriesController < Groups::ApplicationController
before_action :authorize_admin_group!
before_action :verify_packages_enabled!
feature_category :package_registry
def index
end
private
de... | 19.681818 | 73 | 0.732102 |
3919c9b14068579a0dc7cf3b0001518e1b154881 | 291 | require 'open-uri'
require 'nokogiri'
require 'rufus-scheduler'
require_relative '../../lib/fetch_dmhy_resource'
$scheduler = Rufus::Scheduler.new
$logger = Rails.logger
def circle_fetch_dmhy_resource
$scheduler.every '1m' do
FetchDmhyResource.load
end
end
circle_fetch_dmhy_resource
| 18.1875 | 48 | 0.793814 |
7a3a7f9eceb5b80636b8b031c74205562b6e685c | 388 | require 'rails_helper'
RSpec.describe PostOrderNotificationJob, type: :job do
let(:order) { Fabricate(:order) }
it 'finds the order and posts the event' do
action = Order::SUBMITTED
expect(Artsy::EventService).to receive(:post_event).with(topic: 'commerce', event: instance_of(OrderEvent))
PostOrderNoti... | 35.272727 | 111 | 0.75 |
7aab0c61e6c9e966d10040c2bbd3d92ed891a0c4 | 101 | # frozen_string_literal: true
module Terrafying
module Components
VERSION = '0.0.0'
end
end
| 12.625 | 29 | 0.722772 |
38dfd13671d98e92ec4fe56cada6724fbb40425d | 590 | cask "zy-player" do
version "2.8.5"
sha256 "6ea222c64b979e096efbf4126cbdc2b2c700ca2da60dc17a6961d61a272d6e74"
url "https://github.com/Hunlongyu/ZY-Player/releases/download/v#{version}/ZY-Player-#{version}.dmg"
name "ZY Player"
desc "Video resource player"
homepage "https://github.com/Hunlongyu/ZY-Player"
... | 25.652174 | 101 | 0.722034 |
33c14a187c61ef4df5f42eb816e5fd96ddf0ed4e | 445 | require 'abstract_unit'
class HeaderTest < Test::Unit::TestCase
def setup
@headers = ActionController::Http::Headers.new("HTTP_CONTENT_TYPE"=>"text/plain")
end
def test_content_type_works
assert_equal "text/plain", @headers["Content-Type"]
assert_equal "text/plain", @headers["content-type"]
as... | 29.666667 | 85 | 0.719101 |
b9462871e973c84f9368dc77cc2946dfaccac224 | 959 | class Juju < Formula
desc "DevOps management tool"
homepage "https://jujucharms.com/"
url "https://launchpad.net/juju/2.6/2.6.3/+download/juju-core_2.6.3.tar.gz"
sha256 "7a39c3126cd595607f18476af24c405bc6f4a28e84c290057b4574c3ac86fcbe"
bottle do
cellar :any_skip_relocation
sha256 "06796cdc6a32054d9fc... | 34.25 | 93 | 0.749739 |
b901ade2c80268fa30e8615bf9de0452214ac377 | 83 | class Course < ActiveRecord::Base
def course_num
dept + ' ' + num
end
end
| 11.857143 | 33 | 0.638554 |
08fa5ffb99e55d0cf3fc61b3d9ddb86e93c4efc9 | 876 | module User::Authentication
extend ActiveSupport::Concern
MINIMUM_PASSWORD_LENGTH = 8
included do
has_secure_password validations: false
has_many :sessions, dependent: :nullify
validates :password,
length: {minimum: MINIMUM_PASSWORD_LENGTH},
allow_nil: true
end
class_methods do
... | 20.857143 | 73 | 0.714612 |
8739232519020485c51570d4f6f52bc2174a0761 | 2,576 | # frozen_string_literal: true
RSpec.describe MemoryDb do
context "#initialize" do
subject { described_class.new }
let(:uid) { "8e8004b8-d91d-4d57-b7a4-605ad926fff7" }
let(:transaction) { build(:transaction, uid: uid).to_h }
let(:new_transaction) do
tr = build(:transaction).to_h
tr.delete... | 28.622222 | 104 | 0.667702 |
915dc893550c3000fce3fbfcf8e9c901b576c1c2 | 6,136 | require 'spec_helper'
describe Travis::Github::Services::SyncUser::Repository do
include Support::ActiveRecord
let(:user) { Factory(:user, github_id: 1) }
let(:run) { lambda { described_class.new(user, repo).run } }
describe 'find or create repository' do
let(:repo) { { 'id' => 100, 'name' => 'min... | 38.835443 | 198 | 0.587679 |
382a93b9d568da7ae93a0faa58ef962d6e745c60 | 4,139 | # frozen_string_literal: true
require "rails_helper"
require "fileutils"
# Don't delay jobs so that any mails would get sent immediately
describe Utils::Generators::MainGenerator, :without_tenant, :perform_jobs do
# Classes that are allowed to have no sample data
NO_SAMPLE_DATA_CLASSES = %w[Billing::Template
... | 37.972477 | 107 | 0.65209 |
f8f2f5c832ecb8168dd05dc1ddd053253bef6157 | 193 | # frozen_string_literal: true
FactoryBot.define do
factory :users_ops_dashboard_project, class: 'UsersOpsDashboardProject' do
user factory: :user
project factory: :project
end
end
| 21.444444 | 76 | 0.777202 |
e22272547f3db26cea1f149f52c65a62700dbfc0 | 4,721 | module ActiveAdmin
module Filters
class Disabled < RuntimeError
def initialize
super "Can't remove a filter when filters are disabled. Enable filters with 'config.filters = true'"
end
end
module ResourceExtension
def initialize(*)
super
add_filters_sidebar_sect... | 30.262821 | 137 | 0.645414 |
115a4941a7d9c2b52d7ad036167d11f60b522507 | 254 | class PowersController < ApplicationController
skip_before_filter :authenticate_user!
def index
@powers = Power.search(:c => params[:c], :d => params[:d], :page => params[:page])
end
def show
@power = Power.find(params[:id])
end
end | 23.090909 | 86 | 0.669291 |
39264c7c1d51711240a22ba80a362be2bcd989fe | 6,771 | Puppet::Util::Log.newdesttype :syslog do
def self.suitable?(obj)
Puppet.features.syslog?
end
def close
Syslog.close
end
def initialize
Syslog.close if Syslog.opened?
name = "puppet-#{Puppet.run_mode.name}"
options = Syslog::LOG_PID | Syslog::LOG_NDELAY
# XXX This should really be c... | 26.142857 | 150 | 0.618816 |
6118bfd1f2fe3489c34497c166a1a6553437b875 | 582 | class SaveAppealPage < BasePage
set_url '/'+ ENV['TEST_LOCALE'] +'/users/sign_up'
section :content, '#main-content' do
element :appeal_header, 'h1', text: I18n.t('users.registrations.new.appeal_test')
element :closure_header, 'h1', text: I18n.t('users.registrations.new.application_test')
elements :logi... | 44.769231 | 129 | 0.730241 |
089f5e60699bf399b69cae1d9f51caa1bd1d8c81 | 20,180 | require 'spec_helper'
describe 'zabbix::proxy' do
let :node do
'rspec.puppet.com'
end
on_supported_os.each do |os, facts|
next if facts[:os]['name'] == 'windows'
context "on #{os} " do
let :facts do
facts
end
case facts[:os]['name']
when 'Archlinux'
context '... | 52.415584 | 216 | 0.625669 |
abce70b9c50609dafa2ae49a7b91d9c42af544f7 | 2,565 | =begin
#Scubawhere API Documentation
#This is the documentation for scubawhere's RMS API. This API is only to be used by authorized parties with valid auth tokens. [Learn about scubawhere](http://www.scubawhere.com) to become an authorized consumer of our API
OpenAPI spec version: 1.0.0
Contact: bryan@scubawhere.co... | 30.535714 | 224 | 0.739961 |
bb7d4312b768fc6bfc3113582e8beb86122c4c9f | 1,457 | # frozen_string_literal: true
module Types
module IncidentManagement
class OncallScheduleType < BaseObject
graphql_name 'IncidentManagementOncallSchedule'
description 'Describes an incident management on-call schedule'
authorize :read_incident_management_oncall_schedule
field :iid,
... | 29.734694 | 85 | 0.612903 |
798ada5785505618405e9f96e52312f71f8627ea | 751 | require 'formula'
class Libglade < Formula
homepage 'http://glade.gnome.org'
url 'http://ftp.gnome.org/pub/GNOME/sources/libglade/2.6/libglade-2.6.4.tar.gz'
sha256 'c41d189b68457976069073e48d6c14c183075d8b1d8077cb6dfb8b7c5097add3'
bottle do
sha1 "c722d34f96736fcc6fa15790fc89ce86b2f60895" => :mavericks
... | 28.884615 | 81 | 0.712383 |
5d1a4d845f8cb96472813c80e812fb6760d678c9 | 5,390 | #
# Cookbook Name:: cookbook-openshift3
# Recipe:: upgrade_control_plane36
#
# Copyright (c) 2015 The Authors, All Rights Reserved.
# This must be run before any upgrade takes place.
# It creates the service signer certs (and any others) if they were not in
# existence previously.
Chef::Log.error("Upgrade will be ski... | 41.461538 | 451 | 0.741744 |
264cd6b891269d8b975273ec090f84ee2283b7d8 | 233 | class PostSerializer < ActiveModel::Serializer
attributes :id, :title, :content, :published, :author
def author
user = self.object.user
{
name: user.name,
email: user.email,
id: user.id
}
end
end
| 17.923077 | 55 | 0.626609 |
1a735daec5b8de617c620563cd72e593b534f190 | 2,040 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... | 23.72093 | 110 | 0.67598 |
382754288f7ef4992bc20e5a248e9b18ab2017f6 | 13,647 | =begin
#OpenAPI Petstore
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 6.0.0-SNAPSHOT
=en... | 34.902813 | 157 | 0.632886 |
62fbc23948cf4a7e7e8dcbcddcec1ab0aa90bf9b | 1,876 | # frozen_string_literal: true
def code_location_stub(scm_type: :git, url: Faker::Internet.url, branch: :main)
url = ":pserver:anonymous:@cvs.sourceforge.net:/#{Faker::Lorem.word}/#{Faker::Lorem.word}" if scm_type == :cvs
CodeLocation.new(url: url, scm_type: scm_type, branch: branch)
end
def code_location_stub_wit... | 46.9 | 117 | 0.771322 |
7a6af1d39b4a125baf9fddaf7ef08a6bce623958 | 55 | class AlignmentsController < ApplicationController
end
| 18.333333 | 50 | 0.890909 |
f7c233fb5b0d41e74087e2e3b877a84e6d4c0749 | 127 | module MyApp
class ApplicationMailer < ActionMailer::Base
default from: 'from@example.com'
layout 'mailer'
end
end
| 18.142857 | 46 | 0.724409 |
ab4f18b11bdeec3301cccb378bb14c8852e3850d | 5,330 | require_relative '../helper'
describe "save-file" do
before do
@tf = Tempfile.new(["pry", ".py"])
@path = @tf.path
@t = pry_tester
end
after do
@tf.close(true)
end
describe "-f" do
it 'should save a file to a file' do
temp_file do |f|
path = f.path
f.puts ":cute_ho... | 29.611111 | 111 | 0.579362 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.