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
e9da935ef3d5eb3d5d0c79ad3e789f670bbe1827
1,027
class RewardsController < ApplicationController after_filter :verify_authorized, except: :index inherit_resources belongs_to :project, finder: :find_by_permalink! respond_to :html, :json def index render layout: !request.xhr? end def new @reward = Reward.new(project: parent) authorize @rewar...
20.54
87
0.717624
01bbff7bfad4d5f2094833ace77920e7632509fa
1,592
PixieStrd6Com::Application.configure do # Settings specified here will take precedence over those in config/application.rb # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the...
43.027027
85
0.775754
5d9d5351687dc121e5605d1fc5b5d3e87b567159
3,607
require 'spec_helper' describe Projects::Registry::RepositoriesController do let(:user) { create(:user) } let(:project) { create(:project, :private) } before do sign_in(user) stub_container_registry_config(enabled: true) end context 'when user has access to registry' do before do proje...
28.856
101
0.613252
ab1f5d6dabd652646c6ce562dc6f909694065755
1,010
class Admin::PostsController < Admin::BaseController def index @posts = Post.order((params[:order].present? ? params[:order] : "created_at") + " DESC").page(params[:page]) end def show @post = Post.find(params[:id]) @views = Statistic.where(model_id: @post.id).where(content_type: :visit).order(create...
36.071429
171
0.69802
abeaa0ef6ff03ad060374e751a26fee4de21fe00
166
a, b = gets.split(' ').map(&:to_i) def possible?(v) v / 3 > 0 && v % 3 == 0 end puts possible?(a) || possible?(b) || possible?(a + b) ? "Possible" : "Impossible"
20.75
81
0.536145
79dc14b0180135d74cb9cdafee98fee5c6424d06
346
cask 'qlab' do version '4.4.5' sha256 'eab8f96f0e95c46f61555fa76e332cf35952c5f4959aad86552a28c671985410' url "https://figure53.com/qlab/downloads/QLab-#{version}.zip" appcast "https://figure53.com/qlab/downloads/appcast-v#{version.major}/" name 'QLab' homepage 'https://figure53.com/qlab/' auto_updates t...
24.714286
75
0.742775
269e09837c5ba3c38cdbc4b576086dbf592d9dad
775
require "spec_helper" describe Mongoid::Extensions::FalseClass do describe "#__sortable__" do it "returns 0" do expect(false.__sortable__).to eq(0) end end describe "#is_a?" do context "when provided a Boolean" do it "returns true" do expect(false.is_a?(Boolean)).to be true ...
18.023256
50
0.621935
1d644c1eb9a473d7ec4e9e59c6868d13d2be2251
3,071
class ListsController < ApplicationController before_action :set_list, except: [:new, :create, :index] def new @list = List.new if params[:user_id] user = User.find_by(id: params[:user_id]) if user verify_user(user) else fl...
27.918182
86
0.499186
e2c73c9703de2b6136e44f46433c452ec201df35
2,878
# frozen_string_literal: true require_relative '../lib/product' require_relative '../lib/lease_feed' RSpec.describe LeaseFeed do ENV['GREENSUB_TEST'] = '1' before do # Don't print status messages during specs allow($stdout).to receive(:puts) end context "HEB's live individual subscriber feed" do ...
44.96875
260
0.676164
036f5fae98a888a11acd316187a112e76a79708d
946
require 'spec_helper' RSpec.describe GeoCombine::Iso19139 do include XmlDocs let(:iso_object){ GeoCombine::Iso19139.new(stanford_iso) } describe '#initialize' do it 'returns an instantiated Iso19139 object' do expect(iso_object).to be_an GeoCombine::Iso19139 end end describe '#xsl_geoblacklight...
29.5625
78
0.730444
f796e859a46e5ed80ccb793fec5ed47b0a488cd1
1,864
require 'test_helper' class UsersEditTest < ActionDispatch::IntegrationTest def setup @user = users(:michael) end test "unsuccessful edit" do log_in_as(@user) get edit_user_path(@user) assert_template 'users/edit' patch user_path(@user), params: { user: { name: "", ...
33.285714
78
0.498927
03055fdd039c8f6fd770c22e5bac8071783bc5ed
134
class StaticPagesController < ApplicationController def home end def support end def about end def contact end end
9.571429
51
0.723881
1dfee3ab16dcb126f9a5e38bf03fa3027519af58
1,021
class Presenters::FacetValues::DefaultPresenter attr_reader :count def initialize(view, active_facets, facet_value) @value = facet_value.value @count = facet_value.count @solr_index = facet_value.solr_index @active_facets = active_facets || {} @view = view end def facet_search_link if...
30.939394
108
0.633692
08d08f17726329e4c2666625afd8e44bf0b1bbc8
953
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "core/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "core" s.version = Core::VERSION s.authors = ["Elton Silva"] s.email = ["elton.chrls@gmail.com"] s....
31.766667
87
0.670514
61f82626c93d248bf7e3a3f7c1685d744c2516c0
2,217
# -*- encoding: utf-8 -*- # stub: sshkit 1.7.1 ruby lib Gem::Specification.new do |s| s.name = "sshkit" s.version = "1.7.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.require_paths = ["lib"] s.authors = ["Lee Hambley", "Tom Clements"] s.date =...
41.055556
118
0.608931
ed140cb6a7f53caa668c15a862436f99def04781
349
require_relative "./dog_breeds_info/version" require_relative "./dog_breeds_info/cli" require_relative "./dog_breeds_info/breed_list" require_relative "./dog_breeds_info/breed" require_relative "./dog_breeds_info/scraper" require 'nokogiri' require 'open-uri' module DogBreedsInfo class Error < StandardError; end ...
24.928571
47
0.802292
bf01eacb527042228c2586dc940d75af2f77ce9c
480
# frozen_string_literal: true redis_url = "redis://#{ENV['REDIS_HOST']}:#{ENV['REDIS_PORT']}/#{ENV['REDIS_DB']}" Sidekiq.configure_server do |config| config.redis = { url: redis_url, namespace: 'sidekiq_data' } end Sidekiq.configure_client do |config| config.redis = { url: redis_url, namespace: 'sidekiq_data' } ...
26.666667
82
0.735417
01f2e13362fddbf43fed6cb49763e4aca34f996a
572
require 'pg' class Peep def self.all if ENV['ENVIRONMENT'] == 'test' connection = PG.connect(dbname: 'chitter1_test') else connection = PG.connect(dbname: 'chitter1') end result = connection.exec('SELECT * FROM peeps') result.map { |peep| peep['message'] } end def self.create(opti...
24.869565
77
0.636364
ab6c5bfb2f5781535e9ccae0683a5196f1a90e4b
442
class Cache < ActiveRecord::Base validates :cache_valid, inclusion: { in: [true, false] } validates :cache_valid, exclusion: { in: [nil] } validates :key, presence: true, length: { maximum: 255 } validates :value, presence: true, length: { maximum: 4096 } def invalidate update_attribute :cache_valid, false e...
24.555556
61
0.719457
7af261643181e12c23330ed232d48095c87216df
853
require_relative "../canvas_base_resolver" module LMSGraphQL module Resolvers module Canvas class GetRubricCommentsReadStateCourse < CanvasBaseResolver type Boolean, null: false argument :course_id, ID, required: true argument :assignment_id, ID, required: true argument :use...
32.807692
93
0.615475
e82610d79b5865eed6a7acd9d869dbcc9d7c0a92
786
require "test_helper" describe TopicsController do include RummagerHelpers describe "GET topic" do describe "with a valid topic slug" do before do content_store_has_item("/topic/oil-and-gas", topic_example) end it "sets expiry headers for 30 minutes" do get :show, params: { ...
25.354839
78
0.678117
ed7af129cea5d585b6d666b57e0642d75c81b859
279
class Label attr_accessor :title, :color, :items def initialize(title, color) @id = Random.rand(1..1000) @title = title @color = color @items = [] end def add_item(item) @items.push(item) unless @items.include?(item) item.label = self end end
17.4375
50
0.62724
ff133daac0e8bf794130405d8b22b0f33a11245c
2,057
# frozen_string_literal: true require 'rails_helper' describe MVI::Models::MviProfile do describe '#mhv_correlation_id' do context 'with multiple ids' do subject { build(:mvi_profile) } it 'returns the first id' do expect(subject.mhv_correlation_id).to eq(subject.mhv_ids.first) end ...
25.7125
95
0.607681
ed3682da3ac59795ecf0ed1d4c2a9b8c96629968
297
require 'spec_helper' describe Cronofy::ResponseParser do it 'should return hash from a given response' do response = OpenStruct.new(body: '{"a": 1, "b": 2}') response_parser = Cronofy::ResponseParser.new(response) expect(response_parser.json).to eq({'a' => 1, 'b' => 2}) end end
29.7
60
0.680135
ab987161a8daf498236ccc6fa43a8f69ea7bdecd
313
class CreateStudentAdditionalDetails < ActiveRecord::Migration def self.up create_table :student_additional_details do |t| t.references :student t.references :additional_field t.string :additional_info end end def self.down drop_table :student_additional_details end end
24.076923
62
0.741214
38bbed3cf72da06dc7b2ce8fdb85076119d007b1
4,333
# frozen_string_literal: true # Generated HTML is transformed back to GFM by app/assets/javascripts/behaviors/markdown/nodes/reference.js module Banzai module Filter # Base class for GitLab Flavored Markdown reference filters. # # References within <pre>, <code>, <a>, and <style> elements are ignored. ...
29.277027
107
0.609508
e2030976e7e8e09299b997b9e7c5799cf83e86dd
472
cask "rightfont" do version "5.9.0" sha256 "17539732acb77bfa7c156175b82f33f4a02e8ceb15784442752d93e10722d0f1" url "https://rightfontapp.com/update/rightfont.zip" appcast "https://rightfontapp.com/update/appcast#{version.major}.xml" name "RightFont" desc "Font manager that helps preview, install, sync and m...
29.5
75
0.756356
911ca8eb4a0c855dfaff83fdb4b5eebd4e83bc2b
2,603
# Copyright (c) 2009-2012 VMware, Inc. module Bosh::Agent module ApplyPlan class Plan attr_reader :deployment attr_reader :jobs attr_reader :packages def initialize(spec) unless spec.is_a?(Hash) raise ArgumentError, "Invalid spec format, Hash expected, " + ...
26.561224
78
0.553208
f73d97bd2c86c57dc28d6bd192c6e6bf21cf7783
2,400
class Deno < Formula desc "Secure runtime for JavaScript and TypeScript" homepage "https://deno.land/" url "https://github.com/denoland/deno/releases/download/v1.0.0/deno_src.tar.gz" sha256 "89709f489e4cbbcfd6913d14e903fcb47c92f329d077477190b0dbd8bd23acc7" bottle do cellar :any_skip_relocation rebuil...
35.820896
109
0.6825
91b25915ec5463364a3df5408858c134ea979eee
328
require "brilliant/ast/node" class Brilliant::AST::CodeBlock < Brilliant::AST::Node attr_accessor :child_nodes def initialize(child_nodes) self.child_nodes = child_nodes.first end def generate_code(mod, builder) child_nodes.each do |child_node| child_node.generate_code(mod, builder) end ...
19.294118
54
0.737805
b94973ae97bd31777413606f87e5a1a5ee4c23e8
176
class CreateStandards < ActiveRecord::Migration[5.1] def change create_table :standards do |t| t.string :standard_name t.string :identifier end end end
19.555556
52
0.693182
1d48c70acc9bc32b4cdfc4769d3bdeb4a7ff5458
581
category_list = { "furniture" => { }, "fitness" => { }, "automotive" => { }, "children toys" => { }, "entertainment" => { }, "books" => { }, "clothes" => { }, "sports equipment" => { }, "other" => { } } category_list.each do |n...
14.525
52
0.478485
ed0c7bdbcff145bda71c466bf559dd1a31c5e399
1,127
RSpec.describe ReplyContract do it "must have a comment" do actual = ReplyContract.new.call({}) expect(actual.errors.to_h[:comment]).to include "is missing" end it "must have a comment greater than 3 characters" do actual = ReplyContract.new.call(comment: "123") expect(actual.errors.to_h[:comme...
25.613636
87
0.69299
6a0e41b54cd12305a716545680b6144d073072b2
760
require 'spec_helper' require 'omnibus/manifest_entry' module Omnibus describe Fetcher do let(:source_path) { '/local/path' } let(:project_dir) { '/project/dir' } let(:build_dir) { '/build/dir' } let(:manifest_entry) do double(Software, name: 'software', locked_version: '31...
24.516129
75
0.648684
ed7bb597a68c2e53978c1a398d51a032a077473f
1,405
require 'spec_helper' RSpec.describe MessagePolicy, type: :policy do let(:user){ } let(:record){ create :message } subject{ MessagePolicy.new user, record } context 'without a user' do it_behaves_like 'a policy forbidding', :index, :show, :create, :update, :destroy end context 'with a user' do le...
31.222222
84
0.688968
ed340919286a4231d98e3735de1bf95e0e9f8777
163
require "test_helper" class UserTest < ActiveSupport::TestCase test "random_password" do pw = User.random_password(10).length assert pw == 10 end end
18.111111
40
0.723926
e8f47b30b78eecfce630eb5b11d0b8c9626607f0
1,648
# -*- encoding: utf-8 -*- # stub: sprockets-rails 2.3.3 ruby lib Gem::Specification.new do |s| s.name = "sprockets-rails".freeze s.version = "2.3.3" s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["J...
39.238095
112
0.662621
218476f4341b0b1bccd7738b650b3980a516d0c6
2,173
# frozen_string_literal: true control 'V-75515' do title "A file integrity tool must be installed to verify correct operation of all security functions in the Ubuntu operating system." desc "Without verification of the security functions, security functions may not operate correctly and the failure may go unnotic...
36.830508
79
0.769903
ed1419e677800fc151eecdd2ecc06a35fd6f76fc
10,356
module Sfdo_api_npsp # NPSP will automatically create certain fields on certain objects based on required input values for those records. # There is no way to know in advance from the API which these are, so we find them empirically and note them here # before calling the create() method in SfdoAPI @fields_acce...
39.079245
144
0.685689
e9be47abb294941362535706758db9cd85e88f4a
2,697
# stdlib require "base64" require "openssl" require "securerandom" # modules require "lockbox/box" require "lockbox/calculations" require "lockbox/encryptor" require "lockbox/key_generator" require "lockbox/io" require "lockbox/migrator" require "lockbox/model" require "lockbox/padding" require "lockbox/utils" require...
25.685714
97
0.742677
ff325afc54e38ff86a1f1f6b129c143121190eb9
78,063
# frozen_string_literal: true require "active_support/core_ext/hash/slice" require "active_support/core_ext/enumerable" require "active_support/core_ext/array/extract_options" require "active_support/core_ext/regexp" require "action_dispatch/routing/redirection" require "action_dispatch/routing/endpoint" module Actio...
34.419312
175
0.538283
ff7bf3e86362c5c07ca9a8d511ecf5b12bee9788
39,955
require "keg" require "language/python" require "formula" require "tempfile" require "version" require "development_tools" require "utils/shell" module Homebrew module Diagnostic def self.missing_deps(ff, hide = nil) missing = {} ff.each do |f| missing_dependencies = f.missing_dependencies(hi...
35.834081
114
0.615292
e27e69526b9cfbb02de765f652558694c52bfe99
1,794
## # 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 = GreatRanking...
24.243243
84
0.593645
614d95dcf4f3410594ead431b8ee3d0d2a596e4c
506
require 'rails_helper' RSpec.describe Experts::ReservesController, type: :controller do describe "予約一覧画面" do before do @reserve1 = FactoryBot.create(:reserve) @reserve2 = FactoryBot.create(:reserve) login_expert(@reserve1.expert) end it "予約一覧画面 予約が取得できていること テンプレートが表示されること" do get ...
28.111111
64
0.705534
21f9497c15316a708402dbd4aee0edf5b006a9eb
182
# frozen_string_literal: true module SensuPluginsChef module Version MAJOR = 7 MINOR = 1 PATCH = 1 VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.') end end
15.166667
56
0.659341
384f8457508fe270bf5d0e1e914c576725bab5a9
765
class BufferedStreamClient class BufferActionWorker include Sidekiq::Worker sidekiq_options queue: 'soon' def perform(group, id, method, *parameters) if method == 'unfollow' target_group, target_id, options = parameters return @buffer.unfollow_buffer.push( options.merge( ...
29.423077
75
0.622222
6227feaaadea75cd3f8cd31a44cdb6955a29ca50
2,322
# frozen_string_literal: true class Middleman::Extensions::AssetHost < ::Middleman::Extension option :host, nil, 'The asset host to use or a Proc to determine asset host', required: true option :exts, nil, 'List of extensions that get cache busters strings appended to them.' option :sources, %w[.css .htm .html ....
40.736842
120
0.567614
1dcebd9598015a5c1d279be5c89ac29e1c1948ee
1,272
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'paperclip/av/transcoder/version' Gem::Specification.new do |spec| spec.name = "paperclip-av-transcoder" spec.version = Paperclip::Av::Transcoder::VERSION spec.authors =...
41.032258
83
0.683962
4a61e583b3a2929be62954b070047263061fe8bf
37
module Fewer VERSION = '0.3.0' end
9.25
19
0.648649
f86ad99e4473f34630045012d9e2e9c37d2c5cfd
613
cask "qlcolorcode" do version "4.0.2" sha256 "07d11cc54a28c2015b9cf298c4fe4a6fc3de14b9f2fd5f486de0d349fa4c3ee9" url "https://github.com/anthonygelibert/QLColorCode/releases/download/release-#{version}/QLColorCode.qlgenerator.zip" appcast "https://github.com/anthonygelibert/QLColorCode/releases.atom" name "QL...
36.058824
119
0.792822
1d399fef3f8ce75d1834788e8d954f1a65b0dd92
2,719
require 'init_test' require 'rest_client' describe Patriot::Worker::InfoServer do context "default config" do before :all do @config = config_for_test('worker') port = @config.get(Patriot::Worker::InfoServer::PORT_KEY, Patriot::Worker::InfoServer::DEFAULT_PORT) @url =...
41.19697
96
0.653917
7941f213c09f858f7ded61b1d46cfc03f285eccd
1,156
# frozen_string_literal: true require_relative '../base' module Fusuma module Plugin module Parsers # Parser change record and tag in event # Inherite this base class class Parser < Base # Parse Event and convert Record and Tag # if `#parse_record` return nil, this method will ...
25.130435
86
0.58391
289449f6785436aafd113969e11c6f24cd4f97ca
813
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: # ActiveSupport::Inflector.inflections(:en) do |inflec...
38.714286
69
0.734317
615932b8417ba650e56d7862463e0caf9be845f8
580
class AppEnvironmentPolicy RESERVED_ENV_VAR_ERROR_MSG = 'reserved_key:%s' def initialize(app) @errors = app.errors @environment_json = app.environment_json end def validate return if @environment_json.nil? unless @environment_json.is_a?(Hash) @errors.add(:environment_json, :invalid_envir...
26.363636
92
0.717241
91728d0ce4eb08525cda07e558d9c8af78f7521a
18,702
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2007 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/mips/main' # TODO coprocessors, floating point, 64bits, thumb mode module Metasm class MIPS private def addop(name, bin, *arg...
41.467849
202
0.576142
1845b7cb63a499e3bff81595645fe720e827a7aa
2,573
#-- encoding: UTF-8 #-- copyright # OpenProject is a project management system. # Copyright (C) 2012-2017 the OpenProject Foundation (OPF) # # 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,...
31.378049
106
0.74077
f84449900b1cea6bded95918ccc111e85370b5f8
2,783
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/vision/v1p3beta1/web_detection.proto require 'google/protobuf' require 'google/api/annotations_pb' Google::Protobuf::DescriptorPool.generated_pool.build do add_file("google/cloud/vision/v1p3beta1/web_detection.proto", :syntax => :prot...
52.509434
155
0.754941
4a0229300b8863d38c80882be8d255500511155a
878
require 'test_helper' class I18nTest < ActiveSupport::TestCase def test_uses_authlogic_as_scope_by_default assert_equal :authlogic, Authlogic::I18n.scope end def test_can_set_scope assert_nothing_raised { Authlogic::I18n.scope = [:a, :b] } assert_equal [:a, :b], Authlogic::I18n.scope Authlogic::...
25.823529
78
0.719818
6a10341f3248de5dcf76c2dee11aefbd0810472d
5,870
# rubocop:disable Style/FrozenStringLiteralComment require 'conditions_generator_column_string_regexped' # Used to generate simple_search query condition # # = SwimmerFuzzyFinder # # - Goggles framework vers.: 6.071 # - author: Steve A. # # Fuzzy-finder class used to retrieve lists of Swimmer instances based # u...
34.127907
102
0.672572
111f0a9a715a6677c052d447b41b48d18220ce55
11,365
require File.expand_path('../helper', __FILE__) describe "business days" do describe "with a standard Time object" do describe "when adding/subtracting positive business days" do it "should move to tomorrow if we add a business day" do first = Time.parse("April 13th, 2010, 11:00 am") later ...
42.092593
116
0.658337
61cfb29d964462ca418c663fcc8ab416ffa65031
833
Pod::Spec.new do |s| s.name = "NXCollectionViewDataSource" s.version = "1.1.5" s.summary = "Generic data source for UICollectionView using either static data of a NSFetchRequest." s.homepage = "https://github.com/nxtbgthng/NXCollectionViewDataSource" s.licen...
55.533333
123
0.594238
79c8b51522c48f5129ca39d61bc77ddf1cc5c421
1,494
# coding: utf-8 Gem::Specification.new do |spec| spec.name = "alembic-jekyll-theme" spec.version = "3.0.9" spec.authors = ["David Darnes"] spec.email = ["me@daviddarnes.com"] spec.summary = %q{A Jekyll boilerplate theme designed to be a starting point for any Jekyll websit...
46.6875
208
0.691432
bf610c7c7b66f263c0e83aa54328d7e109d6e916
815
# Ruby wrapper for Colonel Kurtz data # # Contents of `data` hash # # type: # block type # string, lower-cased and dashed, e.g. "hero-photo" # # content: # block content # hash # # blocks: # block children # array of `data` hashes # module ColonelKurtz class Block attr_reader :pare...
15.377358
80
0.579141
ff1183c9feeac98d78ccdb2be657664748de2304
140
class AddAvailabilityToProperties < ActiveRecord::Migration[6.1] def change add_column :properties, :availability, :boolean end end
23.333333
64
0.778571
bf8d36f66585309128e29a353beeaae40490c726
1,233
# frozen_string_literal: true class Issue < ApplicationRecord validates :status, presence: true validates :problem, presence: true, uniqueness: { scope: :team_id } validates :team, presence: true # 状態遷移条件 # unsolved: 未対応 # in_progress: 対応中 # solved: 解決 enum status: { unsolved: 1, in_progre...
22.418182
69
0.664234
91021deed10e6954a9b73ab9156225c881f3a0d7
3,784
# frozen_string_literal: true require 'spec_helper' shared_examples 'generic namevar' do |name| it { expect(described_class.attrtype(name)).to eq :param } it 'is the namevar' do expect(described_class.key_attributes).to eq [name] end end shared_examples 'generic ensurable' do |*allowed| allowed ||= [:pr...
28.02963
104
0.667548
6115a1bcc62ced5d0196cfb00803a7a341c07c2f
119
class Email include Mongoid::Document field :address validates_uniqueness_of :address embedded_in :patient end
17
34
0.798319
2833fd1be0f0ff00f33b31d9cc5ede05afd1a992
287
class StaticPagesController < ApplicationController def home if logged_in? @micropost = current_user.microposts.build @feed_items = current_user.feed.paginate(page: params[:page]) end end def help end def about end def contact end end
13.666667
67
0.66899
1d726c9a1e700fc5f507592ae3ec463390d50b89
109
# frozen_string_literal: true Ralyxa::Skill.intent 'AMAZON.NextIntent' do # TODO: respond('TBD Next') end
18.166667
43
0.743119
01f76ef7fbbbb7460ac8d013dbe12714e8bfed6e
280
module Cucumber module Ast class Visitor DEPRECATION_WARNING = "Cucumber::Ast::Visitor is deprecated and will be removed. You no longer need to inherit from this class." def initialize(step_mother) raise(DEPRECATION_WARNING) end end end end
23.333333
134
0.703571
e9a765bfc7671cdc205048773d65b43a3d90e2ad
1,784
require 'puppet' require 'beaker-rspec/spec_helper' require 'beaker-rspec/helpers/serverspec' # overriding puppet installation for the RedHat family distros due to # puppet breakage >= 3.5 def install_puppet(host) host['platform'] =~ /(fedora|el)-(\d+)/ if host['platform'] =~ /(fedora|el)-(\d+)/ safeversion = ...
32.436364
154
0.619395
87574dc3c63c0a9e8055d794a76fdffcc391d0d6
2,319
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. config.webpacker.check_yarn_integrity = false config.hosts << 'skimo-pl' # In the development environment your application's code is reloaded on # every request. This slows down response time but...
36.234375
87
0.763691
91e80e9f6dbf49c67c2d00841d3acf7043dd2095
301
class TwsGecko::ServerDatabaseError < StandardError attr_reader :raw def initialize(raw) @raw = raw super "No response from database of server" end end class TwsGecko::ServerNoResponseError < StandardError def initialize(raw = nil) @raw = raw super "#{@raw['stat']}" end end
21.5
53
0.704319
01564024c6bba66b837aaa661470e8bad77d9012
2,156
# # Author:: Doug MacEachern <dougm@vmware.com> # Cookbook:: windows # Provider:: shortcut # # Copyright:: 2010-2016, VMware, 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...
35.344262
94
0.756957
185098bbb9f9f77b6ebd23d814cdef07fae1caf3
1,707
class ListStack attr_accessor :head class ListElement attr_accessor :value, :next_element def initialize(value: , next_element: ) self.value = value self.next_element = next_element end end def push(value) old_head = self.head self.head = ListElement.new(value: value, next_elem...
17.597938
69
0.666667
1c99321c58d641eeb04a9f6db0f451fc5da13ce2
523
# Import modules require './Common.rb' class ExtractAnnotations def self.Run() # Getting instance of the API $api = GroupDocsAnnotationCloud::AnnotateApi.from_config($config) file_info = GroupDocsAnnotationCloud::FileInfo.new() file_info.file_path = "annotationdocs\\input.docx" $request = Grou...
26.15
76
0.730402
619015196f493c5469b7fe30e802c059829111fc
10,750
# :markup: tomdoc require 'oauth2/access_token' require 'omniauth-slack/refinements' require 'omniauth-slack/data_methods' require 'omniauth-slack/debug' module OmniAuth module Slack using StringRefinements module OAuth2 # Enhanced subclass of OAuth2::AccessToken, used by OmniAuth::Slack # ...
41.992188
161
0.560744
2688c4ccbad5738dba1d3b4768b30cd08375e872
656
# frozen_string_literal: true module Sentry module Gruf # Current gruf-sentry version # # format: 'a.b.c' with possible suffixes such as alpha # * a is for major version, it is guaranteed to be changed # if back-compatibility of public API is broken # * b is for minor version, it is guarant...
34.526316
69
0.670732
1cb3966b75724024fa6a63f3105bc86432a0eda3
304
class UpgradeApidaeObjsTitleDataType < ActiveRecord::Migration[5.2] def change add_column :apidae_objs, :title_data, :jsonb Apidae::Obj.all.unscoped.each do |o| o.update(title_data: {'title' => {'fr' => o.read_attribute(:title)}}) end remove_column :apidae_objs, :title end end
30.4
75
0.697368
1aff62b5165797fc509d096d2550c1e031edc8d7
1,495
module SpreePayuGateway module Generators class InstallGenerator < Rails::Generators::Base class_option :auto_run_migrations, type: :boolean, default: false def self.source_root @_config_source_root ||= File.expand_path("../", __FILE__) end def add_javascripts append_fil...
34.767442
137
0.668227
1de3e24fbab55d14d6dc0140d1079abd39748cd9
4,419
# Adding in the require_relative 'logged_in_page' line to ensure that the autoloader does not fail # with the error "uninitialized constant LoggedInPage (NameError)" require_relative 'logged_in_page' require_relative '../page' require_relative '../project' require_relative 'select2_module' class CreateProjectPage < Lo...
29.264901
114
0.746549
01c3ed699c054c034624e1d569e2a7471e99e6ec
2,855
# frozen_string_literal: true # See LICENSE.txt at root of repository # GENERATED FILE - DO NOT EDIT!! require 'ansible/ruby/modules/base' module Ansible module Ruby module Modules # Manage Self-IPs on a BIG-IP system. class Bigip_selfip < Base # @return [String, nil] The IP addresses for the...
58.265306
282
0.705079
217459164638068adbf9d6bf166c1793edcffd0e
1,682
module API class Features < Grape::API before { authenticated_as_admin! } helpers do def gate_value(params) case params[:value] when 'true' true when '0', 'false' false else params[:value].to_i end end def gate_target(pa...
25.484848
117
0.592152
bbbaa04be67c66127f05a6de7a3cccc0eb0cdfc1
220
require 'spec_helper' describe 'nodejs::default' do # Serverspec examples can be found at # http://serverspec.org/resource_types.html it 'does something' do skip 'Replace this with meaningful tests' end end
22
45
0.740909
ab766ae77ef5e369cd19bfdcdd5b70ab30291673
3,891
require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your applica...
41.393617
100
0.759188
2139315a15e5953ed935f51153809dd730b68de7
933
cask "malus" do version "1.9.6" sha256 "5318b05bfead4b3bd08b25772af4c265d850bbd0af7ce2f57e7bb49421980ebe" url "https://malus.s3cdn.net/uploads/Malus-mac_#{version.no_dots}.dmg", verified: "malus.s3cdn.net/" name "Malus" desc "Proxy to help accessing various online media resources/services" homepage "...
29.15625
75
0.721329
ff181a08ea20760fb6e9bcfc80bed0f25cc0d2a8
1,550
class InitialSchema < ActiveRecord::Migration[5.2] def change create_table "customers" do |t| t.string "first_name", default: "", null: false t.string "middle_initial", default: "", null: false t.string "last_name", default: "", null: false t.string "address1", default: "", null: false ...
36.046512
81
0.624516
bf025eba3fee051238887acbab58a05e22f5d257
756
Warden::OpenID.configure do |config| config.required_fields = 'email' config.optional_fields = %w(fullname) config.user_finder do |response| user = User.where( :identity_url => response.identity_url ).first unless user fields = OpenID::SReg::Response.from_success_response(response) user = Use...
31.5
135
0.727513
e9b8fc21ae17868b22a35d03467feb006fdac0cf
4,200
# frozen_string_literal: true require 'test_helper' if defined? ActiveRecord class ActiveRecordRelationMethodsTest < ActiveSupport::TestCase sub_test_case '#total_count' do setup do @author = User.create! name: 'author' @author2 = User.create! name: 'author2' @author3 = User.create!...
44.680851
137
0.670714
0309164678ac4ce43a661db4639e1a426e3037b8
25,129
require 'active_record/version' require 'active_record/connection_adapters/abstract_adapter' require 'arjdbc/version' require 'arjdbc/jdbc/java' require 'arjdbc/jdbc/base_ext' require 'arjdbc/jdbc/connection_methods' require 'arjdbc/jdbc/driver' require 'arjdbc/jdbc/column' require 'arjdbc/jdbc/connection' require 'ar...
36.738304
108
0.633929
7a6b66cae88753c19b8c1978e32f9e7827430e26
121
def solution(position, array) array.each_index do |index| return index if array[index] == position end return -1 end
20.166667
42
0.743802
03a0450f399c5a961db182ebd2d67af59a8b5a5c
11,856
# Copyright 2015 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 applicable law or agreed to in writing, ...
41.166667
175
0.751771
62695fdcae344ccc22ca46cb5aee3a7a24b48c54
3,261
## --- BEGIN LICENSE BLOCK --- # Copyright (c) 2009, Mikio L. Braun # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # ...
30.476636
72
0.671266
381e2cbf6a59e2864f3310b40ad034de14e32eb3
462
# frozen_string_literal: true module Jfuzz class Generator def initialize(property, property_fuzzer) @property = property @property_fuzzer = property_fuzzer end def try_generate generate end def self.type raise "`type` must be implemented by sub class" end priva...
17.111111
57
0.675325
6a2469a8961fac9060bd143b9f71f83fd10ec19e
433
require_relative 'test_helper' require 'import_controller' require 'options' class ImportControllerTest < Minitest::Test include TestHelper include FileSystemTestMixin def test_untested # p test_options.filename # p subject.yaml_file_path assert true end def subject ImportController.new tes...
16.037037
50
0.759815
b9af5de8d0f2681aa677654e589b14700770e003
719
require 'rails_helper' RSpec.describe UserDatatable, type: :datatable do let(:user_datatable) do described_class.new(instance_double('view', params: params), options) end let(:account) { create(:account) } let(:user) { create(:user, account: account) } # supporting data let(:par...
20.542857
72
0.603616
2119ef254a9bc5e56d3e728653200ccbffc6fed5
148
require 'rails_helper' RSpec.describe "tag_xy/viewPage_name.html.erb", type: :view do pending "add some examples to (or delete) #{__FILE__}" end
24.666667
62
0.75
08adb256c0d7368321d620c9a4dba7dd9b6fe9de
196
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../shared/trace', __FILE__) require 'matrix' describe "Matrix#trace" do it_behaves_like(:trace, :trace) end
24.5
58
0.734694
d53f58ec5b2163954561196adfd48ebe58df6596
5,341
## # This module requires Metasploit: http://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## require 'msf/core' class MetasploitModule < Msf::Exploit::Remote Rank = NormalRanking include Msf::Exploit::Remote::HttpClient def initialize(info = {}) super(update_inf...
34.019108
165
0.544467
1a138a3c3d9deaa4e5620f32d40b172fba84628b
350
require "test_helper" class ReadonlyTest < MiniTest::Spec class SongForm < Reform::Form property :artist property :title, writeable: false # TODO: what to do with virtual values? end let (:form) { SongForm.new(OpenStruct.new) } it { form.readonly?(:artist).must_equal false } it { form.readonly?...
25
49
0.7