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
e8acff8cf21cf993c449b12824db2f020882323c
322
describe directory('/usr/local/android-ndk-r10e') do it { should exist } it { should be_owned_by 'random' } end describe file('/etc/profile.d/ANDROID_NDK_R10E.sh') do it { should exist } its('mode') { should cmp '0755' } its('content') { should cmp "export ANDROID_NDK_R10E=/usr/local/android-ndk-r10e\n" } en...
29.272727
87
0.698758
e293467774e181f0b1a7f122a84fe2cfcf059be3
591
# frozen_string_literal: true RSpec.shared_examples 'cluster application version specs' do |application_name| describe 'update_available?' do let(:version) { '0.0.0' } subject { create(application_name, :installed, version: version).update_available? } context 'version is not the same as VERSION' do ...
28.142857
88
0.698816
01edd8b0efa323295b7dc5efc4c449dd9ff2ccd3
3,757
# # Author:: Joshua Sierles <joshua@37signals.com> # Author:: Joshua Timberman <joshua@opscode.com> # Author:: Nathan Haneysmith <nathan@opscode.com> # Author:: Seth Chisamore <schisamo@opscode.com> # Author:: Tim Smith <tsmith84@gmail.com> # Cookbook Name:: nagios # Attributes:: client # # Copyright 2009, 37signals # ...
45.817073
143
0.653979
1a8c01664ae9c0bffca167418a7d56a5160f6dd1
5,160
Doorkeeper.configure do # Change the ORM that doorkeeper will use (needs plugins) orm :active_record # This block will be called to check whether the resource owner is authenticated or not. resource_owner_authenticator do # Put your resource owner authentication logic here. # Example implementation: ...
45.263158
162
0.764729
1d3d896108ceeba8e57ae661ed1472ffe13f367b
999
# frozen_string_literal: true module EE module Types module BoardListType extend ActiveSupport::Concern prepended do field :milestone, ::Types::MilestoneType, null: true, description: 'Milestone of the list' field :max_issue_count, GraphQL::INT_TYPE, null: true, ...
32.225806
97
0.631632
038cb41bdacfa983faf1300b99b61afa1ad1f7b2
2,815
## # 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::HttpServer::HTML def initialize(info = {}) super(upda...
28.72449
93
0.564121
9172b6883497adda582465aa9a93267bccf08a87
338
# coding: utf-8 module ONIX class SenderIdentifier include ROXML xml_name "SenderIdentifier" xml_accessor :sender_id_type, :from => "SenderIDType", :as => Integer, :to_xml => ONIX::Formatters.two_digit xml_accessor :id_type_name, :from => "IDTypeName" xml_accessor :id_value, :from => "I...
24.142857
112
0.686391
086e51fbc03c2747b4a667e895ff7227e20eea7a
3,031
# frozen_string_literal: true module Api module Pilot class UploadedDocumentsController < ApplicationController before_action :set_uploaded_document, only: %i[show download destroy] # GET /api/pilot/uploaded_documents def index # Grab just the uploaded documents for the given profile ...
35.658824
158
0.686572
1c37351fc24304530de29b18581765beb46bfb04
543
module Stradivari module Table class Builder < Stradivari::Builder Implementations = { action: 'ActionBuilder', boolean: 'BooleanBuilder', checkbox: 'CheckboxBuilder', text: 'TextBuilder', number: 'NumberBuilder', date: 'DateBuilder', ...
21.72
56
0.59116
01d556731d0deaa3b94c1b68270cf14782f3412b
444
class User < ApplicationRecord before_save { self.email = self.email.downcase } validates :name, presence: true, length: { maximum: 50 } VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i validates :email, presence: true, length: { maximum: 255 }, format: { with: VALID_EMAIL_REGEX }, ...
44.4
61
0.623874
7a1845443e734eed6e220f318eb34efd8df33932
466
Dir["#{Rails.root}/lib/api/*.rb"].each {|file| require file} module Gitlab class API < Grape::API VERSION = 'v2' version VERSION, using: :path rescue_from ActiveRecord::RecordNotFound do rack_response({'message' => '404 Not found'}.to_json, 404) end format :json error_format :json ...
19.416667
64
0.665236
01a0a53118af3492b96e3dd781fee715ce2ee8de
3,741
# encoding: utf-8 require 'pathname' require 'fileutils' require 'multi_json' require 'oj' require 'elasticsearch' require 'patron' module Backup module Database # Integration with the Backup gem [https://github.com/meskyanichi/backup/] # # This extension allows to backup Elasticsearch indices as fla...
26.160839
111
0.534082
1d1ce3e44482edc10a8b47504c2ad0ff058c907f
1,250
# frozen_string_literal: true lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'xmlhasher/version' Gem::Specification.new do |spec| spec.name = 'xmlhasher' spec.version = XmlHasher::VERSION spec.authors = ['Gene Drabkin'] spec.email ...
35.714286
67
0.6704
ab853d3b9a1661e6d571ed15468e59df9c191973
189
module Capistrano module Daemonize class Version MAJOR = 0 MINOR = 9 PATCH = 2 def self.to_s "#{MAJOR}.#{MINOR}.#{PATCH}" end end end end
13.5
36
0.52381
d5f2e7cb8e84aa4066f1f3a182a78776ff45270e
672
class AddFieldsToResources < ActiveRecord::Migration def change change_table :resources do |t| t.integer :dataset_license_id # Because the existing license_id is a *default* for the items *in* the resource. t.string :dataset_rights_holder, # " " limit: 255 t.st...
42
123
0.630952
62d72dd057d346ce929435afb967d288a4961289
420
class Puppet::Parser::CodeMerger # Concatenates the logic in the array of parse results into one parse result # @return Puppet::Parser::AST::BlockExpression # def concatenate(parse_results) children = parse_results.select {|x| !x.nil? && x.code}.reduce([]) do |memo, parsed_class| memo + parsed_class...
32.307692
94
0.711905
bbfdcfa9c978a59cd67e4d440a485cd3f8606e9c
1,315
# `zendesk_api` gem root module ZendeskAPI # A rich factory that returns a class for your searches class Search # Creates a search collection def self.search(client, options = {}) if (options.keys.map(&:to_s) & %w[query external_id]).empty? warn "you have not specified a query for this search"...
25.288462
88
0.640304
b98ac0bfdf21c4912cbb0723c4c477da6e785bed
237
require 'rubygems' require 'lib/bandwidth' require 'awesome_print' bandwidth = Bandwidth.new(:developer_key => 'your developer key', :use_lab_uris => true) ap bandwidth.area_code_number_search :area_code => '720', :max_quantity => 1
29.625
90
0.755274
1deb41a864e1711ccc7e628e2e62056545439501
4,487
module GovKit class TransparencyDataResource < Resource # default_params and base_uri are provided by HTTParty default_params :apikey => GovKit::configuration.sunlight_apikey base_uri GovKit::configuration.transparency_data_base_url def self.search_for( path, ops={} ) response = get(path, :que...
30.944828
174
0.630711
7ab24389b87ff84f2e532808239024b612a1c014
5,082
module ActionController module Assertions # A small suite of assertions that test responses from Rails applications. module ResponseAssertions # Asserts that the response is one of the following types: # # * <tt>:success</tt> - Status code was 200 # * <tt>:redirect</tt> - Status cod...
42
166
0.618064
6144061d48cb1aeed9923b0627086346deff4cc7
1,352
# encoding: utf-8 # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # /spec/fixtures/responses/whois.nic.fr/yt/status_available.expected # # and regenerate the tests with the following rake task # # $ rake genspec:parsers # require 'spec_helper' require '...
22.163934
83
0.66568
6252ac371af97d6e6e167b555f4793f68b5068fa
429
# Be sure to restart your server when you modify this file. EventManager::Application.config.session_store :cookie_store, key: '_event_manager_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the session table wi...
47.666667
91
0.818182
614bace6c306c0268e6a4a0b25c0af01afecf626
1,513
# 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 source for your # dat...
32.191489
86
0.72505
3926364748c6b4867ef817d9e578eac9dce71f8c
6,498
=begin #OpenAPI Petstore #This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech OpenAPI Generator version: 5.1.0-SNAPSHOT =en...
29.671233
196
0.625115
ffaeccae55f46fd05c4b33de08e79c4094e978cc
401
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'notes/new', type: :view do before(:each) do assign(:note, Note.new( body: 'MyText' )) end it 'renders new note form' do render assert_select 'form[action=?][method=?]', notes_path, 'post' do ...
20.05
67
0.600998
aba7ec21ce92b94df8de55ca3f7506a8f2804bef
118
# frozen_string_literal: true warn "requiring rdoc/markup/inline is deprecated and will be removed in RDoc 4." if $-w
39.333333
87
0.779661
8734cebff269b494a43cd84131d900cd31706937
13,645
# coding: utf-8 require 'helper' describe Twitter::Tweet do before do @old_stderr = $stderr $stderr = StringIO.new end after do $stderr = @old_stderr end describe "#==" do it "returns true when objects IDs are the same" do tweet = Twitter::Tweet.new(:id => 1, :text => "foo") ot...
36.097884
143
0.631953
396607fe1a7174cfb337efe1479fd8b069354819
512
class CimStorageExtentController < CimInstanceController def index process_index end def button process_button end def show process_show( 'ontap_logical_disks' => :logical_disks, 'ontap_storage_volumes' => :storage_volumes, 'snia_local_file_systems' => :local_file_systems...
20.48
56
0.585938
01ac2e79a8735d99d8805e4199d688045dcc1674
690
classTelevisor attr_accessor:estado , :canalactual attr_reader :marca definitialize(params) @marca = params[:marca] @estado = "apagado" end defencender self.estado = "Encendido" puts self.estado end defapagar self.estado = "Apagado" puts self.estado end defcambiar_canal(canal) if canal > 1...
16.046512
47
0.701449
3802739d2020705004f2faf6789104e20b84e833
194
class Settings::BaseController < ApplicationController before_action :no_anonymous before_action :set_user layout "settings" private def set_user @user = @current_user end end
16.166667
54
0.762887
79f54f9df204385d2e45c59ad4fdaff0e5870568
15,648
require "rails_helper" describe StyleGuide::Ruby, "#violations_in_file" do include ConfigurationHelper context "with default configuration" do describe "for { and } as %r literal delimiters" do it "returns no violations" do expect(violations_in(<<-CODE)).to eq [] "test" =~ %r|test| ...
24.526646
79
0.596115
8759aabc2ea6029a0f419e640d28ff7310c60d01
2,539
# frozen_string_literal: true require_relative '../../../step/base' require_relative '../../../step/buy_train' require_relative '../../../step/automatic_loan' module Engine module Game module G1867 module Step class BuyTrain < Engine::Step::BuyTrain include Engine::Step::AutomaticLoan ...
27.901099
111
0.541946
62ba9a5606e509a2a414e61ae1b6f1640fe375d6
1,662
# # Author:: Fletcher Nichol (<fnichol@nichol.ca>) # # Copyright (C) 2013, Fletcher Nichol # # 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 # ...
30.218182
82
0.637786
f849f84f5cb148bb224d851eabcdab3aedd6530c
1,278
module CS50 PLUGINS = { "jekyll-algolia" => "1.7.1", "jekyll-default-layout" => "0.1.5", "jekyll-optional-front-matter" => "0.3.2", "jekyll-redirect-from" => "0.16.0", "jekyll-titles-from-headings" => "0.5.3" }.freeze DEFAULTS = { "cs50" => { "local" => { "day" => "numeric"...
21.3
46
0.466354
aba152e48512c9234f05f78b470554c93ced42ef
206
require 'spec_helper' describe WelcomeController, type: :controller do describe "GET 'index'" do it 'returns http success' do get 'index' expect(response).to be_success end end end
18.727273
48
0.68932
7a2283a4c92153394169e2f3d38e3218601228c9
617
cask 'portfolioperformance' do version '0.39.0' sha256 '54a577672ca9cfa234afda5d602730a7a441ab465f39772fe614e27e66991059' # github.com/buchen/portfolio was verified as official when first introduced to the cask url "https://github.com/buchen/portfolio/releases/download/#{version}/PortfolioPerformance-distro-#{...
32.473684
138
0.784441
1c0bf9f401052391940b2cf66fa36ba039e8fe30
59
class Project < ActiveRecord::Base has_many :deploys end
14.75
34
0.779661
5d98c30582241322c20959732ce7e752c224b474
541
cask 'browserosaurus' do version '10.4.1' sha256 '07ef1a1c5a554f311ec9d80ccc1a1682183a5aaabd05c3404e75384167605205' # github.com/will-stone/browserosaurus/ was verified as official when first introduced to the cask url "https://github.com/will-stone/browserosaurus/releases/download/v#{version}/Browserosaurus-#...
36.066667
112
0.789279
4a0af51c6233e7b3723ff9c06d69375e8b27823a
24,072
require 'spec_helper' describe Oregano::Parser::Resource do before do environment = Oregano::Node::Environment.create(:testing, []) @node = Oregano::Node.new("yaynode", :environment => environment) @known_resource_types = environment.known_resource_types @compiler = Oregano::Parser::Compiler.new(@nod...
37.378882
152
0.644649
61d63c6bb804b9dcbcfc3d75ee1238dbe033818f
1,949
class Folly < Formula desc "Collection of reusable C++ library artifacts developed at Facebook" homepage "https://github.com/facebook/folly" url "https://github.com/facebook/folly/archive/v2019.06.10.00.tar.gz" sha256 "afecd68815a83865d95a3a6b861abe8096beefae45c89566e0d510279b631b57" head "https://github.com/...
27.842857
93
0.640841
e8fc240bf71b6f6b8b829ebd6706671464ff628a
122
class AddGithubLoginToUser < ActiveRecord::Migration def change add_column :users, :github_login, :string end end
20.333333
52
0.770492
1894ee4b99a4097ae75c415964d0a3e4223547d1
1,278
require_relative '../shared' require_relative '../../systemctl/systemctl' module Zlown::CLI desc 'Manage systemctl' command 'systemctl' do |c| c.desc 'Enable systemctl service' c.command 'enable' do |cmd| cmd.action do |global_options, options, args| Zlown::Systemctl.enable(args, options) ...
25.058824
51
0.63928
01750001a132adc40fccd5b1a2830aeb4e6d6b7e
246
class CreateAccounts < ActiveRecord::Migration[5.1] def change create_table :accounts do |t| t.references :user t.string :name t.string :category t.datetime :created_at t.datetime :updated_at end end end
20.5
51
0.658537
7a403c9872dc10d73d3b3e52af38e3db2914e489
1,211
# -*- coding: utf-8 -*- Pod::Spec.new do |s| s.name = "RichRelevanceSDK" s.version = "1.1.0" s.summary = "A native Objective-C interface to the Rich Relevance API." s.description = <<-DESC The Rich Relevance SDK is a native Objective-C interface to the Rich Relevance API featuring: - Interaction wi...
44.851852
176
0.69777
18e9273036ff515a8e8c2f6ab00c7782ca243b99
3,801
# Copyright 2016 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, ...
28.155556
74
0.74191
b99391feda68b2c24516189a5fd246dda1cb304f
1,387
class SportsApi::Fetcher::Boxscore include SportsApi::Fetcher::ESPN::Scraper attr_accessor :gameid def initialize(gameid) self.gameid = gameid end def gameid=(gameid) @gameid = gameid.to_i end def self.find(league, gameid) case league when SportsApi::NFL SportsApi::Fetcher::Boxsco...
24.333333
103
0.656813
1cc581720a18b0ff540a54642d3244e9aa8982d9
1,291
require 'spec_helper' describe 'sudo::user_specification' do context 'supported operating systems' do on_supported_os.each do |os, os_facts| context "on #{os}" do let(:facts){ os_facts } let(:title) { 'user_specification_spec' } context 'default parameters' do let(:params...
31.487805
145
0.536019
28cea84e6fd3b4778f2072dbf2e918c9230aa900
511
require 'puppet-lint-security-plugins' # Matches tidy resources without age and size parameters PuppetLint.new_check(:security_tidy_all_files) do def check check_resource_index( :resource_type => 'tidy', :severity => :warning, :message => 'Purging all files, be warned!' ) do |rule| ...
24.333333
63
0.690802
080b23cfde2d1123f80c2c54c34923841fa71097
340
class AuthorizeRequest prepend SimpleCommand attr_reader :token, :uid def initialize(headers = {}) @token = headers['token'] @uid = headers['uid'] end def call user end private def user user = User.where(token: token, email: uid).first raise Exceptions::InvalidToken unless user...
15.454545
53
0.658824
4a67ab9393f1d771256b96521ae682ffc35f4f83
690
# # Copyright:: Copyright (c) 2016 GitLab B.V. # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
32.857143
74
0.750725
08fbf7eb59345fa010162117fc7d75ec138685b4
211
require "rspec" RSpec.describe SolrSearchTree do it "has a version number" do expect(SolrSearchTree::VERSION).not_to be nil end it "does something useful" do expect(false).to eq(true) end end
16.230769
49
0.71564
1c0db20896a2a96ff971ac1a941ec1bce99ad21d
907
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'removing a participant' do before do create :participant end context 'with admin privilege' do it 'removes a participant' do when_current_user_is :admin visit participants_path click_on 'Remove' expect(page).to...
24.513514
77
0.708931
62c25d181c8f9203ff1027fdfc9af87e09606617
1,015
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'to_sep/version' Gem::Specification.new do |spec| spec.name = "to_sep" spec.version = ToSep::VERSION spec.authors = ["Kim,SeongJun"] spec.email = ["me@kimseong...
40.6
154
0.661084
79da784ea06f95019fbb2e23f2bc09f4bbe5c966
173
require 'test_helper' feature "Navigation" do scenario "the main page renders without error" do visit root_path page.must_have_content "Welcome to EduX" end end
21.625
51
0.757225
ab8afb1d09373e34045afcf4e950425e82d60efe
1,173
require 'formula' # The 2.1 series requires Lion or newer. # 2.0.6 is provided for Snow Leopard compatibility. class Appledoc20 < Formula homepage 'http://appledoc.gentlebytes.com/' url 'https://github.com/tomaz/appledoc/archive/v2.0.6.tar.gz' sha1 '3d76172339cbfea24ef53f55e2452cc78930413e' depends_on :xcode ...
31.702703
93
0.653879
878a13a0938fc878f6193d5fce980ca6e02f29c7
2,875
require File.expand_path('../boot', __FILE__) require 'rails/all' if defined?(Bundler) # If you precompile assets before deploying to production, use this line Bundler.require(*Rails.groups(:assets => %w(development test))) # If you want your assets lazily compiled in production, use this line # Bundler.requi...
42.910448
100
0.732522
21bb65559fb69ad63c810e8cb966043ebe1a7cb3
196
class AddEmploymentStatusToTslrClaim < ActiveRecord::Migration[5.2] def change add_column :tslr_claims, :employment_status, :integer add_index :tslr_claims, :employment_status end end
28
67
0.790816
5df4ae7a6b5b7944bc2c54e2496a1685048cc5c2
1,773
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "heiseirb_api_client/version" Gem::Specification.new do |spec| spec.name = "heiseirb_api_client" spec.version = HeiseirbApiClient::VERSION spec.authors = ["Tashiro"] spec.email ...
41.232558
96
0.686407
33a342f9d90ee12710dc428d7a33ff4b3175bd46
1,003
class ClassificationFeaturing < ApplicationRecord belongs_to :edition, inverse_of: :classification_featurings belongs_to :offsite_link belongs_to :classification, inverse_of: :classification_featurings belongs_to :image, class_name: 'ClassificationFeaturingImageData', foreign_key: :classification_featuring_imag...
22.795455
121
0.73679
790e1cad5705d125eab5fb7d57ef688f4c089ed6
3,085
# frozen_string_literal: true require 'spec_helper' RSpec.describe TagsFinder do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project, :repository) } let_it_be(:repository) { project.repository } def load_tags(params) described_class.new(repository, params).execute end describe '...
28.045455
125
0.6094
2658778298268c4a5dec4354ba9295e45f9fc333
1,738
# 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 source for your # dat...
41.380952
89
0.699655
61bbacc4c7736b2d496d1a9d85a6799fb6e3edae
1,125
class Mmix < Formula desc "64-bit RISC architecture designed by Donald Knuth" homepage "http://mmix.cs.hm.edu/" url "http://mmix.cs.hm.edu/src/mmix-20160804.tgz" sha256 "fad8e64fddf2d75cbcd5080616b47e11a2d292a428cdb0c12e579be680ecdee9" bottle do cellar :any_skip_relocation sha256 "b694920e61edf2dec09...
28.846154
92
0.683556
ac7918daad83c83192b7a5ef92bc9169c52d7d8b
842
module Cmor module MultiTenancy module Generators class InstallGenerator < Rails::Generators::Base desc 'Generates the initializer' source_root File.expand_path('../templates', __FILE__) attr_reader :base_controller_class_name def initialize(*args) super ...
27.16129
109
0.653207
872246e0d947141ad923dbd331935d5e98a33279
243
class AddMissingIndexesLatest < ActiveRecord::Migration disable_ddl_transaction! def change add_index :votes, :votable_id, algorithm: :concurrently add_index :users, [:invited_by_id, :invited_by_type], algorithm: :concurrently end end
30.375
80
0.802469
79fedff655d5ef7ea5b9873bc0ea4ec62dc7cc0f
23,757
# Copyright 2019 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, ...
53.029018
146
0.625795
21ff0977c239f2be152104bb5b95518f8b44c69f
1,841
class PasswordResetsController < ApplicationController before_action :get_user, only: [:edit, :update] before_action :valid_user, only: [:edit, :update] before_action :check_expiration, only: [:edit, :update] def new end # パスワード再設定用のcreateアクション def create @user = User.find_by(email: params[:pass...
24.223684
73
0.652363
61fa82adb29b43205a2d84be01deb8443c47fa35
220
require 'spec_helper' describe Repository do it { should respond_to :id } describe '#image_tags' do it 'should always respond to each' do expect(subject.image_tags).to respond_to :each end end end
16.923077
52
0.704545
ed2262878d627afa86b33ee723f0c071988f08cb
2,156
require 'test_helper' class StateTransitionTest < Test::Unit::TestCase context 'state transition' do setup do @opts = {:from => 'foo', :to => 'bar', :guard => 'g'} @st = AASM::SupportingClasses::StateTransition.new(@opts) end should 'set from, to, and opts attr readers' do assert_e...
28.368421
84
0.580705
7aa646451aab69aff102c8775d542fd3068e0e42
1,581
=begin #Selling Partner API for Merchant Fulfillment #The Selling Partner API for Merchant Fulfillment helps you build applications that let sellers purchase shipping for non-Prime and Prime orders using Amazon’s Buy Shipping Services. OpenAPI spec version: v0 Generated by: https://github.com/swagger-api/swagger-cod...
29.277778
182
0.752056
386ebb1569ba6c7144bbdf1cf7b84255dd948851
129
class RemovePasswordFromUsers < ActiveRecord::Migration[5.1] def change remove_column :users, :passowrd, :string end end
21.5
60
0.75969
26fa677540a62775a307838ebb968b1bf8b858ca
1,348
module SolidusManyDeliveryAddresses module Generators class InstallGenerator < Rails::Generators::Base class_option :auto_run_migrations, type: :boolean, default: false def add_javascripts append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/solidus_many_...
43.483871
170
0.703264
91e63b4bf6d986791bb95a6269ffe0d4fe3b8e23
565
require 'test_helper' class MicropostsControllerTest < ActionDispatch::IntegrationTest def setup @micropost = microposts(:orange) end test 'should redirect create when not logged in' do assert_no_difference 'Micropost.count' do post microposts_path, params: { micropost: { content: "Lorem ipsum" } ...
26.904762
77
0.743363
4a610f289295e267355ca21a239f90d2a090418b
40
module Sniffles VERSION = "0.2.0" end
10
19
0.675
e2e2aebd75fbc26f0b9df7ba33191169e23eb29a
1,525
# frozen_string_literal: true # encoding: utf-8 require 'spec_helper' describe Mongo::Auth::CR do let(:server) do authorized_client.cluster.next_primary end let(:connection) do Mongo::Server::Connection.new(server, SpecConfig.instance.test_options) end describe '#login' do before do co...
19.0625
75
0.596066
1837f5d5014c14309bc9563b5ac0aed2aa62605e
1,011
module DigitalRiver class LineItemsResource # Update a line items quantity by passing a # line item id and a quantity. # It returns a HTTP status 204. # # https://developers.digitalriver.com/resourcemethod/post-shoppersmecartsactiveline-itemsid # # @example # update = Update.new(sess...
24.071429
95
0.596439
bf5be3f05ac166febeb02645ebb53510946baad2
391
# @param {Integer[]} nums # @return {Void} Do not return anything, modify nums in-place instead. def wiggle_sort(nums) (0..nums.size - 2).each do |i| swap(nums, i, i+1) if (i.even? && nums[i] > nums[i+1]) || (i.odd? && nums[i] < nums[i+1]) end nums end def swap(nums, i, j) temp = nums[i] nums[i] = nums[j...
20.578947
93
0.58312
87fc0ec43cef41a6451ad067d9d5b3f193db914d
117
class AddNumeroBienItem < ActiveRecord::Migration def change add_column :items, :numeroBien, :string end end
19.5
49
0.760684
bba49df4296afa49ed70587e70593627949a5d37
1,006
# frozen_string_literal: true module Kenna module Toolkit module ParamsHelper # Helper used to build params from command line # This implementation accepts whitespaces and colons as separators. # Colons are ignored as separators when inside double quoted strings. # @return [Array<String>]...
23.952381
75
0.536779
18fe8e8cab94a2c540e89f8abb220ccd0cfc6cca
10,110
module ActiveJob module Unique module Adapters module SidekiqAdapter module Web module Server def self.registered(app) # index page of stats app.get '/job_stats' do redirect '/job_stats/*/*' end app.get '/...
38.007519
154
0.528289
18b109ce6f845359d8fc99365e2b2182f45b68ea
3,192
# frozen_string_literal: true module ActiveRecord class DatabaseConfigurations # A HashConfig object is created for each database configuration entry that # is created from a hash. # # A hash config: # # { "development" => { "database" => "db_name" } } # # Becomes: # # #<A...
32.907216
181
0.66604
d53dca9b39541b26190908e716675aeb52a57deb
1,509
class Pdnsrec < Formula desc "Non-authoritative/recursing DNS server" homepage "https://www.powerdns.com/recursor.html" url "https://downloads.powerdns.com/releases/pdns-recursor-4.0.6.tar.bz2" sha256 "f2182ac644268bb08b865a71351f11d75c5015ac0608a1469eb4c1cd5494d60d" bottle do sha256 "545c4e165dabc5ab3fb...
29.588235
93
0.719019
ab4ab73961a18b108ea837177664589631e20426
13,493
# # Copyright:: Copyright (c) Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # #...
43.95114
216
0.600978
113a0d7521ed3961ba0a338b3f9dda2612283ff4
50,552
# frozen_string_literal: true require 'parser/current' RSpec.describe RuboCop::AST::NodePattern do before { $VERBOSE = true } after { $VERBOSE = false } let(:root_node) do buffer = Parser::Source::Buffer.new('(string)', 1) buffer.source = ruby builder = RuboCop::AST::Builder.new Parser::Curren...
25.428571
119
0.546447
e98023bb6642395d49fa943e7228797598cd1084
1,440
require File.expand_path("./spec_helper", File.dirname(__FILE__)) describe "HTTP Dynamic Redirect Module" do let(:origin) do "http://#{nginx_host}:#{nginx_port}/" end let(:dest) do "http://#{nginx_host}:#{nginx_port}0/" end before do insert_entry_on_redis(origin, dest) end context "disable...
20.869565
65
0.61875
ed6a6435437b728d875a680b995937dadf287464
594
require "spec_helper" describe Mongoid::Persistence::Operations::Insert do before do Person.delete_all end before(:all) do Mongoid.identity_map_enabled = true end after(:all) do Mongoid.identity_map_enabled = false end describe "#persist" do context "when the insert succeeded" do ...
16.971429
52
0.641414
bf5f69501dabd47353e1b8ecefeb17613406c9a8
1,037
class Qcachegrind < Formula desc "Visualize data generated by Cachegrind and Calltree" homepage "http://kcachegrind.sourceforge.net/html/Home.html" url "https://kcachegrind.github.io/files/kcachegrind-0.7.4.tar.gz" mirror "http://kcachegrind.sourceforge.net/kcachegrind-0.7.4.tar.gz" sha256 "0bf6efb647d500bf09...
37.035714
95
0.766635
5d202e9b0c7917a6ca431206f873dfa32860c4e8
112
class AddServiceIndexOnLogs < ActiveRecord::Migration[6.0] def change add_index :logs, :service end end
18.666667
58
0.75
876d5d761d71cb43ba921b56baf1135e6c36f454
1,196
module DockerCookbook class DockerVolume < DockerBase resource_name :docker_volume provides :docker_volume property :driver, String, desired_state: false property :host, [String, nil], default: lazy { ENV['DOCKER_HOST'] }, desired_state: false property :opts, Hash, desired_state: false proper...
33.222222
93
0.702341
d552151a1de01f2da2751926c37b3fb1cd7b8d6a
1,575
require 'action_view/template/resolver' module ActionView #:nodoc: # Use FixtureResolver in your tests to simulate the presence of files on the # file system. This is used internally by Rails' own test suite, and is # useful for testing extensions that have no way of knowing what the file # system will look li...
31.5
128
0.645714
d5bdb53f4abff2eed28de499fdbf5d38c67356d4
1,632
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic...
62.769231
245
0.783088
e21d36046daeff43cfd2835f21af1da6e33762a5
7,845
module Admin::BaseHelper include ActionView::Helpers::DateHelper def subtabs_for(current_module) output = [] AccessControl.project_module(current_user.profile.label, current_module).submenus.each_with_index do |m,i| current = (m.url[:controller] == params[:controller] && m.url[:action] == params[:ac...
30.885827
149
0.641938
03c31f698588c9f147fcc526e7b3947fef4677ed
10,145
require 'rubygems' require 'rbconfig' require 'yaml' RUBY = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['RUBY_INSTALL_NAME']) OUTPUT = "spec/bin-sequel-spec-output-#{$$}.log" TMP_FILE = "spec/bin-sequel-tmp-#{$$}.rb" BIN_SPEC_DB = "spec/bin-sequel-spec-db-#{$$}.sqlite3" BIN_SPEC_DB2 = "spec/bin-sequel-spec-...
40.257937
411
0.625333
e874923b4bcd02f996db89d280d0781a17b5fade
473
# Migration responsible for creating a table to store api keys class CreateApiKeys < ActiveRecord::Migration # Create table def self.up create_table :api_keys do |t| t.belongs_to :authenticatable, :polymorphic => true t.string :token, limit: 255 t.timestamps end add_index :api_keys...
22.52381
69
0.701903
e92e9d11dfcda159e0dec0e90ba962a9bed379f0
5,323
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../../lib/cucumber/mate/files' module Cucumber module Mate module Files describe StepsFile do before(:each) do @fixtures_path = File.expand_path(File.join(File.dirname(__FILE__), %w[.. ....
60.488636
213
0.604546
612321aec8af5038cfb624ff414339478f9c33f3
3,677
# frozen_string_literal: true # Fetches pageview data from the Wikimedia pageviews REST API # Documentation: https://wikimedia.org/api/rest_v1/?doc#!/Pageviews_data/get_metrics_pageviews_per_article_project_access_agent_article_granularity_start_end class WikiPageviews def initialize(article) @article = article ...
31.698276
157
0.700571
1141d22668b55826c99fe2025eb8a1e56a542814
23,102
# BioCatalogue: app/controllers/application_controller.rb # # Copyright (c) 2008-2011, University of Manchester, The European Bioinformatics # Institute (EMBL-EBI) and the University of Southampton. # See license.txt for details. # Filters added to this controller apply to all controllers in the application. # Likewis...
32.86202
197
0.647217
d50619ecb33460164bb6e8b5057473b3c17a0d03
3,904
require 'spec_helper' describe Puppet::Type.type(:mysql_database).provider(:mysql) do let(:defaults_file) { '--defaults-extra-file=/root/.my.cnf' } let(:raw_databases) do <<-SQL_OUTPUT information_schema mydb mysql performance_schema test SQL_OUTPUT end let(:parsed_databases) { %w(in...
32.806723
218
0.657018
874937bc4ce830b78579f5e5fb002137e4a2cb2a
3,960
# frozen_string_literal: true require 'spec_helper' RSpec.describe Ci::PipelineEditorHelper do let_it_be(:project) { create(:project) } describe 'can_view_pipeline_editor?' do subject { helper.can_view_pipeline_editor?(project) } it 'user can view editor if they can collaborate' do allow(helper).t...
38.446602
104
0.641162
392ab60519186bfae1ea17604618d85b113c9145
1,124
describe PeerReviewPolicy do let(:context) { { role: role, real_user: role.user } } describe_rule :view? do succeed 'role is an instructor' do let(:role) { create(:instructor) } end succeed 'role is a ta' do let(:role) { create(:ta) } end succeed 'role is a student' do let(:ro...
24.977778
60
0.604982
395e821750b11b6f69c230889e5ff40ac378d385
2,588
class MarkupTweet class << self def markup_tweet(tweet) text = tweet['full_text'] entities = tweet['entities'] extended_entities = tweet['extended_entities'] text = MarkupTweet::markup_media(text, entities, extended_entities) text = MarkupTweet::markup_urls(text, tweet) text = ...
35.452055
137
0.619397