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 |
|---|---|---|---|---|---|
e825093059d3f86e96914aeeac62ad7e03262d48 | 206 | class AddSubmittedAtToEvaluation < ActiveRecord::Migration
def self.up
add_column :evaluations, :submitted_at, :datetime
end
def self.down
remove_column :evaluations, :submitted_at
end
end
| 20.6 | 58 | 0.76699 |
08161ad1c6ec89bceb410fb921610365705392e8 | 362 | if defined?(ActiveRecord)
module ActiveRecord
module ConnectionAdapters
class ConnectionPool
def force_new_connection
old_lock = @lock_thread
@lock_thread = nil
with_connection do |conn|
yield conn
end
ensure
@lock_thread = old_lo... | 21.294118 | 35 | 0.582873 |
bbc2648228a027f57dc8d8a9809c062e7136808a | 44 | # Add your variables here
first_number(x,y)
| 14.666667 | 25 | 0.772727 |
5df2b7c32d6f6783515ed84ee0b74baa48910551 | 846 | # frozen_string_literal: true
FactoryBot.define do
factory :project_repository_storage_move, class: 'ProjectRepositoryStorageMove' do
container { association(:project) }
source_storage_name { 'default' }
trait :scheduled do
state { ProjectRepositoryStorageMove.state_machines[:state].states[:sched... | 28.2 | 93 | 0.732861 |
6a2fbfce9ec550184264f4b740b97ce5fc5c54eb | 1,636 | # Encoding: UTF-8
require "gosu"
WIDTH, HEIGHT = 640, 480
class Welcome < (Example rescue Gosu::Window)
PADDING = 20
def initialize
super WIDTH, HEIGHT
self.caption = "Welcome!"
text =
"<b>Welcome to the Gosu Example Box!</b>
This little tool lets you launch any of Gosu’s example game... | 27.266667 | 122 | 0.651589 |
389c9ca51a4e42cb033d052467e83ce6e6764b14 | 99 | # frozen_string_literal: true
# Defines the gem version.
module SlimLint
VERSION = '0.20.2'
end
| 14.142857 | 29 | 0.737374 |
180d785d4d9774bf0668a52964bba2197514a7dc | 1,172 | module SimpleApiAuth
class Request
attr_accessor :headers, :http_verb, :query_string, :uri, :body, :original
def initialize(options = {})
assign_options(options)
@normalizer = SimpleApiAuth.config.request_normalizer.new
@header_field = SimpleApiAuth.config.request_fields[:headers]
sel... | 26.636364 | 77 | 0.670648 |
088b85dd5da4fa1e6ee497bfd48c1c033b2ed312 | 1,386 | # frozen_string_literal: true
class MigrateNullPackageFilesFileStoreToLocalValue < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
JOB_INTERVAL = 2.minutes + 5.seconds
BATCH_SIZE = 5_000
MIGRATION = 'SetNullPackageFilesFileStoreToLocalValue'
disable_ddl_transactio... | 31.5 | 83 | 0.726551 |
ac56237b53ab37893f57216ede1c3b79e3e404ea | 233 | class TrialOrderSelectionMapping < ApplicationRecord
belongs_to :trial_order, :foreign_key => "trial_order_id"
belongs_to :user, :foreign_key => "user_id"
belongs_to :phase_definition, :foreign_key => "phase_definition_id"
end
| 38.833333 | 69 | 0.793991 |
f747abdf58f71b7a364a0831f9780c01a5db041b | 387 | class CreateProducts < ActiveRecord::Migration
def self.up
create_table :products do |t|
t.integer :category_id, :vendor_id
t.float :unit_price, :null => false
t.string :description, :name, :null => false
t.integer :status, :product_type, :default => 0, :null => false
t.timestamps... | 24.1875 | 69 | 0.648579 |
3923cfca0e5fb5c875e4dcf02d19c6f26750a3b4 | 2,050 | require 'rails_vue_js_spec_helper'
require_relative "../support/test_controller"
require_relative "support/form_test_controller"
require_relative "support/model_form_test_controller"
include VueJsSpecUtils
describe "Form Component", type: :feature, js: true do
before :all do
class DelayFormTestController < Form... | 29.710145 | 108 | 0.648293 |
b906c0156fd7db7894e8c4124483d37110d5f9d5 | 863 | require 'spec_helper'
RSpec.describe 'Uniswap integration specs' do
let(:client) { Cryptoexchange::Client.new }
let(:dai_eth_pair) { Cryptoexchange::Models::MarketPair.new(base: 'dai', target: 'eth', market: 'uniswap') }
it 'fetch pairs' do
pairs = client.pairs('uniswap')
expect(pairs).not_to be_empty
... | 26.96875 | 110 | 0.692932 |
082a4d47a7fad3d1183ab57188362aa74e5ef660 | 1,831 | # frozen_string_literal: true
describe Facter::Resolvers::DMIComputerSystem do
let(:logger) { instance_spy(Facter::Log) }
before do
win = double('Facter::Util::Windows::Win32Ole')
allow(Facter::Util::Windows::Win32Ole).to receive(:new).and_return(win)
allow(win).to receive(:return_first).with('SELECT... | 32.122807 | 115 | 0.703441 |
038de5c18e5d3cf8f61c6c6b419ba0aba25d713c | 19,037 | require 'spec_helper_min'
require 'support/helpers'
require 'helpers/feature_flag_helper'
require 'spec_helper'
class TestFirewallManager
@rules = {}
@config = nil
class <<self
attr_reader :rules, :config
attr_writer :config
end
def initialize(config)
@config = config
TestFirewallManager.con... | 34.177738 | 107 | 0.636602 |
626d44ba0a20a4d3c9396408cd933e4c73a42f1a | 628 | require 'rails_helper'
require 'ruby_prof'
module RailsProbe
module Printers
RSpec.describe GraphText do
let(:result) { double('result') }
let(:report) { double('report') }
let(:action) { double('action') }
subject { described_class.new(result, report, action) }
describe '::PRINTE... | 23.259259 | 66 | 0.611465 |
187376b9c32a65fad749c6fc2f8abff28b1d8b1a | 59 | module Mobb
module Redis
VERSION = '1.0.0'
end
end
| 9.833333 | 21 | 0.627119 |
91d65d521c5be5be18110285b4a3b0ef815e0fcb | 20,586 | =begin
#NSX-T Manager API
#VMware NSX-T Manager REST API
OpenAPI spec version: 2.5.1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.19
=end
require 'date'
module NSXT
# Represents a Label-Value widget configuration
class LabelValueConfiguration
# Link to ... | 35.554404 | 508 | 0.642816 |
21d828523ed3922e30e1be2f8bfd5426703874d5 | 1,491 | #
# mutex_m.rb -
# $Release Version: 3.0$
# $Revision: 1.7 $
# Original from mutex.rb
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
# modified by matz
# patched by akira yamada
#
# --
# Usage:
# require "mutex_m.rb"
# obj = Object.new
# obj.extend Mutex_m
# ...
# extended object can be handle... | 16.206522 | 53 | 0.652582 |
7a400005aec8d55bec89146116b700daea685556 | 1,606 | # frozen_string_literal: true
require 'test_helper'
class UsersSignupTest < ActionDispatch::IntegrationTest
test 'unsuccessful signup create new user' do
get signup_path
assert_no_difference 'User.count' do
post signup_path, params: { user: { name: '',
email: '... | 37.348837 | 91 | 0.5934 |
61e504b3c7443949a99b9faec5dc8c5bda80c5a6 | 315 | # frozen_string_literal: true
require "rails_helper"
module Renalware
describe System::Country, type: :model do
it :aggregate_failures do
is_expected.to validate_presence_of(:name)
is_expected.to validate_presence_of(:alpha2)
is_expected.to validate_presence_of(:alpha3)
end
end
end
| 22.5 | 50 | 0.752381 |
389d6f08f65184acf903808bacc8c5680d2c540f | 285 | class StaticPagesController < ApplicationController
def home
if logged_in?
@micropost = current_user.microposts.build
@feed_items = current_user.feed.paginate(page: params[:page])
end
end
def help
end
def about
end
def contact
end
end
| 14.25 | 67 | 0.673684 |
e29f740760b761820a636addf09a529902fbb3cb | 6,183 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe JabberAdmin do
describe '.configuration' do
it 'return a new instance of JabberAdmin::Configuration' do
expect(described_class.configuration).to be_a(JabberAdmin::Configuration)
end
it 'memorizes the configuration instance' do
... | 32.542105 | 79 | 0.617014 |
ff7df439805ae185cb29f8998c57f2747e71e5aa | 4,502 | # This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause this
# file to always be loaded, without a need to explicitly require it in any files.... | 44.574257 | 129 | 0.742781 |
088a3897d58c4aa82d4557ebedd0330371763aee | 9,727 | require_relative "../../aws_refresher_spec_common"
require_relative "../../aws_refresher_spec_counts"
describe ManageIQ::Providers::Amazon::CloudManager::Refresher do
include AwsRefresherSpecCommon
include AwsRefresherSpecCounts
before(:each) do
@ems = FactoryGirl.create(:ems_amazon_with_vcr_authentication,... | 36.430712 | 145 | 0.599157 |
ab56d726d45054beabea4f89af72bf9c042e467b | 1,500 | # frozen_string_literal: true
require "hanami/devtools/integration/files"
require "hanami/devtools/integration/with_tmp_directory"
RSpec.shared_context "Application integration" do
let(:application_modules) { %i[TestApp Main] }
end
RSpec.configure do |config|
config.include RSpec::Support::Files, :application_in... | 32.608696 | 86 | 0.762667 |
019e156a56d428ae79add12d720d58a7f24f7b3f | 2,158 | # Copyright (C) The Arvados Authors. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
if not File.exist?('/usr/bin/git') then
STDERR.puts "\nGit binary not found, aborting. Please install git and run gem build from a checked out copy of the git repository.\n\n"
exit
end
git_dir = ENV["GIT_DIR"]
git_wo... | 39.962963 | 137 | 0.648749 |
624c2a489330af8bf8c55bff32db818db99e0d2d | 3,323 | require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/methods', __FILE__)
describe "Time#+" do
it "increments the time by the specified amount" do
(Time.at(0) + 100).should == Time.at(100)
end
it "is a commutative operator" do
(Time.at(1.1) + 0.9).should == Tim... | 32.262136 | 77 | 0.643395 |
2856cc9a7e5f29530022d61d95ee7deeeaa4ab80 | 540 | require 'spotify_client'
class SpotifyClient
RESULT_SIZE = 5
def initialize
@client = Spotify::Client.new
end
def search_track(search_string)
results_for(search_string).map do |result|
{
id: result.fetch('id'),
artist: result.fetch('artists').first['name'],
track: result... | 18.62069 | 54 | 0.616667 |
33c1be954ffb35b5a5c084b45c2eb69d2a78c7aa | 794 | require File.dirname(__FILE__) + '/memcache_server_test_helper'
class MemcacheNativeServerTest < Test::Unit::TestCase
include MemcacheServerTestHelper
include MemcacheServerTestHelper::AdvancedMethods
with_prefixes nil, "foo:", "bar:"
PORTS = [11212, 11213, 11214, 11215, 11216]
def setup
init_memcache(*... | 24.060606 | 82 | 0.680101 |
e29276270eb7cf98635a0b93464599d2cfbea7e9 | 33,847 | class Person
include Config::AcaModelConcern
include Config::SiteModelConcern
include Mongoid::Document
include SetCurrentUser
include Mongoid::Timestamps
include Mongoid::Versioning
include Mongoid::Attributes::Dynamic
include SponsoredBenefits::Concerns::Ssn
include SponsoredBenefits::Concerns::Dob
... | 35.590957 | 215 | 0.699176 |
e8c163010f8ebdd25a35caf41ca47a354815848d | 145 | # AbstractExpression: 命令・抽象的な表現
class Expression
def |(other)
Or.new(self, other)
end
def &(other)
And.new(self, other)
end
end
| 13.181818 | 31 | 0.655172 |
7af84b39077e5fbeabe6402ef64abaab2fec4a09 | 7,500 | require 'spec_helper'
module Pageflow
describe VideoFilesHelper do
describe '#mobile_poster_image_div' do
it 'has default css classes' do
html = helper.mobile_poster_image_div
expect(html).to have_selector('div.background.background_image')
end
context 'no poster' do
i... | 32.051282 | 111 | 0.639867 |
7a0052d536bbeddc5af04e6dcd90936ac34c062a | 1,457 | Gem::Specification.new do |s|
s.name = 'logstash-output-s3'
s.version = '4.3.3'
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 |
b953a7fbcf08490dd36088d937d0be81e63bd3be | 270 | Rails.application.routes.draw do
namespace :api do
resources :images do
resources :comments
end
end
resources :comments
resources :images
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end
| 19.285714 | 102 | 0.72963 |
87b3bf596ed4fe695d330c2c84bb07da1d950de2 | 139 | # Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_tripify_session'
| 34.75 | 77 | 0.805755 |
7ab890d457ed2d008147ea424a7bf52cbf82606a | 2,516 | # 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... | 34.465753 | 95 | 0.713434 |
b9a5b03fc9e56b49f1765a66e3c734e090b7ec6f | 592 | # frozen_string_literal: true
module Importer
module Factory
extend ActiveSupport::Autoload
eager_autoload do
autoload :ObjectFactory
autoload :StringLiteralProcessor
autoload :ConferenceItemFactory
autoload :DatasetFactory
autoload :GenericWorkFactory
autoload :JournalAr... | 23.68 | 68 | 0.716216 |
7ad3eea8704f8aca258c998a6e3ea2c5dd0c3526 | 116 | require 'rails_helper'
module CannedMeat
RSpec.describe SubscriptionsController, type: :controller do
end
end
| 14.5 | 62 | 0.801724 |
18dffb31a75a1388164ca41b8fb94f7ccd4a3786 | 963 | # frozen_string_literal: true
# Copyright (c) 2018 Continental Automotive GmbH
#
# 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 req... | 31.064516 | 74 | 0.719626 |
e845b72976a5a5e2f413a3238b59aa3ebe7a86f8 | 5,410 | # encoding: utf-8
require 'spec_helper'
require 'backgrounder/workers/store_asset'
RSpec.describe CarrierWave::Workers::StoreAsset do
let(:fixtures_path) { File.expand_path('../fixtures/images', __FILE__) }
let(:worker_class) { CarrierWave::Workers::StoreAsset }
let(:user) { double('User') }
let!(:worker) { wo... | 39.202899 | 102 | 0.669316 |
abea50ccb76b960237f058fa02111629ebee5c9e | 837 | module MetricFu
class Roodi < Generator
def self.verify_dependencies!
`roodi --help`
raise 'sudo gem install roodi # if you want the roodi tasks' unless $?.success?
end
def emit
files_to_analyze = MetricFu.roodi[:dirs_to_roodi].map{|dir| Dir[File.join(dir, "**/*.rb")] }
@out... | 26.15625 | 98 | 0.572282 |
ff4b154ed183826bdb7146ca90d5b1d2c02ad441 | 8,592 | ##
# 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 = ExcellentRanking
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::EXE
def initialize(... | 31.704797 | 154 | 0.561918 |
ff0d338b4805b1802286afcc6830bfe1a9b21427 | 28,083 | #
# Author:: Nimisha Sharad (<nimisha.sharad@msystechnologies.com>)
# Copyright:: Copyright (c) Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the... | 44.294953 | 185 | 0.619592 |
4a48a735b382382fb8073d0d5f10859743c1b26a | 8,035 | run "if uname | grep -q 'Darwin'; then pgrep spring | xargs kill -9; fi"
# GEMFILE
########################################
inject_into_file 'Gemfile', before: 'group :development, :test do' do
<<~RUBY
gem 'devise'
gem 'autoprefixer-rails', '10.2.5'
gem 'font-awesome-sass'
gem 'simple_form'
RUBY
... | 30.551331 | 222 | 0.581207 |
397cd210703e8ce4aa1cb121d1dbca4c63e45f32 | 1,701 | file '/tmp/dummy.key' do
content <<EOF
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.14 (GNU/Linux)
mQENBFr5hf8BCACzqYz7Hz0Bg1f9kba0PKTXSTEY7Tjq1HNJL36n5gURzq0487vo
ueqzRLI2LMqcnxBeHC1M4TSe+6BJHzAQZwe6n18zMVvOJCVm2ffJXc+cmKkxSYow
AmhkYCiN1gHVAZ54E+9TWPatbEnnggaa10h1hC6+nyQXED5pJrCahRjvxDjP+R5b
AgamvRsBFZG... | 36.191489 | 64 | 0.843034 |
79a61cff2c1eada4fb2bd7c29b30897181f0447c | 1,854 | require_relative '../../../../test_helper'
module Troo
module Commands
describe Show do
let(:described_class) { Show }
let(:klass) { stub(type: :resource_type) }
let(:id) {}
let(:type) { :card }
let(:id) { '1' }
let(:default) ... | 27.264706 | 58 | 0.516181 |
f75bd642e10957c9580a2c5a090ddf6aa12d53b4 | 209 | class CreateBookMarks < ActiveRecord::Migration
def change
create_table :book_marks do |t|
t.string :name
t.string :url
t.string :note
t.timestamps null: false
end
end
end
| 17.416667 | 47 | 0.650718 |
bf3ceeb039aeb604d08d5091fcb3f9dc8f671e78 | 682 | # frozen_string_literal: true
module Strings
module Fold
LINE_BREAK = "(\r\n+|\r+|\n+|\t+)".freeze
# Fold a multiline text into a single line string
#
# @example
# fold("\tfoo \r\n\n bar") # => "foo bar"
#
# @param [String] text
#
# @param [String] separator
# the separa... | 24.357143 | 80 | 0.530792 |
f72e3e9454d613331a5afd38765e6a1883398adc | 1,712 | # Copyright © 2020 MUSC Foundation for Research Development~
# All rights reserved.~
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:~
# 1. Redistributions of source code must retain the above copyright notice, this list o... | 65.846154 | 146 | 0.794393 |
1afb151bcba03d80d9241a451ec46da2d3a24116 | 1,367 | # 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::Compute::Mgmt::V2018_06_01
module Models
#
# Describes the parameters of ephemeral disk settings that can be specified
# for ope... | 27.34 | 79 | 0.58376 |
e96decb27f4457cae4ee2d317e2cda6aa78f50aa | 725 | MRuby.each_target do
current_dir = File.dirname(__FILE__)
relative_from_root = File.dirname(__FILE__).relative_path_from(MRUBY_ROOT)
current_build_dir = "#{build_dir}/#{relative_from_root}"
self.libmruby_objs << objfile("#{current_build_dir}/mrblib")
file objfile("#{current_build_dir}/mrblib") => "#{current... | 38.157895 | 108 | 0.686897 |
d580ae87dcc8fdcecbefc141145ba16a5c62b968 | 1,287 | class Lesspipe < Formula
desc "Input filter for the pager less"
homepage "https://www-zeuthen.desy.de/~friebel/unix/lesspipe.html"
url "https://downloads.sourceforge.net/project/lesspipe/lesspipe/1.82/lesspipe-1.82.tar.gz"
sha256 "3fd345b15d46cc8fb0fb1d625bf8d881b0637abc34d15df45243fd4e5a8f4241"
bottle do
... | 34.783784 | 95 | 0.72805 |
33d0159553a776a1e8a457d3d97f16993fbe539c | 100 | # frozen_string_literal: true
module Authentication
end
require 'authentication/subject_receiver'
| 14.285714 | 41 | 0.85 |
217240d5525a35969a42da66372b3ff5c735cbfa | 173 | Rails.application.config.content_security_policy do |policy|
policy.connect_src :self, :http, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
end
| 43.25 | 107 | 0.774566 |
f7e2bb2256559a6ee9f83473d06f07379529d6ef | 1,100 | require("pry")
class Train
attr_writer(:train_name)
def initialize(attributes)
@train_name = attributes.fetch(:train_name)
end
def self.all
returned_trains = DB.exec("SELECT * FROM train;")
trains = []
returned_trains.each() do |train|
name = train.fetch("name")
train_id = train.fet... | 26.829268 | 104 | 0.623636 |
e25d42626b91b67298f961f38c5610806c33052f | 825 | #
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'file_chooser'
s.version = '0.0.1'
s.summary = 'Displays macOS open and save panels.'
s.description = <<-DESC
Displays macOS open and save panels.
... | 35.869565 | 117 | 0.602424 |
6231b1199af5919c254e7b339079d8e618cb2097 | 34,810 | # frozen_string_literal: true
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 58.113523 | 477 | 0.576271 |
e90244f982379afff5911ddbc4e2e79f968964a5 | 1,558 | # ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be ... | 45.823529 | 116 | 0.629012 |
e900d05d5a3c173bf7eaec8f259983da01244727 | 938 | # frozen_string_literal: false
require File.expand_path('spec_helper', __dir__)
module Danger
describe Danger::DangerTinyPNG do
it "should be a plugin" do
expect(Danger::DangerTinyPNG.new(nil)).to be_a Danger::Plugin
end
describe "with Dangerfile" do
before do
@dangerfile = testing_... | 31.266667 | 193 | 0.684435 |
e8790cf01ab4d1ac85198ad0598befed08c8f393 | 354 | # Copyright:: Copyright 2021 Trimble Inc.
# License:: The MIT License (MIT)
# This is raised whenever a method attempts to modify any {Layout::Entity}
# that resides on a locked {Layout::Layer}, or when attempting to change the
# shared attribute of a locked {Layout::Layer}.
#
# @version LayOut 2018
class Layout::Lock... | 29.5 | 76 | 0.751412 |
b941f0306bb837bace7627179a503bf3f3879a21 | 5,355 | Pod::Spec.new do |s|
s.name = 'FirebaseRemoteConfig'
s.version = '8.7.0'
s.summary = 'Firebase Remote Config'
s.description = <<-DESC
Firebase Remote Config is a cloud service that lets you change the
appearance and behavior of your app without requiring users to download an
... | 43.893443 | 117 | 0.689823 |
280e463e7ae84989f247e02ca9cedc080128669d | 656 | require File.join(Rails.root, "app", "data_migrations", "change_suffix_person")
# This rake task is to change the name suffix of a person
# RAILS_ENV=production bundle exec rake migrations:change_suffix_person hbx_ids='19760877 19776645 19747772 19758664 19776417 18941825 19766429 19761376 19753221 19762647 19775694 19... | 93.714286 | 386 | 0.844512 |
620da247161a4af823d2842799fe39c2bb4f236e | 134 | class UpdateStoryType < ActiveRecord::Migration[6.1]
def change
Story.where(type: nil).update_all(type: 'MediaStory')
end
end
| 22.333333 | 57 | 0.738806 |
391873187effb1109fa1fa8aaa78f8c322c25845 | 2,952 | require_relative 'spec_helper'
#noinspection RubyStringKeysInHashInspection
describe Appium::Tutorial do
attr_reader :tutorial_root, :tutorial, :first_module_gen
def expect_gen_exists boolean
exists = exist? first_module_gen
expect(exists).to eq(boolean)
end
def expect_html_exists boolean
exists ... | 24.396694 | 77 | 0.719173 |
262a56bfe5a64c2d4efd51ddb40248186f054e81 | 708 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Course::LevelNotifier, type: :notifier do
let!(:instance) { Instance.default }
with_tenant(:instance) do
describe '#level_reached' do
let(:course) { create(:course) }
let(:level) { create(:course_level, course: course) }
let... | 28.32 | 72 | 0.663842 |
62237a7d5978be7e546830a6f40aa9697c66689c | 1,973 | #
# Author:: Patrick Collins (<pat@burned.com>)
# Copyright:: Copyright (c) 2013 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | 30.828125 | 84 | 0.651799 |
1aaae40a682766f7a259807d4e45b7853b7922cf | 6,728 | # 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... | 31.148148 | 111 | 0.676873 |
4ab93975d3d5e85791c39e6e33ac74dbc66c0b53 | 3,743 | # frozen_string_literal: true
module V0
class DisabilityCompensationFormsController < ApplicationController
before_action { authorize :evss, :access? }
before_action :validate_name_part, only: [:suggested_conditions]
def rated_disabilities
response = service.get_rated_disabilities
render jso... | 34.33945 | 120 | 0.717606 |
2675f03917bf79932898420f96c0bcb3e3eba372 | 153 | actions :run
default_action :run
attribute :node_ip, :kind_of => String, :name_attribute => true
attribute :port, :kind_of => Integer, :default => 27017 | 30.6 | 63 | 0.738562 |
f8c9900104332ce8f3228c5cbadbc0ee3ed914b3 | 4,071 | # 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.261364 | 129 | 0.749693 |
1d50450c26f3928b43f1e914d975588afd37639f | 2,316 | require 'rails_helper'
RSpec.describe CandidateInterface::GcseEnicForm do
describe 'validations' do
let(:form) { subject }
let(:qualification_data) do
{
enic_reference: '12345',
comparable_uk_qualification: 'GCSE (grades A*-C / 9-4)',
}
end
it { is_expected.to validate_p... | 34.567164 | 103 | 0.708117 |
ace37466bc4a027fb6bf206389c1d3f2ff833cb3 | 9,381 | # encoding: UTF-8
require 'spec_helper'
describe CloudModel::ItemIssue do
it { expect(subject).to have_timestamps }
it { expect(subject).to have_field(:title).of_type String }
it { expect(subject).to have_field(:message).of_type String }
it { expect(subject).to have_field(:key).of_type String }
it { expect... | 33.503571 | 190 | 0.683296 |
ab9ac5f9669b8138197895d53dec9f9ae983485f | 556 | class UserMailer < ApplicationMailer
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.user_mailer. account_activation.subject
#
def account_activation(user)
@user = user
mail to: user.email, subject: "Account activation"
end
# Subject can be... | 24.173913 | 65 | 0.703237 |
5d4a6062e66ae41e8312e629cafc897e5acda44c | 2,339 | # frozen_string_literal: false
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic ... | 29.2375 | 116 | 0.64643 |
2660d281fcf83eb169afd979550cba36c780bd91 | 218 | str = "Now I need a drink, alcoholic of course, after the heavy lectures involving quantum mechanics."
splited_str = str.split(/\s|,\s*|;\s*|\.\s*/)
splited_str.each do |word|
# puts word
puts word.size
end
| 21.8 | 102 | 0.674312 |
4a8a74904d23a5aa198871e5aa40535e8007ab65 | 2,124 | class Tomcat < Formula
desc "Implementation of Java Servlet and JavaServer Pages"
homepage "https://tomcat.apache.org/"
stable do
url "https://www.apache.org/dyn/closer.cgi?path=tomcat/tomcat-8/v8.0.30/bin/apache-tomcat-8.0.30.tar.gz"
mirror "https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.30/bin/ap... | 31.701493 | 124 | 0.693503 |
79cad68118741258a41a2270602e598fcb4e81e9 | 1,869 |
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "Dark_Library/version"
Gem::Specification.new do |spec|
spec.name = "Dark_Library"
spec.version = DarkLibrary::VERSION
spec.authors = ["Ilovaiskyi Valery"]
spec.email = ["avi... | 43.465116 | 96 | 0.678438 |
f85d3ade364af77713db64d335d9eebb17f94303 | 398 | module Mongoid
module Token
module Finders
def self.define_custom_token_finder_for(klass, field_name = :token)
klass.define_singleton_method(:"find_by_#{field_name}") do |token|
if token.is_a?(Array)
self.in field_name.to_sym => token
else
self.find_by fie... | 24.875 | 74 | 0.613065 |
6a258c3ac5a6a47ba4fe185a3bf004f3ff102f2f | 1,921 | # frozen_string_literal: true
module Spree::Image::PaperclipAttachment
extend ActiveSupport::Concern
included do
validate :no_attachment_errors
has_attached_file :attachment,
styles: { mini: '48x48>', small: '400x400>', product: '680x680>', large: '1200x1200>' },
... | 34.303571 | 147 | 0.684019 |
91a335cd504658eae717a81fd8cfed44bc7a299b | 842 | # frozen_string_literal: true
module AutoDevopsHelper
def show_auto_devops_callout?(project)
Feature.disabled?(:auto_devops_banner_disabled) &&
show_callout?('auto_devops_settings_dismissed') &&
can?(current_user, :admin_pipeline, project) &&
project.has_auto_devops_implicitly_disabled? &&
... | 28.066667 | 71 | 0.748219 |
01323be37f16b429116f16b6cbe1fe43d8ef3efe | 194 | def image_fixture_file
@image_fixture_file ||= File.open(Rails.root.join('test/fixtures/minister-of-funk.960x640.jpg'))
end
Dir[Rails.root.join('test/factories/*.rb')].each { |f| require f }
| 32.333333 | 98 | 0.737113 |
4a5556725895a92376adf06a653f8f7720a03053 | 2,852 | # frozen_string_literal: true
require "search"
module Cask
class Cmd
# Abstract superclass for all `brew cask` commands.
#
# @api private
class AbstractCommand
include Homebrew::Search
def self.min_named
nil
end
def self.max_named
nil
end
def se... | 22.456693 | 88 | 0.539972 |
f8b25a0438e50bd4baba11d2044ef35c64af18ba | 299 | require 'rails_helper'
RSpec.describe StoryText, type: :model do
it "has a limit on the story cache field" do
s = StoryText.new
s.body = "Z" * 16_777_218
s.valid?
expect(s.errors[:body]).to eq([I18n.t('activerecord.errors.models.story_text.attributes.body.too_long')])
end
end
| 24.916667 | 109 | 0.695652 |
1a69eb0b7a8e919ad0d204d4d03f761633fcdd17 | 952 | property :git_url, String
use 'common_properties'
action_class do
include Asdf::Cookbook::Helpers
def plugin_installed?
::Dir.exist?("#{asdf_path}/plugins/#{new_resource.name}")
end
def plugin_can_be_updated?
new_resource.name == '--all' || new_resource.name != '--all' && plugin_installed?
end
end... | 23.8 | 85 | 0.740546 |
1a33d33fa377073b7f490383d9d0d2fe5c43f5da | 524 | namespace :db do
namespace :mongoid do
desc 'Migrate the documents specified by criteria. criteria is optional'
task :lazy_migrate, [:criteria] => :environment do |t, args|
criteria = args.criteria ? eval(args.criteria) : nil
Mongoid::LazyMigration.migrate(criteria)
end
desc 'Cleanup a mi... | 32.75 | 76 | 0.692748 |
62565e86ea47b48ee0dd7503834dac9e78c6ae71 | 174 | class AppsController < InheritedResources::Base
authorize_resource
private
def app_params
params.require(:app).permit(:name, :url, :description)
end
end
| 15.818182 | 60 | 0.718391 |
bbd2dc293b4538dbb4dd654f875038eba383dcd6 | 2,558 | require 'spec_helper'
RSpec.describe Mysql2::Instrumentation do
describe "Class Methods" do
it { should respond_to :instrument }
end
let (:tracer) { OpenTracingTestTracer.build }
before do
Mysql2::Instrumentation.instrument(tracer: tracer)
# prevent actual client connections
allow_any_instan... | 27.804348 | 100 | 0.622752 |
ff37f1d33329adf604e7a5dd761ce70377b62dbb | 397 | require 'sms_tools/version'
require 'sms_tools/encoding_detection'
require 'sms_tools/gsm_encoding'
if defined?(::Rails) and ::Rails.version >= '3.1'
require 'sms_tools/rails/engine'
end
module SmsTools
class << self
def use_gsm_encoding?
@use_gsm_encoding.nil? ? true : @use_gsm_encoding
end
de... | 19.85 | 55 | 0.715365 |
bb3f67fc5d4e3d91900f470769552f4862aae0bd | 79 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'extrapost'
| 26.333333 | 58 | 0.734177 |
e9e6585c15f28af1009d67edcb3e85820bb115ae | 746 | Before do
# As of 2017-10-30 it appears that tests do not complete in linux environments
# if an element is not visible on the page. This should not be a problem and
# cannot be replicated locally when running on OSX, however has been confirmed
# in our AWS environments and on local Ubuntu machines.
# Therefo... | 46.625 | 80 | 0.739946 |
1a8d9c8174e9130bf5be8915e198bb1b4366abd6 | 16,439 |
# Controller responsible for providing login and logout processes
# as well as displaying main page
class MainController < ApplicationController
include ApplicationHelper, MainHelper
protect_from_forgery with: :exception, except: [:login, :page_not_found]
# check for authorization
before_action :author... | 35.736957 | 191 | 0.673946 |
2179311b0d1636cefeb6925fa7c42f37b8111613 | 2,501 | module Gql::Runtime
# ATTENTION: use :: namespace
# Rubel::Base inherits from BasicObject. This means we don't have
# access to the default namespace, so prepend classes and modules
# with ::.
class Debug < Rubel::Runtime::Console
attr_reader :scope
def initialize(scope = nil)
@scope = scope
... | 23.157407 | 96 | 0.555778 |
39489b77e8bb4041216c1d50c68f0aee4294943d | 1,728 | require 'set'
module Makefile
MACRO_REF_PATTERN = %r!
\$ (?:
\(
(?<paren> [^:)]+ ) (?: :(?<paren_subst>[^=]+) = (?<paren_substval>[^)]*) )?
\) |
{
(?<brace> [^:}]+ ) (?: :(?<brace_subst>[^=]+) = (?<brace_substval>[^}]*) )?
} |
(?<single> [^({] )
)
!x
# An... | 27 | 83 | 0.5625 |
b9408fa6f3ffc5c9e3e9c75426155180c379a03e | 8,704 | require 'active_support/concern'
module DuckMap
##################################################################################
# This module has a single purpose. To declare a class-level attribute using the Rails class_attribute method.
# Also, we are using ActiveSupport::Concern and the included block. ... | 47.824176 | 165 | 0.633617 |
08636561e48e31273a53cfc7306e85783b566d26 | 351 | class JobsController < ApplicationController
def index
@store = STORE
@crashes = CRASHES
end
def crashing
CrashingJob.new.async.perform
redirect_to jobs_path
end
def single
SingleJob.new.async.perform
redirect_to jobs_path
end
def multiple
MultipleJob.new.async.perform
r... | 15.954545 | 44 | 0.723647 |
21d7373dedafca90843c038fcb773ede4e2bd0ac | 83 | ActsAsTaggableOn.force_lowercase = true
ActsAsTaggableOn.strict_case_match = false
| 27.666667 | 42 | 0.879518 |
919c1d274a975d24094d61d654ba77e5bd8eef01 | 2,894 | #
# 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
# distributed under ... | 28.372549 | 101 | 0.628542 |
79c0c501c1a9dfb819095247fd1cbbbabe6e8ac9 | 74 | module DefineRails
module SensitiveData
VERSION = "1.0.1"
end
end
| 12.333333 | 22 | 0.702703 |
e243bc68fdc91582484d4f9d590f2243cef26e14 | 287 | require 'webrick'
include WEBrick
s = HTTPServer.new(
:Port => 2010,
:DocumentRoot => Dir::pwd
)
s.mount('/sh/scripts', WEBrick::HTTPServlet::FileHandler, '../scripts')
s.mount('/sh/styles', WEBrick::HTTPServlet::FileHandler, '../styles')
trap('INT') { s.stop }
s.start
| 23.916667 | 72 | 0.648084 |
181d43d1d41b11071bf093915ada4a037e997c12 | 270 | module WidgetsInc
module Types
class ValidatedOrderLine < ::Dry::Struct
attribute :order_line_id, Types.Instance(Types::OrderLineId)
attribute :product_code, Types::ProductCode.type
attribute :quantity, Types::OrderQuantity.type
end
end
end | 30 | 66 | 0.737037 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.