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
183e6668717bd707ac014b01b94a3c0e1e47f744
86
module React module Tags module Rails VERSION = "3.0.1" end end end
10.75
23
0.593023
391469b647f554c8b46abbdbb3138fbaecc4f72b
444
class Staff::ChangePasswordForm include ActiveModel::Model attr_accessor :object, :current_password, :new_password, :new_password_confirmation validates :new_password, presence: true, confirmation: true validate do errors.add(:current_password, :wrong) unless Staff::Authenticator.new(object).authenticate(...
24.666667
112
0.754505
7a167aa267d42a8abd0274e6f99982bd460f6fd1
799
class ApplicationController < ActionController::Base before_action :configure_permitted_parameters, if: :devise_controller? protect_from_forgery with: :exception around_action :set_time_zone if !Rails.env.development? rescue_from ActionView::MissingTemplate do |exception| render file: "public/404.htm...
23.5
72
0.740926
389fd2e7fbd666e1e27866d89d330fb433b6a8c7
484
# frozen_string_literal: true describe MarkdownController do context 'POST' do before :each do @input = 'input' end let :submit do post :explanation, params: { preview_input: @input } end context 'staff' do before :each do when_current_user_is :staff end it '...
22
76
0.640496
d53561046e8f4dc43723a469f369034201305c0a
4,104
# frozen_string_literal: true require "erb" require "cgi" require "fileutils" require "digest/sha1" require "time" # Ensure we are using a compatible version of SimpleCov major, minor, patch = SimpleCov::VERSION.scan(/\d+/).first(3).map(&:to_i) if major < 0 || minor < 9 || patch < 0 raise "The version of SimpleCov ...
31.569231
180
0.643762
79ea2e2ea47be31b347be6f022dc84a887bc5142
1,754
# frozen_string_literal: true # This creates and queues reminder emails for in-progress drafts class WorkReminderGenerator # Sends the day's reminders about open drafts, using default values for the notification # interval unless the caller overrides the defaults with custom values. Intended to be run daily # by...
46.157895
117
0.748575
28339c6fd30458051d0b871f9c57a69b647e0cd0
5,799
require 'test_helper' class TagsControllerTest < ActionController::TestCase include AuthenticatedTestHelper fixtures :all def setup login_as Factory(:user, person: Factory(:person)) end test 'handles invalid tag id' do id = 9999 get :show, params: { id: id } assert_not_nil flash[:error] ...
33.327586
105
0.685635
1d9607955d8550ad16a05074e8b50aeb815324eb
1,166
module ElasticsearchDslBuilder module DSL module Search module Queries class HasChild < Query def initialize(child_type = nil) @type = :has_child child_type(child_type) super() end def child_type(child_type) raise Argumen...
27.116279
115
0.571184
ed260bf96ec9e44d37b9a6189fd10e2d4b3b8fd5
1,698
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suit...
42.45
85
0.773263
5d4da564a3f81aaf43c68ba981791a15b30f2be4
766
class Cms::LayoutsController < ApplicationController include Cms::BaseFilter include Cms::CrudFilter model Cms::Layout navi_view "cms/main/navi" before_action :set_tree_navi, only: [:index] private def set_crumbs @crumbs << [t("cms.layout"), action: :index] end def fix_params { cur_user:...
21.277778
90
0.665796
39e4a6cf5b69012cc09ca15a017fdf7ccddf637e
335
class CreatePayments < ActiveRecord::Migration[5.2] def change create_table :payments do |t| t.string :payer_id t.string :recipient_id t.string :organization_id t.integer :conversation_id t.integer :sum_cents t.string :sum_currency t.string :status t.timestamps ...
20.9375
51
0.662687
08319f6a3cbf55b6fa9750f7de963268c6c6ede4
10,861
# Copyright (c) 2016, 2020, 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...
44.695473
379
0.66016
1cd1eb6438f8529ed060f073a7bb7ddcb1f08029
25,355
class Array ## # call-seq: # ary.uniq! -> ary or nil # ary.uniq! { |item| ... } -> ary or nil # # Removes duplicate elements from +self+. # Returns <code>nil</code> if no changes are made (that is, no # duplicates are found). # # a = [ "a", "a", "b", "b", "c" ] # a.uniq!...
26.887593
98
0.516348
339a8f6a98f306963c85c563ba76b13ec09a4cc8
2,687
cask 'wine-staging' do version '4.9' sha256 'd51f6d2ef7fb9cb263b3f2384e7feca49e3f3d763e35881205ff957370092f22' # dl.winehq.org/wine-builds/macosx was verified as official when first introduced to the cask url "https://dl.winehq.org/wine-builds/macosx/pool/winehq-staging-#{version}.pkg" appcast 'https://dl.wi...
47.140351
104
0.651284
1a174c6cef1d4546309f24a26f70621a702dadb8
1,714
require File.dirname(__FILE__) + '/../../spec_helper' require File.dirname(__FILE__) + '/shared_manager_behavior' module RosettaQueue describe ThreadedManager do before(:each) do @mutex = mock("Mutex") @mutex.stub!(:synchronize).and_yield Mutex.stub!(:new).and_return(@mutex) Stomp::Conne...
32.961538
157
0.619603
62178ab08ffa0c0bf41f886d6c39f7b819ad3ae5
767
# frozen_string_literal: true require_relative '../../command' module Rubyists module Opr module Commands class List # Items subcommand class Items < Rubyists::Opr::Command attr_reader :vault def initialize(vault, options) @vault = vault @options...
25.566667
97
0.565841
18f75f777e7a942943bbf44da9bf7c4497469396
792
require 'spec_helper' describe TeamsController do describe 'routing' do it 'routes to #index' do expect(get('/teams')).to route_to('teams#index') end it 'routes to #new' do expect(get('/teams/new')).to route_to('teams#new') end it 'routes to #show' do expect(get('/teams/1')).t...
23.294118
70
0.594697
1cf4f360d63bd370184a1da6f2a93993caa373b5
256
require 'rubygems' require 'hpricot' require 'open-uri' require 'date' require 'cgi' require 'htmlentities' require 'imdb/imdb' require 'imdb/imdb_company' require 'imdb/imdb_movie' require 'imdb/imdb_name' require 'imdb/imdb_genre' require 'imdb/patches'
19.692308
27
0.785156
084b059e9c313a2bb63a82ea50f6e090abfae5d8
4,812
# frozen_string_literal: true require 'webmock/rspec' # 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...
48.12
92
0.74335
e2fa9b8ce6e6182e9d1d1771953830b207dd6b0d
5,920
# 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::V2019_11_01 module Models # # P2SVpnGateway Resource. # class P2SVpnGateway < Resource include MsRestA...
32.173913
79
0.471453
0110d920fd093e344df9e66d77448c4e69d76f17
116
class Therapeutor::Questionnaire::Therapy::PropertyOrder < Therapeutor::Questionnaire::Therapy::PreferenceOrder end
38.666667
111
0.844828
b97b0b03088c7c17e35e497a78ad81eae42d0c75
658
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "engine_example/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "engine_example" s.version = EngineExample::VERSION s.authors = ["sue445"] s.email = ["sue4...
26.32
83
0.6231
38f06b145b65ca4de75e05c0bf1bd6486f5ef636
985
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "em-hiredis/version" Gem::Specification.new do |s| s.name = "em-hiredis" s.version = EventMachine::Hiredis::VERSION s.platform = Gem::Platform::RUBY s.authors = ["Martyn Loughran"] s.email = ["me@mloughran....
36.481481
83
0.634518
0857ba94468455f8039df74340ed528c8f15f5b7
4,952
# Copyright 2017 Google Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, so...
34.873239
99
0.661753
79c7ac62c6c9d54b9942f206f4297671d145a2a6
1,301
require 'test_helper' class KlarnaModuleTest < Test::Unit::TestCase include ActiveMerchant::Billing::Integrations def test_notification_method Klarna::Notification.expects(:new).with('post_body', authorization_header: 'auth header') Klarna.notification('post_body', authorization_header: 'auth header') e...
33.358974
93
0.668716
6a41724bde0476ce5c848112b1bcd6da12239320
1,011
Spree::Core::Engine.config.to_prepare do if Spree.user_class Spree.user_class.class_eval do include Spree::UserApiAuthentication include Spree::UserPaymentSource include Spree::UserReporting has_and_belongs_to_many :spree_roles, join_table: 'spree_roles_user...
29.735294
94
0.644906
26a6f42a174b01ce3b06d3113b03eb313546ef41
4,409
require 'telegram/bot/types/compactable' require 'telegram/bot/types/base' require 'telegram/bot/types/user' require 'telegram/bot/types/photo_size' require 'telegram/bot/types/audio' require 'telegram/bot/types/document' require 'telegram/bot/types/mask_position' require 'telegram/bot/types/sticker' require 'telegram/...
47.408602
69
0.85643
39c39597d4de03680995b03b7d9dec3c4409ed3d
228
def resource_not_found {status: 404, error: 'Resource not found' }.to_json end def bad_request {status: 400, error: 'Bad request' }.to_json end def server_error {status: 500, error: 'Internal server error' }.to_json end
19
56
0.732456
7aee4be580a6934c55a01963c3ce583cc81067b2
759
# Configure Rails Environment ENV["RAILS_ENV"] = "test" require File.expand_path("../../test/dummy/config/environment.rb", __FILE__) ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)] require "rails/test_help" require 'rails-controller-testing' # Filter out Minitest...
36.142857
101
0.764163
1a0624dda356a227186302d3be7e0821a607e922
1,854
class RelaysController < ApplicationController before_action :set_relay, only: [:show, :edit, :update, :destroy] # GET /relays # GET /relays.json def index @relays = Relay.all end # GET /relays/1 # GET /relays/1.json def show end # GET /relays/new def new @relay = Relay.new end # G...
24.72
89
0.64671
e2ea1a44eb535fe5f5a0e9f70b6682c1f0c88e35
10,431
class Location < ApplicationRecord self.table_name = 'n3_obce_body' def self.find_obec(kod_obec) @obec ||= {} unless @obec.key?(kod_obec) @obec[kod_obec] ||= Location.find_by_sql([ "select naz_obec, kod_obec, kod_okres, point_x, point_y from #{table_name} where kod_obec::integer = ?...
37.65704
114
0.371489
18b391f9eee05beb9924b9b18569988e533a11ec
290
require File.expand_path('../../../../../spec_helper', __FILE__) describe "OpenSSL::SSL::SSLContext#tmp_ecdh_callback" do it "needs to be reviewed for spec completeness" end describe "OpenSSL::SSL::SSLContext#tmp_ecdh_callback=" do it "needs to be reviewed for spec completeness" end
29
64
0.748276
61a7c06607b9cc59ebd1d5cc65593c836a26c3ef
1,449
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "lowruby/version" Gem::Specification.new do |spec| spec.name = "lowruby" spec.version = Lowruby::VERSION spec.authors = ["gingray"] spec.email = ["gingray.dev@gmail.com"] ...
37.153846
96
0.667357
f804a834a55202ef8e6bc749dc93dd213c7a3ea7
991
module Poly module GravatarHelper # Based on http://expo.stimulusreflex.com/demos/gravatar def user_gravatar(email, options) return unless %r{[^@]+@[^.]+\..+}.match?(email) email_md5 = Digest::MD5.hexdigest(email.downcase.strip) query_params = url_params(options) @gravatar_image_url = ...
29.147059
89
0.659939
6a1ca22c64bbf55b1b3e5d543134d0002999de74
1,490
require 'time' # A module to gather uptime facts # module Facter::Util::Uptime def self.get_uptime_seconds_unix uptime_proc_uptime or uptime_sysctl or uptime_kstat or uptime_who_dash_b end def self.get_uptime_seconds_win require 'facter/util/wmi' last_boot = "" Facter::Util::WMI.execquery("sele...
22.575758
84
0.689262
bbbfed6832923cb41e94d2defe0af74843bf77a4
507
unless Rails.env.test? # Tell the Rack::Attack Rack middleware to maintain an IP blacklist. We will # update the blacklist from Grack::Auth#authenticate_user. Rack::Attack.blacklist('Git HTTP Basic Auth') do |req| Rack::Attack::Allow2Ban.filter(req.ip, Gitlab.config.rack_attack.git_basic_auth) do # This...
39
87
0.717949
4a740987fe3d530b0c2e716e0372d79424874ad3
16,990
# frozen_string_literal: true require 'bolt/pal' module Bolt class Outputter class Human < Bolt::Outputter COLORS = { red: "31", green: "32", yellow: "33", cyan: "36" }.freeze def print_head; end def initialize(color, verbose, trace, spin, stream =...
33.710317
106
0.54126
1136ba1782af4dbdbf330119bed71760f4b7650d
151
class ResetUserLoginTriesCountWorker include Sidekiq::Worker def perform(id) user = User.find(id) user.reset_login_tries_count! end end
16.777778
36
0.754967
f838fb463be16be17cc4d44df24fbb067c43cd40
7,291
require "addressable/template" require "faraday" require "json" require "logger" module Eversign class FileNotFoundException < Exception end class Client attr_accessor :access_key, :base_uri, :business_id, :token def initialize() self.base_uri = Eversign.configuration.api_base || "https://api.eve...
31.291845
154
0.663558
1160eaf55311811ae77d7de79f3f7b80a7dbf3d9
2,788
# 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...
34.419753
86
0.715208
793228362228b08481d0f732be98a8267b9a1c81
1,316
class CommentsController < ApplicationController include ActionVoter before_action :authenticate_user! before_action :find_comment, only: [:update, :destroy] def create @comment = current_user.comments.new(comment_params) if @comment.save @new_comment = Comment.new if @comment.parent_id.ni...
24.37037
73
0.680091
5ddb7ad4aacfa4f8f11b123a41b6fdba7ab12e1d
1,333
# class Egi::Fedcloud::Cloudhound::AppdbAppliance attr_reader :identifier, :version, :url, :checksum, :format, :owner, :published, :mpuri attr_reader :sites # def initialize(element) Egi::Fedcloud::Cloudhound::Log.debug "[#{self.class}] Initializing with #{element.inspect}" ...
23.385965
95
0.579895
26ad402bb18a87dd99f7bd81db670bdb3728f881
5,339
=begin PureCloud Platform API With the PureCloud Platform API, you can control all aspects of your PureCloud environment. With the APIs you can access the system configuration, manage conversations and more. OpenAPI spec version: v2 Contact: DeveloperEvangelists@genesys.com Generated by: https://github.com/swagger-ap...
23.519824
177
0.582881
08d064b604ee1cfca58eb6e6890f4bd1ad42c7ee
98
require "organ/trail/version" module Organ module Trail # Your code goes here... end end
12.25
29
0.693878
39b4c1cf17d3bf47d55de9d572b287541d724c5e
4,465
# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative sou...
36.300813
109
0.665398
e278fdd51009ad621d1c947e74a02b1494974c38
16,284
class PythonAT37 < Formula desc "Interpreted, interactive, object-oriented programming language" homepage "https://www.python.org/" url "https://www.python.org/ftp/python/3.7.10/Python-3.7.10.tar.xz" sha256 "f8d82e7572c86ec9d55c8627aae5040124fd2203af400c383c821b980306ee6b" license "Python-2.0" revision 2 ...
40.306931
168
0.681221
bf29f6bd43af5079a534de8e373a4cde9e8677ed
119
module HtmlComposite class MapTag < Tag def to_s "<map#{attributes_list}>#{super}</map>" end end end
14.875
45
0.630252
7a5210fac700bdce89162b1f4283d537fcfb7794
1,571
RSpec.describe 'ValidatesTimeliness::Extensions::MultiparameterHandler' do context "time column" do it 'should be nil invalid date portion' do employee = record_with_multiparameter_attribute(:birth_datetime, [2000, 2, 31, 12, 0, 0]) expect(employee.birth_datetime).to be_nil end it 'shou...
35.704545
95
0.707193
bf072162d9ee5dd85497c7d5238d1c5ec4729a04
1,891
# # Copyright:: 2015-2019, 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 # # U...
25.554054
80
0.680592
e93465c9cb8b6d0df89aadbbbd25f84b08430e74
1,664
require 'beaker-rspec/spec_helper' require 'beaker-rspec/helpers/serverspec' require 'beaker/puppet_install_helper' run_puppet_install_helper UNSUPPORTED_PLATFORMS = ['Suse','windows','AIX','Solaris'] RSpec.configure do |c| # Project root proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) #...
40.585366
161
0.640625
ff57e845e538e6066f6ecd96f9619ba990940868
1,945
# -*- encoding: utf-8 -*- # # Author:: Fletcher Nichol (<fnichol@nichol.ca>) # # Copyright (C) 2012, 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.o...
28.188406
74
0.660668
61e781928626aa2e8267262125820ed1d28723a0
1,337
require 'spec_helper' describe Arrays do context "empty array" do it "should work" do array = [] Arrays.sort_012(array) array.should == [] end end context "only 0s" do it "should work" do array = [0, 0, 0, 0, 0] Arrays.sort_012(array) array.should == [0, 0, 0, 0, ...
19.661765
52
0.513837
e22c390df1c3a150baf6d00df24b246ff3388c6e
527
require 'test_helper' class SessionHelperTest < ActionView::TestCase include SessionsHelper def setup @user = users(:derek) remember(@user) end test "current_user returns right user when session is nil" do assert_equal @user, current_user assert is_logged_in?...
27.736842
78
0.671727
385dbf17e3b8683258de4c8e8aee1493b3ee5375
6,737
require 'rubyXL' require 'rubyXL/convenience_methods/cell' module PolyPress module Serializers class Excel send(:include, Dry::Monads[:result, :do]) send(:include, Dry::Monads[:try]) DATA_FEATURE_KEYS = %w(sheet page_group rows row cells checkboxes split_fields) DERIVED_INPUT_KINDS = %w...
35.645503
113
0.614814
bfdfa767d3d78d7a7c181bb91c5fe9cff94d4aa5
2,991
#-- encoding: UTF-8 #-- copyright # OpenProject is an open source project management software. # Copyright (C) 2012-2020 the OpenProject GmbH # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProje...
24.516393
91
0.715145
87338488ebac7bcbf8f330c1637e04933daedcc7
5,317
# frozen_string_literal: true class Import::BitbucketServerController < Import::BaseController before_action :verify_bitbucket_server_import_enabled before_action :bitbucket_auth, except: [:new, :configure] before_action :validate_import_params, only: [:create] # As a basic sanity check to prevent URL injecti...
35.925676
164
0.7634
1aef7569b03f6fe746d4b214eb3bad99a0a2be2f
2,864
module Pod class ConfigureIOS attr_reader :configurator def self.perform(options) new(options).perform end def initialize(options) @configurator = options.fetch(:configurator) end def perform # keep_demo = configurator.ask_with_answers("Would you like to include a demo a...
30.468085
137
0.622905
79b5d4eae6d2baa05fe0a2cf8ada06161ec31594
1,093
require 'rails' require 'redcarpet' require 'omniauth' require 'omniauth-shibboleth' # require 'omniauth-google-oauth2' require 'omniauth-orcid' require 'jquery-rails' require 'jquery-ui-rails' require 'jquery-turbolinks' require 'filesize' require 'kaminari' require 'amoeba' require 'font-awesome-rails' require 'stas...
27.325
76
0.730101
e990fab304b9224dfc64494f5be649fa7e861cab
138
# frozen_string_literal: true module Cropio module Resources class ProductivityEstimate < Cropio::Resource::Base end end end
15.333333
55
0.753623
7a48897b7fdfaad3ad3a2617751e56b4c2fc3a64
6,437
require "spec_helper" return unless defined?(Sequel) require "mobility/plugins/sequel/column_fallback" describe Mobility::Plugins::Sequel::ColumnFallback, orm: :sequel, type: :plugin do plugins :sequel, :backend, :reader, :writer, :column_fallback let(:model_class) do stub_const 'Article', Class.new(Sequel:...
35.174863
122
0.63803
f895b8d30cd70a6e40c2b1e9816a0b0db036af99
144
# frozen_string_literal: true json.extract! widget, :id, :name, :slug, :content, :design_id json.url backend_widget_url(widget, format: :json)
28.8
61
0.756944
6148b5a8d335cbf1253bd520f6c060e24cd1e1a0
224
require 'sidekiq/testing' # https://github.com/mperham/sidekiq/wiki/Testing#testing-worker-queueing-fake Sidekiq::Testing.fake! RSpec.configure do |config| config.before(:each) do Sidekiq::Worker.clear_all end end
20.363636
78
0.763393
5d9aafb708dc362dde907199205f1b494ef24c2a
882
Pod::Spec.new do |s| s.name = 'FacebookImagePicker' s.version = '2.0.11' s.license = 'MIT' s.summary = 'An image/photo picker for Facebook albums & photos modelled after UIImagePickerController' s.author = { "Deon Botha" => "deon@oceanlabs.co" } s.social_media_url = 'https://twi...
44.1
110
0.668934
acfee31474e811f0066fc179691712272fd43ce9
37,152
require 'spec_helper' describe ActiveHash, "Base" do before do class Country < ActiveHash::Base end end after do Object.send :remove_const, :Country end it "passes LocalJumpError through in .transaction when no block is given" do expect { Country.transaction }.to raise_error(LocalJumpError...
28.039245
203
0.603117
39da7d5a4b484c584183ec2a70865aac8262831f
1,438
require 'test_helper' class CrumbsTest < ActionDispatch::IntegrationTest test 'links' do get '/' assert_equal Hash.new, session[:referers] assert_select 'a', count: 1 assert_select 'a[href=?]', 'http://www.example.com', text: /home/, count: 1 get '/admin/users?query=' assert_equal( { ...
35.073171
110
0.621697
e250a15039b7dd16154cf0191bba43b7d3118454
1,457
Gem::Specification.new do |s| s.name = 'logstash-output-s3' s.version = '4.1.1' s.licenses = ['Apache-2.0'] s.summary = "Sends Logstash events to the Amazon Simple Storage Service" s.description = "This gem is a Logstash plugin required to be installed on top of the Logst...
48.566667
205
0.669183
e9072d545a8e241fe97a1d64726488305cb48fa9
21,415
## # Module ISO Test def labeled_module(name, &block) Module.new do (class <<self; self end).class_eval do define_method(:to_s) { name } alias_method :inspect, :to_s end class_eval(&block) if block end end def labeled_class(name, supklass = Object, &block) Class.new(supklass) do (cla...
25.343195
112
0.678917
28eaf291c7cbd30f0c4c46504e5ac7787c1f76fd
1,871
# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::ContainerInstance::Mgmt::V2017_10_01_preview module Models # # Image registry credential. # class ImageRegistryCredential include MsRes...
27.115942
76
0.520577
d5579b94308b0e3e44980f0c132c2a6c5263188f
225
class RiceReportsController < CropController def safe_params get_model unless @symbol return params.require(@symbol).permit(:bags_harvested, :pishori_bags, :super_bags, :other_bags, :kg_of_seed_planted) end end
25
120
0.782222
e90a15b5f8bb4a925b0af9b1456a37575a96f336
2,509
# frozen_string_literal: true require 'spec_helper' describe 'epics list', :js do include FilteredSearchHelpers let(:user) { create(:user) } let(:group) { create(:group, :public) } let(:label) { create(:group_label, group: group, title: 'bug') } let!(:epic) { create(:epic, group: group, start_date: 10.days...
29.174419
102
0.679155
4ad5f0ba3b1c4ed1510ed14d51221d4314f6c180
879
module Capable module ActsAsCapabilityRenewer def self.included(base) base.extend Capable::Base base.extend ClassMethods end module ClassMethods def acts_as_capability_renewer has_many :capabilities, as: :renewer, :dependent => :destroy include Capable::ActsAsCapabili...
21.975
84
0.667804
1d61fb6f01d6034b1b5eb265415b1f5e0f2a8896
1,063
#!/usr/bin/env ruby # # Graphite # === # # DESCRIPTION: # I extend OnlyCheckOutput mutator specialy for Graphite. # This mutator only send event output (so you don't need to use # OnlyCheckOutput) and change parameter name if it is hostname # for better view in Graphite. # # OUTPUT: # event output with all do...
27.25641
109
0.687676
b9b9b6e4e880dbb7eb849c310308a1c0a7033858
2,243
module UploadsActions include Gitlab::Utils::StrongMemoize include SendFileUpload UPLOAD_MOUNTS = %w(avatar attachment file logo header_logo).freeze def create link_to_file = UploadService.new(model, params[:file], uploader_class).execute respond_to do |format| if link_to_file format.js...
22.656566
83
0.709318
7aa440e30f0a9ebf38ff92d66a07144160eb263d
662
default['gusztavvargadr_packer_dotnet']['default'] = { 'features' => { # 'NetFx3' => {}, }, 'native_packages' => { '.NET Core 1.1.4 Runtime' => { 'source' => 'https://download.microsoft.com/download/6/F/B/6FB4F9D2-699B-4A40-A674-B7FF41E0E4D2/dotnet-win-x64.1.1.4.exe', 'install' => [ '/...
27.583333
136
0.531722
abf9036cf815083a324c846095a61dd8ace310ad
2,399
require 'cinch' require 'array_utility' require_relative 'base_command' require_relative '../wiki' module Plugins module Commands class Abbreviate < AuthorizedCommand include Cinch::Plugin include Plugins::Wiki using ArrayUtility ignore_ignored_users set(help: 'Abbreviates a mod fo...
38.079365
115
0.55148
62c7d1fb2fc775dbaf1e7e90b826fa46b2cfaf9f
622
class ContactsController < ApplicationController before_action :find_candidate, only: %i[new create] def new @contact = Contact.new end def create success = verify_recaptcha(action: 'contact_create', minimum_score: ENV['RECAPTCHA_MINIMUM_SCORE'].to_f) @contact = @user.contacts.build(contact_params...
22.214286
108
0.71865
08009bf0d9cd69b35f922898fcf1f508b5aaa96d
1,170
require 'rails_helper' describe Mutations::Cart::Update, type: :request do let(:user) { create(:user) } let(:account) { user.account } let(:product) { create(:product, account: account) } let!(:jwt_token) { generate_jwt_test_token(user) } let(:name) { 'Spiritual Instinct' } let(:query) do <<~GQL ...
25.434783
130
0.516239
08bc809885762ecfbaf5aaea541ec5e3ce66a0f9
5,650
require 'test_helper' require 'json' require 'webmock' module Api module V1 class SingleMessagesControllerTest < ActionController::TestCase fixtures :all def setup @request.env["devise.mapping"] = Devise.mappings[:user] @request.headers['Accept'] = Mime::JSON @request.heade...
41.544118
207
0.655221
91aa1105b0f0ec9c75cb6cfcdd6934d6523c4f4d
229
$LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'rubygems' require 'faketwitter' require 'spec' require 'spec/autorun' Spec::Runner.configure do |config| end
22.9
66
0.755459
1c8bf2bf1488115ee17ac7e2786d38332cfee305
318
class CreateAuthorCommentVotes < ActiveRecord::Migration[6.1] def change create_table :author_comment_votes do |t| t.references :author, null: false, foreign_key: true t.references :comment, null: false, foreign_key: true t.integer :vote_value, default: 0 t.timestamps end end end
26.5
61
0.707547
bf72a2508fde6370716bc83c1fa8fd0308acf22f
120
class AddRatingColToRecipeTable < ActiveRecord::Migration def change add_column :recipes, :rating, :int end end
20
57
0.766667
e8ae24b673352a2465f292ca7b7b796f35d10b9e
2,304
### Calculate ProductOptionBridge # ## ===== source columns ====== # ## ===== calculated columns ====== # :selling_price # class ProductOptionBridge < ApplicationRecord belongs_to :connectable, polymorphic: true belongs_to :product_option JOIN_CONNECTABLE_QUERY = lambda do |klass| resource_key = 'connectable...
24.510638
147
0.708333
015b1da191441585ed22dc238e8e28c87982c431
653
require 'async/mysql/client' RSpec.describe Async::MySQL::Client do include_context Async::RSpec::Reactor let(:connection) {Async::MySQL::Client.new(host: 'localhost', database: 'test')} it "should execute query" do reactor.async do results = connection.query("SELECT 42 AS LIFE") expect(results.each...
21.064516
81
0.652374
e959a796b9320e105dc06606073790d575b876ba
1,142
# http://www.jroller.com/obie/tags/unicode class String class << self def unpack(string) return ActiveSupport::Multibyte::Chars.g_unpack(string).collect{ |c| c[0] } if ActiveSupport::Multibyte::Chars.respond_to?(:g_unpack) string.split('').collect{ |c| c.chars[0] } end end def to_ascii ...
36.83871
139
0.706655
7abac9e58d5e495c6c01cb755ad1e694daac8961
1,050
cask 'casio-screen-receiver' do version '3.02,b:4' sha256 '5eaff7fd7894d483534d82e7fbc6b77a6d304afa580e10b1c7bce38a3a69e07a' url "https://edu.casio.com/education/support_software/dl/screen_Receiver/screenrecv_inst_#{version.before_comma.no_dots}#{version.after_comma.before_colon}_#{version.after_colon}.zip" na...
42
185
0.712381
d5015343465ef4d7a6a9003e2cc3df928c119ff1
79
module WebSql class ApplicationController < ActionController::Base end end
15.8
54
0.810127
1ad74c23e83c012c1c6b74a60723532ae50cdd08
72
module ISO8601 ## # The gem version VERSION = '0.11.0'.freeze end
12
27
0.638889
79da0f53ac3ded097f21d144e346f9f3f8d20568
21
require 'mauth/rack'
10.5
20
0.761905
21b1d167f3312d8328fe4ff7aeaaf27b694b53b1
295
default['packagecloud']['base_repo_path'] = "/install/repositories/" default['packagecloud']['gpg_key_path'] = "/gpgkey" default['packagecloud']['hostname_override'] = nil default['packagecloud']['default_type'] = value_for_platform_family( 'debian' => 'deb', ['rhel', 'fedora'] => 'rpm' )
32.777778
68
0.698305
91a1b41bef71f20039c8844b3c7d77a36ceba400
896
module RBKubeMQ class Streamer < Faye::WebSocket::Client include Check def initialize(client:, client_id: nil, channel: nil, meta: nil, store: false) is_class?(client, [RBKubeMQ::Client], "client") @client = client @client_id = client_id @channel = channel @meta = meta.nil? ...
27.151515
82
0.581473
796380bbed9c893abc1a888c4996e400c7d8f297
3,071
cask 'markdown-service-tools' do version '2.14' sha256 'd0f48be1acaae6ad46370869501b44fdcc765fbe3f1ca8594a766273fc9c128f' url "http://cdn3.brettterpstra.com/downloads/MarkdownServiceTools#{version}.zip" name 'Markdown Service Tools' homepage 'http://brettterpstra.com/projects/markdown-service-tools/' serv...
69.795455
90
0.778248
e95327c4822b5c73910c8c68cc2cc36d17af9c39
1,028
require 'java' require 'jolt-core' require 'multi_json' require 'jruby-jolt/namespace' require 'jruby-jolt/errors' require 'jruby-jolt/chainr' require 'jruby-jolt/spec_store' module Jolt @specs = Jolt::SpecStore.new class << self attr_reader :specs def spec(name) @specs[name] end def loa...
20.156863
85
0.655642
bbe9a14c20e487a995833456be344ca501dbf97a
158
class User < ApplicationRecord belongs_to :authentication has_many :messages delegate :email, to: :authentication, prefix: false, allow_nil: false end
22.571429
71
0.778481
8764f4bf85f088585ee4bead2232ff051ccd1a35
1,173
# Watch for any rails server exceptions and write the stacktrace to ./tmp/test_bot/exception.txt # This file is checked for by assert_no_exceptions module EffectiveTestBot class Middleware def initialize(app) @app = app end def call(env) begin @app.call(env) rescue Exception =>...
28.609756
112
0.589088
1c94522ae0bbd26bd6ef4ef59e74147a9457b80b
1,468
require 'priority_queue' module Algorithms class DijkstraService def initialize(list, start, finish) @nodes = list.nodes @start = @nodes.find(start) @finish = @nodes.find(finish) @queue = PriorityQueue.new @maxint = (2**(0.size * 8 -2) -1) @distances = {} @previous =...
22.242424
61
0.535422
385fc5cd7e733207c8e49fcc744e3850b633f103
1,917
# A wiki page class WikiPage < ActiveRecord::Base has_many :revisions, :class_name => 'WikiRevision', :order => 'id' has_many :references, :class_name => 'WikiReference', :order => 'referenced_name' has_one :current_revision, :class_name => 'WikiRevision', :order => 'id DESC' belongs_to :company has_many ...
25.223684
247
0.678143
ab75df357b5697d116335ca84286e0a49f877773
279
module CIMaestro::Utils module Reflection def instance_variables_as_hash instance_variables.inject({}) do |hash, ivar| attr_reader_name =ivar.gsub('@', '').to_sym hash.merge(attr_reader_name => self.send(attr_reader_name)) end end end end
25.363636
67
0.681004
e28e64e9bc215b94ebbf2b57dfb4d01b0a65cfda
340
module Faker class ElderScrolls < Base class << self def race fetch('elder_scrolls.race') end def creature fetch('elder_scrolls.creature') end def region fetch('elder_scrolls.region') end def dragon fetch('elder_scrolls.dragon') en...
15.454545
39
0.570588
21ae43aded5b75eb8afe2ade0922216e0641a84f
897
class Ocamlbuild < Formula desc "Generic build tool for OCaml" homepage "https://github.com/ocaml/ocamlbuild" url "https://github.com/ocaml/ocamlbuild/archive/0.14.0.tar.gz" sha256 "87b29ce96958096c0a1a8eeafeb6268077b2d11e1bf2b3de0f5ebc9cf8d42e78" head "https://github.com/ocaml/ocamlbuild.git" bottle do ...
34.5
114
0.764771
33d6cf38ca54f76a4d9c611bf8279cf088bf5a02
4,938
require "spec_helper" require "httpi/adapter/httpclient" require "httpi/request" HTTPI::Adapter.load_adapter(:httpclient) describe HTTPI::Adapter::HTTPClient do let(:adapter) { HTTPI::Adapter::HTTPClient.new(request) } let(:httpclient) { HTTPClient.any_instance } let(:ssl_config) { HTTPClient::SSLConfig.any_...
28.056818
89
0.663832