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
391446773fd1fe5017e0681129f1423c98b1610b
172
class Helpers def self.current_user(session) User.find(session[:user_id]) end def self.is_logged_in?(session) !!session[:user_id] end end
17.2
36
0.633721
26754632cb0f10e35c67e080eaf44bd81ff8fe80
1,510
# 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::EventGrid::Mgmt::V2020_04_01_preview module Models # # Properties of the PartnerNamespace update. # class PartnerNamespaceUp...
27.454545
71
0.525166
185576800652ef4f4d7ea1a93394d738334d02d2
449
# Logging configuration for the whole app. # # For details see https://github.com/TwP/logging require 'logging' require 'rack-timeout' Logging.logger.root.tap do |root| root.appenders = Logging.appenders.stdout( layout: Logging::Layouts.pattern(format_as: :inspect, pattern: '%-5l [%c]: %m\n') ) root.level =...
24.944444
85
0.703786
38ed3dbac8e317aaad3a1e4a447f50048e6a7f9e
1,131
# frozen_string_literal: true module Spree module Admin class CollaboratorsController < Spree::Admin::ResourceController def index @collaborators = collection end def edit @collaborator = Spree::Collaborator.find(params[:id]) authorize! :update, @collaborator end ...
24.586957
81
0.640141
ab270dbdd382c6f513f8888674c50f53ccd06924
109
require_relative 'graph' require_relative 'priority_map' # O(|V| + |E|*log(|V|)). def dijkstra2(source) end
15.571429
31
0.706422
b9129045347868f3a252193a8758b498af80db55
10,402
#-- # Author:: Daniel DeLeo (<dan@opscode.com>) # Copyright:: Copyright (c) 2012 Opscode, 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 # # ...
32.104938
142
0.611325
ed7b7ac25646ab9ad566e2e4a0869e9f7a278cbb
282
FactoryBot.define do factory :customer do first_name "Ed" last_name "Gruberman" phone { rand(10 ** 10).to_s.rjust(10,'0') } email { |u| "#{u.first_name[0]}#{u.last_name}#{(1..99).to_a.sample}@example.com".downcase } association :user active true end end
25.636364
95
0.638298
8764d9c890e99edcab4b86b4b0ebf3ad4e768f88
5,811
# frozen_string_literal: true require 'ndr_import' require 'ndr_import/universal_importer_helper' require 'parquet' require 'pathname' require_relative 'ndr_parquet_generator/version' # Reads file using NdrImport ETL logic and creates parquet file(s) class NdrParquetGenerator include NdrImport::UniversalImporterHel...
29.201005
93
0.62984
28ec6ad42fef49708ddd0f83def0735394106b55
290
class CreateEthereumLogSubscriptions < ActiveRecord::Migration def change create_table :ethereum_log_subscriptions do |t| t.integer :owner_id t.string :owner_type t.string :account t.string :xid t.datetime :end_at t.timestamps end end end
18.125
62
0.682759
9157f6c97fb4c1d441ad7d963b3ca18dbddc21f9
1,904
include YARD include Templates module JavadocHtmlHelper JAVA_TYPE_MATCHER = /\A(?:[a-z_$](?:[a-z0-9_$]*)\.)+[A-Z][A-Za-z_$]*/ RUBY_COLLECTION_TYPE_MATCHER = /\A(?:[A-Z][A-Za-z0-9_])(?:::[A-Z][A-Za-z0-9_]*)*</ SAXON_TYPE_MATCHER = /\A(?:net\.sf\.saxon|com\.saxonica)/ def format_types(typelist, brackets = true)...
26.082192
84
0.619748
e8afba27a5e8520078c35d3d7b4d8ce583c27b3f
209
class CreateAnswers < ActiveRecord::Migration[6.0] def change create_table :answers do |t| t.references :question, null: false t.text :body, null: false t.timestamps end end end
19
50
0.660287
1a28db435cd0f339e1670a0019bbdadf714e8567
4,565
require 'active_record' require 'active_support/concern' module ActiveUUID module Patches module Migrations def uuid(*column_names) options = column_names.extract_options! column_names.each do |name| type = ActiveRecord::Base.connection.adapter_name.downcase == 'postgresql' ? 'uu...
36.814516
154
0.691347
e9575b67b726aa26bce7aa0cfdfc5a069dee263b
2,610
module Pod class ConfigureTVOS attr_reader :configurator def self.perform(options) new(options).perform end def initialize(options) @configurator = options.fetch(:configurator) end def perform keep_demo = configurator.ask_with_answers("Would you like to include a demo ap...
29.659091
135
0.627203
01001c4da270d8557dabc40c7d942873625ef596
1,942
require_relative '../core/service' require_relative '../console/colour' require_relative '../console' class ConsoleHostService < Service provided_features :console_host def initialize(io_in, io_out, io_err) super @io_in = io_in @io_out = io_out @io_err = io_err end de...
20.229167
77
0.632853
e2d8850fc39ec58c803223a066915cbd6d916ba7
320
module Types class FollowingType < Types::BaseObject field :id, ID, null: false field :follower_id, Integer, null: true field :followed_id, Integer, null: true field :created_at, GraphQL::Types::ISO8601DateTime, null: false field :updated_at, GraphQL::Types::ISO8601DateTime, null: false end end
32
67
0.725
01d1bb506fa52d6ec8846d152b8fbead76b617e7
1,076
class Game class << self def dfs24(item, index) $r << item $book[index] = true if $r.size == 7 rc = $r.join('') rs = eval rc rescue 0 # 使用ruby eval 进行执行 if rs == 24 puts rc+"=24" end end $a.each_with_index do |ai, ix| # 循环 item的下一个结点元素...
19.563636
76
0.511152
d5e50ceb1541993039e9339633fa7efd9d1755a3
1,668
class DeviseTokenAuthCreateUsers < ActiveRecord::Migration[5.1] def change create_table(:users, id: :uuid) do |t| ## Required t.string :provider, :null => false, :default => "email" t.string :uid, :null => false, :default => "" ## Database authenticatable t.string :encrypted_passwor...
30.888889
110
0.63729
bf8361dfb35fd888acb74ef106084dfc259cb662
588
module Talkable module API class Origin < Base AFFILIATE_MEMBER = "AffiliateMember".freeze PURCHASE = "Purchase".freeze EVENT = "Event".freeze DEFAULT_TRAFFIC_SOURCE = 'talkable-gem' class << self def create(origin_type, params) post '/origin...
20.275862
51
0.530612
33d11c2621c600ac54a5bec13fd85ce7bd357af4
425
module MusicStory::Model class Batch < ThinModels::Struct attribute :path attribute :state DATE_PATTERN = /([0-9]{4})\-([0-9]{2})\-([0-9]{2})/ def date m = DATE_PATTERN.match(File.basename(path)) m && Date.new(m[1].to_i, m[2].to_i, m[3].to_i) end def to_s "#<Batch path=#{p...
19.318182
55
0.548235
4ad03d19f7d0c635b01f5da4d9c9a67c8eb9b9cf
798
require File.expand_path("../../../kernel_v2/config/ssh", __FILE__) module VagrantPlugins module CommunicatorWinSSH class Config < VagrantPlugins::Kernel_V2::SSHConfig def finalize! @shell = "cmd" if @shell == UNSET_VALUE @sudo_command = "%c" if @sudo_command == UNSET_VALUE if @exp...
25.741935
69
0.605263
f7e138e327d7a543b852478e66ca7d3b08473e0d
1,099
# frozen_string_literal: true require "rails_helper" require File.expand_path("../../support/shared_contexts/work_forms_context", __dir__) RSpec.describe Hyrax::DenverBookChapterForm do include_context "work forms context" do describe "#required_fields" do subject { form.required_fields } it { is_e...
37.896552
98
0.682439
01fb5794929b149e017709bb3f341b098a5dcc97
2,901
# Copyright (c) 2018 Public Library of Science # 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, pub...
34.535714
90
0.683557
3902e2c936252461c9c61064b779870c88e4ca76
317
class CreateProducts < ActiveRecord::Migration def change create_table :products do |t| t.string :title t.text :description t.decimal :price t.decimal :size t.boolean :is_spicy t.boolean :is_veg t.boolean :is_best_offer t.string :path_to_image t.timestamps end end end
17.611111
46
0.681388
f86f848c27f8b4224d0466fa9f8e9a94cdc54a8d
6,449
=begin #Xero Payroll AU #This is the Xero Payroll API for orgs in Australia region. Contact: api@xero.com Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.3.1 =end require 'time' require 'date' module XeroRuby::PayrollAu require 'bigdecimal' class Employees attr_accessor :employe...
30.135514
208
0.623508
0138235d91a9f7e0825438d9c729484a03200042
1,435
require 'rails_helper' RSpec.describe YarnProductPolicy do subject { described_class } permissions :update? do let(:record) { build :yarn_product, created_by: 47, created_at: try(:created_at) || Time.current } context 'when user is a maintainer' do let(:user) { build :user, :maintainer } it ...
25.625
102
0.625087
e2147f81db13e50a9605e69cef5a19aafa9a8573
7,223
# frozen_string_literal: true require "spec_helper" require "shared_contexts" require "dependabot/dependency" require "dependabot/dependency_file" require "dependabot/bundler/update_checker/force_updater" RSpec.describe Dependabot::Bundler::UpdateChecker::ForceUpdater do include_context "stub rubygems compact index...
29.242915
80
0.568877
039f4d05334489e063de4678befbcb0be1bab502
961
require_relative '../../wrappers/Ruby/aergo.rb' aergo = Aergo.new("testnet-api.aergo.io", 7845) account = AergoAPI::Account.new # set the private key account[:privkey] = "\xDB\x85\xDD\x0C\xBA\x47\x32\xA1\x1A\xEB\x3C\x7C\x48\x91\xFB\xD2\xFE\xC4\x5F\xC7\x2D\xB3\x3F\xB6\x1F\x31\xEB\x57\xE7\x24\x61\x76" # or use an accou...
30.03125
150
0.669095
910e8fe399de0271269f0b9d0dedc39d0100a4f3
773
Pod::Spec.new do |s| s.name = 'VENTouchLock' s.version = '1.0.6' s.summary = 'A passcode framework that features Touch ID' s.description = <<-DESC An easy to use passcode framework used in the Venmo app. DESC s.homepage = 'https://www.github.com/ve...
40.684211
100
0.569211
1838246f80f55e7875b4199492f554774d8421af
129
class RemoveStageFromStartups < ActiveRecord::Migration[4.2] def change remove_column :startups, :stage, :string end end
21.5
60
0.75969
7a8c696b077952ac62e99176e41d08dadc008e66
294
class CreatePictureLists < ActiveRecord::Migration def self.up ActiveRecord::Base.transaction do create_table :picture_lists do |t| t.timestamps end end end def self.down ActiveRecord::Base.transaction do drop_table :picture_lists end end end
18.375
50
0.687075
bbf08801a5c7c28f25f21a40fdb545a447153331
3,213
require 'spec_helper' require 'yaml' require 'ruby-swagger/data/operation' describe Swagger::Data::Operation do let(:payload) do { 'tags' => ['pet'], 'summary' => 'Updates a pet in the store with form data', 'description' => 'Zippo', 'operationId' => 'updatePetWithForm', 'consumes' ...
32.785714
86
0.577653
b957e24abe0ec76a21d32666e473c7f2d959cb19
4,067
# frozen_string_literal: true require "pathname" require "rbconfig" module Spec module Path def root @root ||= Pathname.new(ruby_core? ? "../../../.." : "../../..").expand_path(__FILE__) end def gemspec @gemspec ||= root.join(ruby_core? ? "lib/bundler/bundler.gemspec" : "bundler.gemspec") ...
22.977401
199
0.601426
bf05aeafed59cf64196753ad8663c6eb9b91cbd7
332
require "i18n" I18n.load_path << File.expand_path("../responsys/i18n/en.yml", __FILE__) I18n.locale = :en I18n.enforce_available_locales = false require "responsys/exceptions/all" require "responsys/helper" require "responsys/configuration" require "responsys/api/client" require "responsys/member" require "responsys/...
25.538462
72
0.795181
87d035f271c6dfdf8407fc27eb68bda66699ed66
6,010
require 'fileutils' require 'colored2' module Pod class TemplateConfigurator attr_reader :pod_name, :pods_for_podfile, :prefixes, :test_example_file, :username, :email def initialize(pod_name) @pod_name = pod_name @pods_for_podfile = [] @prefixes = [] @message_bank = MessageBank.new...
26.59292
137
0.597171
91981b8231b9e34cd793b1e308b4b3b91b62601e
691
# -*- encoding : utf-8 -*- module Satrap class HttpClient def self.call(uri, xml) new(uri, xml).call end def call http.post(uri.path, xml, headers) end private attr_reader :uri, :xml def initialize(uri, xml) @uri = uri @xml = xml end def headers {...
16.853659
63
0.557164
1ae2ef2a6853f57e3769df2341a62e49b67a323f
79
# frozen_string_literal: true module FontAwesomeRails VERSION = "0.1.0" end
13.166667
29
0.759494
210e0f3af60b120ce27aa53782ba18bac08778c5
1,474
require 'beaker-rspec' require 'tmpdir' require 'yaml' require 'simp/beaker_helpers' include Simp::BeakerHelpers require 'beaker/puppet_install_helper' unless ENV['BEAKER_provision'] == 'no' hosts.each do |host| # Install Puppet if host.is_pe? install_pe else install_puppet end incl...
23.774194
83
0.651289
33c8017e3ef655ef2e7781ff7e4c4613fa626986
1,372
# frozen_string_literal: true require 'spec_helper' describe 'apache::mod::lookup_identity', type: :class do it_behaves_like 'a mod class, without including apache' context 'default configuration with parameters' do context 'on a Debian OS' do let :facts do { lsbdistcodename: 'jessie'...
29.191489
79
0.599125
33794dafc6d41af4fa28ff1e393a65405c4bad89
33,635
#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Resource::Catalog, "when compiling" do include PuppetSpec::Files before do @basepath = make_absolute("/somepath") # stub this to not try to create state.yaml Puppet::Util::Storage.stubs(:store) end # audit only resources are unmanaged ...
34.818841
211
0.656519
ede45edb097c8ea7ee7e2fe431580dda7f0109be
2,281
require "spec_helper" require "active_attr/chainable_initialization" require "active_support/concern" module ActiveAttr describe ChainableInitialization do subject(:model) { model_class.new("arg") } shared_examples "chained initialization" do describe "#initialize" do it { expect { model }.not...
24.265957
99
0.605436
ab4ed48e1702c1b68f80bf05dd8bc072b1361a90
247
maintainer "Opscode" maintainer_email "do_not_reply@opscode.com" license "Apache 2.0" description "Installs/Configures template" long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) version "0.1"
35.285714
74
0.708502
e2181ffd5bfe378750f5c553e3aff0cc66dfeea7
1,422
#!/usr/bin/env ruby module Daily class Configuration def initialize() @configs = nil found = false ["~/.config/daily_brefing/config.json"].each { |item| path = File.expand_path item if File.exist? path file = File.read(...
34.682927
137
0.363572
1cf8555ef701b930c1e5caa7bc3e50baa54460ca
430
Российские фосфористы победили американцев и дошли до финала турнира на Олимпийских играх. Сборная России по фехтованию вышла в финал командного турнира на Олимпийских играх в Рио - де - Жанейро. В полуфинале российские спортсмены избили американскую команду со счетом 45-41. Финал пройдет в 12: 30, где россияне настрое...
86
153
0.823256
62a1290bfa0509e7a020949d017fe8a9e863f3f3
1,267
class Fd < Formula desc "Simple, fast and user-friendly alternative to find" homepage "https://github.com/sharkdp/fd" url "https://github.com/sharkdp/fd/archive/v8.2.1.tar.gz" sha256 "429de7f04a41c5ee6579e07a251c72342cd9cf5b11e6355e861bb3fffa794157" license "Apache-2.0" head "https://github.com/sharkdp/fd.g...
36.2
95
0.771113
7a6ec8bc6ed684a1be70df1c36adfa95a184cd48
2,397
# # This module provides methods to diff two hash, patch and unpatch hash # module HashDiffSym # Apply patch to object # # @param [Hash, Array] obj the object to be patched, can be an Array or a Hash # @param [Array] changes e.g. [[ '+', 'a.b', '45' ], [ '-', 'a.c', '5' ], [ '~', 'a.x', '45', '63']] # @para...
28.2
102
0.582395
5d252e116b2e012e030906e036f102d50d4b07c1
59,350
require 'test/unit' require 'tempfile' require 'timeout' require 'io/wait' require_relative 'envutil' require 'rbconfig' class TestProcess < Test::Unit::TestCase RUBY = EnvUtil.rubybin def setup Process.waitall end def teardown Process.waitall end def windows? self.class.windows? end def...
29.899244
186
0.583589
f7cf16f5bdd8ac2ef27c3ca138b9f7c8ba6eb575
75
# frozen_string_literal: true module TencentCloud VERSION = '0.3.5' end
12.5
29
0.746667
ab2f9c3dd8f46cc3bb9fe742b08054b993bc6c77
1,041
require "language/node" class Heroku < Formula desc "Command-line client for the cloud PaaS" homepage "https://cli.heroku.com" # heroku should only be updated every 10 releases on multiples of 10 url "https://registry.npmjs.org/heroku/-/heroku-7.0.90.tgz" sha256 "c64367241578494c1450ce7707d0b3f6d7a72ee3fed34...
33.580645
93
0.735831
4a12af6abcb3e99f97df79280cf5eaa6c10d3ad0
627
class Condition < ActiveRecord::Base acts_as_paranoid belongs_to :user validates :name, presence: true validates :user_id, presence: true include BelongsToUniverse include IsContentPage include Serendipitous::Concern include Authority::Abilities self.authorizer_name = 'ExtendedContentAuthorizer' ...
15.675
52
0.725678
e26fe04942757e76c79fd5b67ce52fc9633fc096
1,642
cask "imazing" do version "2.14.6,15535" sha256 "390e7f8ba1f65218f0f53a4aff8f1c36da5687d3ed85508270dfba66e5ad348e" url "https://downloads.imazing.com/mac/iMazing/#{version.csv.first}.#{version.csv.second}/iMazing_#{version.csv.first}.#{version.csv.second}.dmg" name "iMazing" desc "iPhone management applicati...
37.318182
147
0.70341
87ca2069247c65f21d77b724582b194217074b15
2,054
# frozen_string_literal: true class HoundConfig CONFIG_FILE = ".hound.yml" LINTERS = { Linter::CoffeeScript => { default: true }, Linter::Credo => { default: false }, Linter::Eslint => { default: false }, Linter::Flog => { default: false }, Linter::Go => { default: true }, Linter::Haml => { ...
24.164706
68
0.669912
21626bc2e95a93f1799702cce8a0b96c4749285c
530
# frozen_string_literal: true workers Integer(ENV['WEB_CONCURRENCY'] || 1) threads_count = Integer(ENV['MAX_THREADS'] || 5) threads threads_count, threads_count preload_app! rackup DefaultRackup port 3000 environment ENV['RACK_ENV'] || 'development' stdout_redirect('/dev/stdout', '/dev/stderr', true) on_worker_b...
24.090909
115
0.773585
629ed1d64e82775426bc8cd7113cb167d876f84b
786
# 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...
27.103448
74
0.732824
1c30f9dbd974b6e6f9b264721d4ce72d36c1b348
2,288
require 'ebay/types/xml_requester_credentials' require 'ebay/types/bot_block_request' module Ebay # :nodoc: module Requests # :nodoc: # == Attributes # value_array_node :detail_levels, 'DetailLevel', :default_value => [] # text_node :error_language, 'ErrorLanguage', :optional => true # text_node :...
46.693878
119
0.690559
217c7d121d8d9873368a9ecf71b4cbf90d7e3c2e
4,074
class Libelf < Formula desc "ELF object file access library" homepage "https://web.archive.org/web/20181111033959/www.mr511.de/software/english.html" url "https://www.mirrorservice.org/sites/ftp.netbsd.org/pub/pkgsrc/distfiles/libelf-0.8.13.tar.gz" mirror "https://fossies.org/linux/misc/old/libelf-0.8.13.tar.gz...
44.769231
122
0.706186
1d2e2fd82f2e791e2a65cb58dd34804ff77177d4
429
require 'test_helper' class ErrorsControllerTest < ActionDispatch::IntegrationTest test 'should get bad_request' do get errors_bad_request_url assert_response :bad_request end test 'should get not_found' do get errors_not_found_url assert_response :not_found end test 'should get internal_se...
22.578947
60
0.79021
5d2708750c37c908179889dfba698e1e6f169659
1,844
module JekyllAdmin class Directory extend Forwardable def_delegator :@path, :basename, :name def_delegator :@path, :mtime, :modified_time attr_reader :path, :splat, :content_type, :base include Enumerable include JekyllAdmin::URLable include JekyllAdmin::APIable TYPE = :directory ...
25.971831
86
0.605748
ab869b400fb37ca2cd4d9ca6eff934b8c52ce2cc
516
# # Removes simple_form's css class logic. module SimpleForm module ActionViewExtensions module FormHelper def simple_form_for(record, options = {}, &block) options[:builder] ||= SimpleForm::FormBuilder options[:html] ||= {} unless options[:html].key?(:novalidate) options[...
24.571429
71
0.641473
3875e1c8feee2df0760c31b40bff4415a124ac0c
11,936
require "rubygems" require "hbc/cask_dependencies" require "hbc/staged" require "hbc/verify" module Hbc class Installer # TODO: it is unwise for Hbc::Staged to be a module, when we are # dealing with both staged and unstaged Casks here. This should # either be a class which is only sometimes...
32
178
0.631451
6abaa614569967f11511d04710522caeb15a3ab5
279
class AddTrashedAndCurrentPriceToVendorProducts < ActiveRecord::Migration def change add_column :vendor_products, :trashed, :bool, default: false add_column :vendor_products, :current_price, :bool, default: true add_index :vendor_products, :current_price end end
34.875
73
0.78853
33bfcbe72d7b603f3039f646646adac759faf376
5,002
RSpec.describe Remont::Schema do it 'processes each matching record' do # rubocop:disable RSpec/ExampleLength bob = User.create(email: 'bob@example.com', role: 'admin', processed_at: nil) schema = described_class.new(model: User, process_timestamp_attribute: :processed_at) do attribute(:email) { 'email'...
30.13253
98
0.662935
03beb502bb945a6f17ebe2ecdc7b49d667f1c3c7
489
module Travis::API::V3 module Renderer::Error AVAILABLE_ATTRIBUTES = [ :error_type, :error_message, :resource_type, :permission ] extend self def available_attributes AVAILABLE_ATTRIBUTES end def render(error, **options) { :@type => 'error'.freeze, :error_type...
24.45
87
0.629857
d5e86d7354020110628820d486432f68ab958fca
130,739
# frozen_string_literal: true require_relative 'test_helper' context 'Blocks' do default_logger = Asciidoctor::LoggerManager.logger setup do Asciidoctor::LoggerManager.logger = (@logger = Asciidoctor::MemoryLogger.new) end teardown do Asciidoctor::LoggerManager.logger = default_logger end conte...
32.956642
556
0.625942
264ea8798c208953fe75ba157287d9b891cbccf1
2,224
# ---------------------------------------------------------------------------- # # *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** # # ---------------------------------------------------------------------------- # # This file is automatically generated by Magic Modules and manual # changes...
39.714286
114
0.622752
5d8823583c15de3a5b28a62e6006699aa31e638e
10,218
RSpec.describe MiqWidgetSet do let(:group) { user.current_group } let(:user) { FactoryBot.create(:user_with_group) } let(:miq_widget) { FactoryBot.create(:miq_widget) } before do @ws_group = FactoryBot.create(:miq_widget_set, :name => 'Home', :owner => group) end context ".seed" do include_examp...
38.126866
172
0.669211
3344ff80bfadc344ba3ee7ac168bf3063cd2f0b7
926
module Fog module Compute class OpenStack class Real def list_servers(options = {}) params = options.dup if params[:all_tenants] params['all_tenants'] = 'True' params.delete(:all_tenants) end request( :expects => [200, 203]...
25.027027
92
0.481641
33988a5afd2cfacbfe8b5891484ca042990ccbca
1,556
class ApplicationController < ActionController::Base include Concerns::Event protect_from_forgery with: :exception if ENV['HTTP_BASIC_AUTH_ENABLED'] == 'true' http_basic_authenticate_with name: ENV['HTTP_BASIC_AUTH_NAME'], password: ENV['HTTP_BASIC_AUTH_PASSWORD'] end before_action :authenticate_user! ...
24.698413
113
0.678021
ffe52011ba32a0db48d9b5d48009cfdd5f12b332
93
# frozen_string_literal: true class Ledger < ActiveRecord::Base has_one_keepr_account end
15.5
33
0.817204
910c1c0c10528c6bb88db9b7cd4757f2345bf773
599
require File.expand_path('../../../../../spec_helper', __FILE__) require 'net/http' require File.expand_path('../fixtures/http_server', __FILE__) describe "Net::HTTP#copy" do before(:all) do NetHTTPSpecs.start_server end after(:all) do NetHTTPSpecs.stop_server end before(:each) do @http = Net::...
24.958333
74
0.69616
6ab8badb5aecb17e2810ac5e8ce0c68e776f2bd5
1,252
# Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
33.837838
84
0.731629
1dad5c6269897d476e0308c25bf711df45c94283
306
class NotificationSerializer < ActiveModel::Serializer attributes :id, :actor, :content_type, :content, :read, :read_at, :created_at, :updated_at, :notification_text has_one :actor, serializer: SimpleUserSerializer def notification_text object.content.notification_text(object.actor) end end
30.6
112
0.787582
d5f9ab93e249a30711409f291028c84e906af761
1,974
# frozen_string_literal: true # We have already seen how to define an outline tree sequentially. # # If you'd like to add nodes to the middle of an outline tree the # <code>add_subsection_to</code> may help you. # # It allows you to insert sections to the outline tree at any point. Just # provide the <code>title</code...
32.360656
76
0.711246
bf9d9141a97927de7428b44ac1a92beb475a9352
6,069
module ActiveFedora module Indexing class FieldMapper class_attribute :id_field, :descriptors # set defaults self.id_field = 'id' self.descriptors = [DefaultDescriptors] # @api # @params [Hash] doc the hash to insert the value into # @params [String] name the name of the...
40.731544
180
0.585269
bb9ac375b9465a7e9a4d640104550aab64a22a99
327
class CdrController < Controller def post uuid, xml, leg = request['uuid', 'cdr', 'leg'] xml = CGI.unescape(xml) if xml[0, 9] == '%3C%3Fxml' call = TinyCdr::Call.create_from_xml(uuid, xml, leg) Ramaze::Log.info "New call from #{call.username || call.caller_id_number} to #{call.destination_number}" e...
36.333333
108
0.669725
01f3e3672f79356c14b12e185dc207c21a91516b
1,750
# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative sou...
43.75
104
0.730857
1c55e796508d0162ce149c3fea072d477137760d
992
# Programming Languages, Dan Grossman # Section 7: Subclassing class Point attr_accessor :x, :y def initialize(x,y) @x = x @y = y end def distFromOrigin Math.sqrt(@x * @x + @y * @y) # why a module method? Less OOP :-( end def distFromOrigin2 Math.sqrt(x * x + y * y) # uses getter methods ...
24.195122
75
0.606855
ab9751023cde58e1cfa9a607b4ad322305b8e75b
3,186
require 'devise' RSpec.configure do |config| config.include Devise::TestHelpers, :type => :controller # rspec-expectations config goes here. You can use an alternate # assertion/expectation library such as wrong or the stdlib/minitest # assertions if you prefer. config.expect_with :rspec do |expectations| ...
43.643836
129
0.736974
ed2ea8e20e4767199c4fa5bdb11c54bd5f2c799e
753
class YoutubeUrlValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) @record = record @attribute = attribute @value = value if value.present? code = response_code(parsed_url) record_error("is not valid. Please check it and try again.") unless code == 200 e...
20.351351
85
0.654714
39d93c85b7660f4236739feda346963e7e427b14
574
# rubocop:disable Layout/LineLength require './item' # Create class Book class Book < Item attr_accessor :publisher, :cover_state attr_reader :publish_date def initialize(publisher, cover_state, publish_date) super(publish_date) @publisher = publisher @cover_state = cover_state end def to_s ...
22.96
136
0.702091
7aa779c2094133d7a82366e977ce4d1e8b83dbd8
4,936
# This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause # this file to always be loaded, without a need to explicitly require it in any # file...
47.92233
92
0.742504
b9496b84993c263ca9f26aef8ba043fb4b375cb6
1,000
# encoding: utf-8 module FriendlyId::NonSluggableInstanceMethods attr :found_using_friendly_id # Was the record found using one of its friendly ids? def found_using_friendly_id? @found_using_friendly_id end # Was the record found using its numeric id? def found_using_numeric_id? !@found_using_fr...
22.727273
72
0.747
79cc2d15b9c9a472c300a72fafec71223a988a39
1,624
# TODO: handle fields & fieldGroup # TODO: make original response available # TODO: specs require 'httparty' require 'ostruct' require 'plissken' require 'flyticket/ticketfly_error' require 'flyticket/util' module Flyticket class Endpoint include HTTParty # Returns the key used to get the list of entries ...
24.238806
82
0.674877
1cbc986cd8d73375a26b5a6d9008bec7390d4a34
6,274
# Generated by the protocol buffer compiler. DO NOT EDIT! # Source: google/privacy/dlp/v2/dlp.proto for package 'google.privacy.dlp.v2' # Original file comments: # Copyright 2018 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Li...
54.086207
105
0.687121
4aa66062a5d236f1c03dad6797ab11c132398e2d
49
require 'goldtweets' require 'minitest/autorun'
12.25
26
0.795918
114860ba2616675ec2016f222ee3dbb992562516
98
# typed: strict # frozen_string_literal: true class FakePackage < PackageSpec export Yabba end
14
31
0.785714
181dd566b6a5cb0d1bc72ad7178a4ca1c1876d42
279
RSpec.describe Magick::Image, '#base_columns' do it 'works' do image = described_class.new(100, 100) expect { image.base_columns }.not_to raise_error expect(image.base_columns).to eq(0) expect { image.base_columns = 1 }.to raise_error(NoMethodError) end end
27.9
67
0.716846
398899325d939276df39b1eb2fc8367c9314baeb
2,798
# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::Monitor::Mgmt::V2016_03_01 module Models # # An alert incident indicates the activation status of an alert rule. # class Incident inclu...
28.55102
78
0.496069
0346b1f155f16b71b43a4b9537aa5ac3a4cdaab5
117
# frozen_string_literal: true module AlertManagement def self.table_name_prefix 'alert_management_' end end
14.625
29
0.794872
08fc75ef4066efc2872bee50319107a2020dafaa
1,641
# frozen_string_literal: true class AddSlackUserAndTeamIdToLeader < ActiveRecord::Migration[5.0] SLACK_TEAM_ID = Rails.application.secrets.default_slack_team_id def change add_column :leaders, :slack_id, :text add_column :leaders, :slack_team_id, :text reversible do |change| # Populate fields w...
25.246154
78
0.638635
1d3fa2afb956b04373b97ea832a50f4d83c3ac3a
948
module Spree module TestingSupport module Preferences # Resets all preferences to default values, you can # pass a block to override the defaults with a block # # reset_spree_preferences do |config| # config.site_name = "my fancy pants store" # end # def reset_spr...
29.625
69
0.682489
017be053783ec0d6a353d02123e8b6d9b60d4305
3,096
require 'simplecov' SimpleCov.start if ENV["TRAVIS"] || ENV['CI'] require 'coveralls' Coveralls.wear!('rails') { add_filter("/spec/") } end ENV["RAILS_ENV"] ||= 'test' ENV["AUTOMATE_DOMAINS"] = "ManageIQ" # Reset only the ManageIQ automate domain when testing. require File.expand_path('manageiq/config/environmen...
26.016807
100
0.710271
acb2792bc3789edf98a358cde16ec92fd72c63d9
1,680
describe command("/bin/hab sup -h") do its(:stdout) { should match(/The Habitat Supervisor/) } end svc_manager = if command("systemctl --help").exit_status == 0 "systemd" elsif command("initctl --help").exit_status == 0 "upstart" else "sysv"...
27.540984
90
0.654167
1d60e8eb8a79888acae7ea209cd6a827264ed067
8,772
# frozen_string_literal: true require 'lograge/log_subscribers/action_controller' require 'active_support/notifications' require 'active_support/core_ext/string' require 'logger' require 'active_record' require 'rails' describe Lograge::LogSubscribers::ActionCable do let(:log_output) { JSON.parse(io_target.string, ...
31.328571
103
0.672367
e224775b81b70bf77f74170adffb6e854f1f418b
10,148
#!/usr/bin/env ruby # Copyright 2013-2014 Bazaarvoice, 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 applicab...
37.172161
174
0.650572
33fd82e8f026ad6fcc012bd3fe05a8c4a5b1797e
1,207
module Boxcutter class Server def self.all api = Api.new(*ENV['BBG_API_KEY'].split(':')) resp = api.servers if resp.success? resp.parsed.map {|attrs| new(api, attrs)} else [] end end def self.find_by_hostname(hostname) all.detect {|server| server.hostn...
16.763889
99
0.561723
87a4b703b1fa8cc0703a39aa678dae667716c34e
270
# encoding: UTF-8 require File.join(File.dirname(__FILE__), "spec_helper") describe Escodegen do describe "#load_path" do it "escodegen.js should exist at the load path" do File.should exist(File.join(Escodegen.load_path, "escodegen.js")) end end end
24.545455
71
0.722222
3873a1d0b786c025e4ad9fa0e68812153c078080
470
require 'bundler' Bundler.require() def fake_song(title, release_year, artist) {:title => title.to_s, :release_year => release_year.to_s, :artist => artist.to_s} end get '/api/shake_it_cough' do cross_origin fake_song('shake_it_cough','1987','Baylor_Diff') end get '/api/strip_pop_lupe' do cross_origin fake...
21.363636
84
0.744681
e8e0cbecfb7f2feb8dca9adf7858b8dc2f755795
452
class CreateBoringScienceArticles < ActiveRecord::Migration[5.0] def change create_table :boring_science_articles do |t| t.string :blog, null: false, index: true t.string :title, null: false t.string :summary t.text :body, null: false t.date :publication_date t.string :slug, nu...
28.25
64
0.665929
286a6c3de97814423b4e2b1be23a9800688500a9
2,232
RSpec.shared_examples Hcheck::ApplicationHelpers::Responders do require 'pg' require 'rack/test' include Rack::Test::Methods def app application end before do ENV['HCHECK_SECURE'] = nil end after(:all) do ENV['HCHECK_SECURE'] = 'true' end context 'all checks pass' do it 'display...
26.258824
91
0.638889
21d707947795c90e0736a7c519ffcbf1ae1ad655
1,455
class PagesController < ApplicationController before_action :authenticate_user!, only: [:admin_panel] def index @user = User.new end def ticket @ticket = Ticket.where(user_id: current_user.id).first if Ticket.where(tour: "1").count >= 100 @disable_radio_button_tou...
27.980769
110
0.617182