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 |
|---|---|---|---|---|---|
28aa0a0dd5f42820e998971bda00eb9250e64394 | 375 | name 'chef-server'
version '3.1.1'
maintainer 'Chef Software, Inc.'
maintainer_email 'cookbooks@chef.io'
license 'Apache 2.0'
description 'Installs and configures Chef Server 12'
source_url 'https://github.com/chef-cookbooks/chef-server'
issues_url 'https://github.com/chef-cookbooks/chef-server/issues'
depends 'chef-s... | 26.785714 | 65 | 0.784 |
e8829ebdb8ca7f04433b4fcda7caad3ce7517db6 | 1,075 | require 'test_helper'
class RestaurantTest < ActiveSupport::TestCase
setup do
@restaurant = restaurants(:one)
end
test "should create opening_hours" do
restaurant = Restaurant.create name: "Good Pizza", user_id: 1
assert_not_empty restaurant.opening_hours
end
test "should have default adress" ... | 25.595238 | 65 | 0.736744 |
392721ee9dacdcd021fbb1830fe5a77f04495a2b | 1,048 | #
# Copyright (C) 2012 Onyx Point, Inc. <http://onyxpoint.com/>
#
# 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 applic... | 36.137931 | 120 | 0.695611 |
ff88509d78ae169f142c7027e59d8e30f4389992 | 51,891 | require 'puppet'
require 'getoptlong'
require 'puppet/util/watched_file'
require 'puppet/util/command_line/puppet_option_parser'
require 'forwardable'
require 'fileutils'
# The class for handling configuration files.
class Puppet::Settings
extend Forwardable
include Enumerable
require 'puppet/settings/errors'
... | 33.434923 | 161 | 0.681024 |
e963137d05cbe59b3911e6aa86e90e5037f275fe | 212 | require File.dirname(__FILE__) + '/../../../spec_helper'
require File.dirname(__FILE__) + '/shared/to_s'
require 'rexml/document'
describe "REXML::CData#value" do
it_behaves_like :rexml_cdata_to_s, :value
end
| 26.5 | 56 | 0.740566 |
f8ef11b0957eda78fd8992a65da1dbbb3b0bce7f | 4,256 | #!/usr/bin/env ruby
# Encoding: utf-8
#
# Copyright:: Copyright 2013, Google Inc. All Rights Reserved.
#
# License:: 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
#
# ... | 39.045872 | 121 | 0.700188 |
01cf210e3d09f460fa5cb842069af28daadb1734 | 4,971 | # Author:: "Christian Höltje" <choltje@us.ibm.com>
# Author:: "Christopher M. Luciano" <cmlucian@us.ibm.com>
# Author:: Shahul Khajamohideen (<skhajamohid1@bloomberg.net>)
# Copyright (C) 2015 IBM Corp.
# Copyright (C) 2015 Bloomberg Finance L.P.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache Lic... | 32.490196 | 135 | 0.652384 |
ed750b1bbef744518800b8ebdd662461c8cb21b6 | 11,848 | require 'arel'
require 'arel/select_manager_sqlserver'
module Arel
module Nodes
# Extending the Ordering class to be comparison friendly which allows us to call #uniq on a
# collection of them. See SelectManager#order for more details.
class Ordering < Arel::Nodes::Unary
def hash
expr.hash... | 36.232416 | 155 | 0.575456 |
1dbdcf65a92982d393807ff14b8b9162465732d4 | 94 | # frozen_string_literal: true
module RuboCop
module Expert
VERSION = '0.1.2'
end
end
| 11.75 | 29 | 0.702128 |
e86e25aed37e0bc14ccac48f2545716a11f83e77 | 6,290 | # encoding: utf-8
require "test_utils"
require "logstash/util/accessors"
describe LogStash::Util::Accessors, :if => true do
context "using simple field" do
it "should get value of word key" do
str = "hello"
data = { "hello" => "world" }
accessors = LogStash::Util::Accessors.new(data)
i... | 33.457447 | 93 | 0.558665 |
ab8e675b36365fe65068b00384d69e624d5119fd | 867 | # frozen_string_literal: true
module Facts
module Aix
class Disks
FACT_NAME = 'disks'
ALIASES = %w[blockdevices blockdevice_.*_size].freeze
def call_the_resolver
facts = []
disks = Facter::Resolvers::Aix::Disks.resolve(:disks)
return Facter::ResolvedFact.new(FACT_NAME,... | 26.272727 | 112 | 0.645905 |
bb55f5945b4bcf8b86175348003dea90e38a6063 | 1,046 | module Puppet::Module::Tool
class Dependency
# Instantiates a new module dependency with a +full_module_name+ (e.g.
# "myuser-mymodule"), and optional +version_requirement+ (e.g. "0.0.1") and
# optional repository (a URL string).
def initialize(full_module_name, version_requirement = nil, repository... | 41.84 | 112 | 0.712237 |
d530cb59b97f8e5f4c011da090960d7303501929 | 597 | require File.expand_path("#{File.dirname(__FILE__)}/../../../test_helper")
class Piston::Git::TestGitWorkingCopyRememberance < Piston::TestCase
def setup
super
@wcdir = mkpath("tmp/wc")
@wc = Piston::Git::WorkingCopy.new(@wcdir)
end
def test_creates_dot_piston_dot_yml_file
@wc.remember({}, "a" =... | 27.136364 | 74 | 0.664992 |
acc638d8015439f5e295917a74b8a810924699d8 | 3,423 | ##
# 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 = AverageRanking
include Msf::Exploit::Remote::Tcp
include Msf::Exploit::Remote::Seh
def initialize(in... | 30.026316 | 114 | 0.553608 |
39fba1b0a3c9586d2c30e788bf5c5c02940b1241 | 1,267 | require_relative 'lib/qbittorrent/version'
Gem::Specification.new do |spec|
spec.name = 'qbittorrent'
spec.version = QBittorrent::VERSION
spec.authors = ['Roy Zheng']
spec.email = ['github@roy.cc']
spec.summary = 'QBittorrent WEB API Client.'
spec.description = 'QBitto... | 40.870968 | 87 | 0.667719 |
034809962d4708c3ad10c595ace3587cef6bc086 | 1,774 | #!/usr/bin/ruby
require "awesome_print"
require "optparse"
require "pp"
require "socket"
ap "This is ruby program about modbus"
options = {}
option_parse = OptionParser.new do |opts|
# 帮助信息
opts.banner = 'here is help messages of the command line tool.'
# Option 作为switch,不带argument,用于将switch设置成true或false... | 22.74359 | 80 | 0.600902 |
6a31fe8b9eb528b6a41cfda1e104ff0d504580ac | 1,338 | # frozen_string_literal: true
$LOAD_PATH.push File.expand_path("../lib", __FILE__)
require "simplecov/version"
Gem::Specification.new do |gem|
gem.name = "simplecov"
gem.version = SimpleCov::VERSION
gem.platform = Gem::Platform::RUBY
gem.authors = ["Christoph Olszowka"]
gem.email = [... | 37.166667 | 136 | 0.700299 |
ed54970b3e5a5b6aeee3f9362f631c0ecf1d6032 | 13,720 | # This is a configuration file for octocatalog-diff (https://github.com/github/octocatalog-diff).
#
# When octocatalog-diff runs, it will look for configuration files in the following locations:
# - As specified by the environment variable OCTOCATALOG_DIFF_CONFIG_FILE
# - Your current working directory: `$PWD/.octocata... | 59.912664 | 109 | 0.561152 |
03727c021a030af70267317a684f5c93aba0caa4 | 317 | #!/usr/bin/env ruby -wKU
class AVLTree
def initialize
@contents = []
end
def empty?
@contents.empty?
end
def include?(obj)
@contents.include?(obj)
end
def <<(obj)
@contents << obj
end
def height
Math::log(@contents.length).ceil
end
def remove(obj)
@contents.delete(obj)
end
end
| 10.566667 | 35 | 0.637224 |
9138e6a1e98ca7ad8536a4a19bbf9003549fd811 | 340 | require 'spec_helper'
describe "wrap request parameters", type: :request do
describe "json format" do
it 'should not add a root node to the controller parameters' do
get "/users/sign_up", nil, { "CONTENT_TYPE" => "application/json; charset=utf-8" }
expect(request.params).not_to include(:registration... | 28.333333 | 88 | 0.702941 |
26f2cca2dbf98a1e641ff63b4e8f2373be43d791 | 3,235 | #--
# Ruby Whois
#
# An intelligent pure Ruby WHOIS client and parser.
#
# Copyright (c) 2009-2018 Simone Carletti <weppos@weppos.net>
#++
require_relative 'base'
require 'whois/scanners/base_shared2'
module Whois
class Parsers
# Shared parser 2.
#
# @abstract
class BaseShared2 < Base
inclu... | 25.273438 | 85 | 0.559815 |
e86ce906b1da103eee4499071f527a60c6da7a7b | 39 | module Rainbow
VERSION = "0.1.0"
end
| 9.75 | 19 | 0.666667 |
03be3649a8a608093f72ce2a95923975d4f1e9b4 | 970 | #
# Author:: Matt Eldridge (<matt.eldridge@us.ibm.com>)
# © Copyright IBM Corporation 2014.
#
# LICENSE: Apache 2.0 (http://www.apache.org/licenses/)
#
require 'chef/knife/softlayer_base'
class Chef
class Knife
class SoftlayerVlanCreate < Knife
include Knife::SoftlayerBase
banner 'knife softlayer ... | 25.526316 | 125 | 0.634021 |
e2f7529842a10b9a7a2e062ba2e1acf6f7455f42 | 1,151 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads/v4/enums/frequency_cap_time_unit.proto
require 'google/protobuf'
require 'google/api/annotations_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_file("google/ads/googleads/v4/enums/frequency_cap_time_unit.prot... | 34.878788 | 205 | 0.748914 |
b978b5fef539193d1ec82942f7456b0d560f3ad4 | 6,961 | #!/usr/bin/env ruby
require 'json'
require 'optparse'
BIN_DIR = "#{File.dirname(__FILE__)}/bin"
DMG_DIR = "#{File.dirname(__FILE__)}/dmg"
BOX_DIR = "#{File.dirname(__FILE__)}/box"
def log_info(msg)
STDERR.puts "\033[0;32m-- #{msg}\033[0m"
end
def log_error(msg)
STDERR.puts "\033[0;31m-- #{msg}\033[0m"
end
def ... | 32.680751 | 209 | 0.702773 |
ab6f6437efb6150d786ee6835950ba29dc05abe4 | 6,643 | # Chef Provider for configuring an elasticsearch instance
class ElasticsearchCookbook::ConfigureProvider < Chef::Provider::LWRPBase
include ElasticsearchCookbook::Helpers
provides :elasticsearch_configure
def whyrun_supported?
true # we only use core Chef resources that also support whyrun
end
action :... | 40.260606 | 142 | 0.735812 |
b97aeb435b97b84433c46f8a1221e65f122c23b1 | 1,959 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe BulkImports::Groups::Pipelines::EntityFinisher do
it 'updates the entity status to finished' do
entity = create(:bulk_import_entity, :started)
pipeline_tracker = create(:bulk_import_tracker, entity: entity)
context = BulkImports::Pipelin... | 33.775862 | 96 | 0.699847 |
117e9cbeb1a1d50bf3459ad4dd861b8814764d0a | 368 | # frozen_string_literal: true
module Creators
class CollectionCreator
attr_accessor :collection
def initialize(user:, form:)
@user = user
@form = form
end
def call
@collection = @user.collections.new(
name: @form.name,
description: @form.description
)
... | 15.333333 | 42 | 0.608696 |
1c12b145cac846460aca68193d6170451181fb50 | 1,467 | require 'rails_helper'
# IMPORTANT: Add spec/support/tasks.rb to your project to load rake tasks.
RSpec.describe "Subscription tasks", :type => :task do
context "subscription:confirmation_overdue:delete" do
before do
# Freeze time as task is time-sensitive
travel_to Time.now
end
after { t... | 30.5625 | 100 | 0.698705 |
39d0fa8f37c0e319abc655c71709302a7beef127 | 750 | # frozen_string_literal: true
require 'rdown/version'
module Rdown
autoload :Errors, 'rdown/errors'
autoload :Nodes, 'rdown/nodes'
autoload :Parser, 'rdown/parser'
autoload :Position, 'rdown/position'
autoload :PositionDelta, 'rdown/position_delta'
autoload :PreProcessor, 'rdown/pre_processor'
autoload ... | 27.777778 | 63 | 0.713333 |
b9ff9e77db80d3954379a11db95a715bb9cc4b5c | 232 | class AddCommentToPostComments < ActiveRecord::Migration[5.2]
def change
add_column :post_comments, :user_id, :integer
add_column :post_comments, :post_id, :integer
add_column :post_comments, :comment, :text
end
end
| 29 | 61 | 0.75431 |
ffd1b3e8a795e339925dd703c3170c63b5ee2376 | 909 | # coding: utf-8
module ONIX
class OtherText
include Virtus.model
attribute :text_type_code, Integer
attribute :text_format
attribute :text
attribute :text_link_type,Integer
attribute :text_link
attribute :text_author
def to_xml
OtherTextRepresenter.new(self).to_xml
end
... | 25.25 | 95 | 0.721672 |
bbe938122eaecec9c294948bddbfaa7a20761ac9 | 383 | class CreateQualifyings < ActiveRecord::Migration[6.0]
def change
create_table :qualifyings do |t|
t.bigint :race_id, null: false
t.bigint :driver_id, null: false
t.bigint :constructor_id, null: false
t.integer :number, null: false
t.integer :position
t.string :q1
t.strin... | 22.529412 | 54 | 0.637076 |
87bb83524b3bb8180393a6d43c6b17337f6e0079 | 6,532 | # encoding: UTF-8
require 'spec_helper'
RSpec.describe Measurement do
describe 'kiloliters' do
subject { described_class.parse('1 kl') }
it 'converts to hectoliters' do
expect(subject.convert_to(:hl).quantity).to eq 10
end
it 'converts to dekaliters' do
expect(subject.convert_to(:dal).... | 24.931298 | 63 | 0.672994 |
7af75c2725a6d98b9ffc2d11fa1d491b0fad1ffa | 408 | class User < ApplicationRecord
before_save { self.email = email.downcase }
validates :name, presence: true, length: { maximum: 50 }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, length: { maximum: 255 },
format: { with: VALID_EMAIL_REGEX }
... | 40.8 | 61 | 0.634804 |
012152f83fc6ea2d363a8e5591d2442669a148a6 | 2,072 | module Terrazine
class Builder
# doesn't use Predicates
# use Operators, Expressions
private
# TODO: split
def build_tables(structure)
case structure
when Array
if check_alias(structure.first) # VALUES function or ...?
build_operator(structure)
# if it's a ... | 28.383562 | 90 | 0.54971 |
335cade3bfe7391784bf8ddc5980b3aa15506f7d | 2,104 | # -*- encoding: utf-8 -*-
# stub: railties 5.2.0 ruby lib
Gem::Specification.new do |s|
s.name = "railties".freeze
s.version = "5.2.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "changelog_uri" => "https://github.com/rails/rail... | 44.765957 | 208 | 0.67538 |
284da843eb65fc967036a17649a1dc7f2e4832a7 | 228 | class CreateInvitationsUsers < ActiveRecord::Migration[5.2]
def change
create_table :invitations_users, id: false do |t|
t.belongs_to :invitation, index: true
t.belongs_to :user, index: true
end
end
end
| 25.333333 | 59 | 0.70614 |
38017db05b2043cc0ab139927ceeae02d528a61f | 78 | # frozen_string_literal: true
module ActsAsRemovable
VERSION = '3.1.1'
end
| 13 | 29 | 0.75641 |
87500d1c8199ed1a03b6becd2219a9225a130901 | 756 | require 'cgi'
require 'json'
require 'httparty'
require 'smarty_streets/version'
require 'smarty_streets/configuration'
require 'smarty_streets/location'
require 'smarty_streets/request'
module SmartyStreets
class << self
attr_accessor :configuration
# Call this method to set your configuration.
#
#... | 22.909091 | 49 | 0.691799 |
6227e42019d39612b0e051edfcb1b336de1796ab | 13,561 | # Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmat... | 48.956679 | 154 | 0.751198 |
398fdc91cfb6d83246afab13c16f009e87a9ab1c | 231 | module ChartmogulClient::Consts
module ApiVersions
V1 = 'v1'
end
module HttpStatuses
BAD_REQUEST = 400
SERVER_ERROR = 500
end
module HttpMethods
GET = :get
POST = :post
DELETE = :delete
end
end | 14.4375 | 31 | 0.65368 |
61f8e2ab187a0a9aa5cfaccb373b8a6c0e12c7ca | 6,344 | # 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_04_01
module Models
#
# Private endpoint resource.
#
class PrivateEndpoint < Resource
include Ms... | 33.389474 | 82 | 0.466425 |
d5ac3bd90372c75d776d845e345c3cc60bd60ac5 | 145 | RSpec.describe MatchboxRails do
it "has a version number" do
expect(MatchboxRails::VERSION).not_to be nil
end
# TODO: Write tests
end
| 18.125 | 48 | 0.731034 |
0331b037c26a0b14b55bd822add6f3f391b9b2b7 | 2,446 | require_relative 'lib/tuga/version'
Gem::Specification.new do |spec|
spec.name = 'tuga'
spec.version = Tuga::VERSION
spec.authors = ['Wilson Silva']
spec.email = ['me@wilsonsilva.net']
spec.summary = 'A Portuguese script programming language.'
spec.description = 'A Por... | 47.038462 | 104 | 0.699509 |
62967d85ca092d10405b8797cbd1deec388794b3 | 164 | # Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Rails300ActiveRecord::Application.initialize!
| 27.333333 | 52 | 0.817073 |
79b1c52ddbd71cf803ffb3a8de453b04e9a1362c | 134 | RSpec.describe HatenablogPublisher do
it "has a version number" do
expect(HatenablogPublisher::VERSION).not_to be nil
end
end
| 22.333333 | 54 | 0.776119 |
d55d9a0033c7f592bba6f583c0f0b653bc832a3f | 168 | # frozen_string_literal: true
require 'octokit'
client = Octokit::Client.new(access_token: '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')
user = client.user
user.login
| 18.666667 | 86 | 0.809524 |
e811937d9cb9f6cd4186578b4608803f39845de6 | 1,815 | require 'transcode'
# Represents an encoding format and encoding options used to transcode an audio
# file from one format to another. This is an analog to the
# `ActiveStorage::Variation` class for images. An encoding can be coded into a
# URL.
class Transcode::Encoding
# @return [String] The format to transcode,... | 25.208333 | 95 | 0.684848 |
bb228ee8f86b4c107e2861430b87cbfa02345938 | 1,480 | require 'rouge'
module Jekyll
class CodeRefTag < Liquid::Tag
def initialize(tag_name, args, tokens)
all = args.strip.reverse.split(' ')
item = all.first.reverse
file = all[1..-1].join(" ").reverse
raise "You need to specify a name for the section to fetch" if all.size == 1
super
... | 32.173913 | 128 | 0.578378 |
08085cfba00a21cb5a1f01063001cd2379cfb095 | 659 | require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module RuShambo
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails ... | 32.95 | 82 | 0.764795 |
915dbe72331e6fd0921b018f8d98f3273d2fc1d9 | 913 | module Rhino
class Launcher
def initialize(port, bind, reuseaddr, backlog, config)
@port = port
@bind = bind
@reuseaddr = reuseaddr
@backlog = backlog
@config = config
end
def run
log_run
begin
socket.setsocket(:SOL_SOCKET, :SO_REUSEADDR, @reuseaddr)
... | 16.303571 | 64 | 0.556407 |
796cdfad88c46e6733f3508e3e05331d41d77643 | 41 | module JustInform
VERSION = "0.0.6"
end | 13.666667 | 19 | 0.707317 |
339ece780365cf3487dc0111162f71a6e965aae7 | 500 | require "foreman/version"
module Foreman
class AppDoesNotExist < Exception; end
# load contents of env_file into ENV
def self.load_env!(env_file = './.env')
require 'foreman/engine'
Foreman::Engine.load_env!(env_file)
end
def self.runner
File.expand_path("../../bin/foreman-runner", __FILE__)
... | 19.230769 | 61 | 0.69 |
6206a8692442810bdb10fe91347980f29142acc7 | 2,761 | # 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::V2016_04_30_preview
module Models
#
# The List Image operation response.
#
class ImageListResult
inclu... | 27.61 | 80 | 0.517204 |
f87cdeefe3aed56bc19add708cf9c686a3c4a323 | 1,090 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
require "json"
package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json")))
version = package['version']
source = { :git ... | 35.16129 | 115 | 0.584404 |
0346890830d328291c9526e17b2710fa312cb345 | 896 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'phttp/version'
Gem::Specification.new do |spec|
spec.name = "phttp"
spec.version = PHTTP::VERSION
spec.authors = ["Kim Burgestrand", "Jonas Nicklas"]
spec.email ... | 35.84 | 74 | 0.651786 |
bb0948157431f46224092167c7fb36dee8ab314c | 5,663 | # frozen_string_literal: true
require "spec_helper"
require "dependabot/dependency"
require "dependabot/dependency_file"
require "dependabot/update_checkers/java_script/yarn"
require_relative "../shared_examples_for_update_checkers"
RSpec.describe Dependabot::UpdateCheckers::JavaScript::Yarn do
it_behaves_like "an u... | 29.649215 | 79 | 0.607275 |
e9a27790f146f5b7f735473b04811c0e3d836c90 | 579 | cask 'iglance' do
version '2.0.3'
sha256 '4f5c416d99c35884e28ad7b418c28b6f8c1cd75faa33895ae5f85d3ad04b0735'
url "https://github.com/iglance/iglance/releases/download/v#{version}/iGlance_v#{version}.zip"
appcast 'https://github.com/iglance/iglance/releases.atom'
name 'iGlance'
homepage 'https://github.com/i... | 28.95 | 96 | 0.694301 |
edd387e7210e3dd9f6ea117d47e6131e66c08afa | 111 | class Comment < ActiveRecord::Base
belongs_to :post
belongs_to :user
validates :body, presence: true
end
| 18.5 | 34 | 0.756757 |
d5f9a04bb00c48e5080ad3634fa6674f4edeb24f | 1,603 | # frozen_string_literal: true
#
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for mi... | 38.166667 | 85 | 0.766064 |
284e7441f109118c8fa3c98800e3750ad637dc9c | 496 | class JokeGenerator::Category
attr_accessor :title, :link
attr_reader :jokes
@@all = []
def self.new_from_categories_page (category)
self.new(
category.attribute("title").value,
category.attribute("href").value
)
end
def initialize (title = nil, link = nil)
@title = title
@link = l... | 14.171429 | 46 | 0.608871 |
6a25acc3b671f7201a622cc95b4e0cfef50948d8 | 746 | cask 'font-firacode-nerd-font-mono' do
version '1.1.0'
sha256 '551309fad856238876d051bfb2d81d9c85707f797de562529cb5aa2505e2ac7d'
url "https://github.com/ryanoasis/nerd-fonts/releases/download/v#{version}/FiraCode.zip"
appcast 'https://github.com/ryanoasis/nerd-fonts/releases.atom',
checkpoint: '109f1... | 43.882353 | 90 | 0.776139 |
ab425b0adf3c3375e8c36bcf7aa65bf9926a2002 | 2,744 | # frozen_string_literal: true
module SidekiqAutoscale
module Strategies
class DelayScaling < BaseScaling
SAMPLE_RANGE = 1.minute
DELAY_LOG_KEY = "sidekiq_autoscaling:delay_log"
DELAY_AVERAGE_CACHE_KEY = "sidekiq_autoscaling:delay_average"
LOG_TAG = "[SIDEKIQ_SCALE][DELAY_SCALING]"
... | 37.589041 | 146 | 0.679665 |
6ab79ea6601f28cfba1e260008417ab685fb2e75 | 1,092 | class Dbhash < Formula
desc "Computes the SHA1 hash of schema and content of a SQLite database"
homepage "https://www.sqlite.org/dbhash.html"
url "https://sqlite.org/2019/sqlite-src-3300100.zip"
version "3.30.1"
sha256 "4690370737189149c9e8344414aa371f89a70e3744ba317cef1a49fb0ee81ce1"
bottle do
cellar ... | 36.4 | 93 | 0.738095 |
bf4382a6d8a0e9279ef7fba8fa082561dad51d8f | 663 | #
# Cookbook Name:: apache2
# Recipe:: mod_expires
#
# Copyright 2008-2013, Opscode, 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
#
... | 31.571429 | 74 | 0.75264 |
1178e9348e96f110bcf6828eec639beee8c02a90 | 72 |
begin
quotient = 1 / 0
rescue
puts 'ぜろで助産師用とした'
end
p quotient
| 9 | 21 | 0.652778 |
877aa191a795e5eb068aeaf9b9d8a6fdae423180 | 2,162 | class SKISymbol < Struct.new(:name)
def to_s
name.to_s
end
def inspect
to_s
end
def combinator
self
end
def arguments
[]
end
def callable?(*arguments)
false
end
def reduciable?
false
end
def as_a_function_of(name)... | 14.707483 | 81 | 0.584644 |
f806f97d5b89ae7c929450d8664496f77baa8dc5 | 8,553 | # frozen_string_literal: true
require 'verbal_expressions'
require 'filesize'
require 'cgi'
module Jekyll
module Algolia
# Catch API errors and display messages
module ErrorHandler
include Jekyll::Algolia
# Public: Stop the execution of the plugin and display if possible
# a human-readabl... | 31.560886 | 84 | 0.580264 |
5d2842b3b343c3f19090c0f498824a81d569ab24 | 27 | RSpec.describe Apps do
end
| 9 | 22 | 0.814815 |
4a8f25907067430c19c4ed2352c90aed7a87dfb6 | 4,479 | require 'test_helper'
describe Shaf::Formable do
let(:clazz) { Class.new }
let(:subject) do
Class.new do
extend Shaf::Formable
end
end
it 'adds form_for class method' do
assert subject.respond_to? :form_for
end
it 'creates a create form' do
subject.forms_for(clazz) do
title 'C... | 24.745856 | 63 | 0.679839 |
0301e6fcc72c1fda88e49a60b370b88c8d10aef3 | 714 | require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
describe "/acceptance_criteria/edit" do
before :each do
assigns[:project] = mock_model(Project,
:stories => [],
:iterations => [],
:cr... | 31.043478 | 71 | 0.477591 |
1a97a43ddc3bc1c86427526b31ab6a4e02d3d0ea | 101 | module Alexa
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
end
| 16.833333 | 46 | 0.762376 |
1d31b237ff6a56507da292fb932dea9c73686b28 | 222 | def bubble_sort(array)
i = 0
while i < array.size - 1
j = i + 1
while j < array.size
array[i], array[j] = array[j], array[i] if array[i] > array[j]
j = j + 1
end
i = i + 1
end
array
end
| 17.076923 | 68 | 0.509009 |
e2cf242f901a4a5b74731aa5838a0261b7f00aa2 | 658 | # encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
# frozen_string_literal: true
module NewRelic
module Agent
# This class is used for instrumentations that have exceptions or error classes
... | 28.608696 | 93 | 0.729483 |
8775a92f90d529097155f2ecd204ba50852e521c | 6,724 | require "spec_helper"
require "membrane"
require "json_message"
require "cf_message_bus/mock_message_bus"
module VCAP::CloudController
describe LegacyBulk do
let(:mbus) { CfMessageBus::MockMessageBus.new({}) }
before do
@bulk_user = "bulk_user"
@bulk_password = "bulk_password"
end
descr... | 31.568075 | 102 | 0.542385 |
e9f9767eb45f2487713a9e1eea39deb39621501b | 1,142 | require 'spec_helper'
RSpec.describe HackingProgram do
let(:passphrase) { 'welcome' }
let(:record) do
DataSources::Record.new({
source: 'foo',
passphrase: passphrase,
start_node: 'bar',
end_node: 'baz',
start_time: Time.now.to_s,
end_time: Time.now.to_s,
})
end
let(:... | 26.55814 | 65 | 0.636602 |
ffe5e42ae36d38d5a4df2e023af8049582426271 | 1,088 | module ApplicationHelper
# Helper function for including CSS in the head
def css_for_head filename, type=:page
@head_css_cache = {} if @head_css_cache.nil?
content_symbol = type == :page ? :page_assets : :layout_assets
content_for content_symbol do
stylesheet_link_tag("/css/" + filename... | 27.2 | 66 | 0.683824 |
798dd8661417e1a18cdd850f4a6b48d7d3875209 | 1,325 | module Rabl
# DependencyTracker for ActionView to support cache digest
class Tracker
# Matches:
# extends "categories/show"
EXTENDS_DEPENDENCY = /
extends\s* # extends, followed by optional whitespace
\(? # start an optional parenthesis for the extends call... | 24.537037 | 82 | 0.594717 |
bfbe8acab1f30000bb375ff6fe7d4338d7229e7d | 197 | # frozen_string_literal: true
class AddPidToExecutionsAndRuns < ActiveRecord::Migration[5.2]
def change
add_column :executions, :pid, :integer
add_column :runs, :pid, :integer
end
end
| 21.888889 | 62 | 0.746193 |
e925a8b89a0d233e12d9f470f395b1f23f0214d5 | 205 | # frozen_string_literal: true
module TodoLists
class Create
include RailsEventSourcing::Command
attributes :name
def build_event
TodoLists::Created.new(name: name)
end
end
end
| 14.642857 | 40 | 0.717073 |
6ad2d83dd7c1dde403f26874519e601d326c3d4d | 3,085 | # frozen_string_literal: true
require_relative "mime_type"
module ShopifyCLI
module Theme
class File < Struct.new(:path)
attr_accessor :remote_checksum
def initialize(path, root)
super(Pathname.new(path))
# Path may be relative or absolute depending on the source.
# By conve... | 22.683824 | 97 | 0.576337 |
212c8f8bf33ca5310862c32caf5944d1b9671f5b | 330 | module Cryptoexchange::Exchanges
module Btcexa
class Market < Cryptoexchange::Models::Market
NAME = 'btcexa'
API_URL = 'https://api.btcexa.com/api'
def self.trade_page_url(args={})
"https://btcexa.com/exchange?tag=#{args[:target]}&name=#{args[:base]}_#{args[:target]}"
end
end
... | 25.384615 | 95 | 0.636364 |
1a7b32e82cb51ec36407224875420c9eb370225e | 858 | require 'spec_helper'
RSpec.describe 'Inheritance relation hierarchy' do
include_context 'container'
before do
module Test
class Users < ROM::Relation[:memory]
schema(:users) { }
def by_email(email)
restrict(email: email)
end
end
class OtherUsers < Users
... | 22.578947 | 66 | 0.667832 |
4aea276db968b35aa3252bf8f60c81cf2edc6675 | 2,361 | class Entry < ApplicationRecord
belongs_to :category
belongs_to :user
belongs_to :request, optional: true
has_many :thoughts
has_many :entries_cards
has_many :cards, through: :entries_cards
validates :interpretation_1, :interpretation_2, :interpretation_3, presence: true, if: -> { request_id.present? }
... | 40.016949 | 138 | 0.707327 |
217fa8dcef748fed41ef01e5d6b643e82625fe6b | 2,311 | # encoding: utf-8
require 'github_api/request/oauth2'
require 'github_api/request/basic_auth'
require 'github_api/request/jsonize'
require 'github_api/connection'
module Github
# A class responsible for dispatching http requests
class Request
include Connection
HTTP_METHODS = [:get, :head, :post, :put, ... | 27.188235 | 81 | 0.62527 |
e94e3a3879567e9264eda8ef019315859a2704ec | 125,406 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
require 'seahorse/client/plugins/content_length.rb'
require 'aws-sdk-core/plugins... | 42.800683 | 177 | 0.669282 |
ed0c84b1b6a4532a0a5784ff56dee9383fe6103c | 169 | require "rails_helper"
RSpec.describe Resource, type: :model do
it { is_expected.to validate_presence_of :title }
it { is_expected.to belong_to :resourcetype }
end
| 24.142857 | 51 | 0.769231 |
62e17f569b1c06d387f7839552c0b80a83972822 | 1,878 | # encoding: utf-8
##
# This file is auto-generated. DO NOT EDIT!
#
require 'protobuf'
##
# Imports
#
require 'google/protobuf/descriptor.pb'
module Google
module Protobuf
module Compiler
::Protobuf::Optionable.inject(self) { ::Google::Protobuf::FileOptions }
##
# Message Classes
#
... | 23.475 | 85 | 0.625133 |
ac9ada6a29fd3fa5ed7664963ae242a2035a9b2c | 3,513 | class User < ApplicationRecord
has_many :microposts, dependent: :destroy
has_many :active_relationships, class_name: "Relationship",
foreign_key: "follower_id",
dependent: :destroy
has_many :passive_relationships, class_name: "Relationship... | 30.284483 | 89 | 0.679192 |
39d819b4bdf96074c61cf222915c9936b0baef7d | 367 | module Pushcar
module Transport
class Sse < Base
register :sse
def content_type
"application/x-dom-event-stream"
end
def write(data)
renderer.call ["Event: message\n" +
data.split("\n").map { |datum| "data: #{datum}\n" }.join +
... | 21.588235 | 81 | 0.482289 |
f80e8c120784b1f158ddcf549166f193c9c1af7f | 661 | def btr(c, x, y, i, j)
return '' if i < 1 || j < 1
return btr(c, x, y, i - 1, j - 1) + x[i - 1] if x[i - 1] == y[j - 1]
return btr(c, x, y, i, j - 1) if c[i][j - 1] > c[i - 1][j]
btr(c, x, y, i - 1, j)
end
File.open(ARGV[0]).each_line do |line|
line.chomp!
next if line.empty?
x, y = line.split(';')
c =... | 27.541667 | 71 | 0.476551 |
ed44ad9b0ae21dd9453b40edef04f9ad38cc90be | 597 | # == Schema Information
#
# Table name: transactions
#
# id :bigint not null, primary key
# user_id :integer not null
# transaction_type :string not null
# created_at :datetime not null
# updated_at :datetime not null
# asse... | 27.136364 | 78 | 0.577889 |
ac93393ac3af45bfc902e7a98d0359a577d74afb | 6,917 | require 'spec_helper'
describe Projects::MergeRequests::CreationsController do
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:fork_project) { create(:forked_project_with_submodules) }
let(:get_diff_params) do
{
namespace_id: fork_project.namespace.to_param,
... | 32.32243 | 190 | 0.649559 |
33adae12eada553893fb34df43af9aa81918c32d | 809 | module LanguageServer
module Protocol
module Interface
#
# Show message request client capabilities
#
class ShowMessageRequestClientCapabilities
def initialize(message_action_item: nil)
@attributes = {}
@attributes[:messageActionItem] = message_action_item if m... | 21.864865 | 86 | 0.606922 |
f71d5ea89e5c520c0b224437b355e58a9596aa9e | 1,253 | module Volt
module ReactiveAccessors
module ClassMethods
# Create a method to read a reactive value from an instance value. If it
# is not setup, create it so it can be updated through the reactive value
# at a later point.
def reactive_reader(*names)
names.each do |name|
... | 26.104167 | 87 | 0.618516 |
f7b989bdb9dc0d7e1bc5818c33eb077ae14e683a | 8,001 | # frozen_string_literal: true
require "project_types/script/test_helper"
describe Script::UI::ErrorHandler do
describe ".display_and_raise" do
let(:failed_op) { "Operation didn't complete." }
let(:cause_of_error) { "This is why it failed." }
let(:help_suggestion) { "Perhaps this is what's wrong." }
... | 33.061983 | 101 | 0.650669 |
b974b8a7e8a78f4615e00f900327524682277709 | 1,386 | require 'logger'
require_relative 'gitlab_config'
require_relative 'gitlab_logger'
module GitlabMetrics
module System
# THREAD_CPUTIME is not supported on OS X
if Process.const_defined?(:CLOCK_THREAD_CPUTIME_ID)
def self.cpu_time
Process.
clock_gettime(Process::CLOCK_THREAD_CPUTIME_ID... | 24.315789 | 93 | 0.694084 |
ff972d0639ff336474ff1f87886e302461a0dd00 | 1,229 | # frozen_string_literal: true
RSpec.describe RuboCop::Cop::Layout::ClosingHeredocIndentation do
subject(:cop) { described_class.new(config) }
let(:config) do
RuboCop::Config.new('Layout/ClosingHeredocIndentation' => cop_config)
end
let(:cop_config) { { 'Enabled' => true } }
it 'accepts correctly indent... | 20.830508 | 73 | 0.545159 |
33109ae98c61fb6a03a32d59b893a60691e45c85 | 2,001 | shared_examples 'php-fpm::layout' do
it "should have local php-fpm layout" do
expect(file("/opt/docker/etc/php")).to be_directory
expect(file("/opt/docker/etc/php/fpm")).to be_directory
expect(file("/opt/docker/etc/php/fpm/pool.d")).to be_directory
expect(file("/opt/docker/etc/php/p... | 36.381818 | 82 | 0.617691 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.