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
abff971bd1d92df4f38ee9c11dd60c1a61e329db
557
require 'bio-ucsc' describe "Bio::Ucsc::Hg19::WgEncodeHaibMethylRrbsMcf10aesYalestruhlgrowprotSitesRep1" do describe "#find_by_interval" do context "given range chr1:1-800,000" do it 'returns a record (r.chrom == "chr1")' do Bio::Ucsc::Hg19::DBConnection.default Bio::Ucsc::Hg19::DBConnecti...
32.764706
106
0.691203
7ad0be58869b05ef636847d99101924947c59d02
137
RSpec::Matchers.define :be_url do |expected| match do |actual| URI.parse(actual) rescue URI::InvalidURIError false end end
17.125
44
0.708029
79ea6adfc62ccea1de6ad0454f6834a8e7c825bc
2,123
class ZeroInstall < Formula desc "Zero Install is a decentralised software installation system" homepage "http://0install.net/" url "https://github.com/0install/0install/archive/v2.12-1.tar.gz" version "2.12-1" sha256 "317ac6ac680d021cb475962b7f6c2bcee9c35ce7cf04ae00d72bba8113f13559" revision 1 bottle do...
34.803279
92
0.675459
7a575d230999167111464e4d6f19f1b6b4a57750
1,946
class NicknamesController < ApplicationController before_action :set_nickname, only: [:show, :edit, :update, :destroy] # GET /nicknames # GET /nicknames.json def index @nicknames = Nickname.all end # GET /nicknames/1 # GET /nicknames/1.json def show end # GET /nicknames/new def new @nic...
25.946667
95
0.668037
ff3423b6841e3eed0e8fe848b19bf4b288db5e0c
367
require "bundler/setup" require "hl/citation" RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" # Disable RSpec exposing methods globally on `Module` and `main` config.disable_monkey_patching! config.expect_with ...
24.466667
66
0.752044
ed2bf083ea94baea408edee7dc172a7c6180604d
255
pap_file=Файл паролей PAP,0 ppp_options=Файл настройки PPP,0 dialin_config=Файл настройки приема входящих звонков mgetty,0 encrypt_pass=Шифровать пароли в файле паролей,1,1-Да,0-Нет login_config=Файл настройки входов mgetty,0 line2=Системные параметры,11
36.428571
61
0.847059
11098c7552f586b80c05edd0abf53e657fbf5277
551
Spree::Admin::StockTransfersController.class_eval do def load_viewable_stock_locations @stock_locations = Spree::StockLocation.for_store.accessible_by(current_ability, :read) end def load_source_stock_locations @source_stock_locations ||= Spree::StockLocation.for_store.accessible_by(current_ability, :tra...
39.357143
162
0.823956
ed3ef1e7144d8f437a9f9e7968777bd1409fff1f
859
#!/usr/bin/env ruby # encoding: utf-8 drchord_dir = File.expand_path(File.dirname(__FILE__)) begin ENV['BUNDLE_GEMFILE'] = File.expand_path(File.join(drchord_dir, 'Gemfile')) require 'bundler/setup' rescue LoadError puts "Error: 'bundler' not found. Please install it with `gem install bundler`." exit end requ...
28.633333
82
0.684517
e803d7fa674121c0b866c9bd9e704877c1438476
53
class X < Hash def initialize end end X.new.dup
7.571429
16
0.679245
332e3c509fc8cc468db22d7b59911c4bfb2d25aa
1,583
class PetitionCountJob < ApplicationJob class InvalidSignatureCounts < RuntimeError; end delegate :update_signature_counts, to: :Site delegate :signature_count_interval, to: :Site delegate :disable_signature_counts!, to: :Site delegate :enable_signature_counts!, to: :Site delegate :disable_invalid_signatur...
23.279412
61
0.725837
91df4191702eb90db0be1e1cecf90d7024405831
20,629
# 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...
31.982946
210
0.534878
bb29447fc1af081e16f32b085a8e7f2f16628f11
2,071
class Libdap < Formula desc "Framework for scientific data networking" homepage "http://www.opendap.org" url "https://github.com/OPENDAP/libdap4/archive/version-3.18.0.tar.gz" sha256 "373c60cf2c5c9eaf598558167aedbc3ef9a0d9b652dfbd96b4725637cf03f628" head "https://github.com/OPENDAP/libdap4.git" bottle do ...
33.95082
92
0.708353
33b73a7b5a18b9a1663272575401def8c40ed3ed
694
# == Schema Information # # Table name: accounts # # id :integer not null, primary key # type :string default("Account"), not null # description :string default(""), not null # currency :string default("USD"), not null # created_at :datetime not nu...
25.703704
61
0.62536
18fded52a20abb832f6acd5e97dc0203d8e49c86
7,229
require 'concurrent/dereferenceable' require 'concurrent/atomic/condition' require 'concurrent/atomic/event' module Concurrent # An `MVar` is a synchronized single element container. They are empty or contain one item. # Taking a value from an empty `MVar` blocks, as does putting a value into a full one. # You ...
33.16055
203
0.650989
e21999b7319d5d93641974bb986386419850f113
703
require_relative '../rspec_helper' describe Nfe::NaturalPeople do before(:each) do Nfe.api_key('e12cmDevG5iLhSd9Y7BOpxynL86Detjd2R1D5jsP5UGXA8gwxug0Vojl3H9TIzBpbhI') Nfe::NaturalPeople.company_id("55e8a2c9440c3b0b84ceaa12") end it 'should list all NaturalPeople' do natural_peoples_list = Nfe::Natura...
33.47619
86
0.775249
018126ba72a7bc4badcee9a2c316f13b44ca71f2
77
Delayed::Worker.destroy_failed_jobs = false Delayed::Worker.max_attempts = 2
25.666667
43
0.818182
5df96f0445238273bfd64c6522991af8eb53a1e7
3,350
# Copyright 2011-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" fil...
29.130435
78
0.570149
21de45ba714a800fe9d0c761f924a9f046f2d6e3
1,321
# frozen_string_literal: true require_relative "support/simplecov" require "spec_helper" ENV["RAILS_ENV"] ||= "test" require_relative "../config/environment" # Prevent database truncation if the environment is production abort("The Rails environment is running in production mode!") if Rails.env.production? require "...
26.42
86
0.770628
1cb3b157f0abbf835f7b6a809e057b3e5f12f05f
3,483
# frozen_string_literal: true module RuboCop module Cop module Layout # This cop looks for trailing blank lines and a final newline in the # source code. # # @example EnforcedStyle: final_blank_line # # `final_blank_line` looks for one blank line followed by a new line # #...
30.552632
78
0.559288
4a3778a0ac271479ad83d6a9cb2f753b33864de1
81
class Clue < ActiveRecord::Base belongs_to :game_board belongs_to :place end
16.2
31
0.777778
ed76f1b385e8c17c9ed8f08c3b6d04d2f9524f1f
5,184
# # Be sure to run `pod spec lint ALTimer.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://docs.cocoapods.org/specification.html # To see working Podspecs in the CocoaPods repo see https://github.co...
37.294964
101
0.597222
e9e787fe8c64ad343776f2d8458b1bbb6a1559bc
235
Two sparse right-hand sides for a five by five matrix EXAMPLE3 rhsrs SPARS_R2 r 5 2 3 (5I5) (5I5) (5E10.1) 1 3 4 3 4 5 3.0 4.0 1.0
39.166667
72
0.387234
1830a8d657c35d5e60940233d5a24055fc86d5b6
1,015
# frozen_string_literal: true require 'capybara/selenium/extensions/html5_drag' class Capybara::Selenium::ChromeNode < Capybara::Selenium::Node include Html5Drag def set_text(value, clear: nil, **_unused) super.tap do # React doesn't see the chromedriver element clear send_keys(:space, :backspace...
23.604651
148
0.703448
03e3429f6cb42ccb9d703222164bb5f91054811a
651
Pod::Spec.new do |s| s.name = 'Godzippa' s.version = '2.1.1' s.license = 'MIT' s.summary = 'GZip Compression / Decompression Category for NSData and NSFileManager.' s.homepage = 'https://github.com/mattt/Godzippa' s.social_media_url = 'https://twitter.com/mattt' s.author = { 'Mattt' => 'mattt@me....
31
88
0.632873
acb6baf4329682e0541584db806d3658d16489bc
1,568
require File.dirname(__FILE__) + '/../abstract_unit' class RangeTest < Test::Unit::TestCase def test_to_s_from_dates date_range = Date.new(2005, 12, 10)..Date.new(2005, 12, 12) assert_equal "BETWEEN '2005-12-10' AND '2005-12-12'", date_range.to_s(:db) end def test_to_s_from_times date_range = Time.u...
24.5
96
0.686224
abe51121c987094674ee8fb84f1f43adc29760bc
9,788
RSpec.describe Sentry do before do perform_basic_setup end let(:event) do Sentry::Event.new(configuration: Sentry::Configuration.new) end let(:transport) do Sentry.get_current_client.transport end describe ".init" do context "with block argument" do it "initializes the current hub...
28.703812
109
0.670719
7ad48b027f20772175bda703fbe499884aaceaee
4,721
# encoding: utf-8 require 'openssl' require 'hashie/mash' require 'utils/file_reader' module Inspec::Resources class X509CertificateResource < Inspec.resource(1) name 'x509_certificate' supports platform: 'unix' supports platform: 'windows' desc 'Used to test x.509 certificates' example " ...
34.210145
139
0.651769
e8fc0f5f04890a88c5f681fdb594923e832ed04f
930
# -*- ruby -*- # frozen_string_literal: true require 'observability' unless defined?( Observability ) # A mixin that allows events to be created for any current observers at runtime. module Observability::ObserverHooks ### Create an event at the current point of execution, make it the innermost ### context, then ...
29.0625
85
0.73871
bbb4c63ba0694be933dc5d4d9289fbf078650834
1,197
Puppet::Type.newtype(:swift_container_sync_realms_config) do ensurable newparam(:name, :namevar => true) do desc 'Section/setting name to manage from /etc/swift/container-sync-realms.conf' newvalues(/\S+\/\S+/) end newproperty(:value) do desc 'The value of the setting to be defined.' munge do...
22.166667
107
0.640769
339f484caebe2292daaab97404776b1120e59b64
158
require 'spec_helper' describe Chatter::Config do it 'should specify a default robot' do expect(Chatter::Default.bot).to be_an(Bots::Clever) end end
19.75
55
0.740506
5d5c77bfa71e6ab909f143508ab23ee70f3fbf60
7,823
require_relative "./table" require_relative "./inline" module IsoDoc module WordFunction module Body def define_head(head, filename, _dir) head.style do |style| loc = File.join(File.dirname(__FILE__), "..", "base_style", "metanorma_word.scss") styleshee...
30.439689
80
0.509907
9146a52634e9cb92eb8851f78c9306e8a27d2dfd
446
# -*- coding: utf-8 -*- module DataMapper module Validations module Fixtures class Pirogue # # Behaviors # include DataMapper::Resource # # Properties # property :id, Serial property :salesman, String, :default => 'Layfayette'...
15.37931
60
0.504484
b924ad14a88d114288576f1b0cd72fbc9f660b4a
131
class Supplier < ApplicationRecord #Associations has_many :requests #Validations validates_presence_of :description end
13.1
36
0.793893
ac271a05563e98ef0f227fb5e17fef7906a78634
2,489
#!/usr/bin/env ruby # I am a newbie and thought this one seemed easy enough # to jump in (especially since I "borrowed" the hard part # from a previous Ruby Quiz). I would appreciate any # comments improving my idiomatic ruby. # - Mark Thomas ['ruby','thomaszone.com'].join('@') # seed sentence sentence = "LOOK AND SAY...
24.643564
64
0.62716
6aec90c5e2a18bd2142faaa43db5e963a2aad331
175
class CreateAdTags < ActiveRecord::Migration def change create_table :ad_tags do |t| t.belongs_to :ad t.belongs_to :tag t.timestamps end end end
17.5
44
0.662857
0155eaf52ea6774fa1ad9edd982476d16bc4f1b0
942
# frozen_string_literal: true require "rails_helper" module PublishCourseDetails describe View do include SummaryHelper context "with a publish course", feature_publish_course_details: true do let(:course) { trainee.published_course } let(:trainee) { create(:trainee, :with_secondary_education, ...
34.888889
101
0.742038
ac3a503eea222584fa296ed8373416ff049ea107
1,483
module SessionsHelper # Logs in the given user. def log_in(user) session[:user_id] = user.id end # Remembers a user in a persistent session. def remember(user) user.remember cookies.permanent.signed[:user_id] = user.id cookies.permanent[:remember_token] = user.remember_token end # Retu...
23.539683
73
0.690492
d5c586174bc8974194b7a9422b004289ae0dd8fe
1,046
require 'rails_helper' module Mutations module Auth RSpec.describe SignIn, type: :request do describe '.resolve' do it 'returns current_user' do user = FactoryBot.create(:user) variables = {auth: user.username, password: user.password} post '/graphql', params: {query: ...
25.512195
71
0.448375
5d3585638b5b09abf8f9bc14724c85f78f80ac2b
7,259
#!/usr/bin/env ruby # Copyright 2016 hidenorly # # 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 a...
25.925
113
0.675988
f72d53918c6c5db93ba4fdf40178b24eb26cb694
704
# -*- ruby -*- _VERSION = "0.4.6" date = %w$Date:: 2016-09-11 19:33:36 +0900#$[1] Gem::Specification.new do |s| s.name = "io-console" s.version = _VERSION s.date = date s.summary = "Console interface" s.email = "nobu@ruby-lang.org" s.description = "add console capabilities to IO instances." s.required_ru...
32
81
0.653409
08ca862ac3ce59a9483536f04455c7514b5209dd
289
class CreateAuthentications < ActiveRecord::Migration def self.up create_table :authentications do |t| t.integer :user_id, :null => false t.string :provider, :uid, :null => false t.timestamps end end def self.down drop_table :authentications end end
20.642857
53
0.678201
bb04c3b85779164fd35af5b69f8dec4e8174bdda
1,562
class Avrdude < Formula desc "Atmel AVR MCU programmer" homepage "https://savannah.nongnu.org/projects/avrdude/" url "https://download.savannah.gnu.org/releases/avrdude/avrdude-6.3.tar.gz" mirror "https://download-mirror.savannah.gnu.org/releases/avrdude/avrdude-6.3.tar.gz" sha256 "0f9f731b6394ca7795b88359689...
34.711111
93
0.731754
f750067c3a12d4e4f833d39e843b22d34189de57
1,412
class Slides < Formula desc "Terminal based presentation tool" homepage "https://github.com/maaslalani/slides" url "https://github.com/maaslalani/slides/archive/refs/tags/v0.6.2.tar.gz" sha256 "67de7cd34317bfba774102c690cd7de9f6d5b8f0271d34c1a5eff5fbb22f36b8" license "MIT" head "https://github.com/maaslalan...
32.837209
122
0.721671
6ab2be01746e15cfc47649cf4496b4d55f99d4b2
658
require 'spec_helper_acceptance' # Ensure IPTables is installed - Section 3.6.1 describe package('iptables') do it { should be_installed } end # Ensure Default deny Firewall Policy - Section 3.6.2 # Ensure loopback traffic is configured - Section 3.6.3 # Ensure outbound and established connections are configured ...
34.631579
76
0.731003
285cb301e1f82d73fbee1402da4201a6e58a1254
2,861
# frozen_string_literal: true require 'spec_helper' require 'pinboard-fixup-tweets/stats' require 'timecop' # rubocop:disable Metrics/BlockLength RSpec.describe PinboardFixupTweets::Stats do subject do Timecop.freeze(Time.utc(2018, 1, 29, 21, 47, 11)) do described_class.new('Unit Test') end end #...
26.009091
88
0.631597
91f6f10f485e7cb2d4a205b955257ffaee35cea0
1,004
class Shapelib < Formula desc "Library for reading and writing ArcView Shapefiles" homepage "http://shapelib.maptools.org/" url "https://download.osgeo.org/shapelib/shapelib-1.5.0.tar.gz" sha256 "1fc0a480982caef9e7b9423070b47750ba34cd0ba82668f2e638fab1d07adae1" livecheck do url "https://download.osgeo.or...
32.387097
93
0.748008
019290bb87ae9ba770a887ca5e0a233ff18e31ca
57
class NilClass #:nodoc: def to_param nil end end
9.5
23
0.666667
26338b24336c1ab92212e8b4507eb969b9a9073a
229
class UsersController < Clearance::UsersController private def new @user = User.new end def user_params params.require(:user).permit(:name, :cash_balance, :email, :password) end end
17.615385
77
0.624454
0183a8c0f6d38d4b8fa41fbab3950810ad9f9e6b
461
module StatsD::Instrument::Helpers def capture_statsd_calls(&block) mock_backend = StatsD::Instrument::Backends::CaptureBackend.new old_backend, StatsD.backend = StatsD.backend, mock_backend block.call mock_backend.collected_metrics ensure if old_backend.kind_of?(StatsD::Instrument::Backends::Ca...
30.733333
74
0.774403
91539ef2c5e34d0418eb3c014b72c06d27c09ad0
897
# frozen_string_literal: true class NotificationMailer < ApplicationMailer helper :base layout nil def article(article, user) @user = user @blog = article.blog @article = article build_mail @blog, @user, "New article: #{article.title}" end def comment(comment, user) @user = user @bl...
21.878049
70
0.654404
217139ef46ab7d7008edf7c15c05ac8143c36e5a
62
class Instrument < ApplicationRecord belongs_to :band end
15.5
36
0.790323
d52d3f7b0674dd82be0b96cc41645d48461cb7de
38
require File.join('omniauth', 'webex')
38
38
0.736842
ff7d36984b43e4d52653289d8b63b1926e776c6c
10,130
class ContainerDashboardService < DashboardService include ContainerServiceMixin include Mixins::CheckedIdMixin CPU_USAGE_PRECISION = 2 # 2 decimal points def initialize(provider_id, controller) @provider_id = provider_id @ems = find_record_with_rbac(ManageIQ::Providers::ContainerManager, @provider_id...
34.222973
166
0.636032
08829e9b26afd42f8dd41fcc7e03b173f3235678
8,254
# # Author:: Bryan McLellan (btm@loftninjas.org) # Copyright:: Copyright 2009-2016, Bryan McLellan # 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 # # ...
36.201754
138
0.607584
1a843f667fd3081df5e67c174a51facbf74b47a8
398
require 'rails_helper' RSpec.describe Category do describe "should exclude sentinel category only" do let!(:current_user) { create :user } let!(:another_user) { create :user } let!(:ucat) { create :category, user_id: current_user.id } let!(:acat) { create :category, user_id: another_user.id } it...
26.533333
62
0.68593
e806161370badd9a781500de9477cb7b4c157b77
12,677
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'DAST profiles (GraphQL fixtures)' do describe GraphQL::Query, type: :request do include ApiHelpers include GraphqlHelpers include JavaScriptFixturesHelpers include API::Helpers::GraphqlHelpers include RepoHelpers shared_exa...
30.040284
147
0.595488
5d80fb086ece6781ab3711a520a334fd5ffca6bc
6,593
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::EmptyLinesAroundModuleBody, :config do subject(:cop) { described_class.new(config) } let(:extra_begin) { 'Extra empty line detected at module body beginning.' } let(:extra_end) { 'Extra empty line detected at module body end.' } let(:missing_b...
24.600746
78
0.586986
6293ab538ed581af12186b4eef442e6cafa80d0f
211
FactoryGirl.define do factory :notification do association :blog, :factory => :blog email "sue@home.com" end factory :invalid_notification, parent: :notification do |f| f.email nil end end
21.1
61
0.696682
bf8f35f4bf4b1395f9ac4c5eb03b7c18c9e78c4c
9,200
# -*- coding: binary -*- require 'rex/socket' require 'rex/proto/http' require 'rex/proto/http/handler' module Rex module Proto module Http ### # # Runtime extension of the HTTP clients that connect to the server. # ### module ServerClient # # Initialize a new request instance. # def init_cli(server) sel...
23.650386
107
0.625109
bf232cee5b8d60806d712a791357fdcc8c522ce4
2,528
require 'rails_helper' RSpec.describe BidsController, type: :controller do describe 'testing bids controller' do before do @user_seller = FactoryBot.create(:user) @lot_pending = FactoryBot.create(:lot, user: @user_seller) @lot_closed = FactoryBot.create(:lot, :closed, user: @user_seller) ...
32
89
0.607991
d540ebf74e31386dc28e637fd0469b05f15ce76d
1,203
Given /^community "(.*?)" allows only organizations$/ do |community| c = Community.where(ident: community).first c.only_organizations = true c.save! end Given /^I signup as an organization "(.*?)" with name "(.*?)"$/ do |org_username, org_display_name| steps %Q{ Given I am on the signup page When I fil...
31.657895
99
0.697423
ab4479819c09a16c914dff2614b9847c56f0652a
1,112
class Bcpp < Formula desc "C(++) beautifier" homepage "https://invisible-island.net/bcpp/" url "ftp://ftp.invisible-island.net/bcpp/bcpp-20150811.tgz" sha256 "6a18d68a09c4a0e8bf62d23d13ed7c8a62c98664a655f9d648bc466240ce97c3" bottle do cellar :any_skip_relocation sha256 "ca36fc5ff5890cebc995c184c9cd80...
33.69697
93
0.705935
1cfcad4232fb683e2e0f9147ec3cddd86bce7e14
701
class AddAbilityForAuctionToEndAt2359TheSameDay < ActiveRecord::Migration[5.2] def up auction_duration_description = <<~TEXT.squish Number of hours for which an auction is created. You can also use 'end_of_day' for auctions to end at the end of the same calendar day. Default: 24. TEXT setting...
31.863636
84
0.746077
ac1c052fd2fbdcc26f835d4d6462baa0189669b3
334
class CreateCourses < ActiveRecord::Migration[6.0] def up create_table :courses do |t| t.string :title, null: false, index: { unique: true } t.text :content, null: false t.integer :credit_hour, null: false, default: 0 t.timestamps null: false end end def down drop_table :cour...
20.875
59
0.649701
ed626cf99063d398f855e9836ce390030f9f13af
1,863
module OpenActive module Models module Schema class Course < ::OpenActive::Models::Schema::CreativeWork # @!attribute type # @return [String] def type "schema:Course" end # @return [String,OpenActive::Models::Schema::AlignmentObject,OpenActive::Models::Sche...
33.872727
109
0.6146
6204474736beb4879f8d142fcae2484a6a7396ad
471
require 'fog/telefonica' require 'time' auth_url = "http://10.0.0.101:5000/v2.0/tokens" username = 'admin' password = 'D78JVyRnzJG8j7Mb6fgpeUMp7' @connection_params = { :telefonica_auth_url => auth_url, :telefonica_username => username, :telefonica_api_key => password, } puts "### SERVICE CO...
20.478261
62
0.698514
1d055650523b5723230a08a647d2016fe493d67d
398
cask 'amidst' do version '4.2' sha256 'dcc3692207ab4b386bc74a2be087bcd3b52f641a7f0cf505c166a7d8eccb0946' url "https://github.com/toolbox4minecraft/amidst/releases/download/v#{version}/amidst-v#{version.dots_to_hyphens}.zip" appcast 'https://github.com/toolbox4minecraft/amidst/releases.atom' name 'amidst' h...
33.166667
120
0.786432
d5329b89b1b266e5c48d1cc3467c868041766c91
301
class Navigator < ActiveRecord::Base belongs_to :navigatable, polymorphic: true belongs_to :block, touch: true validates_presence_of :name, :block_id, :navigatable_id, :navigatable_type def self.list(block_id) includes(:navigatable).where(block_id: block_id).order("position") end end
27.363636
76
0.767442
d5286c44a98672381cb296fcaf91491106fe811d
386
# == Schema Information # # Table name: environments # # id :integer not null, primary key # name :string(255) # description :string(255) # application_id :integer # created_at :datetime # updated_at :datetime # require 'test_helper' class EnvironmentTest < ActiveSuppor...
19.3
57
0.629534
1a61f3449467ba477fcd93e03a2305a23efac7dd
3,759
require 'test_helper' class DomainConstraintsTest < ActiveSupport::TestCase def setup ThreeScale::DevDomain.stubs(enabled?: false) end class BuyerDomainConstraintsTest < DomainConstraintsTest setup do ThreeScale.config.stubs(tenant_mode: 'multitenant') @domain = 'domain.example.com' ...
31.588235
114
0.727321
015245bba48bc8fff567010fadcda5faf9f5f642
608
require 'chefspec' require 'chefspec/berkshelf' # Spec helper for np-web module SpecHelper @@runner = {} # rubocop:disable Style/ClassVars def common_stubs stub_command('which nginx').and_return('/usr/bin/nginx') stub_data_bag_item('certificates', 'nginx-default').and_return( 'cert' => 'some_cert',...
21.714286
77
0.680921
1dd5f7f86f95a070ff1d7291a315e755730daf53
1,762
require "spec_helper" describe RoutesListController do before do @user_id = rand(999999).to_s end before :each do request.env["HTTP_ACCEPT"] = 'application/json' end it "should not list any routes for not logged in users" do get :smoke_test_routes expect(response.status).to eq(403) exp...
31.464286
106
0.696368
62c8ecf3fb89bf23ef0f649a4c37a9accac45521
2,099
# Copyright:: (c) Autotelik Media Ltd 2015 # Author :: Tom Statter # Date :: Feb 2015 # License:: MIT # # Details:: Read mappings and provide cache type services for source=>destination mappings # require 'erubis' module DataShift module Exporters class Configuration < DataShift::Configuration ...
24.694118
92
0.633635
ed1b42880b11368893608102e4066cccb65ffdd5
1,581
# # Be sure to run `pod lib lint KKPodTest.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 https://guides.cocoapods.org/syntax/podspec.html # Pod::Spec.new do |s| s.name = 'KKPodTest...
36.767442
99
0.633144
e293b5cfbf13e09eb5b100e54e377108d95214f1
656
# frozen_string_literal: true require "rake" RSpec.describe "timestamp_migrator_undo_extension" do def create_migrator Sequel::TimestampMigrator.new(DB, "spec/files/migrations") end before { create_migrator.run } specify do expect(DB.tables).to include(:first_table, :second_table) create_migrato...
25.230769
92
0.733232
e834ec96857f2d6b3661b90ab2257b55ab20eb32
294
require "rails_helper" RSpec.describe "pages/home.html.erb", type: :view do it "displays the gov banner" do assign(:search, {}) render template: "pages/home", layout: "layouts/application" expect(rendered).to match "An official website of the United States government" end end
29.4
83
0.721088
e985a6464a92402ce7d62755d70d220731559966
4,068
# # Copyright (c) 2009-2011 RightScale 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 without restriction, including # without limitation the rights to use, copy, modify, merge, publis...
38.377358
108
0.721976
61689be4de21d7d5bf7068964cb6fdc8cb4ca38b
1,917
# # Cookbook Name:: cfncluster # Recipe:: _compute_base_config # # Copyright 2013-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the # License. A copy of the License is located at # # h...
26.260274
121
0.725091
ab518b3281d7f0fe563e02c85e0976b492b3d8cb
12,608
module Neo4j module ActiveNode module Query # rubocop:disable Metrics/ModuleLength module QueryProxyMethods # rubocop:enable Metrics/ModuleLength FIRST = 'HEAD' LAST = 'LAST' def rels fail 'Cannot get rels without a relationship variable.' if !@rel_var ...
41.748344
153
0.603823
7976ec221b3492adc050661983cdec760c65c8ff
270
# frozen_string_literal: true require "test_helper" # Tests to assure external pages are accessible. class ExternalControllerTest < ActionDispatch::IntegrationTest test "should get privacy policy" do get privacy_policy_url assert_response :success end end
22.5
62
0.796296
26a5d4829de54634dd533cfa424e390746846cb7
656
module I18n module Gettext PLURAL_SEPARATOR = "\001" CONTEXT_SEPARATOR = "\004" autoload :Helpers, 'i18n/gettext/helpers' @@plural_keys = { :en => [:one, :other] } class << self # returns an array of plural keys for the given locale so that we can # convert from gettext's integer-i...
25.230769
75
0.629573
e2d9fe749ddca30b1a372ba858c28120688c05c3
751
class Ability include Hydra::Ability include Hyrax::Ability self.ability_logic += %i[ everyone_can_create_curation_concerns group_permissions superadmin_permissions ] # Define any customized permissions here. def custom_permissions can [:create], Account end def admin_permissions ...
17.068182
46
0.693742
e2215d3dd746cbb384884c5d82a3a512f8f3631c
1,022
module Zoomus module Actions module Report def report_getaccountreport(*args) options = Utils.extract_options!(args) Utils.require_params([:from, :to], options) Utils.process_datetime_params!([:from, :to], options) Utils.parse_response self.class.post("/report/getaccountrepo...
32.967742
91
0.665362
62e5a6a8c21b4346e3591fc474a5dc7b62792e39
347
# frozen_string_literal: true # fruit_prices = { # banana: 1.05 # } fruit_prices = Hash.new('Not found') fruit_prices[:banana] = 1.05 fruit_prices[:orange] = 0.69 fruit_prices[:kiwi] = 10.99 p(fruit_prices[:steak]) p(fruit_prices[:celery]) p(fruit_prices[:mushrooms]) p(fruit_prices[:banana]) p(fruit_prices[:orang...
18.263158
36
0.717579
797cc42a03c507454ae2534fcee2992926435446
978
# frozen_string_literal: true require 'spec_helper' RSpec.describe Gitlab::WordDiff::Segments::Chunk do subject(:chunk) { described_class.new(line) } let(:line) { ' Hello' } describe '#removed?' do subject { chunk.removed? } it { is_expected.to be_falsey } context 'when line starts with "-"' do ...
18.111111
51
0.605317
e2408a91cfefd8bc3482d7b78987b4477251dccf
707
require 'spec_helper' describe "RailsAdmin Basic Bulk Action" do subject { page } before(:each) do @players = 2.times.map { FactoryGirl.create :player } end describe "bulk_delete" do it "shows names of to-be-deleted players" do page.driver.post(bulk_action_path(:bulk_action => 'bulk_delete', :...
27.192308
129
0.676096
b9e3723d8d2e539174d90a63bd85bb86bee40e03
1,241
# 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/version-3/CONTRIBUTING.md # # WARNING ABOUT GENERATED CODE Gem::Specification.new do |spec| spec.name = 'aws-sdk-dax' spec....
38.78125
140
0.662369
bbf2e140cf18e9f99aa9aeecdc9fffc006319a28
553
# frozen_string_literal: true require 'spec_helper' RSpec.describe Nanites::Compounds::MatchNoneCompound do it_behaves_like :ClassLoader it_behaves_like :Compound, [NoneCommand.new, SomeCommand.new] let :command_queue do [NoneCommand.new, SomeCommand.new] end context 'when executed' do it 'has onl...
23.041667
63
0.725136
28643fb7eaa6b16f54091848073ff495c3feca32
38
ClerkRails::Engine.routes.draw do end
12.666667
33
0.815789
3301cad91cdd7c1ebda0d77f5e83adb5c9bd9704
430
module Hbc class CLI class Base def self.command_name @command_name ||= name.sub(/^.*:/, "").gsub(/(.)([A-Z])/, '\1_\2').downcase end def self.visible true end def self.cask_tokens_from(args) args.reject { |a| a.empty? || a.chars.first == "-" } end ...
16.538462
83
0.497674
5dd731f2ab98235afd4d981a8bc60dc4eae87ef6
1,086
# rubocop:disable Style/AsciiComments # Module mixed into Field that encapsulates all the style logic (single, # multiple, required, optional, etc.). module Field::Style CHOICES = { "single" => "Single value – optional", "single-required" => "Single value – required", "multiple" => "Multiple values – opt...
27.846154
77
0.632597
62a2b49c4fc47259d83659f77219db581def7193
401,897
# 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 require 'seahorse/client/plugins/content_length.rb' require 'aws-sdk-core/plugins/credentials_configuration.rb' ...
60.390233
217
0.691319
e94d4c8d67f209e61847c2081daa2e4b795171d9
1,067
require 'rails_helper' describe User do describe '#generate_uid' do it 'gets uid assigned' do user = create(:user) expect(user.uid).not_to be_blank end end describe 'Validation' do context 'when valid' do it 'creates a new user' do expect{create(:user)}.to change(User, :cou...
27.358974
84
0.617619
03357af7b7102ad74e57904d86c8d9a968c76f06
2,725
#!/usr/bin/env ruby # Encoding: utf-8 # # Copyright:: Copyright 2016, Google Inc. All Rights Reserved. # # License:: 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 # # ...
32.831325
79
0.679633
91c74e4694c1c37ccdb3a265799900d7415e7773
485
# frozen_string_literal: true # mock ElasticSearch request to response success class MockElasticSearch class << self FakeResponse = Struct.new(:status, :body, :headers) do def status values[0] || 200 end def body values[1] || {hits: {hits: [], total: 0}} end def he...
19.4
83
0.610309
796eed3eb82fc7cfebc18276bac75c55b35f4dea
362
module Flipper module Rails def self.flipper @flipper ||= Flipper.new( ::Rails.application.config.flipper[:adapter].new( ::Rails.application.config.flipper[:adapter_options] || {} ) ) end end end require 'flipper' require 'flipper/rails/version' require 'flipper/rails...
20.111111
68
0.660221
ffdded10e899dc7704da7db424a1ef5eda55db21
6,552
require 'support/shared/integration/integration_helper' require 'chef/mixin/shell_out' describe "chef-client" do extend IntegrationSupport include Chef::Mixin::ShellOut when_the_repository "has a cookbook with a no-op recipe" do file 'cookbooks/x/recipes/default.rb', '' it "should complete with success...
44.27027
160
0.700855
91949b660ad9a2b9b0f093488ad4d21f5f0c3fa4
163
# typed: false class AddNameIndexToOperationType < ActiveRecord::Migration def change add_index :operation_types, [:category, :name], unique: true end end
23.285714
64
0.760736
f81d348179e098094b275b02b3b632fa234ed4a4
156
# frozen_string_literal: true class AnimalSpecy < ApplicationRecord has_many :animal_breeds, dependent: :destroy validates :name, uniqueness: true end
22.285714
46
0.801282
330b96c0895b45e1181f7a69f43bd2b5bc919cb9
3,789
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web serve...
41.184783
102
0.757192