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
28b0387f7e3f17461df4fd4a8ecf7dc306add3db
2,559
require 'rspec' require 'pry' require 'word_definer' require 'definition' describe '#Word' do before(:each) do Word.clear Definition.clear end describe('#save') do it("saves a word") do word = Word.new({:name => "Tree", :id => nil}) word.save word2 = Word.new({:name => "House", ...
25.848485
112
0.558812
0399b6cc557e08238c57c25e82d374c8690f0ce4
338
elasticsearch_user 'elasticsearch' elasticsearch_install 'elasticsearch' do type 'package' end elasticsearch_configure 'elasticsearch' do allocated_memory '512m' configuration ({ 'cluster.name' => node['elasticsearch']['cluster']['name'] }) end elasticsearch_service 'elasticsearch' do service_actions [:en...
24.142857
62
0.766272
f72e8fdb138010eb35eceb3294dd79c409c95d75
21,002
# frozen_string_literal: true require 'carrierwave/orm/activerecord' class Issue < ApplicationRecord include AtomicInternalId include IidRoutes include Issuable include Noteable include Referable include Spammable include FasterCacheKeys include RelativePositioning include TimeTrackable include Th...
34.599671
168
0.71617
1dbacece23d28c53f6c2c030ad95e859500cba7f
1,122
class Climgur::CLI attr_accessor :climgur def initialize @climgur = nil end def start @climgur = Climgur::ImgurGet.new.scrape_main_page puts "welcome to CLIMGUR, the command line imgur browser." commands end def commands puts "\ncommands:\n 'start' loads previews of the most popular ...
22.897959
168
0.64795
6ae2f2b0a0ea7d6c3395c341ea3ce2b524fefc97
291
# frozen_string_literal: true require_relative "production.rb" Rails.application.configure do # Overwrite any production settings here, or if you want to start from # scratch then remove line 1. # Use AWS for active storage for staging config.active_storage.service = :amazon end
24.25
72
0.776632
bb894abb590a71f4c559ac9837f3f28f42a9655e
1,750
# # Cookbook Name:: mongodb # Recipe:: configserver # # Copyright 2011, edelight GmbH # Authors: # Markus Korn <markus.korn@edelight.de> # # 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 ...
29.166667
74
0.716571
1c4aa048d8efc2ac8022a2a1ef440cffa42902a9
590
require_relative 'cocoapods/mixbox_spec' Mixbox::FrameworkSpec.new do |s| s.name = 'MixboxIpcSbtuiClient' s.platforms = [:ios] s.dependency 'MixboxIpc' s.dependency 'MixboxSBTUITestTunnelClient' # for network mocks, kind of a kludge, but SBTUITestTunnel should be removed soon: s.dependency 'MixboxTe...
25.652174
85
0.723729
ace28426d68774f95be4b5d9fc2ddca37681f97a
1,118
require File.join(%W[#{File.dirname(__FILE__)} lib yard-appendix version]) Gem::Specification.new do |s| s.name = 'yard-appendix' s.summary = "A YARD plugin that adds support for Appendix sections." s.description = <<-eof yard-appendix is a plugin for YARD, the Ruby documentation generation tool, ...
43
79
0.663685
7ab1687f8ba3f486ee2f4b369f0615e4028b8b70
295
# frozen_string_literal: true class MockDeploymentService < DeploymentService def title 'Mock deployment' end def description 'Mock deployment service' end def self.to_param 'mock_deployment' end # No terminals support def terminals(environment) [] end end
14.047619
47
0.715254
f89235d8f9a80058e64a0b16f21d3c6f06086cbd
4,883
require 'spec_helper' describe SS::SortEmulator, dbscope: :example do let!(:site) { cms_site } let(:now) { Time.zone.now.change(usec: 0) } shared_examples "sort enumerator (released) is" do it do array1 = ruby.to_a array2 = mongo.to_a expect(array1.length).to eq array2.length array1....
30.329193
111
0.611305
b93ecb746e699699431ebe515cadd4e0b08e09f7
3,709
require 'net/imap' require "getoptlong" $stdout.sync = true $port = nil $user = ENV["USER"] || ENV["LOGNAME"] $auth = "login" $ssl = false $starttls = false def usage <<EOF usage: #{$0} [options] <host> --help print this message --port=PORT specifies port --user=USER ...
22.077381
78
0.535724
793541eb17664c4ace365ef5a007835351f799e3
2,389
RSpec.describe Api::V1::GeographicalAreasController, 'GET #countries' do render_views let!(:geographical_area1) do create :geographical_area, :with_description, :country end let!(:geographical_area2) do create :geographical_area, :with_description, :country ...
25.147368
72
0.603181
010613b2be03ca749e807309f7073b2b84addfc9
734
module Questionnaires::Validations extend ActiveSupport::Concern included do validates :name, :organization, :email_subject, :email_text, :email_link, presence: true validates :name, uniqueness: true, allow_nil: true, allow_blank: true validates :name, :email_subject, :email_text, :email_link, ...
29.36
77
0.716621
b9c4988194047ea8261c0a3f28958669b85000ae
2,000
class UsersController < ApplicationController before_action :error_if_not_logged_in, only: [:update, :friend, :messages] def create user = User.new(user_params) user.save session[:user_id] = user.id render json: user, status: 200 end def update user = User.find(params[:id].to_i) user...
22.222222
76
0.535
1a3895068adfceaa5e73f04e46ba3158c87fbeab
1,366
# frozen_string_literal: true require 'application_system_test_case' class Bookmark::PageTest < ApplicationSystemTestCase setup do @page = pages(:page1) end test 'show page bookmark on lists' do visit_with_auth '/current_user/bookmarks', 'kimura' assert_text @page.title end test 'show active b...
28.458333
57
0.72328
79387a1d144ebef2c2b0c93d540fefb99c9801cd
1,366
require 'net/ssh' module Sitefull module Cloud class Provider include Mock PROVIDERS = %w(amazon azure google) attr_reader :type, :options def initialize(type, options = {}) @type = type || 'base' extend(provider_module) @options = respond_to?(:process) ? process...
22.766667
73
0.601757
f72273f142aef968fb398ab3aa64611f7ea2cc0a
66
FactoryGirl.define do factory :category_item do end end
9.428571
27
0.712121
d5a12f75c6a346551b2b5e2b160ca5cc017a0e55
141
# frozen_string_literal: true $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__) require "show_and_tell" require "minitest/autorun"
23.5
58
0.77305
1cbb87ac60fbb2f4a4098f1c85caeb6b37eb5a88
1,181
# Copyright 2018 Noragh Analytics, 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...
27.465116
112
0.762066
622d9011e90e8b9f7c7151e9f720125ba62b383a
215
# frozen_string_literal: true # NB: Keep this file here as it is executed by the "book-secure-move-metrics" container in each pod require File.expand_path('../../config/environment', __dir__) unless defined? Rails
43
99
0.767442
1cd105aa9b0bc3057a21ea761939aa01c59f9762
707
RSpec.describe Tatami::Models::HttpRequest do describe '#to_s' do let(:sut) { Tatami::Models::HttpRequest.new( name: 'name', base_uri: 'base_uri', method: 'method', user_agent: 'user_agent', uri: 'uri', headers: 'headers', cookies: 'cookies', path_in...
37.210526
228
0.640736
ab23e9500fb92691eb4fe4e8272f67ade60c4ef8
1,260
############################################################################### # tc_isdst.rb # # Test case for the Time#isdst instance method, and the Time#dst? alias. ############################################################################### require 'test/unit' require 'test/helper' class TC_Time_Isdst_Instance...
26.25
79
0.580952
6285586716c0bf2a8c1bad8c20012fcc9ea618d1
4,114
# frozen_string_literal: true require 'spec_helper' require 'bolt/pal/yaml_plan' require 'bolt/util' require 'bolt_spec/files' describe Bolt::Util do include BoltSpec::Files context "when creating a typed name from a modulepath" do it "removes init from the typed name" do expect(Bolt::Util.module_name('...
33.721311
97
0.631988
abe308dac5ef06584c5e14fd2d7fade93481c294
228
class CreateInspectionFindings < ActiveRecord::Migration def change create_table :inspection_findings do |t| t.integer :inspection_id t.text :finding t.string :label t.timestamps end end end
19
56
0.692982
e2642443fb12a6c37bd6561927e2cfadc7dabfd1
2,937
require "jwt" class ApplicationController < ActionController::Base skip_before_action :verify_authenticity_token before_action :snake_case_params # Handle OPTIONS preflight checks # Credit to jpbalarini https://gist.github.com/jpbalarini/54a1aa22ebb261af9d8bfd9a24e811f0 before_action :cors_set_access_contr...
25.763158
111
0.705482
bbebbfffe0e28128b4a7e579133765060388b52f
1,300
# frozen_string_literal: true class PostReplacement < ApplicationRecord belongs_to :post belongs_to :creator, class_name: "User" before_validation :initialize_fields, on: :create before_create :process! attr_accessor :replacement_file, :final_source, :tags attribute :replacement_url, default: "" def i...
26
160
0.702308
181c46ef64e856d89d6b60b5df01ad0d7083ff75
152
# Command to reload module/alias/etc. configs # Use like "%admin/reload" require 'java' ctx.pctx.reload_configs puts 'Configs successfully reloaded'
16.888889
45
0.769737
79796e67baec502da3037df5e0d0293d8c0eab91
3,167
describe Bindl::Entry do include FakeFS::SpecHelpers before(:each) { @store = Bindl::Store.new('/test/').create! } describe '.initialize' do it 'should demand that the store exist' do expect do Bindl::Entry.new(Bindl::Store.new('/dne/'), 'entry.ext') end.to raise_error Bindl::Store::StoreD...
31.989899
67
0.629302
1ca3a037a7d5ba2c9ac8449030830e1b22269077
7,212
class IvlNotices::IvlToCoverallTransitionNoticeBuilder < IvlNotice include ApplicationHelper def initialize(consumer_role, args = {}) @family = Family.find(args[:options][:family]) find_transition_people(args[:options][:result][:people]) args[:recipient] = @family.primary_applicant.person args[:not...
40.745763
191
0.672629
e212552e303c5af632ef5d736671e51c60f25f89
2,668
module Google # deviates from other bin stuff to accomodate gem class << self def class_for(key) case key when :compute Fog::Compute::Google when :dns Fog::DNS::Google when :monitoring Fog::Google::Monitoring when :storage Fog::Storage::Google wh...
29.644444
108
0.584708
393ebe4d08ef978a5d4e9b76fd890f8401ae1861
328
Peatio::Blockchain.registry[:bitcoin] = Bitcoin::Blockchain Peatio::Blockchain.registry[:geth] = Ethereum::Eth::Blockchain Peatio::Blockchain.registry[:parity] = Ethereum::Eth::Blockchain Peatio::Blockchain.registry[:"geth-bsc"] = Ethereum::Bsc::Blockchain Peatio::Blockchain.registry[:"geth-heco"] = Ethereum::Heco::Blo...
54.666667
70
0.77439
01dda4de844bd9976856bfb68158e4c79176d14f
319
require 'net/http' puts ((ARGV.length != 1) ? "Usage: #$0 <zip code>" : (["The temperature in"] + (/Weather<\/b> for <b>(.*)<\/b>.*\D(\d+)&deg;F/.match(Net::HTTP.get( URI.parse("http://www.google.com/search?hl=en&q=temperature+#{ARGV[0]}")))[1,2].collect! {|x| " is " + x})).to_s.gsub!(/in is /, "in ") + " degree F")
53.166667
88
0.554859
ff81fe968d7232833738de345de1253172809ce3
5,394
# frozen_string_literal: true require "cose/algorithm" require "cose/error" require "cose/rsapkcs1_algorithm" require "openssl" require "webauthn/authenticator_data/attested_credential_data" require "webauthn/error" module WebAuthn module AttestationStatement class UnsupportedAlgorithm < Error; end ATTESTA...
29.47541
116
0.661661
ab44c2c6dbc8eb8fe6b1500d0737d55bbc1fef3c
1,750
# frozen_string_literal: true FactoryBot.define do factory :deposit do member { create(:member, :level_3) } amount { Kernel.rand(100..10_000).to_d } factory :deposit_btc, class: 'Deposits::Coin' do currency { find_or_create :currency, :btc, id: :btc } address { create(:payment_address, :btc_...
31.25
65
0.624
ff925cac387a9ef5826cb119734fc35eb873336c
3,164
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web serve...
40.050633
104
0.762642
d59c932c6f23e73c3b73c7bc53a3897988bcf855
206
class Category < ApplicationRecord has_many :workouts scope :filter_duplicates, -> { group(:name).having("count(*) >= 1")} def self.order_by_size order(workouts: :desc) end end
15.846154
72
0.640777
18f6a95566aae347ac23f5c9a83c62979b0d1074
660
require 'yaml' class MinitestQueryHook < Mumukit::Templates::FileHook isolated true line_number_offset 2, include_extra: true def tempfile_extension '_test.yml' end def compile_file_content(request) if request.query.strip != 'rake test' raise Mumukit::CompilationError, t(:unrecognized_command)...
21.290323
70
0.651515
280aa52318a214d26e97add4af7431f83bb488b7
194
class CreateAirlines < ActiveRecord::Migration[6.0] def change create_table :airlines do |t| t.string :name t.string :icao_code, limit: 4 t.timestamps end end end
17.636364
51
0.654639
017690c9cc2e152d9fb0f433b7975bf1367980a8
552
class CreateBridgeCacheDomains < ActiveRecord::Migration[5.0] def change return unless BridgeCache.use_internal_database create_table :bridge_cache_domains do |t| t.integer :bridge_id, limit: 8 t.string :name t.integer :parent_id, limit: 8 t.datetime :created_at t.datetime :updat...
27.6
61
0.684783
f7cb08bfc2c262892eca8c533b64fed9cf276bd2
594
module Spina class Blog::CategoriesController < ApplicationController before_action :set_page before_action :find_category before_action :find_posts def show end private def find_category @category = Spina::Blog::Category.friendly.find params[:id] end def find_posts ...
19.8
92
0.664983
1dd95805c3de220b3668983f54ea1186e99c4749
146
module OrigenTesters MAJOR = 0 MINOR = 49 BUGFIX = 0 DEV = 0 VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '') end
18.25
72
0.561644
26cec0d333e0dd2791479186140d01aa7cac5439
261
#!/usr/bin/ruby # Install with 'gem install droplet_kit' require 'droplet_kit' require './config.rb' client = DropletKit::Client.new(access_token: @docean_token_v2) client.ssh_keys.all().each { |x| puts "[SSHKey] id: " + x.id.to_s + " , name: " + x.name }
20.076923
63
0.678161
e99813d1cdef619ed848d9fba390261133a91d46
948
# 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. # # This file is the source Rails uses to define your schema when running `rails #...
41.217391
86
0.767932
abf874ba4a2dec27e58e391ec3e63eb6c6faa5ba
423
module ExecutableHooks module Specification def self.find @executable_hooks_spec ||= if Gem::Specification.respond_to?(:find_by_name) Gem::Specification.find_by_name("executable-hooks") else Gem.source_index.find_name("executable-hooks").last end rescue Gem::L...
23.5
61
0.647754
28855cadd76a81a6958d0912e775621aa9f5b1f8
4,870
# This file was generated by the `rails generate rspec:install` 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 ...
46.826923
92
0.744969
bb20812851e634687f829d4b747f6550b1d0c1ae
172
include_recipe "curl" package "python" package "python-dev" execute "curl http://python-distribute.org/distribute_setup.py | python" do not_if "which easy_install" end
19.111111
75
0.773256
ab99e5f5338828b8b25cd4709e71268b0eded9d7
722
Pod::Spec.new do |s| s.name = "DacteevMusic" s.version = "0.0.1" s.summary = "Dacteev Music SDK" s.homepage = "https://github.com/Dacteev/dacteev-music-sdk-swift" s.license = { :type => "MIT", :file => "LICENSE.md" } s.authors = { "Axel Etcheverry" => "euskadi31@gmail.com" } s.social_media_u...
30.083333
73
0.603878
e90096335040e28beb23f1cac9d20347a498e63b
6,071
# frozen_string_literal: true require "openssl" require "bundler/settings" RSpec.describe Bundler::Env do let(:git_proxy_stub) { Bundler::Source::Git::GitProxy.new(nil, nil, nil) } describe "#report" do it "prints the environment" do out = described_class.report expect(out).to include("Environme...
28.502347
95
0.589853
d5637e5482f91aecf24a4b35357dbe39656615dc
861
class CreateBandEvents < ActiveRecord::Migration def change create_table :band_events do |t| t.integer :band_id t.integer :event_id t.boolean :confirmed #(y/n) (validate when confirmed) t.time :load_time t.time :doors_time t.time :show_time t.time :set_time t...
25.323529
108
0.641115
7abd5ca8772b26e17caba59e0fcc553b6ea05397
1,459
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'PipelineDestroy' do include GraphqlHelpers let_it_be(:project) { create(:project) } let_it_be(:user) { project.first_owner } let_it_be(:pipeline) { create(:ci_pipeline, :success, project: project, user: user) } let(:mutation) do varia...
29.77551
88
0.740918
39f8c7667c13278338aabf664a9803f918d9a1dc
1,352
class RbacSetup < ActiveRecord::Migration def self.up create_table "permissions" do |t| t.string "provider" t.string "operation" t.string "rule" t.timestamps end create_table "permissions_roles", :id => false do |t| t.integer "permission_id" t.integer "role_id" ...
27.591837
105
0.620562
79de989621c4e59df2f3fd604a6c8a68d35b75f5
110
Rails.application.routes.draw do post '/graphql', to: 'graphql#execute' devise_for :users, skip: :all end
22
40
0.727273
5de6ef88a864371c3fd435ecd9a478c2134b7a5b
87
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'ld4l_browser_data'
29
58
0.758621
6ae7fa3abed07f9cb1a51191358916e491bf1825
650
Pod::Spec.new do |s| s.name = 'QEDSDK' s.version = '1.1.4' s.summary = 'The QED REST API provides an easy way to leverage blockchain technology attaching immutable timestamps to your files.' s.homepage = 'http://qed.digital/' s.author = { 'Name' ...
40.625
145
0.550769
e25d5f8347394c3db4b2637ed11e6a3f90bbe1d4
689
cask "font-iosevka-ss09" do version "7.0.4" sha256 "9749448e5b37d2fb7549b10a45b86e708d4c491a956a2abba57493d9359b4935" url "https://github.com/be5invis/Iosevka/releases/download/v#{version}/ttc-iosevka-ss09-#{version}.zip" name "Iosevka SS09" desc "Sans-serif, slab-serif, monospace and quasi‑proportional type...
34.45
105
0.756168
1d8ec850582bdf2473822a9cf57ae191b5e31af6
739
# Copyright 2012, Dell # # 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, software ...
29.56
74
0.753721
1d62ceea1731e3df5f401f21345e260634cbeb22
189
class TokyoMetro::Factory::Seed::Static::RailwayDirection::Hash < TokyoMetro::Factory::Seed::Static::MetaClass::Hash include ::TokyoMetro::ClassNameLibrary::Static::RailwayDirection end
37.8
116
0.793651
6a3f948427fd2ffe764d18de16739868cd90d991
210
require "test_helper" class HttpclientxTest < Minitest::Test def test_that_it_has_a_version_number refute_nil ::Httpclientx::VERSION end def test_it_does_something_useful assert false end end
17.5
39
0.790476
ff2b0672f7b6d0b207a5cde3fc05500382fe0aef
1,553
class Roda module RodaPlugins # The content_for plugin is designed to be used with the # render plugin, allowing you to store content inside one # template, and retrieve that content inside a separate # template. Most commonly, this is so view templates # can set content for the layout template t...
33.042553
67
0.619446
0153a1e6c15eccd45159c1b275d8ce28fc17ae62
194
require "test_helper" class AlpsTest < Minitest::Test def test_casually Alps.x(:test) a = Class.new do def a 1 + 1 end end a.new.a sleep 2 end end
11.411765
31
0.556701
08bf33c288cab6a59ec79e8bc079d2fb747f96dc
173
module ErrnoKnows def knows? error @constants ||= constants.map{|n| const_get(n)} @constants.include? error.class end end module Errno extend ErrnoKnows end
14.416667
50
0.710983
18048f0858434176acecbfdc694caf558e97c52f
698
# This migration comes from refinery_guides (originally 1) class CreateGuidesGuides < ActiveRecord::Migration def up create_table :refinery_guides do |t| t.string :title t.text :description t.text :raw_source t.text :html t.string :author t.string :category t.string :sou...
19.942857
73
0.646132
f861dd0da199e248dd32bd1518a738ed0c296414
1,611
# frozen_string_literal: true class CommentsController < ApplicationController before_action :authenticate_user! before_action :set_comment, only: %i[show edit update destroy] before_action :set_idea, only: %i[new create show edit update destroy] # GET /comments def index @comments = Comment.includes(:u...
22.375
105
0.711359
f8ac9ba6fb9f5881f5cd9706f37155103985bbd6
336
require 'test_helper' class ProjectTest < ActiveSupport::TestCase context 'associations' do should have_many(:positions) should belong_to(:organization) end context 'validations' do should validate_length_of(:title). is_at_least(3).is_at_most(20) should validate_presence_of(:organizatio...
21
49
0.744048
e2ea5b7c38105fe201e091c32ac65799c8158be3
557
class IGVTools < FPM::Cookery::Recipe description 'The igvtools utility provides a set of tools for pre-processing data files. ' name 'igvtools' version '2.3.94' revision 0 homepage 'https://www.broadinstitute.org/igv/igvtools' source "http://data.broadinstitute.org/igv/projects/downloads/igvtools_#{versio...
25.318182
92
0.723519
28ca93188ce6a5d9d71d70ba1cf2c59872365474
527
module AwsAlertMonitor class Config attr_accessor :logger, :file def initialize(args={}) @opts = args[:opts] ||= Hash.new log_level = args[:log_level] self.logger = AwsAlertMonitor::Logger.new :log_level => log_level self.file = load_config_file end private de...
19.518519
71
0.607211
e8420586ecdf7e753bae3ea9ee4ba41dee111f9e
180
class AddListenersToAlbumsAndArtists < ActiveRecord::Migration[7.0] def change add_column :artists, :listeners, :bigint add_column :albums, :listeners, :bigint end end
25.714286
67
0.755556
8736b1af21e793d0441fe90f48cfd33f48b63122
365
require 'twitter/geo' module Twitter class Geo class Point < Twitter::Geo # @return [Integer] def latitude coordinates[0] end alias_method :lat, :latitude # @return [Integer] def longitude coordinates[1] end alias_method :long, :longitude ali...
17.380952
36
0.59726
039ee0bb76e7b80b65a54e359e49f950a74fadea
760
$:.unshift File.expand_path("../lib", __FILE__) require "deb/s3" Gem::Specification.new do |gem| gem.name = "deb-s3" gem.version = Deb::S3::VERSION gem.author = "Ken Robertson" gem.email = "ken@invalidlogic.com" gem.homepage = "http://invalidlogic.com/" gem.summary = "Easily c...
30.4
74
0.625
d5d6ef5a37633711ff89eab4ed9cf1709258f9dd
2,100
module Sudoku class Generator include PeersAndUnits VALID_DIFFICULTIES = ["easy", "medium", "hard", "samuraj"] attr_reader :difficulty_analyzer def initialize @difficulty_analyzer = DifficultyAnalyzer.new end def generate(difficulty = "easy") check_difficulty!(difficulty) ...
24.418605
102
0.67
bf704ebef87d1f69f77052904bc4ab680fb7ea1a
126
class AddIndexesToIncidents < ActiveRecord::Migration[6.0] def change add_index :incidents, :occurred_on_date end end
21
58
0.777778
26b66df074d172491b749ba78e8498771db75ca4
2,379
require "test_helper" class PasswordResetsTest < ActionDispatch::IntegrationTest def setup ActionMailer::Base.deliveries.clear @user = users(:user_a) end test "password resets" do get new_password_reset_path assert_template "password_resets/new" assert_select "input[name=?]", "password_rese...
37.171875
72
0.664985
d54d20cc1c5b50741b8f7c1b2de024779a21db52
1,670
# -*- coding: utf-8 -*- # # frozen_string_literal: true describe Rouge::Lexers::ConsoleLexer do let(:subject) { Rouge::Lexers::ConsoleLexer.new } let(:klass) { Rouge::Lexers::ConsoleLexer } include Support::Lexing it 'parses a basic prompt' do assert_tokens_equal '$ foo', ['Generic.Prompt', '$'],...
29.821429
88
0.643713
1abce1a79c7477224459790420fc73dfe5cd8d07
4,071
require 'exact_target_client/exact_target_rest_client' require 'exact_target_client/exact_target_soap_client' module ExactTargetClient class ExactTargetAPI attr_accessor :oauth_token, :refresh_token class TimeOut < Exception; end class TokenExpired < Exception; end class ClientException < Ex...
31.55814
126
0.669369
7936ad19689a9fae82da8ac5bf84fada7e9bdaa0
8,960
require 'action_view' require 'fileutils' require 'cucumber/formatter/io' require 'cucumber/formatter/duration' require 'cucumber/core/ast/scenario' require 'cucumber/multiline_argument/data_table' require File.join(File.dirname(__FILE__), 'view_helper') require File.join(File.dirname(__FILE__), 'report') # Starting ...
31.111111
153
0.643527
e99a245e41e73b579b56c2d31ef2f63561c8c0c1
107
require 'rails_i18n/common_pluralizations/one_other' ::RailsI18n::Pluralization::OneOther.with_locale(:sw)
35.666667
53
0.841121
b9671884ab478be44ef2a38979b13275084828cf
481
module FeaturesHelper def ensure_on(path) visit(path) unless current_path == path end def verify(call) expect(call).to be_truthy end def refute(call) expect(call).to be_falsey end def dom_id_for(model) ActionView::RecordIdentifier.dom_id(model) end def dom_id_selector(model) "#...
16.033333
46
0.654886
e9351cf1ee6805be86668d3612126d3637f8357e
383
cask "font-digital-numbers" do version :latest sha256 :no_check # github.com/google/fonts/ was verified as official when first introduced to the cask url "https://github.com/google/fonts/raw/master/ofl/digitalnumbers/DigitalNumbers-Regular.ttf" name "Digital Numbers" homepage "https://fonts.google.com/spec...
31.916667
96
0.772846
266991b180443c71dea6b3c64c407b495c8c74de
701
# Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :team_question_bet, class: QuestionBet do answer '42' association :bet, factory: :bet, strategy: :build association :question, factory: :team_question, strategy: :build end factory :player_question_bet...
31.863636
71
0.736091
21f3c2f09c9a93cafe221c57061ce15054eae4ae
7,589
=begin #Adobe Experience Manager (AEM) API #Swagger AEM is an OpenAPI specification for Adobe Experience Manager (AEM) API The version of the OpenAPI document: 3.2.0 Contact: opensource@shinesolutions.com Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.3.1-SNAPSHOT =end require 'date' mod...
29.414729
232
0.613783
26c50bca38e8cc9954471c76b725a4b4724446c0
1,834
require 'test_helper' class UsersControllerTest < ActionDispatch::IntegrationTest def setup @user = users(:michael) @second_user = users(:archer) end test "should get new" do get signup_path assert_response :success end test "should redirect index when not logged in" do get users_path ...
25.123288
63
0.715921
b96ef796e741845ab755f59cd155c0648e0cec16
591
require File.dirname(__FILE__) + '/../test_helper' class CoffeeStatusTest < Test::Unit::TestCase def setup @room = Tinder::Room.new(stub, 1, 'Test room') @bot = Scout::Bot.new(@room) @command = Scout::Commands::CoffeeStatus.new("ma", @bot, "coffeestatus", []) end def test_update_status @comman...
25.695652
80
0.670051
8759e92e2ad024c59a981ffa4a371196957262f4
44
require 'cocoapods-usource/command/usource'
22
43
0.840909
ed348ca67ae5cfd5da96c135acda8bbf34246839
170
# frozen_string_literal: true require "spec_helper" RSpec.describe Code do it "#foo returns :foo being passed 42" do expect(subject.foo(42)).to eq :foo end end
17
43
0.723529
5daa8ffceb0ccc52d652c2dd35d1afcdbd07ada0
518
require "test_helper" require "generators/markerb/mailer/mailer_generator" class GeneratorTest < Rails::Generators::TestCase tests Markerb::Generators::MailerGenerator destination File.expand_path("../tmp", __FILE__) setup :prepare_destination test "assert all views are properly created with given name" do ...
32.375
65
0.776062
1d8cf052e5fbc1a62fe80de219dbff735d1628b7
2,622
describe Unidom::Shipment::Shipment, type: :model do before :each do end after :each do end context do model_attributes = { sender_party_id: SecureRandom.uuid, sender_party_type: 'Unidom::Shipment::SenderParty::Mock', sender_agent_id: SecureRandom.uuid, sende...
38.558824
148
0.683829
1177425a6a67a5ac0ef6c859a74836718e319dbe
79
Rails.application.routes.draw do mount SwellBot::Engine => "/swell_bot" end
15.8
40
0.746835
5d0a4a0aa1a875c48315604665e0970103d07945
2,262
require 'alert_parser' require 'faker' require 'open-uri' Dir[Pathname(__FILE__).dirname.join('shared/*.rb').to_s].each { |f| require f } Dir["./spec/support/**/*.rb"].each {|f| require f } # This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec...
44.352941
80
0.733864
ed1c20e1641435554d027008e7c03b27243b1708
1,476
# Copyright (c) 2021 Target Brands, Inc. All rights reserved. # # Use of this source code is governed by the LICENSE file in this repository. class Vela < Formula # repository information head "https://github.com/go-vela/cli.git" homepage 'https://github.com/go-vela/cli' # utility information version 'v0.10...
29.52
81
0.72019
2198310da7d2ca3bff4e5e6d15b91681fa0ddfff
3,876
# frozen_string_literal: true require 'rails/generators/active_record' require 'generators/devise/orm_helpers' module ActiveRecord module Generators class DeviseGenerator < ActiveRecord::Generators::Base argument :attributes, type: :array, default: [], banner: "field:type field:type" class_option :...
30.761905
142
0.640093
1ae39c9af549db632c35d3c1ae956b08723326d5
1,502
# app/models/mismo_enum/project_legal_structure_type.rb # enum class MismoEnum::ProjectLegalStructureType < MismoEnum::Base validates_presence_of :name validates_uniqueness_of :name def self.description 'Specifies the form of ownership that defines the quality and quantity of'+ ' ownership and rights to...
45.515152
80
0.659121
5dde8d38e3e564f3f5f87b0f8fdfbb838c6f66c8
342
class CreateServiceManagers < ActiveRecord::Migration[6.1] def change create_table :service_managers do |t| t.references :service, null: false, foreign_key: true t.string :name t.string :identify t.integer :update_count t.string :created_by t.string :updated_by t.timesta...
22.8
59
0.675439
4a83198c7bd3d032f1ed98c55015404048153653
90,048
# frozen_string_literal: true # WARNING ABOUT GENERATED CODE # # This file is generated. See the contributing guide for more information: # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md # # WARNING ABOUT GENERATED CODE require 'seahorse/client/plugins/content_length.rb' require 'aws-sdk-core/plugins...
52.506122
317
0.685101
bfce5f2f9f6dac3ddf9b650e6c81ee6d28ca92bf
463
module UsersHelper # Link to a user (default is by name). def user_link(text, user = nil, html_options = nil) if user.nil? user = text text = user.name elsif user.is_a?(Hash) html_options = user user = text text = user.name end # We normally write link_to(..., user) ...
27.235294
71
0.643629
38efffcb148086d8f6a1d5e9497898a3a64cb853
1,301
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "spud_media/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "spud_media" s.version = Spud::Media::VERSION s.authors = ["David Estes"] s.email = ["destes@re...
39.424242
167
0.691776
bb774e232e46deb801417e8762398758941b7b59
2,986
require 'pxp-agent/test_helper.rb' require 'yaml' test_name 'Run puppet agent as non-root' do agents.each do |agent| platform = agent.platform skip_test "Test is not compatible with #{platform}" if platform =~ /windows/ step 'create non-root user on all nodes' do @user_name = 'foo' @group_...
38.779221
129
0.623912
f837e96b2bb26e84feb9ace0466cd17cc15888c4
2,236
class PostfixLogLine < ActiveRecord::Base belongs_to :delivery after_save :update_status! def dsn_class match = dsn.match(/^(\d)\.(\d+)\.(\d+)/) if match match[1].to_i else raise "Unexpected form for dsn code" end end def status case dsn_class when 2 "delivered" ...
27.95
141
0.639982
39c09323164a0ce795d9c6749205b3379e8e8e20
4,278
module Fog module Network class OpenStack class Real # Create a new security group # # ==== Parameters # * options<~Hash>: # * 'name'<~String> - Name of the security group # * 'description'<~String> - Description of the security group # * 'tenant...
45.031579
153
0.491117
f76d1d6acb05529c6b6836516aef743e43105cc0
337
# frozen_string_literal: true require 'active_support/concern' module BetterRecord module Authenticatable extend ActiveSupport::Concern included do include BetterRecord::JWT::ControllerMethods before_action :check_user if use_bearer_token after_action :set_auth_header end ...
17.736842
50
0.732938
7a90572dc56a8bd329e37f077d63816af1457b99
327
require 'rails_helper' require 'dwca/generator' describe Dwca::Generator do specify "stores a compressed file in rails' temp directory" do path = Dwca::Generator.get_archive expect(File.exists?(path)).to be_truthy File.delete(path) expect(path.to_s.index(Rails.root.join('tmp').to_s)).to eq(0) en...
23.357143
65
0.718654