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
5d2ebb9a20f66e53e103a72f2000ffdd071aa929
1,075
# frozen_string_literal: true Capybara::SpecHelper.spec '#has_style?', requires: [:css] do before do @session.visit('/with_html') end it "should be true if the element has the given style" do expect(@session.find(:css, '#first')).to have_style(display: 'block') expect(@session.find(:css, '#first').h...
41.346154
87
0.663256
ed493bdd88268a30ef59a4b69bcbf1986a5df927
6,324
# coding: utf-8 require 'test_helper' ActiveValidators.activate(:twitter) describe "Twitter Validation" do def build_twitter_record format, attrs = {} TestRecord.reset_callbacks(:validate) TestRecord.validates :twitter_username, :twitter => format TestRecord.new attrs end it "rejects invalid urls" d...
34
103
0.694497
b9860f2834efb6f551395000b6cf8e56dcde01d5
2,204
class H2o < Formula homepage "https://github.com/h2o/h2o/" url "https://github.com/h2o/h2o/archive/v0.9.2.tar.gz" sha1 "001f5aefcd829467ed64b328ff0d35b736593dec" head "https://github.com/h2o/h2o.git" bottle do sha1 "3a661417da4cf981935b3ec39a9e0401ce0cfb30" => :yosemite sha1 "046477212770943f9e039fb7...
26.238095
106
0.624319
bf29c8671ecaae8cf5d7e51e9fe5946e40b6f7a6
418
require_dependency 'core/application_record' module Core module SocialWork class ProjectInteraction < ApplicationRecord self.table_name = 'generic.social_work_project_interactions' attr_accessor :type belongs_to :candidate_project mount_uploader :document_one, Core::SocialWork::Document...
26.125
70
0.77512
abce111eeef86bb3145efc36167f46918976601b
3,483
# encoding: utf-8 require "concurrent/atomic/atomic_fixnum" require "concurrent/atomic/atomic_boolean" module LogStash class ShutdownWatcher include LogStash::Util::Loggable CHECK_EVERY = 1 # second REPORT_EVERY = 5 # checks ABORT_AFTER = 3 # stalled reports attr_reader :cycle_period, :report_e...
28.785124
161
0.664944
79668e029d1b9d3ace8b4cd61331cb4fc444811a
852
module Lol # Holds the representation of a MiniSeries class MiniSeries < Model # @!attribute [r] target # @return [String] number of games required to advance attr_reader :target # @!attribute [r] wins # @return [Fixnum] wins in the miniseries attr_reader :wins # @!attribute [r] losses...
28.4
82
0.681925
f793ca305b64dffd1997efe0508797f5390c618e
190
FactoryGirl.define do factory :user, :class => Mtwarden::User do sequence(:email) { |n| "test#{n}@example.com" } password "password" password_confirmation "password" end end
23.75
51
0.678947
613b78bafd1d85445714d4bd010fc80b7cbf3c50
280
Erp::Backend::Engine.routes.draw do root to: "frontend/home#index", as: "home" get "/products", to: "frontend/products#index", as: :products get "/products/:id", to: "frontend/products#detail", as: :product_detail get "/blogs", to: "frontend/blogs#index", as: :blogs end
35
74
0.685714
211e2a41b5dd3839ac98e47680da8788990d4c00
717
capitais = Hash.new capitais = {acre: 'Rio Branco', sao_paulo: 'São Paulo', } #atribuindo novo valor capitais[:minas_gerais] = 'Belo Horizonte' puts capitais #imprimindo as chaves puts "\n" puts 'chaves:' puts capitais.keys #imprimindo os valores puts "\n" puts 'values:' puts capitais.values #######################...
16.674419
57
0.709902
1cd6aba3249c85cfab93659c7e00f4cd1b040a2b
198
require 'test_helper' class CoolrTest < Minitest::Test def test_that_it_has_a_version_number refute_nil ::Coolr::VERSION end def test_it_does_something_useful assert false end end
16.5
39
0.777778
1afa801470aaa4408c63603e3c294247dd9f08f6
1,140
# frozen_string_literal: true module CscCore module ExcelBuilders class ProposedIndicatorExcelBuilder attr_accessor :sheet def initialize(sheet, scorecards) @sheet = sheet @scorecards = scorecards end def build build_header @scorecards.includes(:raised_i...
23.75
90
0.616667
e99aa0595095e9303600e77f6b4d62f0a6a79a3f
384
# encoding: utf-8 class CsvUtils def self.header( path, sep: ',', debug: false ) ## use header or headers - or use both (with alias)? row = CsvReader.header( path, sep: sep ) pp row if debug ## e.g.: # "Country,League,Season,Date,Time,Home,Away,HG,AG,Res,PH,PD,PA,MaxH,MaxD,MaxA,AvgH,AvgD,AvgA...
22.588235
104
0.635417
39501ca99cafd7d20a87c6e931c9b15c0140852f
233
def simple_calculator(nb1, nb2) addition = nb1 + nb2 substraction = nb1 - nb2 multiplication = nb1 * nb2 division = nb1 / nb2 puts "#{addition}, #{substraction}, #{multiplication}, #{division}" end simple_calculator(5, 2)
23.3
69
0.686695
03200a9559ac171cec578cb9c90705db9515f2ab
5,299
require 'possibly' module Import module Brca module Providers module Salisbury # Process Salisbury-specific record details into generalized internal genotype format class SalisburyHandlerDeprecated < Import::Brca::Core::ProviderHandler TEST_SCOPE_MAPPING = { 'breast cancer full sc...
49.064815
96
0.543687
edf06c9a040dd42500583e3c447511678fbec1f4
4,287
require 'json-schema' module GeoConcerns module Discovery class GeoblacklightDocument < AbstractDocument # Implements the to_hash method on the abstract document. # @param _args [Array<Object>] arguments needed for the renderer, unused here # @return [Hash] geoblacklight document as a hash ...
34.853659
95
0.606018
874595aa9344f2f1de16f2866255f780646e5353
203
class Question < ActiveRecord::Base attr_accessible :content, :survey_id, :answers_attributes belongs_to :survey has_many :answers accepts_nested_attributes_for :answers, allow_destroy: true end
29
61
0.812808
91e36bba73ef33e8815ac9512c2046f0ad38235c
198
# frozen_string_literal: true class RenameTypeToMenuItemType < ActiveRecord::Migration[6.1] def change change_table :menu_items do |t| t.rename :type, :menu_item_type end end end
19.8
61
0.732323
33d7de391cbaa98a013483c4d9e4933b12e4d2dd
48,730
# frozen_string_literal: true # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
43.315556
301
0.713195
87857eab7ec67260b7720954340edd4c5723dd8f
2,522
ENV['RAILS_ENV'] ||= 'test' require 'spec_helper' require File.expand_path('../../config/environment', __FILE__) require 'capybara/rails' require 'rspec/rails' require 'sidekiq/testing' Sidekiq::Testing.fake! # Add additional requires below this line. Rails is not loaded until this point! # Requires supporting ruby fi...
43.482759
80
0.748216
e2b516a3d546a321609d60217febdecd8cb946f1
995
module GraphQL module SchemaComparator module Diff class DirectiveArgument def initialize(directive, old_arg, new_arg) @directive = directive @old_arg = old_arg @new_arg = new_arg end def diff changes = [] if old_arg.description != ...
26.184211
100
0.627136
f77641b35037791a00bdc24a5325202b7163d136
835
require 'test/unit' require "-test-/bignum" class TestBignum < Test::Unit::TestCase class TestStr2big < Test::Unit::TestCase SIZEOF_BDIGITS = Bignum::SIZEOF_BDIGITS BITSPERDIG = Bignum::BITSPERDIG BDIGMAX = (1 << BITSPERDIG) - 1 def test_str2big_poweroftwo s = "1" + "0" * 1000 n = 16 **...
21.973684
53
0.60479
b96f717165824b0bbf0d87a859079018907b0508
1,354
class Libxaw < Formula desc "X.Org: X Athena Widget Set" homepage "https://www.x.org/" url "https://www.x.org/archive/individual/lib/libXaw-1.0.14.tar.bz2" sha256 "76aef98ea3df92615faec28004b5ce4e5c6855e716fa16de40c32030722a6f8e" license "MIT" bottle do sha256 arm64_big_sur: "6f9bd6bef10340da3fc23f24d0...
27.08
92
0.692762
bfe9e2849b5f64577e0331d91709e1b39a3031c3
1,443
# -*- encoding: utf-8 -*- # stub: activemodel 5.1.6 ruby lib Gem::Specification.new do |s| s.name = "activemodel" s.version = "5.1.6" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.metadata = { "changelog_uri" => "https://github.com/rails/rails/blob/v...
41.228571
214
0.694387
62790ed47adbe86527a585c9fb51597940db4c64
945
# 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, ...
32.586207
74
0.733333
1a0c71cda5d503e674cf947f92223847150bc2a3
13,104
class PEdump # from wine's winnt.h class NE < IOStruct.new 'a2CCvvVv4VVv8Vv3CCv4', :ne_magic, # 00 NE signature 'NE' :ne_ver, # 02 Linker version number :ne_rev, # 03 Linker revision number :ne_enttab, # 04 Offset to entry table relative to NE :...
30.760563
128
0.514957
182b904e9a307936dc848a4dee86067dd88f9316
1,212
# -*- encoding: utf-8 -*- # stub: mongoid_rateable 0.3.3 ruby lib require File.expand_path('../lib/mongoid_rateable/version', __FILE__) Gem::Specification.new do |s| s.name = "mongoid_rateable" s.version = MongoidRateable::VERSION s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :req...
32.756757
105
0.690594
7a314bca7b31a12994a7da0170d435c541b0e95b
602
Gem::Specification.new do |spec| spec.name = "glpl" spec.version = "0.2.0" spec.date = Time.now.strftime("%Y-%m-%d") spec.summary = "Gitlab Pipelines on your command line." spec.description = "Gitlab Pipelines on your command line." spec.authors = ["Dino"] spec.email = "din...
40.133333
81
0.619601
ac90a7f71b038c28104fef378ef82865d425618c
5,215
module Cms::Addon module TwitterPoster extend ActiveSupport::Concern include Cms::Content extend SS::Addon # media_ids is restricted up to 4 # see: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-update TWITTER_MAX_MEDIA_COUNT = 4 included do ...
31.79878
121
0.638926
6a7d2b110d3ae229ae15c16182daf6f5d88c8502
2,000
# frozen_string_literal: true module Members class InviteEmailExperiment < ApplicationExperiment exclude { context.actor.created_by.blank? } exclude { context.actor.created_by.avatar_url.nil? } INVITE_TYPE = 'initial_email' def resolve_variant_name RoundRobin.new(feature_flag_name, %i[avatar ...
22.222222
94
0.6575
03ef600f269dd8185a51f010041ec80526b8e258
1,029
require "spec_helper.rb" module Huffman describe Node do context "with a particular binary tree" do # We consider the tree example in the Readme # 1 # / \ # 2 3 # / \ \ # 4 5 6 # / \ / # 7 8 9 # Left part n7 = Node.new(7) ...
23.930233
92
0.550049
91bdab97532b0fd97cc5e13c0e0744034ed7e1c1
77
require 'test_helper' class EqulpBoardHelperTest < ActionView::TestCase end
15.4
49
0.831169
b9a9af6ecd8e5d8dacf9ce5b14feec55ee62d693
88
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'pry' require 'todo'
22
58
0.715909
acca0005a6622ca146f314640027d1f2ffca5297
110,002
# frozen_string_literal: true require_relative 'meta' require_relative '../base' require_relative '../stubs_are_restricted' module Engine module Game module G1822 class Game < Game::Base include_meta(G1822::Meta) register_colors(lnwrBlack: '#000', gwrGreen: '#16501...
36.814592
120
0.491718
ab4c811c22b1c9377f687cbaed1d825f045ffce3
420
require 'spec_helper' describe "categories/show" do before(:each) do @category = assign(:category, stub_model(Category, :name => "Name", :description => "Description" )) end it "renders attributes in <p>" do render # Run the generator again with the --webrat flag if you want to use w...
23.333333
87
0.669048
4ac5313655acb17f464369cacf09ea14d005fba7
96
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'speedtest' require 'byebug'
24
58
0.739583
2143580ed88117032f78018a3ea8e42f60031c4b
1,639
# frozen_string_literal: true require 'thread' require_relative 'logger' module Listen module Thread class << self # Creates a new thread with the given name. # Any exceptions raised by the thread will be logged with the thread name and complete backtrace. # rubocop:disable Style/MultilineBlo...
29.8
124
0.639414
79fb343a31d918c8c3d4dcb760d6ed09f3ead920
1,165
# 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-kinesisvideo' spec.version = File.read...
38.833333
138
0.671245
0809b8ead45d5c74ae901f026a6152fcf7025efd
271
module ApplicationHelper #Returns the full title on a per-page basis. def full_title(page_title = '') base_title = "Ruby on Rails Tutorial Sample App" if page_title.empty? base_title else page_title + " | " + base_title end end end
20.846154
52
0.656827
ac87df517bc1089c8afd86a41099768c1591b678
1,235
# # Be sure to run `pod lib lint TMDBSwift.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 = "TMDBSwift"...
37.424242
117
0.663158
bf3ddfdeceea9a943db4c02976e6f547ef15539d
159
# Load the rails application require File.expand_path('../application', __FILE__) # Initialize the rails application AuthyDeviseDemo::Application.initialize!
26.5
52
0.811321
79fd7aa23687a7cfeaaa883cef377b68eced32b0
655
# Copyright 2015 gRPC authors. # # 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...
34.473684
74
0.755725
e920530c41f279ff70e0c7be09909cfa91b1812c
24,028
# # a language data file for Ruby/CLDR # # Generated by: CLDR::Generator # # CLDR version: 1.3 # # Original file name: common/main/kok_IN.xml # Original file revision: 1.31 $ # # Copyright (C) 2006 Masao Mutoh # # This file is distributed under the same license as the Ruby/CLDR. # private def init_data @locali...
42.602837
67
0.58282
bf93480b089ee029b392332b6e4e7503379673be
2,554
class Admin::MemberStoriesController < Admin::BaseController include NewsItemMethods before_filter :setup before_filter :get_news_item, :only => [:show, :update, :edit, :destroy] cache_sweeper :member_stories_sweeper, :only => [:create, :update, :destroy] uses_tiny_mce(:options =>...
29.697674
93
0.613939
6a082f81e22645f4d22dc16e13bd8f3fa5908f7d
1,735
# encoding: utf-8 class ImmutableStruct VERSION = '1.1.1' def self.new(*attrs, &block) struct = Struct.new(*attrs, &block) make_immutable!(struct) optionalize_constructor!(struct) extend_dup!(struct) struct end private def self.make_immutable!(struct) struct.send(:undef_method, "[]="...
21.419753
88
0.575216
5dc1559321055b1777dbbbddfd118616510083b9
1,129
# 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, ...
33.205882
74
0.741364
18a434ecbcd644aea0be78433aa6a7c258659bdd
671
Pod::Spec.new do |s| s.name = "CountdownLabel" s.version = '5.0.0' s.summary = 'Simple countdown UILabel with morphing animation, and some useful function. update to swift 5.0+' s.homepage = "https://github.com/suzuki-0000/CountdownLabel" s.license = { :type => "MIT", :file => "LICE...
44.733333
117
0.621461
edafa081fb1689645f6a9cb1b2a3a94fc6aceb71
2,687
# encoding: utf-8 require 'helper' class TestAddress < Test::Unit::TestCase include DeterministicHelper assert_methods_are_deterministic( FFaker::Address, :building_number, :city, :city_prefix, :city_suffix, :secondary_address, :street_address, :street_name, :street_suffix, :neighborhood, :countr...
24.427273
76
0.717529
876dc1fbbd42cd0c00f7a4588cc2ab04d66a5626
429
require_relative "../canvas_base_input_type" module LMSGraphQL module Types module Canvas class CanvasProficiencyInput < BaseInputObject description "Proficiency Ratings. API Docs: https://canvas.instructure.com/doc/api/proficiency_ratings.html" argument :ratings, String, "An array of profic...
30.642857
132
0.752914
d51dc6be92fe77b751341fd987ab1c2d5dab6cc0
1,248
# Configure Rails Environment ENV["RAILS_ENV"] ||= 'test' if File.exist?(dummy_path = File.expand_path('../dummy/config/environment.rb', __FILE__)) require dummy_path elsif File.dirname(__FILE__) =~ %r{vendor/extensions} # Require the path to the refinerycms application this is vendored inside. require File.expa...
34.666667
117
0.766026
e84cfbd8cf3de668c7a26de318b604d1bb35574b
713
require "spec_helper" require "hamster/stack" describe Hamster::Stack do [:pop, :dequeue].each do |method| describe "##{method}" do [ [[], []], [["A"], []], [%w[A B], ["A"]], [%w[A B C], %w[A B]], ].each do |values, expected| describe "on #{values.inspect}" do...
23
54
0.490884
332d5216852e8e706c1c45f3437c9da5a26f63f4
1,427
# encoding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'jekyll-pandoc-multiple-formats/version' Gem::Specification.new do |gem| gem.name = 'jekyll-pandoc-multiple-formats' gem.version = JekyllPandocMultipleFormats::VERSION gem.a...
46.032258
84
0.683952
6ac741f1bad500e0668e514507d2d552d8275921
363
require 'postal/config' if Postal.config.general&.exception_url require 'raven' Raven.configure do |config| config.dsn = Postal.config.general.exception_url config.environments = ['production'] config.environments << 'development' if ENV['DEV_EXCEPTIONS'] config.silence_ready = true config.tags...
27.923077
65
0.721763
f7ebb6def9fd5efcc6c253425e45e15e8c458d8d
782
# == Schema Information # # Table name: summaries # # id :bigint not null, primary key # content :text not null # created_at :datetime not null # updated_at :datetime not null # author_id :integer not null # feature_id :integer not null # ...
26.965517
66
0.643223
914aa752ab80b5cc1524094c280f8833126bc5b7
961
require 'tempfile' require 'json' target = ARGV[0].tr("\\","/") temp = Tempfile.new new_name = 'NORMALIZED_' + File.basename(target) file_path = File.dirname(target) output_name = file_path + '/' + new_name ffprobe_command = "ffprobe -v quiet -print_format json -show_format -show_streams -select_streams a '" + target...
43.681818
125
0.724246
bf840118ca8164f1d0c07a5a8263985b14740c33
1,235
# frozen_string_literal: true require "test_helper" module Byebug # # Tests exception catching # class CatchTest < TestCase def test_catch_adds_catchpoints enter "catch NoMethodError" debug_code(minimal_program) assert_equal 1, Byebug.catchpoints.size end def test_catch_removes...
23.301887
65
0.728745
1af3627ecb5e3dd55e265526c389835ba453b473
412
module BacklogKit class Client # Methods for the Git API module Git # Get list of git repositories # # @param project_id_or_key [Integer, String] Project id or project key # @return [BacklogKit::Response] List of git repositories def get_git_repositories(project_id_or_key) ...
27.466667
76
0.68932
e8e625506f020aa6a121d4ffb7d1be67fa6006c7
1,807
# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::ContainerRegistry::Mgmt::V2018_09_01 module Models # # Describes the credentials that will be used to access a custom registry # during a run. ...
28.68254
77
0.556724
e2e819035b82d2df9d59ca40161a6a0febafd461
4,154
# frozen_string_literal: true require_relative "abstract_unit" require "active_support/concern" class ConcernTest < ActiveSupport::TestCase module Baz extend ActiveSupport::Concern class_methods do def baz "baz" end def included_ran=(value) @included_ran = value end...
20.979798
102
0.689215
7a514eee3704f66bd615feb5be61136247bca5cd
356
cask 'manager' do version '18.5.21' sha256 '0be82612b7f63653e73d9a64077a112c93bf8cecf5f9989434b828a9c976f3b5' # d2ap5zrlkavzl7.cloudfront.net was verified as official when first introduced to the cask url "https://d2ap5zrlkavzl7.cloudfront.net/#{version}/Manager.dmg" name 'Manager' homepage 'https://www.ma...
29.666667
92
0.772472
1de1c8d156aa8e192191cf87b6e6f213d8013b6c
692
# encoding: utf-8 module HarmoniousDictionary module ModelAdditions def validate_harmonious_of(attr_names, option = {}) configuration = {message:'不能含有敏感词'} library = option.values[0].to_s configuration.update(attr_names.pop) if attr_names.last.is_a?(Hash) validates_each attr_names do |mod...
32.952381
115
0.674855
0150e9d67dde3e5bbc498fbf83b412d2150231d8
1,831
# # Author:: Tyler Cloke (tyler@chef.io) # Copyright:: Copyright 2015-2016, Chef Software, Inc # License:: Apache License, Version 2.0 # # 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 # # ...
24.743243
85
0.656472
1ce3bb9ee8aa23c9882e63dd6309cabc6b6fc16d
2,394
require "rails_helper" require "gds_api/test_helpers/content_store" require "gds_api/test_helpers/router" RSpec.describe DataHygiene::DocumentStatusChecker do include GdsApi::TestHelpers::ContentStore include GdsApi::TestHelpers::Router let(:base_path) { "/base-path" } describe "content-store status" do ...
30.303797
83
0.652464
87a9a64904bcb68b3070e1f2a3a023f76483b25f
241
# frozen_string_literal: true module Dynamodb module Api module Relation class LimitClause # :nodoc: attr_reader :number def initialize(number) @number = number end end end end end
15.0625
33
0.605809
ff1d7c8965ea308cfffcccba44bf8c29acc91342
4,019
require 'spec_helper.rb' describe Rack::OAuth2::Server::Resource::Bearer do let(:app) do Rack::OAuth2::Server::Resource::Bearer.new(simple_app) do |request| case request.access_token when 'valid_token' bearer_token when 'insufficient_scope_token' request.insufficient_scope! ...
32.41129
127
0.675292
ac49cd74c6e78258c5571302108ca64bdf84a09f
2,723
module BookingSync::API class Client module RatesRules # List rates rules # # Returns rates rules for the account user is authenticated with. # @param options [Hash] A customizable set of options. # @option options [Array] fields: List of fields to be fetched. # @return [Array...
40.641791
99
0.654425
4af705a2d0125213a0795bb335511a5a1fb12ef4
816
# frozen_string_literal: true require 'rails_helper' describe Services::Payu::Signature do let(:service) { described_class.new({}) } describe '#call' do let(:source) { double(:source) } subject { service.call } before do allow(service).to receive(:bytesized_hash).and_return source end ...
20.4
110
0.634804
ab3c59b12355f4ff1193aaf90a507b32fbcbaeaa
4,754
# frozen_string_literal: true RSpec.describe RuboCop::Formatter::TapFormatter do subject(:formatter) { described_class.new(output) } let(:output) { StringIO.new } let(:files) do %w[lib/rubocop.rb spec/spec_helper.rb exe/rubocop].map do |path| File.expand_path(path) end end describe '#file_fi...
27.964706
70
0.500421
039ca36af6ea79f0a984d88ae27cd45badfd6a45
5,565
# frozen_string_literal: true require 'spec_helper' RSpec.describe Banzai::Filter::SanitizationFilter do include FilterSpecHelper it_behaves_like 'default allowlist' describe 'custom allowlist' do it_behaves_like 'XSS prevention' it_behaves_like 'sanitize link' it 'customizes the allowlist only o...
30.409836
151
0.610782
f7bffedcd4c54021b9f9b9feaea83e94a17fd02e
979
module VHP module YMLHelper # Load YML the way we expect: symbolized names, # even if they specified symbols or not def load_yml_the_vhp_way(f) YAML.load(File.read(f), symbolize_names: true) end # Expected: a cve_yml hash, key of commits # Returns: every commit sha in the fixes hash ...
26.459459
98
0.572012
014e57b7a3c8cba42f63a210b411f1d005b042bd
243
# frozen_string_literal: true module Spring module Commands class Coach def env(*) "development" end def exec_name "coach" end Spring.register_command "coach", Coach.new end end end
13.5
48
0.596708
1d80735733dbb0c8ad2b715121c208b96d280afe
14,639
# encoding: utf-8 # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::Network::Mgmt::V2020_04_01 # # VpnSiteLinks # class VpnSiteLinks include MsRestAzure # # Creates and initializes a new in...
43.960961
183
0.702234
185d8b5a891911551428cda28c250ece95e6b507
2,686
require File.expand_path('../boot', __FILE__) # Pick the frameworks you want: require "active_record/railtie" require "action_controller/railtie" require "action_mailer/railtie" require "active_resource/railtie" require "sprockets/railtie" # require "rails/test_unit/railtie" if defined?(Bundler) # If you precompile...
41.96875
127
0.733805
ed9864b60ab546cad7e2710125705e279d81e501
4,943
# ========================================== # CMock Project - Automatic Mock Generation for C # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams # [Released under MIT License. Please refer to license.txt for details] # ========================================== class CMockConfig CMockDefa...
38.023077
137
0.51487
b9e235eb2465d51a70cda435906331d863b80b9d
32
module EinsteinVisionHelper end
10.666667
27
0.90625
084da0363637544ea938db66fabde428c88ca95c
189
module Erlash class TipFormatter < TemplateFormatter def format [].tap do |acc| acc << object.title acc << " #{object.description}" end end end end
17.181818
40
0.57672
e8c552a3f59152d58456101f5ab6b5d606e41571
6,625
# frozen_string_literal: false # # irb/multi-irb.rb - multiple irb module # $Release Version: 0.9.6$ # $Revision: 60139 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # # # IRB.fail CantShiftToMultiIrbMode unless defined?(Thread) module IRB class JobManager # Creates a new JobManager object d...
24.906015
85
0.581283
bb7a425eff3fd420fc4116c9f5d48721d8f988bb
584
module Kaminari module ConfigurationMethods extend ActiveSupport::Concern module ClassMethods # Overrides the default +per_page+ value per model # class Article < ActiveRecord::Base # paginates_per 10 # end def paginates_per(val) @_default_per_page = val end...
27.809524
96
0.674658
1ad1a56a4ce2c8a9f925811e1588532e79f47ffe
1,421
class CsvFix < Formula desc "Tool for manipulating CSV data" homepage "https://neilb.bitbucket.io/csvfix/" url "https://bitbucket.org/neilb/csvfix/get/version-1.6.tar.gz" sha256 "32982aa0daa933140e1ea5a667fb71d8adc731cc96068de3a8e83815be62c52b" license "MIT" bottle do cellar :any_skip_relocation sh...
39.472222
94
0.771992
210b0576f05fd4a455b7dcdfa1c32fd19720800c
5,091
# encoding: utf-8 #-- # Copyright 2013-2015 DataStax, 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 la...
24.358852
132
0.554901
ed1da559dd06fa20fa3bc0fd0df1600820376415
5,263
## # 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/ ## require 'msf/core' class Metasploit3 < Msf::Exploit::Remote Rank = GreatRankin...
27.411458
96
0.543036
1aeae3df3d7a345e236d873845cb888d0ed63293
1,099
# frozen_string_literal: true require 'rails_helper' require 'sn_foil/rails/controller/base' RSpec.describe SnFoil::Rails::Controller::Base do let(:subject) { described_class } it 'includes ChangeControllerConcern' do expect(subject.ancestors).to include(SnFoil::Rails::Controller::Concerns::ChangeControllerC...
33.30303
103
0.788899
38765158eac94b91920b748cf16a306389556d4f
1,190
require 'test_helper' class TradesControllerTest < ActionDispatch::IntegrationTest setup do @trade = trades(:one) end test "should get index" do get trades_url assert_response :success end test "should get new" do get new_trade_url assert_response :success end test "should create t...
24.285714
165
0.702521
aca4a7adb1df20ecaede2230836711b0ce578c6a
212
class Preference < ActiveRecord::Base belongs_to :candidate, class_name: "User" belongs_to :user, class_name: "User" validates :candidate_id, presence: true validates :user_id, presence: true end
30.285714
45
0.735849
ffc3df365a76d29749a601a20acb4d8ca0cd254d
251
require 'rails_helper' RSpec.describe "restaurants/index", type: :view do before(:each) do assign(:restaurants, [ Restaurant.create!(), Restaurant.create!() ]) end it "renders a list of restaurants" do render end end
16.733333
50
0.649402
61f264f546f2cee17dde3e8f1d44a9e0d41f4d6e
16,212
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic...
41.783505
245
0.683876
26d15b67ac9ec8ae80cc509181534ca2f25b271f
1,430
class DeviseCreateUsers < ActiveRecord::Migration[4.2] def change create_table(:users) do |t| ## Database authenticatable t.string :email, null: false, default: "" t.string :encrypted_password, null: false, default: "" ## Recoverable t.string :reset_password_token t.datetime :...
31.086957
94
0.665035
ff3f86f53967930cbff0b42c92290abe59dba07d
2,097
require 'fulfil/query' module Fulfil class Model attr_reader :model_name def initialize(client:, model_name:) @client = client @model_name = model_name @query ||= Fulfil::Query.new end # Delegate this to the client, including the model_name so we don't have to # type it every ...
24.103448
79
0.595613
e2e8302488bebe77f3b9e6491b2465a91fe46327
1,476
#-- copyright # OpenProject is an open source project management software. # Copyright (C) 2012-2021 the OpenProject GmbH # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProject, which is a fork ...
41
94
0.76626
e81cbcbc96d1f83dcf1bd6ec860e93fcbb8e8172
8,101
require 'strscan' # EmailReplyParser is a small library to parse plain text email content. The # goal is to identify which fragments are quoted, part of a signature, or # original body content. We want to support both top and bottom posters, so # no simple "REPLY ABOVE HERE" content is used. # # Beyond RFC 5322 (whi...
29.245487
80
0.624985
ab61ddd9cfbf4e996a28be28d1051aec89177669
1,518
# 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, software # distributed under the ...
30.36
120
0.689723
e86e5d851be3b05973d78b18c97c76a3129ee53f
1,473
# frozen_string_literal: true module RuboCop module Cop # This module provides functionality for checking if numbering match the # configured EnforcedStyle. module ConfigurableNumbering include ConfigurableEnforcedStyle SNAKE_CASE = /(?:[a-z_]|_\d+)$/ NORMAL_CASE = /(?:_\D*|[A-Za-z]\d*...
28.326923
77
0.610319
39eea38318a89b89297ba9e4f1ed9fe79beda234
772
require 'forwardable' require 'flat_hash/directory' require 'flat_hash/git' require 'flat_hash/hg' class FlatHash::Repository < FlatHash::Directory extend Forwardable def_delegators :@vcs, :changesets, :addremovecommit def initialize serialiser, path super @vcs = FlatHash::Git.new if File.exist?('.git')...
24.903226
62
0.695596
6ad89d3d5bebc92101e8ac878fdc09ccbb18c7dd
936
# frozen_string_literal: true require 'test/unit' require_relative '../Core/menu' # Tests for the Game class class MenuTest < Test::Unit::TestCase def setup @menu = Menu.new(%w[Start Exit], 'Normal') end def test_options_initialized assert_equal(@menu.options, %w[Start Exit]) end def test_title_in...
23.4
87
0.706197
289dcca77af7c06cf99c1bcf5a6d3fc3830dbcab
796
module ApplicationHelper def divide_in_chunks(arr, chunk_size) chunks = {} chunk_idx = 0 arr.each_with_index do |item,idx| chunks[chunk_idx] ||= [] chunks[chunk_idx] << item if (idx+1)%chunk_size == 0 chunk_idx=chunk_idx+1 end end chunks end def gravatar_url(u...
22.111111
87
0.654523
4aec938a5840327013ea9944ef8ada83e0b01535
24,711
require 'fileutils' require 'securerandom' require 'xcodeproj/project/object' require 'xcodeproj/project/project_helper' require 'xcodeproj/plist_helper' module Xcodeproj # This class represents a Xcode project document. # # It can be used to manipulate existing documents or even create new ones # from scratc...
33.943681
105
0.641779
08ad9060719e0508c49949f4243c6215098c71b7
380
class CreateFokemons < ActiveRecord::Migration[6.0] def change create_table :fokemons do |t| t.string :name t.string :type, :default => "water" t.integer :hit_points, :default => 0 t.integer :attack_points, :default => 0 t.string :avatar, :default => 'https://i.ytimg.com/vi/OxgKvRvNd...
27.142857
90
0.647368
bffb823802a6e8d4dcec99fab13b31f78184e228
1,163
class AuthenticationController < ApplicationController before_action :authenticate_request!, only: [:ping] # POST /api/login # This action handles a POST request for login # if the user data is right it will respond the request # with an auth token and the user data as JSON def authenticate_user user...
29.075
78
0.693035
0326c3f32ffaf4992c8b6e62fc911d79b06619b8
857
require 'mini_magick' require 'securerandom' def convert_all_jpgs(dir) files = Dir.glob(dir) files.each do |file| filename = File.basename(file, '.*') directory = File.dirname(file) puts "Converting #{file}..." image = MiniMagick::Image.open(file) image.resize "#{500*500}@>" image.format "...
23.805556
65
0.700117
bf7a91bc56d2d5abaeb3cde2d99bea0ae9d510d4
1,432
# frozen_string_literal: true # Copyright (c) 2008-2013 Michael Dvorkin and contributors. # # Fat Free CRM is freely distributable under the terms of MIT license. # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php #------------------------------------------------------------------------------...
31.130435
126
0.717179
218ba2ba1aa9cccda8e4f90c39fddc428b327f11
4,422
require_relative '../test_helper' class LicenceEditionTest < ActiveSupport::TestCase def setup @artefact = FactoryGirl.create(:artefact) end should "have correct extra fields" do l = FactoryGirl.create( :licence_edition, panopticon_id: @artefact.id, licence_identifier: "AB1234", ...
41.716981
128
0.688602