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 |
|---|---|---|---|---|---|
61d2ba03b2b3d13fbbc210da97c24b0913afac89 | 40,510 | # 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... | 52.61039 | 168 | 0.547741 |
1ad8aff0cd231d842de20572af7227ea52a85961 | 446 | module Lumos
module Formatters
class Bottom < Lumos::Formatters::Base
def initialize(options = {})
super
@padding = options.fetch(:padding, 0).to_i.abs
end
def result
"#{iterate_chopped_lines{ |line| "#{content_paragraph(line)}\n" }}"\
"#{horizontal_padding}"\
... | 19.391304 | 76 | 0.578475 |
26e92ccaa65433a6795b4f7e045593b41173fd1f | 253 | class User < ApplicationRecord
enum role: { user: 0, admin: 1 }
has_many :quizzes, dependent: :destroy
has_many :user_answers
has_secure_password
validates :firstname, presence: true
validates :email, presence: true, uniqueness: true
end
| 21.083333 | 52 | 0.743083 |
abb43d8abafc0f5464dd83a272c886edfbdd3500 | 2,017 | # frozen_string_literal: true
class GildedRose
def initialize(items)
@items = items
end
def update_quality
@items.each do |item|
if different_from_brie_and_backstage?(item.name)
item.quality = first_validation(item)
elsif quality_less_than_fifty?(item.quality)
second_validati... | 22.411111 | 81 | 0.667824 |
39a36753f534510c77399c2fe8e9f8bc4a523c9d | 15,901 | # frozen_string_literal: true
module GraphQL
module Execution
# Lookahead creates a uniform interface to inspect the forthcoming selections.
#
# It assumes that the AST it's working with is valid. (So, it's safe to use
# during execution, but if you're using it directly, be sure to validate first.)
... | 40.46056 | 180 | 0.628388 |
38a770d8e2fc0a8a455fe200c9045bc7b3492ae5 | 286 | require 'rails_helper'
describe 'Destroy paper action', type: :feature do
let(:paper) { FactoryBot.create :paper }
before { visit paper_path(paper) }
it 'removes the paper from the database' do
expect { click_link 'Delete paper' }.to change(Paper, :count).by(-1)
end
end
| 23.833333 | 72 | 0.702797 |
d57993ab454003d545328765b749aeeffb3d0ab8 | 54,726 | require 'spec_helper'
describe API::Runner, :clean_gitlab_redis_shared_state do
include StubGitlabCalls
include RedisHelpers
let(:registration_token) { 'abcdefg123456' }
before do
stub_feature_flags(ci_enable_live_trace: true)
stub_gitlab_calls
stub_application_setting(runners_registration_token:... | 35.398448 | 129 | 0.565874 |
ac09e7da9255dfb71210eaf4b6274002afa893e3 | 705 | require 'spec_helper'
describe Smtp2go::Smtp2goBaseException do
it { expect(described_class).to be Smtp2go::Smtp2goBaseException }
end
describe Smtp2go::Smtp2goAPIKeyException do
it { expect(described_class).to be < Smtp2go::Smtp2goBaseException }
it "raises a salient exception message" do
exception = desc... | 28.2 | 70 | 0.764539 |
870c3093ac5dba6e62cf5582547473dfd65256ca | 397 | dir = Pathname(__FILE__).dirname.expand_path / 'types'
require dir / 'boolean'
require dir / 'discriminator'
require dir / 'text'
require dir / 'paranoid_datetime'
require dir / 'paranoid_boolean'
require dir / 'object'
require dir / 'serial'
unless defined?(DM)
DM = DataMapper::Types
end
module DataMapper
modul... | 19.85 | 54 | 0.740554 |
e88de652373157c6be597c03c2634185d58c39a8 | 2,081 | class Earthly < Formula
desc "Build automation tool for the container era"
homepage "https://earthly.dev/"
url "https://github.com/earthly/earthly/archive/v0.5.17.tar.gz"
sha256 "1dcc56b419413480fa2e116606cab2c8003483e0b8052443aa7b7da0572ce47f"
license "BUSL-1.1"
head "https://github.com/earthly/earthly.git... | 39.264151 | 139 | 0.730899 |
ac064157ed461ce5b3111467e1e88929b9e6c24b | 2,314 | =begin
#TransferZero API
#Reference documentation for the TransferZero API V1
OpenAPI spec version: 1.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.0.0-beta3
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for TransferZero::PoliticallyExposedPerson
# Automatical... | 27.547619 | 102 | 0.724287 |
035d50c960935fb8f7bef09380b31693e780bd4a | 1,376 | require_relative 'spec_helper'
describe 'openstack-network::plugin_config' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
node.override['openstack']['network']['plugins']['ml2'].tap do |ml2|
ml2['path'] = '/etc/... | 30.577778 | 106 | 0.574128 |
d50f1aa1dd8bb3c8e0acf919b829cf12547fb6af | 10,772 | # frozen_string_literal: true
require('spec_helper')
RSpec.describe Projects::Settings::CiCdController do
let_it_be(:user) { create(:user) }
let_it_be(:project_auto_devops) { create(:project_auto_devops) }
let(:project) { project_auto_devops.project }
before do
project.add_maintainer(user)
sign_in(u... | 30.954023 | 137 | 0.640457 |
01d51502da244599ffe03755c0bcf2b51948657b | 515 | # frozen_string_literal: true
module GraphqlDevise
module Mutations
class Logout < Base
def resolve
if current_resource && client && current_resource.tokens[client]
current_resource.tokens.delete(client)
current_resource.save!
remove_resource
yield current_... | 22.391304 | 72 | 0.656311 |
626e58f87c1fb8da36f47990766aea93718867f3 | 77,324 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
require 'seahorse/client/plugins/content_length.rb'
require 'aws-sdk-core/plug... | 45.726789 | 407 | 0.68063 |
1cf7e19e1868754d4611abb040fe0e4f0b10ba9d | 839 | # Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
# Add Yarn node_modules ... | 46.611111 | 96 | 0.764005 |
918534d9e3c46e2306fc7ba8c6067ae1a3a60b99 | 396 | require "serverkit/resources/base"
module Serverkit
module Resources
class Service < Base
attribute :name, required: true, type: String
# @note Override
def apply
run_command_from_identifier(:start_service, name)
end
# @note Override
def check
check_command_f... | 19.8 | 70 | 0.671717 |
3875db1ff4b0cbc8221a2ee478907faa058d60af | 103 | require 'rails_helper'
describe 'the test' do
it 'is a success' do
expect(1).to eq(1)
end
end
| 12.875 | 22 | 0.660194 |
918e96202d88c059d38f40a4c5862d45f4fd624e | 651 | cask "keep-it" do
version "1.9.3"
sha256 "803afba6a2c178d59c39f80244875009e6605d8b6c75a609f9cb1fa85f38b476"
url "https://reinventedsoftware.com/keepit/downloads/KeepIt_#{version}.dmg"
appcast "https://reinventedsoftware.com/keepit/downloads/keepit.xml"
name "Keep It"
desc "Notebook, scrapbook and organizer... | 29.590909 | 77 | 0.741935 |
d58b953333c170259390568aa48f2163147dafbe | 1,211 | control "PHTN-10-000095" do
title "The Photon operating system must be configured so that the x86
Ctrl-Alt-Delete key sequence is disabled on the command line."
desc "When the Ctrl-Alt-Del target is enabled, locally logged-on user who
presses Ctrl-Alt-Delete, when at the console, can reboot the system. If
accident... | 31.051282 | 77 | 0.738233 |
f71d74d3bb308420571664385faf9f139a4361d8 | 5,755 | # encoding: utf-8
module CartoDB
module TwitterSearch
class JSONToCSVConverter
INDIVIDUAL_FIELDS = [
:link,
:body,
:objectType,
:postedTime,
:favoritesCount,
:twitter_lang,
:retweetCount
]
GROUP_FIELDS = [
:actor,
:inRepl... | 29.512821 | 115 | 0.520938 |
6a053e35669f67c895664e2fd3b28a207b1865bf | 123 | require "spec_helper"
describe Watsi do
it "has a version number" do
expect(Watsi::VERSION).not_to be nil
end
end
| 15.375 | 40 | 0.723577 |
6127290e9ce3d787eaa672968fef089211ff29c9 | 784 | require "reflexive/routing_helpers"
class Method
def reflexive_url
level = receiver.instance_of?(Class) ? :class : :instance
klass = receiver.instance_of?(Class) ? receiver : receiver.class
Reflexive::Application.default_url_prefix +
Reflexive::RoutingHelpers.new_method_path(klass, level, name)
e... | 25.290323 | 71 | 0.765306 |
6a7b24421c91ae0bc03171a295729a7ce2460e74 | 1,068 | # frozen_string_literal: true
module Gitlab
module ImportExport
module Project
class BaseTask
include Gitlab::WithRequestStore
def initialize(opts, logger: Logger.new($stdout))
@project_path = opts.fetch(:project_path)
@file_path = opts.fetch(:file_path)
@n... | 25.428571 | 105 | 0.623596 |
0162e8327ee77748e63224c05bcba783ea7d26ee | 1,205 | #
# hash.rb
#
module Puppet::Parser::Functions
newfunction(:hash, :type => :rvalue, :doc => <<-DOC
This function converts an array into a hash.
*Examples:*
hash(['a',1,'b',2,'c',3])
Would return: {'a'=>1,'b'=>2,'c'=>3}
Note: Since Puppet 5.0.0 type conversions can in general be performed b... | 26.195652 | 118 | 0.618257 |
fff4213dbe938df1e638027a015b33a041b6dd39 | 134 | set :application, 'DMPHub_Stage_x2'
server 'uc3-dmphub02x2-stg.cdlib.org', user: 'dmp', roles: %w[web app db]
set :rails_env, 'stage'
| 33.5 | 73 | 0.723881 |
187e0b98c9948c47b713317e9900744ef47e9e7a | 230 | class MarketSell < ActiveRecord::Base
belongs_to :item
belongs_to :base
validates :quantity, numericality: {only_integer: true}
validates :price, numericality: true
def to_s
"#{quantity} x #{item} @ #{self.base}"
end
end
| 20.909091 | 56 | 0.730435 |
333fa3f01abb5f1ed0e8fc209106e324211257fc | 11,421 | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with this
# work for additional information regarding copyright ownership. The ASF
# licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use... | 40.644128 | 152 | 0.655722 |
f8c8c3e4e8c55c33eea55bc05e683e335c396b1b | 1,438 | module AttachmentsHelper
def default_url_options
{ host: Plek.new.website_root, protocol: "https" }
end
def previewable?(attachment)
attachment.csv? && attachment.attachable.is_a?(Edition)
end
# Until we have sensible (resourceful) routing for serving attachments, this method
# provides a convenie... | 36.871795 | 138 | 0.729485 |
1a5ea6e7702ed89c3ee7b7aae9e4cadc19853411 | 219 | class CreateComments < ActiveRecord::Migration[6.0]
def change
create_table :comments do |t|
t.integer :user_id
t.integer :development_id
t.string :body
t.integer :rating
end
end
end
| 19.909091 | 51 | 0.6621 |
9155d4f3df1e835fcfbb9acf6318f3532ec81299 | 39 | module Cleaner
VERSION = "0.0.7"
end
| 9.75 | 19 | 0.666667 |
3916c67d62495ff57db045f936be8a61ff3193f7 | 248 | # frozen_string_literal: true
class CreateTeams < ActiveRecord::Migration[7.0]
def change
create_table :teams do |t|
t.string :name, null: false
t.text :permissions, null: false, default: ""
t.timestamps
end
end
end
| 19.076923 | 51 | 0.665323 |
ab72d865f324c312df71a75f964bcdbe0967b68b | 8,659 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Monitor::Mgmt::V2017_05_01_preview
#
# Monitor Management Client
#
class DiagnosticSettingsCategoryOperations
include MsRestAzure
... | 41.430622 | 141 | 0.694653 |
03484ce767b72023c560ca1eee003c243c7387bb | 310 | json.id @review.id
json.body do
json.title @review.title
json.description @review.description
json.score @review.score
json.reviewer_id @review.reviewer_id
end
json.dates do
json.created_at @review.created_at
json.updated_at @review.updated_at
json.url review_url(@review, format: :json)
end
| 20.666667 | 45 | 0.767742 |
181fd4382ed987f7b1c033bd35a778cc50b1273a | 21,218 | module Braintree
class WebhookTestingGateway # :nodoc:
def initialize(gateway)
@gateway = gateway
@config = gateway.config
@config.assert_has_access_token_or_keys
end
def sample_notification(kind, id)
payload = Base64.encode64(_sample_xml(kind, id))
signature_string = "#{@co... | 34.898026 | 109 | 0.579838 |
1d9a39669ab63f3d93a8b8920d02201ffc94421d | 592 | # Load the rails application
require File.expand_path('../application', __FILE__)
# Make sure there's no plugin in vendor/plugin before starting
vendor_plugins_dir = File.join(Rails.root, "vendor", "plugins")
if Dir.glob(File.join(vendor_plugins_dir, "*")).any?
$stderr.puts "Plugins in vendor/plugins (#{vendor_plugi... | 39.466667 | 92 | 0.741554 |
6acd7beac88c3f5419e3b83ff324a588120f027f | 201 | def tau(n)
return 1 if n == 1
2 * (1..Math.sqrt(n)).count { |i| n % i == 0 }
end
n, i = 3, 3
while tau(n) < 500
n, i = n+i, i+1
end
result = n
puts result
raise Error unless result == 76576500
| 14.357143 | 48 | 0.562189 |
383e98f58949028dfd16b5f87137beb6d5019590 | 938 | # Copyright 2020 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 32.344828 | 74 | 0.731343 |
5d37ddb111b1e1b733b23d8617b40dc2527986c8 | 552 | module Navigation
class NavbarComponent < ViewComponent::Base
private
def resources
helpers.navigation_resources
end
def nav_link(link_text, link_path)
class_name = "active" if first_uri_segment_matches_link?(link_path)
tag.li class: class_name do
link_to_unless_current link... | 22.08 | 73 | 0.677536 |
87caa420f570b07faa3d114591670d2e2bb9a236 | 3,248 | # frozen_string_literal: true
#
# Cookbook Name:: aws-parallelcluster
# Recipe:: prep_env
#
# Copyright 2013-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the
# License. A copy of the... | 38.666667 | 121 | 0.693658 |
b926d519e8fef9fc1f6fc473108b6266f3c0f66a | 104 | unless Symbol.method_defined? :empty?
class Symbol
def empty?
to_s.empty?
end
end
end
| 13 | 37 | 0.653846 |
623d6391e93ccaeaa938e420832f8e87105945af | 3,473 | require 'vintage/swagger/object'
require 'vintage/swagger/objects/items'
require 'vintage/swagger/objects/schema'
require 'vintage/grape/param'
module Vintage
module Swagger
module Objects
class Parameter < Vintage::Swagger::Object # https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#p... | 39.91954 | 208 | 0.621077 |
39f4e3bbf7ec75c2d27e098c8e92a0baba52c40b | 4,921 | module Ironfan
class Dsl
class Component < Ironfan::Dsl
include Gorillib::Builder
include Gorillib::Concern
include Ironfan::Plugin::Base; register_with Ironfan::Dsl::Compute
field :cluster_name, Symbol
field :facet_name, Symbol
field :realm_name, Symbol
field :name, Sym... | 31.544872 | 114 | 0.640114 |
1cd78764835b91cc9b691e8cb27c3d37aaa65d6c | 110 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'page_by_page'
require 'minitest/autorun'
| 22 | 58 | 0.754545 |
e9f224583a2a0936f32045bc403529e245a8ce42 | 1,631 | #
# Be sure to run `pod lib lint CenfoWebAPICaller.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 https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'C... | 37.930233 | 108 | 0.646842 |
7a91d2086b5717d4ad58202462bcc2f445fe9bb4 | 207 | require "sequel"
db =
if RUBY_PLATFORM.match?(/java/)
"jdbc:sqlite::memory:"
else
"sqlite::memory:"
end
SEQUEL_DB = Sequel.connect(db)
require_relative "./schema"
require_relative "./models"
| 15.923077 | 33 | 0.68599 |
212ce92420359e19d600b309b871ab610c1eca38 | 81 | class Request < ActiveRecord::Base
include Referrer::TrackedModelAdditions
end
| 20.25 | 41 | 0.82716 |
d5635222cdbfcc4920c1603330c140c4136fe88b | 3,297 | require 'spec_helper'
require 'presenters/v3/to_many_relationship_presenter'
module VCAP::CloudController::Presenters::V3
RSpec.describe ToManyRelationshipPresenter do
class ToManyRelationship
def initialize(guid)
@guid = guid
end
def guid
@guid.to_s
end
end
def ... | 28.669565 | 165 | 0.548377 |
6acd889dddc5ca2ab6c0388a2e2603cc16a9ba02 | 1,412 | require 'cases/helper'
require 'models/topic'
class InvalidDateTest < ActiveRecord4116::TestCase
def test_assign_valid_dates
valid_dates = [[2007, 11, 30], [1993, 2, 28], [2008, 2, 29]]
invalid_dates = [[2007, 11, 31], [1993, 2, 29], [2007, 2, 29]]
valid_dates.each do |date_src|
topic = Topic.new... | 42.787879 | 154 | 0.67847 |
38f59acf957ba96159663db6166ca0d57a32e5e7 | 1,276 | # ba_tester
#
# This file was automatically generated by APIMATIC v2.0
# ( https://apimatic.io ).
module BaTester
# BaseController.
class BaseController
attr_accessor :config, :http_call_back
def initialize(config, http_call_back: nil)
@config = config
@http_call_back = http_call_b... | 26.583333 | 88 | 0.628527 |
ede2ef058963489360cacd070914a56d59cbef21 | 246 | # frozen_string_literal: true
module Subjective
##
# Base class for validator strategies.
#
class ValidatorStrategy
attr_reader :context_klass
def initialize(context_klass)
@context_klass = context_klass
end
end
end
| 16.4 | 40 | 0.727642 |
1d12caf2a17bc2e9050796cfe659fbf7e9fee1ec | 78 | class Target < ActiveResource::Base
self.site = "http://localhost:3001/"
end | 26 | 38 | 0.730769 |
7abefd9f4ee72d4213c7dd93d6f717b177c19506 | 23,707 | class MeasureValidator < TradeTariffBackend::Validator
validation :ME1, 'The combination of measure type + geographical area + goods classification item id + additional code type + additional code + order number + reduction indicator + start date must be unique.', on: %i[create update], if: ->(record) { record.not_up... | 51.649237 | 295 | 0.696124 |
5d0e0c21aa8ad915e2d204814f59fabe1eec600e | 1,897 | module ActiveSupport #:nodoc:
module CoreExtensions #:nodoc:
module String #:nodoc:
# Makes it easier to access parts of a string, such as specific characters and substrings.
module Access
# Returns the character at the +position+ treating the string as an array (where 0 is the first character... | 32.152542 | 132 | 0.488666 |
ed2194d1462e9fe0aefc2af57b51442a6eeb1c25 | 395 | class Admin::Resources::RolesController < Admin::ResourceController
include Paginatable
def index
if params[:sort_by] and not params[:q]
order_settings = params[:sort_by] + ' ' + @sort_order
@roles = @roles.reorder(order_settings)
end
end
private
def permitted_attributes
[ :name,... | 23.235294 | 76 | 0.696203 |
1de3ff456670732a818bb5541c93d0816d0cea74 | 4,111 | # 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::ServiceFabric::V6_4_0_36
module Models
#
# Load Information about a Service Fabric application.
#
class ApplicationLoadInfo
... | 34.258333 | 81 | 0.55461 |
338ec679650bc79d7ec542304dd565c828805c7c | 2,968 | class H2o < Formula
desc "HTTP server with support for HTTP/1.x and HTTP/2"
homepage "https://github.com/h2o/h2o/"
url "https://github.com/h2o/h2o/archive/v2.0.1.tar.gz"
sha256 "c53d11589c8c76491cf3a940b649d0a9cb27c36eb276963811ac1bc16cd2bf2c"
head "https://github.com/h2o/h2o.git"
bottle do
sha256 "940... | 28.266667 | 106 | 0.644879 |
4a6c4cc9676fe97621bb37888bd5ca37a811f023 | 276 | require 'spec_helper'
RSpec.describe App do
it 'returns http success' do
get '/'
expect(last_response).to be_ok
end
it 'creates a request record' do
expect {
get '/'
}.to change(Request, :count).by(1)
expect(Request.count).to eq(1)
end
end
| 17.25 | 38 | 0.637681 |
4a0123b33744294883b60c94e76f7c3ef3a00222 | 144 | class AddStakingToPaymentTransactions < ActiveRecord::Migration
def change
add_column :payment_transactions, :staking, :boolean
end
end
| 24 | 63 | 0.805556 |
6ae38b02d8263bf5c7cdd321138c0e88a7f28505 | 777 | Facter.add(:passalgo) do
confine :osfamily => "RedHat"
setcode do
algo = Facter::Core::Execution.exec("authconfig --test | grep hashing | awk '{print $5}'")
case algo
when /md5/
'md5'
when /sha256/
'sha256'
when /sha512/
'sha512'
when /descrypt/
'crypt'
when /bi... | 17.659091 | 94 | 0.537967 |
0380d7e554863161558244363d5e17131ad8bcae | 1,117 | shared_context :common_context do
let(:app_id) { ENV['D2L_API_ID'] }
let(:app_key) { ENV['D2L_API_KEY'] }
let(:auth_host) { D2L::Valence::Host.new(scheme: :https, host: 'partners.brightspace.com') }
let(:api_version) { '1.0'}
let(:app_context) do
D2L::Valence::AppContext.new(
brightspace_host: auth_... | 30.189189 | 94 | 0.675918 |
61ee3a02e886cc5472c96effde3ff3d0a1a917f6 | 2,172 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
require 'msf/core/auxiliary/report'
class MetasploitModule < Msf::Post
include Msf::Post::Windows::Registry
include Msf::Auxiliary::Report
def initialize(i... | 27.493671 | 107 | 0.589779 |
5d26815d2495839b77c8e98e58250a35ad3075d3 | 1,976 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... | 34.068966 | 85 | 0.76164 |
e225b4587785c32aab037d4231a4f00a904709c8 | 711 | require_relative 'boot'
require 'rails'
require 'active_model/railtie'
require 'active_record/railtie'
require 'action_controller/railtie'
require './config/initializers/modules.rb'
Bundler.require(*Rails.groups)
module ExpertPalmTree
class Application < Rails::Application
config.load_defaults 6.0
config.a... | 26.333333 | 63 | 0.732771 |
3979258cdf1ca2af15c4278db81a67675c69e8da | 3,027 | require 'prawn/core'
require 'prawn/format'
require "prawn/measurement_extensions"
require 'gruff'
require "open-uri"
module Pdf
module Finance
class InvoiceGenerator
include Pdf::Printer
# TODO: remove
include ActionView::Helpers::NumberHelper
include ThreeScale::MoneyHelper
inclu... | 27.518182 | 119 | 0.570862 |
acefca8427bf20489198ec3d54a5778c228a778e | 922 | $LOAD_PATH.unshift File.dirname(__FILE__)
require 'helper'
class AliasTest < Test::Unit::TestCase
def test_alias
instructions = hub("alias")
assert_includes "bash", instructions
assert_includes "sh", instructions
assert_includes "csh", instructions
assert_includes "zsh", instructions
assert_i... | 21.952381 | 63 | 0.722343 |
1cdecdff2b2361980e049f88735e7e6d7b940c32 | 407 | require "vagrant"
module VagrantPlugins
module GuestSolaris
class Plugin < Vagrant.plugin("1")
name "Solaris guest."
description "Solaris guest support."
config("solaris") do
require File.expand_path("../config", __FILE__)
Config
end
guest("solaris") do
re... | 19.380952 | 55 | 0.611794 |
f742edc5915a2f35f6cd23e1eb28d1c724bf682a | 23,330 | # require "pry"
# require "pry-rescue"
require "json"
Puppet::Type.type(:azure_ddos_protection_plan).provide(:arm) do
mk_resource_methods
def initialize(value = {})
super(value)
@property_flush = {}
@is_create = false
@is_delete = false
end
def etag=(value)
Puppet.info("etag setter called... | 43.04428 | 279 | 0.664681 |
28cf983cd265656fa2dab25b878cc7a34efa8872 | 1,209 | # frozen_string_literal: true
# Copyright 2015 Australian National Botanic Gardens
#
# This file is part of the NSL Editor.
#
# 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
#
# ht... | 39 | 76 | 0.724566 |
4a5bf599fa4b7951dc3d9348b730a70776d60c95 | 266 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
require '2016-03-01/generated/azure_mgmt_scheduler'
require 'profiles/latest/scheduler_latest_profile_client'
| 44.333333 | 94 | 0.823308 |
33d440043bd5aef9fca5d91eaae471f885801f8e | 424 | # frozen_string_literal: true
class CardSetsController < ApplicationController
before_action :authenticate_user!
def index
@card_list = find_card_list
@card_sets = find_card_sets
end
private
def find_card_list
return nil if params[:list_id].blank?
CardList.find_by!(user_id: current_user.i... | 18.434783 | 71 | 0.747642 |
f88d33c847805c283e54c36d0ddb9d59b54ab3d1 | 1,247 | class String
def clean
self.dup.clean!
end
def clean!
if self.match(/^\s+$/)
return nil
end
self.strip!
self.gsub!(/\s{2,}/, ' ')
self
end
def stub
I18n.transliterate(self).downcase.squish.gsub(/[^a-z\s]/, '').gsub(' ', '-')
end
end
def formatoTelefono digitos, sinLD =... | 23.980769 | 86 | 0.513232 |
e2f781eb4f3cb48deb857dcd0f4e5d88da23e0d7 | 6,266 | ##
# This module requires Metasploit: http//metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
require 'msf/core/exploit/mssql_commands'
class Metasploit3 < Msf::Auxiliary
include Msf::Exploit::Remote::MSSQL_SQLI
include Msf::Auxiliary::Report
def in... | 31.019802 | 120 | 0.649697 |
08c6971630ad54665c7379b23ff973b36fd88dcc | 310 | name 'hadoop_slave_conf_setup'
maintainer 'YOUR_COMPANY_NAME'
maintainer_email 'YOUR_EMAIL'
license 'All rights reserved'
description 'Installs/Configures hadoop_slave_conf_setup'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
| 38.75 | 72 | 0.719355 |
018447934ab4848b2e948ffbceedd50500fd3d0c | 2,604 | class OpenProject::XlsExport::XlsViews::CostEntryTable < OpenProject::XlsExport::XlsViews
def generate
@spreadsheet = OpenProject::XlsExport::SpreadsheetBuilder.new(I18n.t(:label_money))
default_query = serialize_query_without_hidden(@query)
available_cost_type_tabs(options[:cost_types]).each_with_index ... | 26.845361 | 122 | 0.678955 |
bb550e11b2fbb8755c420ae7597b0df3444c6017 | 632 | atom_feed do |feed|
feed.title("Clipster - Recent")
feed.updated(@updated_at) unless @updated_at.nil?
@clips.each do |clip|
feed.entry(clip) do |entry|
if clip.expires.nil?
entry.title("#{clip.title}. A #{clip.language} clip that never expires.")
else
entry.title("#{clip.title}. A... | 31.6 | 94 | 0.610759 |
bba1a7d2f362e177b7c2cb5066a6bf0c0d579a72 | 894 | # frozen_string_literal: true
require_relative './_common'
module GitConfigModule
include CommonModule
def evaluate(config_hash)
with_plan do |plan|
missing = []
current_config = Kernel.send('`', 'git config --global -l').strip.split("\n").map { |l| l.split('=', 2) }.to_h
flat_hash(config_h... | 24.162162 | 116 | 0.620805 |
0342515bdb3d02ed5abc02b0b3addc91af40a21f | 411 | require "archived_concern"
class ServiceInventory < ApplicationRecord
include ArchivedConcern
belongs_to :tenant
belongs_to :source
belongs_to :refresh_state_part, :optional => true
has_many :service_instances
has_many :service_instance_nodes
has_many :service_inventory_tags
has_many :service_offerin... | 21.631579 | 51 | 0.819951 |
5d232756fe3481e5297cd8ee6dc23121585cc51e | 318 | # frozen_string_literal: true
module RailsBand
module ActionController
module Event
# A wrapper for the event that is passed to `exist_fragment?.action_controller`.
class ExistFragment < BaseEvent
def key
@key ||= @event.payload.fetch(:key)
end
end
end
end
end
| 21.2 | 86 | 0.654088 |
1af348336ee3fbf1a05a051f111f68db011d5456 | 912 | require 'sql/force_index_expression'
module Sequel
module Plugins
module ForceIndex
module DatasetMethods
def select_sql()
puts @opts.inspect
puts "is it working #{@opts[:from]}"
result = super
puts result
#raise Exception.new('ad')
... | 26.057143 | 94 | 0.495614 |
4acab5cd2277cd37f1f8838bee5a3ba7e0006899 | 389 | # frozen_string_literal: true
module Types
class EpicSortEnum < BaseEnum
graphql_name 'EpicSort'
description 'Roadmap sort values'
value 'start_date_desc', 'Start date at descending order'
value 'start_date_asc', 'Start date at ascending order'
value 'end_date_desc', 'End date at descending orde... | 27.785714 | 61 | 0.737789 |
ff8cfad431b4ffd20cc02c2cdf77d9e1bfe134cc | 17,029 | #!/usr/bin/env ruby
##
# @file
#
# @brief unit test cases for Kdb::KeySet
#
# @copyright BSD License (see doc/LICENSE.md or http://www.libelektra.org)
#
require 'kdb'
require 'test/unit'
require_relative 'test_helper'
class KdbKeySetTestCases < Test::Unit::TestCase
def test_keySet_new_simple
assert_nothing_ra... | 22.495376 | 79 | 0.582301 |
4ad6ffe323c2feb26ae2b33310e0466e190cf16c | 3,827 | require "rails_helper"
describe Eve::AccessToken, type: :model do
describe "#expired?" do
subject { described_class.new(character).expired? }
let(:character) { instance_double(Character, token_expired?: true) }
it { is_expected.to eq true }
context "when not expired" do
let(:character) { ins... | 28.774436 | 93 | 0.644892 |
b9cbefaab185215180422c8fc24634954ebd07f9 | 70 | class Mood < ActiveRecord::Base
validates :name, presence: true
end
| 17.5 | 33 | 0.757143 |
87a2ec7572b2a01f8e0942e28cacad8ff2869a2e | 295 | class CreateLikes < ActiveRecord::Migration[6.0]
def change
create_table :likes do |t|
t.integer :user_id
t.references :likeable, polymorphic: true, index: true
t.timestamps
end
add_index :likes, [:user_id, :likeable_type, :likeable_id], unique: true
end
end
| 22.692308 | 76 | 0.681356 |
ab81bc988abff74a47e42e4bcf4970d06c653270 | 163 | class CreateSubmissionRecords < ActiveRecord::Migration
def change
create_table :submission_records do |t|
t.timestamps null: false
end
end
end
| 18.111111 | 55 | 0.736196 |
217d441498b76adfd20f6a495374cd66dd55e54f | 878 | # frozen_string_literal: true
RSpec.describe "attribute definition" do
before do
@t12n = T12n.start
end
it "defined attributes must provide a block" do
expect do
@t12n.define_schema :x do
define_attr :a
end
end.to raise_error(T12n::ArgumentError, "No block given")
end
it "ar... | 23.72973 | 73 | 0.638952 |
260532b9f7dafe3288b977bf7ed4ef5ed4dd541e | 743 | module GitCompound
module Worker
# Worker that checks if unwanted circular dependency exists
#
class CircularDependencyChecker < Worker
def visit_component(component)
@element = component
raise_error if circular_dependency_exists?
end
def visit_manifest(manifest)
... | 23.21875 | 66 | 0.651413 |
ace25dc243afd366663f060a15eef7d52c39a0bf | 3,168 | require 'oauth2'
module WeiboOAuth2
class Client < OAuth2::Client
def initialize(client_id='', client_secret='', opts={}, &block)
client_id = WeiboOAuth2::Config.api_key if client_id.empty?
client_secret = WeiboOAuth2::Config.api_secret if client_secret.empty?
super
@site = "https://api... | 31.058824 | 113 | 0.631944 |
2800f44745ceb42204caa621b1744e3f95a0268f | 713 | # NOTE:
#
# Uses the value of node['private_chef']['postgresql']['username'] as
# the user to run the database-creation psql command
def whyrun_supported?
true
end
use_inline_resources
action :create do
EcPostgres.with_connection(node) do |connection|
result = connection.exec("SELECT datname FROM pg_database... | 31 | 153 | 0.71669 |
ed44aac27098a324343eb35fa653c8cd1e7ac1dc | 2,956 | # 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_02_01
module Models
#
# Information gained from troubleshooting of specified resource.
#
class Troubles... | 29.267327 | 86 | 0.492896 |
87cbbbc546f0decfd2de65c3ce878c490a4d1f2f | 1,252 | module OldAWS
module S3
# Entities in S3 have an associated owner (the person who created them). The owner is a canonical representation of an
# entity in the S3 system. It has an <tt>id</tt> and a <tt>display_name</tt>.
#
# These attributes can be used when specifying a ACL::Grantee for an ACL::Gr... | 28.454545 | 123 | 0.594249 |
ed91deb4c73bcfb75ebca4443f12a8a524b178d5 | 2,682 | require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
# require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "sprockets/railtie"
require "rails/test_unit/railtie"
Bundler.require
require "bootstrap_active_... | 42.571429 | 100 | 0.740492 |
18cd47406aff6a240eedc514691f8c68cdf67e3c | 182 | class CreateMessages < ActiveRecord::Migration[5.0]
def change
create_table :messages do |t|
t.string :name
t.string :message
t.timestamps
end
end
end
| 16.545455 | 51 | 0.653846 |
f897943bdb202d45a5f4cc68490cbaee0e6db42f | 2,283 | #
# Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "... | 28.898734 | 78 | 0.657468 |
01ca3f93bd5d0f8492b65bd595091e75907b760c | 10,516 | # encoding: UTF-8
#
# Cookbook Name:: openstack-dashboard
# Attributes:: default
#
# Copyright 2012, AT&T, Inc.
# Copyright 2013-2014, IBM, Corp.
#
# 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 ... | 55.057592 | 137 | 0.705972 |
1c3d188a5e85c84ecfb13c49f9af4d6317bec77b | 3,811 | require 'spec_helper'
require 'active_support/notifications'
module AggregateRoot
RSpec.describe InstrumentedRepository do
describe "#load" do
specify "wraps around original implementation" do
repository = instance_double(Repository)
instrumented_repository = InstrumentedRepository.new(rep... | 34.963303 | 102 | 0.65206 |
5d97f63073c24b95ab55ac5014c6a7d7acfaedc6 | 845 | # API から取得したハッシュからインスタンスを生成するための Factory Pattern のクラス(メタクラス)
class TokyoMetro::Factory::Generate::Api::TrainOperation::Info < TokyoMetro::Factory::Generate::Api::MetaClass::Info::Fundamental
include ::TokyoMetro::ClassNameLibrary::Api::TrainOperation
# Info クラスに送る変数のリスト
# @return [::Array]
def variables
i... | 33.8 | 129 | 0.698225 |
4a751c18fc07e97e2a9702ccb4ef161b96877501 | 109 | require 'spec_helper'
describe Cqslight do
it { expect(Cqslight::Command).to be_instance_of(Module) }
end
| 18.166667 | 60 | 0.770642 |
01d92f8a6c45053b0f963b69979cc22482194378 | 75 | require 'test_helper'
class WritingsHelperTest < ActionView::TestCase
end
| 15 | 47 | 0.826667 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.