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 |
|---|---|---|---|---|---|
d516b6f3a52f9bc22f394c34e8b58914f362418e | 170 | class AddOpenAccessNotificationTimestampToUsers < ActiveRecord::Migration[5.2]
def change
add_column :users, :open_access_notification_sent_at, :datetime
end
end
| 28.333333 | 78 | 0.817647 |
33f4a12156e93c69d4bb62a31ced93eb9214fa7c | 1,861 | require 'vagrant-mutagen-project/action/start_mutagen_project'
require 'vagrant-mutagen-project/action/pause_mutagen_project'
require 'vagrant-mutagen-project/action/resume_mutagen_project'
require 'vagrant-mutagen-project/action/terminate_mutagen_project'
require 'yaml'
module VagrantPlugins
module MutagenProject
... | 37.979592 | 101 | 0.728641 |
330c6f6bdf28c435dabc2d6e422ec761aca56295 | 1,332 | Pod::Spec.new do |s|
s.name = "Action"
s.version = "3.4.0"
s.summary = "Abstracts actions to be performed in RxSwift."
s.description = <<-DESC
Encapsulates an action to be performed, usually by a button press, but also useful to pass actions to execute later
(once or multiple times) with... | 44.4 | 135 | 0.663664 |
6239f14399873ca156cdd28dd4d03c56f11b7535 | 12,737 | # frozen-string-literal: true
module Sequel
class Database
# ---------------------
# :section: 1 - Methods that execute queries and/or return results
# This methods generally execute SQL code on the database server.
# ---------------------
COLUMN_SCHEMA_DATETIME_TYPES = [:date, :datetime].freeze... | 34.991758 | 163 | 0.629426 |
263c988290ab4de1f15c109aee139c177ca760d7 | 1,204 | module PuppetMetadata
class AIO
COMPATIBLE = {
'AlmaLinux' => 'RedHat',
'Amazon' => 'RedHat',
'CentOS' => 'RedHat',
'OracleLinux' => 'RedHat',
'Rocky' => 'RedHat',
'Scientific' => 'RedHat',
}
BUILDS = {
# RPM-based
'RedHat' => {
... | 20.066667 | 69 | 0.339701 |
390846e02d9ea7be56badc7d82f7e54a89101e9e | 5,251 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Network::Mgmt::V2018_02_01
module Models
#
# Response for ApplicationGatewayAvailableSslOptions API service call.
#
class Ap... | 32.81875 | 85 | 0.463721 |
f8a1ebace9ab1d8be68781ad07f22f8e92324535 | 737 | # # config/initializer/elasticsearch.rb
# config = {
# transport_options: { request: { timeout: 5 } },
# }
# if File.exist?("config/elasticsearch.yml")
# template = ERB.new(File.new("config/elasticsearch.yml").read)
# processed = YAML.safe_load(template.result(binding))
# config.merge!(processed[Rails.env].sym... | 43.352941 | 148 | 0.746269 |
21704223c4f2028e4bcf5016b9ea586b13c5a867 | 9,801 | =begin
#The Plaid API
#The Plaid REST API. Please see https://plaid.com/docs/api for more details.
The version of the OpenAPI document: 2020-09-14_1.40.3
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.1.0
=end
require 'date'
require 'time'
module Plaid
# Specify the list of investment... | 30.628125 | 322 | 0.61708 |
4a51f4b6b79e6e818a995dad49fab910e819c13c | 1,677 | class Libtrng < Formula
desc "Tina's Random Number Generator Library"
homepage "https://www.numbercrunch.de/trng/"
url "https://www.numbercrunch.de/trng/trng-4.22.tar.gz"
sha256 "6acff0a6136e41cbf0b265ae1f4392c8f4394ecfe9803bc98255e9e8d926f3d8"
license "BSD-3-Clause"
bottle do
cellar :any
sha256 "b... | 28.913793 | 97 | 0.707812 |
87ffde393c2a8d6990af9d604c1b938d8f6dd5a9 | 3,327 | describe "time conversions" do
it "NSDate and Time should agreee on minutes since epoch" do
t = Time.new
d = NSDate.dateWithTimeIntervalSince1970(t.to_f)
t.to_f.should == d.timeIntervalSince1970
end
it "Parsing '3/18/12 @ 7:00 PM' With Natural Language should work right" do
NSDate.dateWithNatural... | 31.093458 | 145 | 0.65284 |
1d9bab6e1ee3c9a0023b0669d5142a92eb48370d | 713 | require 'chef/resource/lwrp_base'
class Chef
class Resource
# oc_id_application resource
class OcIdApplication < Chef::Resource::LWRPBase
resource_name :oc_id_application
actions :create
default_action :create
attribute :name, kind_of: String, name_attribute: true
attribute :r... | 29.708333 | 77 | 0.660589 |
bf9552fd99bfa12ecb0201ef04d7bfa11cfc1fa4 | 7,780 | #
# Cookbook:: rsyslog
# Attributes:: default
#
# Copyright:: 2009-2015, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | 51.184211 | 147 | 0.613239 |
e9fa200613e6b8c9d4b43398987729a50d48ab6d | 93 | class AddTs < ActiveRecord::Migration[5.0]
def change
add_timestamps :scores
end
end
| 15.5 | 42 | 0.731183 |
bf931740b9fec864daac8be0fbaba20a9e2e5def | 495 | class SessionsController < ApplicationController
def new
end
def create
user = User.find_by_name(params[:session][:name])
if !user.active
flash.now[:error] = 'Banned user'
render 'new'
elsif user && user.authenticate(params[:session][:password])
sign_in user
redirect_back_or ... | 20.625 | 65 | 0.664646 |
18f5effcb49b6f9abb90d8b782412a95c8c65b6e | 1,007 | require 'test_helper'
class UsersSignupTest < ActionDispatch::IntegrationTest
test 'invalid signup information' do
get signup_path
assert_no_difference 'User.count' do
post users_path, user: { name: '', email: 'user@invallid',
password: 'foo',
... | 33.566667 | 79 | 0.569017 |
e294f0efd314f159f277f9399d0b729de8881fad | 1,265 | class CodeMinimap < Formula
desc "High performance code minimap generator"
homepage "https://github.com/wfxr/code-minimap"
url "https://github.com/wfxr/code-minimap/archive/v0.6.0.tar.gz"
sha256 "6f67ed03b33863186c4811b1c8acc6b0cc9c6c63f2bd5b54dbf703f7fc561711"
license any_of: ["Apache-2.0", "MIT"]
bottle ... | 42.166667 | 122 | 0.772332 |
3328854e56b9f6dc59cc743db823d19e62d15973 | 5,130 | =begin
Swagger Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
OpenAPI spec version: 1.0.0
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
License: Apach... | 28.5 | 157 | 0.626316 |
5d15e24caebb00044a4e218ad4a9f3bb30648877 | 502 | module SpeechProperty
def render_speech(value)
type_of_creation = if preset
preset
else
type
end
render_prop = {
french: "une #{type_of_creation} vient d'être créée",
english: "a #{type_of_creation} jus... | 27.888889 | 70 | 0.551793 |
7a23d3807fa35184a22c6f826e336fbd582558e2 | 2,130 | # frozen_string_literal: true
###
# == Panacea::Rails::Template
#
# Template passed to the rails new command.
#
# If you want more information about what's happening you can read Panacea::Rails::Generator docs.
require "yaml"
require_relative "generator"
###
# Panacea's Installation directory
ROOT_DIR = File.expand_... | 36.101695 | 98 | 0.821127 |
f7052198c367b0c42448a77f2d9764d0557540bf | 204 | class SpeechPart
include Mongoid::Document
belongs_to :lang
has_many :meanings
has_and_belongs_to_many :labels
field :code, type: String
field :name, type: String
index({code: 1})
end
| 12.75 | 33 | 0.720588 |
393c1fcf8a1e1a30c4583820bd63d76550586945 | 3,521 | # frozen_string_literal: true
require 'rails_helper'
describe 'rendering a post action share page' do
let(:liquid_layout) { create :liquid_layout }
let(:post_action_share_layout) { create :liquid_layout, :post_action_share_layout }
let!(:page) { create :page, follow_up_liquid_layout: post_action_share_layout }
... | 41.423529 | 103 | 0.733598 |
18c64bcd7a73a498b3a34ddc32de8d4b328c5e70 | 472 | cask 'fontplop' do
version '1.3.0'
sha256 '0ada8c9040bb3da489965b917990f6d88da23c8fec5602f798c91db7e2aafb0e'
# github.com/matthewgonzalez/fontplop was verified as official when first introduced to the cask
url "https://github.com/matthewgonzalez/fontplop/releases/download/v#{version}/fontplop-#{version}.dmg"
... | 36.307692 | 105 | 0.78178 |
7a58ccd4545cb5237b19b99675e304b7415d04ef | 430 | # 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::CustomerInsights::Mgmt::V2017_04_26
module Models
#
# Defines values for FrequencyTypes
#
module FrequencyTypes
Minute... | 21.5 | 70 | 0.655814 |
214603a5e39eb017126cced6e2b8c7220108dab9 | 2,115 | #
# Be sure to run `pod lib lint VerticalCardSwitcher.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = ... | 49.186047 | 390 | 0.696927 |
5d8c08a7c40bbff9336c270f8fde2557942a2f3b | 280 | class CreateUserBadges < ActiveRecord::Migration[6.0]
def change
create_table :user_badges do |t|
t.references :user, null: false, foreign_key: true
t.references :badge, null: false, foreign_key: true
t.datetime :date
t.timestamps
end
end
end
| 23.333333 | 57 | 0.682143 |
26fb35a8af04b9a49459dfc6b92850dd179b2873 | 115 | #todo multimodelsearch
class SearchController < ApplicationController
include RocketCMS::Controllers::Search
end
| 23 | 46 | 0.852174 |
f73be03e763fc24eaf6a577580c4570ad1992137 | 1,369 | class Jansson < Formula
desc "C library for encoding, decoding, and manipulating JSON"
homepage "http://www.digip.org/jansson/"
url "http://www.digip.org/jansson/releases/jansson-2.12.tar.gz"
sha256 "5f8dec765048efac5d919aded51b26a32a05397ea207aa769ff6b53c7027d2c9"
bottle do
cellar :any
sha256 "3f11c... | 33.390244 | 94 | 0.687363 |
1c51a4c4f465e138b8a732f69ae4bb6d6b201352 | 513 | class Admin::AddressesController < Admin::BaseController
def edit
@address = Address.find(params[:id])
render :layout => 'admin_blank'
end
def update
@address = Address.find(params[:id])
@address.update_attributes(params.permit![:address])
if @address.save
flash[:notice] = "Address sav... | 25.65 | 106 | 0.647173 |
ffe77091af3a3529d2c0eef2e35d5da73a342be8 | 82 | Gravatarify.options[:default] = 'identicon'
Gravatarify.options[:secure] = true
| 27.333333 | 44 | 0.756098 |
62f4c4a59feb3185ecf1440427598a34e2fb78a3 | 12,380 | 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 is" do
it do
array1 = described_class.new(criteria, node.sort_hash).to_a
array2 = criteria.order_by(node.sort_hash).to_a
... | 40.194805 | 129 | 0.6437 |
628eb29009c0273b906887b9fd705576ce6eb9b3 | 920 | class UpdatesParser
def initialize(update_paths)
@update_paths = update_paths
end
def call
update_file_paths_to_hash(@update_paths)
end
private
def update_file_paths_to_hash(update_paths)
updates_by_date = {}
update_paths.each do |update_path|
path, name, date_array = process_update... | 29.677419 | 103 | 0.679348 |
6abca6957a89d7ad42776f1b1f7d6f55e62d249d | 7,836 | # frozen_string_literal: true
# This module is included by all {WCC::Contentful::Model models} and defines instance
# methods that are not dynamically generated.
#
# @api Model
module WCC::Contentful::ModelMethods
include WCC::Contentful::Instrumentation
# The set of options keys that are specific to the Model la... | 36.446512 | 99 | 0.623788 |
6a5557e96a6e1ade8650bf218a8af1194fc10f13 | 9,716 | # frozen_string_literal: true
RSpec.describe 'Adding a work to multiple collections', type: :feature, js: true do
include Selectors::Dashboard
let(:admin_user) { create(:admin, email: 'admin@example.com') }
let(:single_membership_type_1) { create(:collection_type, :not_allow_multiple_membership, title: 'Single-me... | 48.824121 | 175 | 0.684438 |
f716ba6a6215937bee434329942306cfaa91d2fe | 2,404 | require 'adwords_api/v201101/MediaService'
require 'adwords_api/v201101/MediaServiceMappingRegistry'
require 'soap/rpc/driver'
module AdwordsApi
module V201101
module MediaService
class MediaServiceInterface < ::SOAP::RPC::Driver
DefaultEndpointUrl = "https://adwords.google.com/api/adwords/cm/v201101/MediaService"
... | 37.5625 | 217 | 0.660982 |
e993f38850504bda0589c045e60ff365af78e798 | 1,688 | # frozen_string_literal: true
require 'digest'
module Fawry
module Requests
module PaymentStatusRequest
def fire_payment_status_request
fawry_api_response = Connection.get(request[:path], request[:params], request[:body], request[:options])
response_body = JSON.parse(fawry_api_response.bod... | 29.103448 | 118 | 0.677133 |
aca363f78cdafa5862ae608ff4223c4d59a7b86f | 1,720 | class Qmmp < Formula
desc "Qt-based Multimedia Player"
homepage "https://qmmp.ylsoftware.com/"
url "https://downloads.sourceforge.net/project/qmmp-dev/qmmp/1.5/qmmp-1.5.1.tar.bz2"
sha256 "f3dc676039b5f190e6a87377a6b2bd2bcca122d1659b5f22668c7a284bb91f43"
license "GPL-2.0-or-later"
head "https://svn.code.sf.n... | 29.152542 | 90 | 0.68314 |
e91304e91d36b5a3f5bf9f3752defb7936be2d50 | 188 | class RemoveEnabledInUsers < ActiveRecord::Migration[5.2]
def up
remove_column :users, :enabled
end
def down
add_column :users, :enabled, :boolean, default: false
end
end
| 18.8 | 57 | 0.718085 |
01815bec43494aa27456701d516cf9bf214703af | 369 | # 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_06_01
module Models
#
# Defines values for VerbosityLevel
#
module VerbosityLevel
Normal = "Normal"
Minimum =... | 21.705882 | 70 | 0.680217 |
394969801bea37accb422eb411156703d3d51078 | 2,953 | # frozen_string_literal: true
require "spec_helper"
RSpec.describe FancyCount::CounterCacheable do
with_model :SuperHero do
# The table block (and an options hash) is passed to Active Record migration’s `create_table`.
table do |t|
t.string :name
t.timestamps null: false
end
# The model... | 25.456897 | 98 | 0.706739 |
61b43669ca2e941ebe50512aed376c609a0f8701 | 1,410 | # 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... | 34.390244 | 74 | 0.771631 |
38058e1e9ca968fb2c2989cc71ac4d01a25ff432 | 1,434 | # $Id$
# collect template definitions
require 'common'
require 'messages'
require 'pathname'
class Templates
include Common
include Messages
$FORMATS = Hash.new
def initialize
# default template directory
systempdir = findTemplateDir()
owntempdir = File.join(findConfigDir(), 'templates')
[... | 25.607143 | 68 | 0.518131 |
bfa3b992a7acfdef09db79e4c28d112da638b7a5 | 152 | require 'spec_helper'
describe GeneralDetailReportQbxml do
describe GeneralDetailReportQbxml::Query do
it_behaves_like 'queryable'
end
end
| 15.2 | 45 | 0.796053 |
39f487c48cced9e9a3c57973550ef2302ff02a06 | 27 | module BackpacksHelper
end
| 9 | 22 | 0.888889 |
3861ad493da02b010875e1faa8e7ddb21434bb87 | 4,113 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Vulnerabilities::CreateService do
before do
stub_licensed_features(security_dashboard: true)
end
let_it_be(:user) { create(:user) }
let(:project) { create(:project) } # cannot use let_it_be here: caching causes problems with permission-re... | 34.855932 | 119 | 0.702407 |
5da289e32762f7790a2f03c148354d4e6f6ab421 | 63 | class RememberToken < ApplicationRecord
belongs_to :user
end
| 15.75 | 39 | 0.825397 |
b96e5654cf02b6aab4a398e850a6d4fbeec96944 | 1,199 | require_relative 'lib/better_cli/version'
Gem::Specification.new do |s|
s.name = 'better_cli'
s.version = BetterCli::VERSION
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
s.require_paths = ['lib']
s.authors = ['Benjamin Smith']
s.date = '2017-12-26... | 34.257143 | 213 | 0.687239 |
87e48826f703503435542768b2a89ac311fa803e | 606 | cask 'itunes-volume-control' do
version '1.6.6'
sha256 '6256c424b8c815ba1d9f50c91869c8a161db202ff0d4fc6573d9d896da5b3a65'
# uni-bonn.de/alberti/iTunesVolumeControl was verified as official when first introduced to the cask
url "http://quantum-technologies.iap.uni-bonn.de/alberti/iTunesVolumeControl/iTunesVolum... | 37.875 | 115 | 0.788779 |
87a0b7d3a614788c3f01aadd84f6f0be35d047b5 | 1,021 | module Jekyll
class ArchivePage < Page
def initialize(site, base, dir, name = nil, layout = nil)
@site = site
@base = base
@dir = dir
@name = name || 'index.html'
@layout = layout || 'archive_index.html'
self.process(@name)
self.read_yaml(File.join(@base, '_layo... | 27.594595 | 70 | 0.60333 |
fff060c9640fee947d282b4be729b90885c39daa | 475 | module Fog
module Brightbox
class Compute
class Real
def get_cloud_ip(identifier, options = {})
return nil if identifier.nil? || identifier == ""
request(
:expects => [200],
:method => 'GET',
:path => "/1.0/cloud_ips/#{identifier}",
... | 23.75 | 64 | 0.48 |
ff75636887998cf280c849200569301eb80c3829 | 675 | $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "authentication/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "authentication"
s.version = Authentication::VERSION
s.authors = ["Marco Damaceno"]
s.email ... | 30.681818 | 85 | 0.644444 |
39f7a5b1d765e5d7d47d30e6870255ec7f7db884 | 1,657 | class MeetingInvitationMailer < ActionMailer::Base
include EmailHeaderHelper
include ApplicationHelper
helper ApplicationHelper
def invite meeting, member
@member = member
@meeting = meeting
@host_address = AddressDecorator.new(@meeting.venue.address)
@rsvp_url = meeting_url(@meeting)
sub... | 30.127273 | 106 | 0.706699 |
21b18226e5023f8356641812fe892c6ef8964746 | 1,359 | cask 'owasp-zap' do
version '2.6.0'
sha256 'ed8f58c07bee746439879649a3b13bd7bffbccd6b1163c335f5eb0711ec3563d'
# github.com/zaproxy/zaproxy was verified as official when first introduced to the cask
url "https://github.com/zaproxy/zaproxy/releases/download/#{version}/ZAP_#{version.dots_to_underscores}_macos.dmg... | 38.828571 | 143 | 0.61663 |
acf6e8335dc4c7d9c8f860a334fae9222f50d0e8 | 1,653 | class Genotype < ApplicationRecord
belongs_to :gene
has_many :cards
has_many :users, :through => :cards
validates :allele1, length: {is: 1}
validates :allele2, length: {is: 1}
validates :allele1, :allele2, presence: true
validates :title, presence: true, uniqueness: true
def repute_gradient
case re... | 26.238095 | 111 | 0.594676 |
e90989a00b64dee9edcfbf6df84e34a33acfa07b | 7,616 | #!/usr/bin/env rspec
require 'spec_helper'
provider_class = Puppet::Type.type(:user).provider(:pw)
describe provider_class do
let :resource do
Puppet::Type.type(:user).new(:name => "testuser", :provider => :pw)
end
describe "when creating users" do
let :provider do
prov = resource.provider
... | 37.517241 | 118 | 0.664653 |
7a68d94ccfca3b030f04e4c6eee6826d81faec06 | 4,026 | # frozen_string_literal: true
require "delegate"
require "http/response/status/reasons"
module HTTP
class Response
class Status < ::Delegator
class << self
# Coerces given value to Status.
#
# @example
#
# Status.coerce(:bad_request) # => Status.new(400)
#... | 26.486842 | 99 | 0.520119 |
5d27d053df2130eb56409adbf144669989104b74 | 712 | require_relative "../canvas_base_mutation"
require_relative "../../types/canvas/enrollment"
module LMSGraphQL
module Mutations
module Canvas
class ReActivateEnrollment < BaseMutation
argument :course_id, ID, required: true
argument :id, ID, required: true
field :enr... | 27.384615 | 83 | 0.578652 |
d5479e7099ff3e5c2d38fd373a576195e8af33c6 | 2,282 | # frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "active_support/notifications"
require "kafka"
require "dotenv"
require "logger"
require "rspec-benchmark"
require "colored"
require "securerandom"
require 'snappy'
require 'extlz4'
Dotenv.load
LOGGER = Logger.new(ENV.ke... | 24.021053 | 94 | 0.71078 |
18cfff383a43dba11a949ca72877b9aaa913ecf6 | 528 | # frozen_string_literal: true
class PostSerializerTest < ActiveSupport::TestCase
test "it serializes the post's title" do
post = posts(:first_post)
serializer = PostSerializer.new(post)
assert_equal('First Post', serializer.serializable_hash.dig(:data, :attributes, :title))
end
test "it serializes... | 26.4 | 102 | 0.723485 |
3353fbb556c08fc2acf07490fcbd8712d37ba856 | 1,298 | # minecraft_status_handler.rb
#
# Author:: Kyle Mullins
require_relative 'minecraft/minecraft_status_client'
class MinecraftStatusHandler < CommandHandler
feature :minecraft, default_enabled: true
command(:mcserver, :show_url)
.feature(:minecraft).no_args.usage('mcserver')
.description('Posts the addres... | 30.186047 | 137 | 0.735747 |
7a3c3eb1173d47094622997843f4679d153b0c87 | 157 | class AddIsEditableToSiteSettings < ActiveRecord::Migration[6.0]
def change
add_column :site_settings, :is_editable, :boolean, default: true
end
end
| 26.166667 | 68 | 0.77707 |
e29be255289a5e92b65ccfaedfcd706867812186 | 5,153 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe API::Clusters::Agents do
let_it_be(:agent) { create(:cluster_agent) }
let(:user) { agent.created_by_user }
let(:unauthorized_user) { create(:user) }
let!(:project) { agent.project }
before do
project.add_maintainer(user)
end
descr... | 33.461039 | 115 | 0.674753 |
f86f187bfa6858f0793e03195bf7c5061f8900bb | 319 | class RosterUpload < ActiveRecord::Base
FetchFailed = Class.new StandardError
belongs_to :uploader, class_name: "User"
belongs_to :country
validates_presence_of :uploader, :country, :body
def roster
@_roster ||= Roster.from_csv(body, country: country)
end
def fetched?
body.present?
end
end
| 18.764706 | 56 | 0.727273 |
08235e656e065e69b237d1992288826c7fdac244 | 468 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Course::Assessment::Question::VoiceResponse, type: :model do
let(:instance) { Instance.default }
with_tenant(:instance) do
subject { Course::Assessment::Question::VoiceResponse.new }
describe '#question_type' do
it 'returns correct ... | 29.25 | 110 | 0.732906 |
d51f1a1b3ad11928faeea7b90dff08ebee4dba2f | 446 | # frozen_string_literal: true
module FindSnippet
extend ActiveSupport::Concern
include Gitlab::Utils::StrongMemoize
private
# rubocop:disable CodeReuse/ActiveRecord
def snippet
strong_memoize(:snippet) do
snippet_klass.inc_relations_for_view.find_by(id: snippet_id)
end
end
# rubocop:enabl... | 17.84 | 66 | 0.757848 |
9109d54134cf54bf9a2c4779220db361114ce89c | 1,793 | class Uftp < Formula
desc "Secure, reliable, efficient multicast file transfer program"
homepage "https://uftp-multicast.sourceforge.io/"
url "https://downloads.sourceforge.net/project/uftp-multicast/source-tar/uftp-4.9.3.tar.gz"
sha256 "9e9215af0315257c6cc4f40fbc6161057e861be1fff10a38a5564f699e99c78f"
bottl... | 33.203704 | 106 | 0.691021 |
9124264882c6000d9556c836b72d567fea1eb483 | 959 | module Awspec::Type
class RdsDbClusterParameterGroup < Base
def resource_via_client
return @resource_via_client if @resource_via_client
parameters = {}
res = rds_client.describe_db_cluster_parameters({
db_cluster_parameter_group_name: @dis... | 27.4 | 102 | 0.593326 |
7afc61ce6bdbf40719e802c8338e3a298adf56dd | 10 | t(:bar_2)
| 5 | 9 | 0.6 |
ab9bb8b28c38d4001b9722821f3c939411768b1f | 2,570 | require 'spec_helper'
RSpec.describe JekyllHtmlTruncatewords do
it "has a version number" do
expect(JekyllHtmlTruncatewords::VERSION).not_to be nil
end
it "works as a Liquid template" do
input = "<p>This is a sentence with more than 5 words.</p>"
liquid = "{{ '#{input}' | html_truncatewords: 5, '~!'... | 31.341463 | 122 | 0.610895 |
08141c85c7e952473a239525cee9da5d85caf6c2 | 152 | After('@unmount_after') do
# unmount, no harm done if not mounted
in_current_dir do
`fusermount -u encrypted_destination_folder 2>&1`
end
end
| 21.714286 | 53 | 0.736842 |
4aedb5b52c8a2f56f3a028c384d24f86ecd705f9 | 467 | require 'svn'
version=<<"---"
=begin
Copyright (C) 2008 Sam Roberts
This library is free software; you can redistribute it and/or modify it
under the same terms as the ruby language itself, see the file COPYING for
details.
=end
module Vpim
PRODID = '-//Ensemble Independent//vPim 0.#{Svn.info['Revision']}/... | 17.961538 | 76 | 0.685225 |
6ad9b9e5bcea40bb441c49a60c5375cf939a9081 | 23 | module SlabsHelper
end
| 7.666667 | 18 | 0.869565 |
1d68ec7b14d190016efd62c25cddc70b6ed3d2e8 | 146 | # frozen_string_literal: true
ActiveRecord::Schema.define do
create_table :data_migrations do |t|
t.string :version, null: false
end
end
| 18.25 | 38 | 0.753425 |
f89d0393b2e89383c2c30712839c64c5971bd761 | 435 | # frozen_string_literal: true
# Parser for https://factual.afp.com, subclass of AFP's parser
require_relative('afp')
class AFPFactuel < AFP
include PaginatedReviewClaims
def hostname
'https://factuel.afp.com'
end
def parse_raw_claim_review(raw_claim_review)
parsed = super(raw_claim_review)
parsed[... | 24.166667 | 101 | 0.749425 |
d59c9ae7913a45cfa10ea408e7e31c1dfac40f9f | 298 | require 'rails_helper'
describe Case::SAR::OffenderPolicy do
subject { described_class }
let(:user) { create :branston_user }
permissions :can_record_data_request? do
it { should permit(user, create(:offender_sar_case)) }
it { should_not permit(user, create(:sar_case)) }
end
end
| 24.833333 | 58 | 0.728188 |
4a12471d6550e47b86e34859b4c85a7cc2b1cd21 | 1,178 | # frozen_string_literal: true
require_relative '../../services/sendgrid'
RSpec.describe Sendgrid, '#deliver' do
it 'delivers email for given fields' do
sendgrid = Sendgrid.new(api_key: '123abc')
stub_sendgrid(
response_body: '',
status: 200,
)
response_code, response_body = sendgrid.del... | 25.06383 | 74 | 0.632428 |
1c79138a30fee215ba3ad961bf16237c16888b41 | 1,317 | require_relative 'boot'
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "active_storage/engine"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_mailbox/engine"
require "action_text/en... | 34.657895 | 82 | 0.779043 |
282f5ff3528356edf9a606c4d9fdeef97a4549a0 | 133 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'bit_attrs'
require 'minitest/autorun'
require 'mocha/mini_test'
| 22.166667 | 58 | 0.759398 |
4a64f5a95bf60812f220927e706cf109c859792a | 134 | require 'test_helper'
class LearningRelationshipTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 16.75 | 56 | 0.731343 |
624a4cc3741addca61a45406aacd998403c9d7bf | 345 | cask "font-londrina-outline" do
version :latest
sha256 :no_check
url "https://github.com/google/fonts/raw/master/ofl/londrinaoutline/LondrinaOutline-Regular.ttf",
verified: "github.com/google/fonts/"
name "Londrina Outline"
homepage "https://fonts.google.com/specimen/Londrina+Outline"
font "Londrina... | 28.75 | 99 | 0.756522 |
184f7f666ae595d524d7e00ebe0b418840e8d886 | 892 | require "formula"
# dub generates version information from git, when building.
# To not break this, we provide a custom download strategy.
class DubHeadDownloadStrategy < GitDownloadStrategy
def stage
@clone.cd {reset}
safe_system "git", "clone", @clone, "."
end
end
class Dub < Formula
homepage "http://... | 24.777778 | 87 | 0.716368 |
33f17b54c1b3005455af47504748ec164a031690 | 342 | class Contact < ActiveRecord::Base
belongs_to :estado
validates :nombre, presence: true, :length => {:in => 3..20}
validates :mensaje, presence: true, :length => {maximum: 300}
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, :uniqueness => true, format: { with: VAL... | 31.090909 | 93 | 0.649123 |
5d686c4d7f8522ce2e25da84d46ba9286c4f245a | 386 |
module Pointsable
require "pointsable/engine"
require "pointsable/acts_as_pointsable"
require "pointsable/pointsable_helper"
class Railtie < Rails::Railtie
initializer "include acts_as_pointsable within ActiveRecord" do
ActiveSupport.on_load(:active_record) do
ActiveRecord::Base.send(:inc... | 27.571429 | 72 | 0.746114 |
18e3c31c515d2c8b31f380ccdbe34146f484cbf1 | 1,789 | # 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... | 34.403846 | 112 | 0.734489 |
792738afd1a7d932c59870c08bd23f0015d9d9cd | 187 | json.array!(@stops) do |stop|
json.id stop.id
json.on_street stop.on_street.titlecase
json.cross_street stop.cross_street.titlecase
json.stop_id stop.stop_id
end | 31.166667 | 47 | 0.71123 |
915c8a73f5e8ac9ced40f2cb33f57471f57f1944 | 39 | module VineApp
VERSION = "0.0.1"
end
| 9.75 | 19 | 0.666667 |
39f5a6cb99677599ea705bbadd6ee41b3342ee69 | 20,061 | class Import::Neptune < Import::Base
include LocalImportSupport
def self.accepts_file?(file)
::Neptune::Source.accept?(file)
rescue => e
Chouette::Safe.capture "Error in testing Neptune file: #{file}", e
return false
end
def steps_count
# does not account for create_referential and save_curr... | 37.012915 | 231 | 0.713823 |
6a8da87dfa54e0f60095ee8f29649651e4cc0507 | 1,356 | module EquationSolver
@@normalize_mappings = {"dependentVariable" => "dependent",
"independentVariable" => "independent",
"integrationMethod" => "method",
"upperBound" => "upper_bound",
"lowerBound" => "lower_boun... | 28.25 | 102 | 0.624631 |
03de40d92ec5bf104c01cb1bc6659bc217865e4b | 1,976 | # 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::ContainerRegistry::Mgmt::V2018_09_01
module Models
#
# The platform properties against which the run has to happen.
#
class ... | 27.444444 | 77 | 0.517713 |
e8c7f9622a9f278d79efa3295dfd378273f8ac87 | 3,046 | # frozen_string_literal: true
class MembersFinder
attr_reader :project, :current_user, :group
def initialize(project, current_user)
@project = project
@current_user = current_user
@group = project.group
end
def execute(include_descendants: false, include_invited_groups_members: false)
project... | 33.108696 | 152 | 0.72587 |
bf04fa09461f225946dbd09500c27600f87b7a54 | 417 | require "rails_helper"
describe EventsController do
let(:user) { create(:user) }
let(:event) { create(:event, user: user) }
before :each do
sign_in user
end
describe "GET #index" do
before { get :index }
it { is_expected.to render_template("index") }
end
describe "GET #show" do
before ... | 19.857143 | 50 | 0.642686 |
213a325e4d190ff3d797d1fd538f99e9cbe6f58e | 140 | require 'spec_helper'
describe 'graphite::graphite_carbon' do
describe process('carbon-cache') do
it { should be_running }
end
end
| 17.5 | 39 | 0.735714 |
d561e83760483f6ef70bdd9b48e3f8140c4722fb | 4,100 | require 'will_paginate/array'
require 'spec_helper'
describe WillPaginate::Collection do
before :all do
@simple = ('a'..'e').to_a
end
it "should be a subset of original collection" do
@simple.paginate(:page => 1, :per_page => 3).should == %w( a b c )
end
it "can be shorter than per_page if on last... | 29.285714 | 87 | 0.666341 |
621c2dc24077a73f44dcba811950f6bbfb1dc617 | 2,283 | chef_gem 'chef-helpers'
require 'chef-helpers'
indexer = tagged?('logstash-indexer') ? node : search(:node, 'tags:logstash-indexer').first
raise "Can't find a Logstash indexer" unless indexer
if node['logstash']['shipper']['input'] && !node['logstash']['shipper']['input'].empty?
include_recipe 'logstash_stack::_co... | 37.42623 | 166 | 0.650898 |
ff2e29502c45efa2b39937d7a223d5f12f86237c | 3,319 | EarthdataSearchClient::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
config.eager_load = true
# Full error reports are disabled and caching is turned on
config.consider_all_re... | 37.715909 | 111 | 0.754745 |
87ba1aba9a6c420bdb9ad16c5ae4a16feb2f86e3 | 264 | require File.expand_path('../../../../../spec_helper', __FILE__)
describe "OpenSSL::X509::Revoked#serial" do
it "needs to be reviewed for spec completeness"
end
describe "OpenSSL::X509::Revoked#serial=" do
it "needs to be reviewed for spec completeness"
end
| 26.4 | 64 | 0.723485 |
39d610a7924dba524eff0ab851a5997f53c89082 | 79 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'doc_2_pdf'
| 26.333333 | 58 | 0.734177 |
794994533eab82ca44496db991d28c922e629fe3 | 6,773 | #
# Author:: Prajakta Purohit (<prajakta@opscode.com>)
# Copyright:: Copyright (c) 2008 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
#... | 38.482955 | 107 | 0.701166 |
1a9308bda08dbad5e6606f832868eb5591f3af2a | 3,599 | require 'spec_helper'
module Bosh::Cli
describe PublicStemcells, vcr: { cassette_name: 'promoted-stemcells' } do
subject(:public_stemcells) { PublicStemcells.new }
describe '#has_stemcell?' do
it { is_expected.to have_stemcell('bosh-stemcell-1001-aws-xen-ubuntu.tgz') }
it { is_expected.not_to ha... | 44.9875 | 94 | 0.594054 |
6a234eb03be190742f41a7f6cdbcd56c75e1ebab | 2,011 | # encoding: utf-8
# The Insertion class inserts a value before or after another
# value in a list.
#
# @example
# Insertion.new([1, 2, 3], 4).before(3) # => [1, 2, 4, 3]
class Insertion
# Creates an insertion object on a list with a value to be
# inserted. To finalize the insertion, call {#before} or
# {#after... | 31.920635 | 92 | 0.657384 |
266286cbaddd9a9c35ebdb290d73765b321c4928 | 107 | FactoryGirl.define do
factory :episode_type do
sequence(:name) { |n| "episode_type_#{n}" }
end
end
| 17.833333 | 47 | 0.682243 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.