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
28e1af6a502f10ab7ccb47b0cf330e223a347845
2,117
# frozen_string_literal: false require "spec_helper" describe Kitabu::TOC::HTML do def regexp(text) /#{Regexp.escape(text)}/ end def input <<-HTML.force_encoding("utf-8") <h1>Item 1</h1> <h2>Item 1.2</h2> <h3>Item 1.1.3</h3> <h4>Item 1.1.1.4</h4> <h5>Item 1.1.1.1.5</h5> ...
34.704918
93
0.633916
213dd934a3571170dd40be97da89c59990a5724b
995
# frozen_string_literal: true module Murax # solr label ops module HasSolrLabels extend ActiveSupport::Concern included do def to_solr(solr_doc = {}) super.tap do |doc| ordered_creator_labels = nested_ordered_creator.map { |i| (i.instance_of? NestedOrderedCreator) ? "#{i.creato...
36.851852
170
0.651256
4a9ec304843bf2c24b052665eda0b9e0a39c5131
1,008
# -*- encoding: utf-8 -*- require File.expand_path('../lib/pry-debugger/version', __FILE__) Gem::Specification.new do |gem| gem.name = 'pry-debugger' gem.version = PryDebugger::VERSION gem.author = 'Gopal Patel' gem.email = 'nixme@stillhope.com' gem.license = 'MIT' gem....
38.769231
121
0.628968
edf7291667e5db78be2af0ee4a9d44a81f98eb02
130
require 'test_helper' class CobranzaAlquilerTest < ActiveSupport::TestCase # test "the truth" do # assert true # end end
16.25
52
0.723077
380cfe5acd534e39754131aac32de4ffa14b9862
571
require 'puma/null_io' require 'test/unit' class TestNullIO < Test::Unit::TestCase attr_accessor :nio def setup self.nio = Puma::NullIO.new end def test_read_with_no_arguments assert_equal "", nio.read end def test_read_with_nil_length assert_equal "", nio.read(nil) end def test_read_wit...
17.84375
44
0.718039
b9ca1f62aa486feddddbe3b8a70d1883432aa625
1,166
##########################GO-LICENSE-START################################ # Copyright 2015 ThoughtWorks, 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/li...
28.439024
74
0.631218
ed46bd933c97bb19adcfa2f74427cb497d952b38
1,429
# rubocop:disable all lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'skippy/version' Gem::Specification.new do |spec| spec.name = 'skippy' spec.version = Skippy::VERSION spec.authors = ['Thomas Thomassen'] spec.email = [...
36.641026
125
0.660602
0128958df997f518d15997a902bb8f76381a56a6
311
require 'rubygems' require 'msgpack/rpc' MessagePack::client.new("127.0.0.1", 9199) do |c| futures = [] futures << c.call_async(:add, 23, 3) futures << c.call_async(:add, 23, 3) futures << c.call_async(:add, 23, 3) futures << c.call_async(:add, 23, 3) futures.each do |f| p f.get end end
19.4375
49
0.620579
6afb1d3581ce282be790ee782b7f6eb1eabfb619
102
# frozen_string_literal: true class Fruit < ActiveRecord::Base validates :name, presence: true end
17
33
0.77451
38ce636a425519b092f8dfcb2b7f7dcdd74f95af
5,178
# 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::Monitor::Mgmt::V2019_03_01 # # A service client - single point of access to the REST API. # class MonitorManagementClient < MsRestAzur...
39.227273
154
0.691773
61438d353357bd9d7dc2f4f1ec2008393030d4b3
1,623
require "spec_helper" describe "locales", :js => true do describe "login page" do I18n.available_locales.each do |locale| it "translates in #{locale}" do page.driver.add_headers("Accept-Language" => locale.to_s) visit "/admin/login" page.should have_content(I18n.t("omniauth_provider...
32.46
91
0.626617
2162e30fbf478e556f4bf1ae4f0cb5d70c6c525d
41
module Epicify VERSION = "0.1.0" end
6.833333
19
0.634146
399e7e17ead698dcaf1aabc0eb15c54af3ff16a2
243
class UpdateHits < ActiveRecord::Migration def change change_column_default :posts, :hits, 0 change_column_default :playgrounds, :hits, 0 change_column_default :ideas, :hits, 0 change_column_default :scraps, :hits, 0 end end
22.090909
47
0.748971
2109c2637c7da1b7250473297567900fb1f33f2c
1,690
# キャンペーン用コントローラ class CampaignsController < ApplicationController before_action :set_campaign, only:[:edit, :update, :destroy] # 一覧表示 def index unless params[:cuepoint_id] @campaigns = Campaign.all else # 下記はVAST URL呼び出しを想定 # TODO @cuepoint = Cuepoint.find(params[:cuepoint_id]) ...
22.837838
88
0.646154
ffebb444348d189abdc0521e084c4fc5f1b80c67
4,831
#!/opt/puppetlabs/puppet/bin/ruby require 'json' require 'puppet' def projects_list_by_subscription(*args) header_params = {} argstring = args[0].delete('\\') arg_hash = JSON.parse(argstring) # Remove task name from arguments - should contain all necessary parameters for URI arg_hash.delete('_task') oper...
31.37013
130
0.66508
e9754fe1dfb6fe142dc072589bd3df986d6848e7
639
# # Copyright 2012-2018 Chef Software, 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 ...
31.95
74
0.751174
1df1f31652992ccc113e126499eba3478adf276c
36
module ChartByDeviceTypesHelper end
12
31
0.916667
1a618712b32a386c14feb19831db86fa19e16f1f
1,792
# frozen_string_literal: true require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20200929052138_create_initial_versions_for_pre_versioning_terraform_states.rb') RSpec.describe CreateInitialVersionsForPreVersioningTerraformStates do let(:namespace) { table(:namespaces).create!(name: 'terraform', pa...
38.12766
126
0.725446
1c10b782eaa80de9333d375a79b4bff48616635e
948
# 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.cira.ca/schema-2/property_status_registered.expected # # and regenerate the tests with the following rake task # # $ rake genspec:parsers # require 'spec_...
23.7
88
0.695148
f8f55081508174019a2e76600f033e67ae141d71
2,116
module ExceptionHandler extend ActiveSupport::Concern included do rescue_from StandardError, with: :handle_standard_error rescue_from ActionController::ParameterMissing, with: :render_parameter_missing rescue_from ActiveRecord::RecordNotFound, with: :render_record_not_found rescue_from ActionView::...
28.986301
92
0.768431
18b0c4ea5d314386e7dbd563f3c288dc3bf19255
760
# encoding: UTF-8 # # Author:: Xabier de Zuazo (<xabier@zuazo.org>) # Copyright:: Copyright (c) 2016 Xabier de Zuazo # 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 t...
36.190476
74
0.752632
1a237f8ccd3c293e5d034c32e21918ed634966dc
344
# frozen_string_literal: true require 'eac_ruby_utils/patches/object/call_if_proc' RSpec.describe ::Object do describe '#call_if_proc' do it { expect(nil.call_if_proc).to eq(nil) } it { expect('a string'.call_if_proc).to eq('a string') } it { expect(-> { 'a returned value' }.call_if_proc).to eq('a retur...
28.666667
83
0.697674
edaf0669d94a347d206f60005fece4567b51cb24
51
require_relative '../../stdlib/uri/rfc3986_parser'
25.5
50
0.764706
ff35aaead528c75c052294db494f6a697d6ff2a4
342
class Exercise < ApplicationRecord validates :name, presence: true validates :time, presence: true belongs_to :user belongs_to :group, optional: true has_many :groups scope :most_recent, -> { order(created_at: :desc) } scope :with_group, -> { where.not(group_id: nil) } scope :without_group, -> { where...
26.307692
53
0.704678
bb4d7eacde972c240c65955b3c0ac17f49708810
2,160
class Appledoc < Formula desc "Objective-C API documentation generator" homepage "http://appledoc.gentlebytes.com/" url "https://github.com/tomaz/appledoc/archive/2.2.1.tar.gz" sha256 "0ec881f667dfe70d565b7f1328e9ad4eebc8699ee6dcd381f3bd0ccbf35c0337" head "https://github.com/tomaz/appledoc.git" bottle do #...
34.285714
93
0.605093
e27b4f56c670ac1d31b1e2667f52489961f04414
2,192
class JobController < ApplicationController require 'rack-flash' use Rack::Flash get '/job/new' do @company = Company_helpers.current_user(session) erb:'/job/new' end get '/job/index' do if Applicant_helpers.logged_in?(session) @company = Company.all @user = Applicant_helpers.current...
26.409639
83
0.600365
08be93e26da3a1908158cf93809ec2c4e3f063d5
1,638
# -*- encoding: utf-8 -*- # stub: public_suffix 3.0.0 ruby lib Gem::Specification.new do |s| s.name = "public_suffix".freeze s.version = "3.0.0" s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["Simon...
39
123
0.667888
616d17b59482586b41dde8169f0184691a656e75
1,453
require 'rails_helper' RSpec.feature '新たに弁当を予約する', type: :feature do given!(:lunchbox) { create(:lunchbox) } given(:order) { create(:order) } scenario '新しく予約する' do visit order_order_items_path(order) user_name = 'sample-user' # NOTE: 未予約なことを確認 expect(page).not_to have_text(user_name) click...
25.491228
67
0.675155
1dc4a2d6bbb8818519d210ae03e6d56da8113ba0
4,223
## # This file is part of the Metasploit Framework and may be subject to # redistribution and commercial restrictions. Please see the Metasploit # Framework web site for more information on licensing and terms of use. # http://metasploit.com/framework/ ## require 'msf/core' class Metasploit3 < Msf::Exploit::Remote ...
27.601307
108
0.620175
6137131e7df7b58251713c1c57a14978892f0130
349
require "try_monad/version" require 'try_monad/none' require 'try_monad/some' module TryMonad end # # Try(obj.foo).or_else { "Other value" } def Try(value) if value.nil? || (value.respond_to?(:size) && value.size == 0) None(nil) else Some(value) end end def Some(value) Some.new(value) end def None(...
13.96
64
0.676218
1adf60aa0703492b42918ac629d52dbe97927124
4,554
## # 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::Seh include Msf::Exploit::Remote::HttpServer def initia...
26.476744
122
0.571146
87f2da9065edc30e668ba4191573e14b30388494
1,691
class ApiResponse < ActiveRecord::Base # include HTTP request helpers include Networkable # include CouchDB helpers include Couchable belongs_to :source belongs_to :retrieval_status attr_accessible :message scope :unresolved, where("unresolved = ?", true) scope :filter, lambda { |id| where("unreso...
41.243902
191
0.693672
0848ccd36499b9b7296229763f3afe9d9a3b9b4c
1,476
module DanarchySys::ConfigManager class OpenStack def initialize(provider, config) (@provider, @config) = provider, config end def add_account(provider, openstack_auth_url, openstack_username, openstack_api_key, openstack_tenant) @config[:accounts][provider.to_sym] = { openstack_...
27.849057
106
0.676152
acd4c7075804ee25e45bedc8ad1b0e913f8720fd
1,568
class Wxmaxima < Formula desc "Cross platform GUI for Maxima" homepage "https://wxmaxima-developers.github.io/wxmaxima/" url "https://github.com/wxMaxima-developers/wxmaxima/archive/Version-19.07.0.tar.gz" sha256 "16237f22cf76ecb9159e536bbb121e89ac5ad043843a5f32aaac74f0b409c658" head "https://github.com/wxMax...
37.333333
110
0.748724
91475ae7f8dcaa1a17fa1b04785716bced3586f1
567
# Created by Jim Weirich on 2007-04-10. # Copyright (c) 2007. All rights reserved. require 'flexmock/rspec' module RSpec module Core module MockingAdapters # @private module Flexmock include ::FlexMock::MockContainer def self.framework_name :flexmock end ...
17.71875
43
0.606702
ed9237be0eec8a78575cda72e7ec0bb04dac915a
2,308
=begin #OpenAPI definition #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v0 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 3.0.23 =end module SwaggerClient class Swagger2ControllerWebMvcApi ...
32.971429
173
0.677643
f7907dbb95811d2054af21ba6d029bf8da58cc13
902
require_relative "../canvas_base_mutation" module LMSGraphQL module Mutations module Canvas class MarkEntryAsReadGroup < BaseMutation argument :group_id, ID, required: true argument :topic_id, ID, required: true argument :entry_id, ID, required: true argument :forced_read_st...
29.096774
76
0.583149
216ccab458ee947a14a03e6ca54844bb3c17db24
4,615
require 'spec_helper' require 'flapjack/gateways/jsonapi' describe 'Flapjack::Gateways::JSONAPI::Methods::ContactLinks', :sinatra => true, :logger => true, :pact_fixture => true do include_context "jsonapi" let(:contact) { double(Flapjack::Data::Contact, :id => contact_data[:id]) } let(:medium) { double(Flapj...
38.458333
122
0.703359
1aaa0c258a64a31b9d5bafd13b9aa066604e6a84
2,141
# This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../dummy/config/environment', __FILE__) # Prevent database truncation if the environment is production abort("The Rails environment is running in production mode!") if R...
46.543478
86
0.74638
91fe8908fdf7e19b0c694398d101db5efbcf6836
569
require 'formula' class Cmus < Formula homepage 'http://cmus.sourceforge.net/' url 'http://downloads.sourceforge.net/cmus/cmus-v2.5.0.tar.bz2' sha1 '244975a5ff642567acb047f6bd518e4a3271c25b' head 'https://git.gitorious.org/cmus/cmus.git' depends_on 'pkg-config' => :build depends_on 'libao' depends_on '...
22.76
65
0.70826
39d0406d9b45d0ced216e3d84a22569ea955eeca
1,662
# active_model-collection.gemspec require File.expand_path "lib/active_model/collection/version" Gem::Specification.new do |gem| gem.name = 'active_model-collection' gem.version = ActiveModel::Collection::VERSION gem.date = Time.now.utc.strftime "%Y-%m-%d" gem.summary = 'Collection class...
44.918919
85
0.663658
08b693610fb97673d11ced566647605b39a17c13
3,193
require "spec_helper" describe "GoogleAnalytics" do let(:queuer) do Tracker::Handlers::GoogleAnalytics::Queuer.new( api_key: "api_key", env: env, uuid_fetcher: uuid_fetcher ) end let(:client_args) { {uuid: "uuid", api_key: "api_key"} } describe "Queuer" do it "builds pageview with given and...
25.544
78
0.52803
286b980a865144c06c0f09a30d37706e9300b467
218
# Add your variables here first_number = 256 second_number = 3 sum = first_number + second_number difference = first_number - second_number product = first_number * second_number quotient = first_number / second_number
31.142857
41
0.811927
7af322227966592562a5b491d161a3c6308a3ef9
5,835
# ------------------------------------------------------------------------------------ # <copyright company="Aspose" file="get_document_properties_online_request.rb"> # Copyright (c) 2021 Aspose.Words for Cloud # </copyright> # <summary> # Permission is hereby granted, free of charge, to any person obtaining a copy ...
38.642384
188
0.677635
0111fc899c4acbfa4466eeb41d0405aed8900cb0
363
# frozen_string_literal: true class CharacterSkillsJob < ActiveJob::Base queue_as :default retry_on EveOnline::Exceptions::Timeout, EveOnline::Exceptions::ServiceUnavailable, EveOnline::Exceptions::BadGateway, EveOnline::Exceptions::InternalServerError def perform(character_id) CharacterSkillsI...
24.2
52
0.787879
214a6003c642b58efdea25e721899a646dfa787c
6,065
class StopAreasController < ChouetteController include ApplicationHelper include Activatable defaults :resource_class => Chouette::StopArea belongs_to :stop_area_referential # do # belongs_to :line, :parent_class => Chouette::Line, :optional => true, :polymorphic => true # belongs_to :network, :pare...
28.608491
210
0.681616
262a213fe9ee267aa4e09e13048e5310ffe9cab6
2,693
class Board #Get's and set's for board and turn attr_accessor :board, :turn #Initialize the board and default turn def initialize board = nil, turn = "x" @dim = 3 @size = @dim * @dim @board = board || Array.new(@size, "-") @turn = turn @movelist = [] end #Define the next letter to play def other_tur...
25.40566
77
0.632752
5dbb5f990a525dad19a6c6b0a3e6946b656cb516
9,890
# frozen_string_literal: true # rubocop:disable Layout/LineLength # == Schema Information # # Table name: settings # # id :uuid not null, primary key # default_outgoing_sms_adapter :string(255) # frontlinecloud_api_key :string(255) # generic_sms_config :jsonb #...
32.640264
109
0.723964
7964df5dd4db5631c327dc7552a3a34fd35be2a4
3,677
require 'thor' require 'dldinternet/thor/dynamic_command' require 'dldinternet/thor/errors' require 'awesome_print' module DLDInternet module Thor class Command < ::Thor no_commands do require 'dldinternet/thor/mixins/no_commands' include DLDInternet::Thor::MixIns::NoCommands end ...
34.364486
190
0.588251
1a81d0127dc7b1483480f675fac6a23525dc7497
9,418
# frozen_string_literal: true require 'spec_helper' RSpec.describe Gitlab::UserAccess do include ProjectForksHelper let(:access) { described_class.new(user, project: project) } let(:project) { create(:project, :repository) } let(:user) { create(:user) } describe '#can_push_to_branch?' do describe 'pus...
29.993631
142
0.66564
3904b1cc3456917686d683c1dde14e482c86a062
476
require 'spec_helper' describe Ducktrap::Formatter, '#body' do let(:object) { described_class.new(output) } let(:output) { StringIO.new } subject { object.body(node) } let(:node) { [Ducktrap::Node::Noop.instance, Ducktrap::Node::Noop.instance] } it 'should print node with members' do subject outp...
23.8
91
0.684874
1cf5010a97f911cfc5b92cfc79c49cb7a734a7f2
10,701
=begin #Topological Inventory Ingress API #Topological Inventory Ingress API The version of the OpenAPI document: 0.0.2 Contact: support@redhat.com Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.2.1 =end require 'date' module TopologicalInventoryIngressApiClient class ServicePlanAllOf ...
31.289474
232
0.630128
015f84d9e8a2479cfc682ef0e4fd248525d7c967
1,099
require 'formula' class Tomcat < Formula homepage "http://tomcat.apache.org/" url "http://www.apache.org/dyn/closer.cgi?path=tomcat/tomcat-8/v8.0.14/bin/apache-tomcat-8.0.14.tar.gz" sha1 "1a63a44dbf1b73f2256a2f21521b3d5ee3e8b5bf" bottle do cellar :any sha1 "100a590222ff8021ee2731a25c4fc0d524ce53ef" =>...
31.4
117
0.725205
08621272c07c2b631825c101ef25b2681a112b34
5,930
# -*- coding: utf-8 -*- require 'helper' require 'fluent/test' require 'fluent/plugin/buf_memory' require 'stringio' require 'msgpack' module FluentMemoryBufferTest class MemoryBufferChunkTest < Test::Unit::TestCase def test_init chunk = Fluent::MemoryBufferChunk.new('key') assert_equal 'key', chunk...
28.926829
106
0.625464
e8119323131e633fee59b4e538e49d50c7a13e33
3,405
# frozen_string_literal: true # Copyright 2015-2017, the Linux Foundation, IDA, and the # CII Best Practices badge contributors # SPDX-License-Identifier: MIT class SessionsController < ApplicationController include SessionsHelper # Do *NOT* redirect session creation, that will cause complicated failures # bec...
31.82243
76
0.708957
39fca11e7d651c96934f04cdcc05d564bb9affc3
183
# Load the Rails application. require_relative 'application' # Initialize the Rails application. Rails.application.initialize! #for key #EDITOR="atom --wait" rails credentials:edit
20.333333
44
0.79235
6a1e5af7b98bd5c29dc11099b836ace26f6843b0
3,570
module Optidash ## # Types of request along with their slightly differing implementations class Request ## # Base class. # Should be inherited by Fetch and Upload classes. class Base attr_reader :type attr_accessor :data attr_accessor :...
26.641791
95
0.465266
6a619f4f6034b62fbc23663459291631c1e15bd4
200
# Encoding: UTF-8 {fileTypes: ["rjs"], keyEquivalent: "^~R", name: "RJS", patterns: [{include: "source.ruby"}], scopeName: "source.ruby.rails.rjs", uuid: "A6AE60CD-18CA-4474-BE7A-5255BC3EF083"}
22.222222
46
0.665
391c232054570ddec182bd486ee8dff862f09572
104
# frozen_string_literal: true module ActiveAdmin module StateMachine VERSION = '1.0.0' end end
13
29
0.730769
abee5fefd1de663b129303d3ba69eb2c8fff9459
1,983
# -*- encoding: utf-8 -*- lib = File.expand_path('../../sunspot/lib/', __FILE__) $:.unshift(lib) unless $:.include?(lib) require 'sunspot/version' Gem::Specification.new do |s| s.name = "sunspot_rails" s.version = Sunspot::VERSION s.platform = Gem::Platform::RUBY s.authors = ['Mat Brown', '...
44.066667
140
0.65053
288727a6c3b440b19b1a06acece52758a967159e
5,096
set_volume! 0.1 use_bpm 60 live_loop :other do # sample ChillD[/.*_loop/, 10] sleep 16 end live_loop :kickit do # sync :beat sample ChillD[/drum_loop/, 10], beat_stretch: 8.0 sleep 8.0 end live_loop :next do sample Corrupt[/kick/,[1,1]].tick(:sample), cutoff: 120, amp: 1.8 sample Corrupt[/drum_loop...
26.268041
91
0.600863
ed54625b4997d63f1e2edb24eb02ed0f6360ac8c
540
require 'test_helper' module ActiveModel class Serializer class RootTest < ActiveSupport::TestCase def setup @virtual_value = VirtualValue.new(id: 1) end def test_overwrite_root serializer = VirtualValueSerializer.new(@virtual_value, { root: 'smth' }) assert_equal('smth...
24.545455
81
0.685185
03cc9d7e64c285609e561eacb43b1523cef0c5d3
3,126
# frozen_string_literal: true require 'spec_helper' RSpec.describe GroupGroupLink do let_it_be(:group) { create(:group) } let_it_be(:shared_group) { create(:group) } let_it_be(:group_group_link) do create(:group_group_link, shared_group: shared_group, shared_with_group: group) ...
35.931034
135
0.672105
ab39519d24d4c4fe67a9b89b5e780ea927e27495
375
class AddTimestampsToWiki < ActiveRecord::Migration[5.1] def change add_timestamps :wikis, default: DateTime.now change_column_default :wikis, :created_at, nil change_column_default :wikis, :updated_at, nil add_column :wiki_pages, :updated_at, :datetime, default: DateTime.now, null: false change_...
34.090909
86
0.762667
03054db5b7dbf9f1869421caceaed7a7a6750698
533
require 'spec_helper' describe Array do context '.and' do it 'one' do expect(['foo'].and).to eq 'foo' end it 'two' do expect(%w(foo bar).and).to eq 'foo and bar' end it 'three' do expect(%w(foo bar baz).and).to eq 'foo, bar and baz' end end context '.or' do it 'one' ...
19.740741
58
0.54409
39c0dfa7279e2d78bd5c04a3d84383bbe94a92f4
4,877
module CommoditiesHelper def leaf_position(commodity) if commodity.last_child? " last-child" end end def commodity_level(commodity) "level-#{commodity.number_indents}" end def commodity_tree(main_commodity, commodities) if commodities.any? content_tag(:ul, class: 'commodities') d...
30.291925
106
0.624974
1c53153abbe3b6b004dcb7b560b3675216ac28f5
170
module ChangePath include Circuit::Behavior use Circuit::Middleware::Rewriter do |script_name, path_info| ["/site/5#{script_name}", path_info] end end
21.25
63
0.7
e902e8478c307db980ce7eae881998525e9b068c
3,052
require 'spec_helper' module Spree module Stock describe Packer, type: :model do let!(:inventory_units) { Array.new(5) { build(:inventory_unit) } } let(:stock_location) { create(:stock_location) } subject { Packer.new(stock_location, inventory_units) } context 'packages' do it '...
33.538462
107
0.610092
e99666a9608eec82c379e9541fb0fe7868d639bd
121
# coding: utf-8 class <%= class_name %>Strategy include ActiveStrategy::Strategy def <%= singular_name %> end end
15.125
34
0.694215
ab7a3a3b95c50013bbfbb048917f1894b8bf670d
396
module FriendlyId module Helpers # Calculate expected result size for find_some_with_friendly (taken from # active_record/base.rb) def expected_size(ids_and_names, options) #:nodoc:# size = options[:offset] ? ids_and_names.size - options[:offset] : ids_and_names.size size = options[:limit] ...
30.461538
90
0.691919
3874c6d055f64ebc80774979b5f72310913dc022
1,278
require 'spec_helper' describe 'Mutating floats' do context 'for a singleton method' do context 'that contains 42.05' do before do write_file 'life.rb', """ class Life def self.answer 42.05 end end """ end context 'with ...
23.666667
71
0.507825
acd4d7018733c28b40c0fb2edfb699bfcf266c67
1,966
# Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. require 'document' require 'document_set' require 'indexed_search_test' class LargeText < IndexedSearchTest YOURKIT_ENABLED = false def setup set_owner("geirst") if YOURKIT_ENABLED then a...
23.686747
111
0.614954
038a8187f0615e820d37510f696196f1360e6059
1,498
# frozen_string_literal: true class CaseInformation < ApplicationRecord self.table_name = 'case_information' NPS = 'NPS' CRC = 'CRC' belongs_to :offender, foreign_key: :nomis_offender_id, inverse_of: :case_information belongs_to :local_delivery_unit, -> { enabled }, optional: true, inverse_of: :case_infor...
31.87234
96
0.709613
5df78ca4c24519bbbc1d840060ec6887fee12499
1,752
begin test_name "puppet module build (basic)" step 'Setup' on master, "mkdir -p #{master['distmoduledir']}" on master, "mkdir -p #{master['sitemoduledir']}" apply_manifest_on master, <<-PP file { [ '#{master['distmoduledir']}/nginx', ]: ensure => directory; '#{master['distmoduledir']}/nginx/Modulefile': ...
36.5
106
0.710046
335518acc364bdb0124105a18b3eee7b9ed63ee6
34
require 'markdown2html/processor'
17
33
0.852941
0134f73bb5f5db9681e8bf2a940eb05ef6cf97c1
1,200
module Link class AnalysisFacilitator attr_reader :analysis delegate :fully_complete?, to: :analysis def initialize(analysis, *args) @analysis = analysis end def execute generate_links end private def generate_links if draft? {finish: finish} elsif...
19.047619
69
0.615
3951c24698b926c1510dc0571a65fab807113507
366
require 'rails_helper' RSpec.describe CategoryRecommendation, type: :model do describe 'validates' do subject { create(:category_recommendation) } it { is_expected.to validate_presence_of(:name) } it { is_expected.to validate_uniqueness_of(:name).case_insensitive } it { is_expected.to have_many(:rec...
30.5
73
0.756831
7a60b04f9a0680a086681d285a1cdf557cefcef6
1,198
class TasksController < ApplicationController include CanCan::ControllerAdditions load_and_authorize_resource before_action :set_story, only: [:show, :create] before_action :set_story_task, only: [:show, :update, :destroy] # GET /stories/:story_id/tasks # GET /tasks def index if params.has_key?(:sto...
19.322581
65
0.671119
79e467c033ef6f9d8743e4d90f837d1d9d8ee2a7
296
# == Schema Information # # Table name: twitter_bots # # id :integer not null, primary key # name :string(510) not null # created_at :datetime # updated_at :datetime # # Indexes # # twitter_bots_name_key (name) UNIQUE # class TwitterBot < ApplicationRecord end
17.411765
53
0.652027
267c86f1732d8ba7278d5c85fd994b983f459d1e
229
class CreateTechnologies < ActiveRecord::Migration[6.0] def change create_table :technologies do |t| t.string :name, null: false t.timestamps end add_index :technologies, :name, unique: true end end
19.083333
55
0.68559
ed5fb9c327a5bbf22b39b249e9e979bdf24bf1d1
1,057
Gem::Specification.new do |spec| spec.name = 'powerdns_dyndns' spec.version = '0.0.2' spec.authors = ['henning mueller'] spec.email = ['mail@nning.io'] spec.summary = 'DynDNS (dyn.com DNS update API) server.' # spec.description = %q{TODO: Write a longer description. Optio...
39.148148
74
0.636708
79ffff37fa7a53b823e56570c69ed7b0ad1ac541
3,415
require 'test_helper' class RubygemsHelperTest < ActionView::TestCase include Rails.application.routes.url_helpers include ApplicationHelper should "create the directory" do directory = link_to_directory ("A".."Z").each do |letter| assert_match rubygems_path(:letter => letter), directory end ...
28.697479
106
0.672328
33e77d7e704b6116d6beb5b6aac381ee40ee0a1e
8,403
# frozen_string_literal: true # == Schema Information # # Table name: replies # # id :integer not null, primary key # user_id :integer not null # topic_id :integer not null # body :text not null # state :integer...
30.78022
123
0.674878
1c04710684768e6a6a9850001ec36b281ffb9d6f
685
Pod::Spec.new do |s| s.name = 'TCBComponents' s.version = '1.0.0' s.summary = 'TCBComponents' s.homepage = 'https://github.com/doquanghuy/iOSTCBComponents.git' s.authors = { 'Techcombank' => 'info@techcombank.com.vn' } s.source = { :git => 'https://github.com/doquanghuy/iOSTCBComponents.git', :tag => s.vers...
32.619048
96
0.664234
e8296aef95b3d99ab5fda28cb08101194b6ff4b1
16,567
require "test_helper" class OwnersControllerTest < ActionController::TestCase include ActionMailer::TestHelper context "When logged in and verified" do setup do @user = create(:user) @rubygem = create(:rubygem) create(:ownership, user: @user, rubygem: @rubygem) sign_in_as(@user) ...
35.551502
125
0.618157
f7f498d0daac15a71b34069fee4f154c27914bd6
2,045
require 'spec_helper' describe "Free shipping promotions", :js => true do let!(:country) { create(:country, :name => "United States of America", :states_required => true) } let!(:state) { create(:state, :name => "Alabama", :country => country) } let!(:zone) { create(:zone) } let!(:shipping_method) do sm = ...
34.083333
100
0.620538
bb2fb0a5cd5724e860a37f56cda31c859abc9764
258
FactoryBot.define do factory :user do sequence(:name) { |n| "John Doe #{n}" } sequence(:email) { |n| "jdoe#{n}@example.com" } sequence(:username) { |n| "jdoe#{n}" } password { 'password' } password_confirmation { 'password' } end end
25.8
51
0.596899
f82263de907e580124decebc0fc086d2568a3589
194
FactoryBot.define do factory :education do association :resume organization { Faker::Educator.university } degree { Faker::Educator.degree } graduate_year { '1989' } end end
21.555556
47
0.701031
287127ce0b3c27d061897b7d41452fdbe6182c60
1,123
module RubyJmeter class DSL def soapxmlrpc_request(params={}, &block) node = RubyJmeter::SoapxmlrpcRequest.new(params) attach_node(node, &block) end end class SoapxmlrpcRequest attr_accessor :doc include Helper def initialize(params={}) testname = params.kind_of?(Array) ? '...
33.029412
102
0.721282
d5d373942bace7f0ec76d827cecfe475b35c71fa
346
require 'coveralls' Coveralls.wear! require File.expand_path('../config/environment', __dir__) require 'rails/test_help' module ActiveSupport class TestCase # Setup all fixtures in test/fixtures/*.yml # => for all tests in alphabetical order. fixtures :all # Add more helper methods to be used by al...
21.625
61
0.722543
39600c4b91718af2e7ddd2101709547a34b7b6f0
684
Koudoku.setup do |config| config.subscriptions_owned_by = :<%= subscription_owner_model %> config.stripe_publishable_key = ENV['STRIPE_PUBLISHABLE_KEY'] config.stripe_secret_key = ENV['STRIPE_SECRET_KEY'] Stripe.api_version = '2020-03-02' # Making sure the API version used is compatible. # config.free_trial_...
38
85
0.769006
87003e252d1a514c1533332889c8bd0baa7a6634
276
class CreateSites < ActiveRecord::Migration[5.0] def change create_table :sites do |t| t.string :name t.string :url t.text :description t.integer :latest_status, default: 0 t.datetime :latest_pinged_at t.timestamps end end end
19.714286
48
0.648551
bfa2bf74dfed3bd56eb2dd20382549d8a33c1ab6
514
numerator1 = 1 denominator1 = 2 numerator2 = 2 denominator2 = 3 numerator3 = 1 denominator3 = 5 tmp_numerator = numerator1 * denominator2 + numerator2 * denominator1 tmp_denominator = denominator1 * denominator2 result_numerator = tmp_numerator * denominator3 + numerator3 * tmp_denominator result_denominator = tmp_...
25.7
78
0.745136
6290f80b40cc417a71fa683fc7f88256da9ecbdd
199
RSpec.describe Blackboard2canvas do it "has a version number" do expect(Blackboard2canvas::VERSION).not_to be nil end it "does something useful" do expect(false).to eq(true) end end
19.9
52
0.728643
ff2fd9e606a5da00e6554eece34c341c63b0779b
2,858
# encoding: utf-8 # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::Network::Mgmt::V2018_07_01 module Models # # Response for ListApplicationGateways API service call. # class ApplicationGatew...
28.58
80
0.536739
039eade396ad278b92bdc4a1c22533ea8036e8fe
719
class PostsController < ApplicationController before_action :find_post, only: [:show, :edit, :update, :destroy] def index @posts = Post.all.order("created_at DESC") end def new @post = Post.new end def create @post = Post.new(post_params) if @post.save redirect_to @post else ...
13.566038
67
0.625869
338e0e979769a74c049fd9818234ac0a991394e8
1,494
# Encoding: utf-8 require_relative 'spec_helper' require_relative 'server_spec' ::LWRP = { step_into: ['logstash_config'] }.merge(::UBUNTU_OPTS) describe 'logstash::server' do describe 'ubuntu' do let(:runner) { ChefSpec::SoloRunner.new(::LWRP) } let(:node) { runner.node } let(:chef_run) do runn...
37.35
100
0.643909
4a733abcb9478c44d31530d407d8f476a2d57146
172
class Api::Responses::BookmarksController < Api::BookmarksController private def set_bookmarkable @bookmarkable = Post.find(params[:response_id]) end end
19.111111
68
0.738372
ffec139f00e384a3ee782406190b2e6393721fb9
1,914
require_relative 'boot' require 'rails/all' # Requiere gemas listas en el Gemfile, incluyendo las # limitadas a :test, :development, o :production. Bundler.require(*Rails.groups) module Dummy class Application < Rails::Application # config.load_defaults 6.0 # Las configuraciones en config/environments/* ...
32.440678
88
0.703239
e225e59724cc74b7e48f3a3f11c999978e02e407
160
class AddInverseTransactionId < ActiveRecord::Migration[4.2] def change add_column :debitcredit_transactions, :inverse_transaction_id, :integer end end
26.666667
75
0.80625