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 |
|---|---|---|---|---|---|
33b750991a91faa053207789299eb886fae992a1 | 458 | ENV['RACK_ENV'] = 'test'
require_relative '../my_app'
require 'minitest/autorun'
require "turn/autorun"
require 'rack/test'
# Include rack helpers and expose full application stack
class MiniTest::Spec
include Rack::Test::Methods
def app
Rack::Builder.parse_file(File.dirname(__FILE__) + '/../config.ru').fi... | 22.9 | 76 | 0.724891 |
03b0aa730efd08ace2bf671060529b63a0d5b2c6 | 558 | # coding: ascii-8bit
##
# This file is part of WhatWeb and may be subject to
# redistribution and commercial restrictions. Please see the WhatWeb
# web site for more information on licensing and terms of use.
# http://www.morningstarsecurity.com/research/whatweb
##
Plugin.define "AnyGate" do
author "Andrew Horton"
ver... | 24.26087 | 77 | 0.716846 |
3893422293b2e303f10a0442f940853730ebf677 | 3,233 | namespace :quality_metrics do
desc 'List the names of quality metrics'
task list: :environment do
puts "Quality Metrics:"
QualityMetric.all.each do |qm|
puts "+ #{qm.name}"
end
end
namespace :run do
desc 'Run quality metrics on latest version of all cookbooks'
task all_the_latest: :e... | 33.329897 | 106 | 0.672131 |
f8075556145098293aa2a648bd1007033756f70a | 3,272 | module Slinky
module ProxyServer
HTTP_MATCHER = /(GET|POST|PUT|DELETE|HEAD) (.+?)(?= HTTP)/
HOST_MATCHER = /Host: (\S+)/
def self.process_proxies proxy_hash
proxy_hash.map{|from, h|
begin
to, opt = h.is_a?(Hash) ? [h.delete("to"), h] : [h, {}]
a = [from, URI::parse(to), ... | 32.078431 | 93 | 0.525672 |
39717f82def5cf744bd868f2edb1561c10bc030e | 1,554 | #
# Be sure to run `pod lib lint Swift-test-Lib.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 = "Swift... | 37.902439 | 116 | 0.632561 |
4a11d0c5177931f846edbe856f463ddb3a970164 | 17 | require 'library' | 17 | 17 | 0.823529 |
4a66ed314306a8a66fb9a033668375c136224b24 | 766 | module Mutest
class Mutator
class Node
module Regexp
# Mutator for root expression regexp wrapper
class RootExpression < Node
handle(:regexp_root_expression)
# Emit mutations for children of root node
#
# @return [undefined]
def dispatch
... | 22.529412 | 55 | 0.535248 |
f8209105b213305b66b47ad35d2a4f22fb1cf887 | 1,019 | # encoding: utf-8
class ParserNobuf
LF = "\n" ## \n == ASCII 0x0A (hex) 10 (dec) = LF (Newline/line feed)
CR = "\r" ## \r == ASCII 0x0D (hex) 13 (dec) = CR (Carriage return)
def self.parse( input )
recs = []
if input.eof?
else
c = input.getc
loop do
## non-blanl li... | 18.196429 | 85 | 0.490677 |
d5a55bf8cc0f31d17b19bc97eb31e3b6e907503c | 208 | class AddRetiredToContainerTypes < ActiveRecord::Migration
def up
add_column :container_types, :retired, :boolean, default: false
end
def down
remove_column :container_types, :retired
end
end
| 23.111111 | 67 | 0.764423 |
f7b88d0f78ba2dfa65dacc93d65c3a3e5b0ac14b | 2,389 | module Archive
##
# Client for archiving questionnaire responses after they're completed.
class Client
def initialize(auth_token:)
headers = {
'Authorization' => "Bearer #{auth_token}"
}
STDOUT.puts "Base URL: #{base_url}"
@connection = Faraday.new(url: base_url, headers: he... | 29.8625 | 104 | 0.620762 |
1d8c30e9a113a7cc741ef6efaf753a4270c2653a | 1,188 | module Api
module Endpoints
class UsersEndpoint < Grape::API
format :json
helpers Api::Helpers::CursorHelpers
helpers Api::Helpers::SortHelpers
helpers Api::Helpers::PaginationParameters
namespace :users do
desc 'Get a user.'
params do
requires :id, type: S... | 30.461538 | 80 | 0.584175 |
185ab26d96b1594634efb5ac01442f10fab0223d | 1,402 | require_relative "base_service"
module Files
class CreateService < BaseService
def execute
allowed = if project.protected_branch?(ref)
can?(current_user, :push_code_to_protected_branches, project)
else
can?(current_user, :push_code, project)
... | 29.208333 | 110 | 0.650499 |
03d1483f425236472c4a3972f0e8615d18216cce | 359 | #!/usr/bin/env ruby
# encoding: utf-8
require "rubygems"
require "amqp"
# Declaring a durable shared queue
AMQP.start("amqp://guest:guest@dev.rabbitmq.com") do |connection, open_ok|
channel = AMQP::Channel.new(connection)
queue = AMQP::Queue.new(channel, "images.resize", :durable => true)
connection.close {
... | 22.4375 | 74 | 0.699164 |
e98876a82a5d3165f57523becaf10fc173438661 | 4,609 | # RSpec for BioRuby-GFF3-Plugin. Run with something like:
#
# rspec -I ../bioruby/lib/ spec/gff3_assemble3_spec.rb
#
# Copyright (C) 2010,2011 Pjotr Prins <pjotr.prins@thebird.nl>
#
$: << "../lib"
require 'bio-gff3'
include Bio::GFFbrowser
GFF3FILE3="test/data/gff/test-cds.gff3"
describe GFF3, "Assemble CDS (ext... | 56.207317 | 946 | 0.812541 |
e2d71ddf5f6ca1f1caabd444247caf0c4be32757 | 522 | class AddCachingRows < ActiveRecord::Migration[5.2]
def change
# we can flatten the tables (to save free rows)
add_column :authors, :orgs_cached, :jsonb unless column_exists?(:authors, :orgs_cached)
add_column :authors, :sources_cached, :jsonb unless column_exists?(:authors, :sources_cached)
... | 40.153846 | 99 | 0.735632 |
bfd2510be242073f985af286a3d7c6ee990ce44e | 1,231 | class Yadm < Formula
desc "Yet Another Dotfiles Manager"
homepage "https://yadm.io/"
url "https://github.com/TheLocehiliosan/yadm/archive/2.4.0.tar.gz"
sha256 "37efea63dc9c77951433c841bde34e0a042dc561e8c026e690d146e768701b0f"
license "GPL-3.0"
bottle :unneeded
def install
system "make", "install", "... | 35.171429 | 99 | 0.692933 |
7a5baec283b5bc74883ce78b8bc36ce1c0db8edc | 2,145 | class Lmod < Formula
desc "Lua-based environment modules system to modify PATH variable"
homepage "https://lmod.readthedocs.io"
url "https://github.com/TACC/Lmod/archive/8.4.7.tar.gz"
sha256 "51788fd935c2278627fe4c0df42e4f2d19fa5de6bbf5ec7c7ea51ab9112be40c"
license "MIT"
bottle do
cellar :any_skip_relo... | 33 | 93 | 0.694172 |
e88ed9f7160f3d02c76bfb81826b55f14a8ff793 | 26 | require "omniauth/wechat"
| 13 | 25 | 0.807692 |
6a9f6c456376c24ec089f9ab06b37beb92b2b5c7 | 3,076 | #-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of ... | 28.747664 | 97 | 0.727243 |
6aa306abe6495aaf635b28203cbf2ea981bdb684 | 1,064 | # frozen_string_literal: true
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'spok/version'
Gem::Specification.new do |spec|
spec.name = 'spok'
spec.version = Spok::VERSION
spec.authors = ['Magnetis Staff']
spec.email = ['... | 35.466667 | 92 | 0.663534 |
1824fa7f16602c43a8fc9bab3799918bf48078fc | 120 | require 'test_helper'
class IpCommTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 15 | 42 | 0.7 |
61488dadb9fe9447c070a3c3bef39fb3ceb8e9b8 | 832 | require "codeclimate-test-reporter"
require "vcr"
require "webmock/rspec"
require "sidekiq/testing"
require "capybara/rspec"
CodeClimate::TestReporter.start
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
co... | 21.333333 | 76 | 0.768029 |
bb00b5d3a27207bd6345fb0cddf91bd7736766ee | 96 | # desc "Explaining what the task does"
# task :frendid_api_client do
# # Task goes here
# end
| 19.2 | 38 | 0.708333 |
e9532f1598a38bb8e9548bc2fa75bad98fe96237 | 477 | module WordWalker
class Sequence
attr_reader :letter_count
attr_reader :passage
attr_reader :words
def initialize(passage, passes: 10)
@passage = passage
@words = parse_passage(@passage.to_str.upcase)
end
protected
def parse_passage(passage)
@letter_count = passage.gsub(/... | 19.08 | 54 | 0.60587 |
f7c608cfc3082f338127456158f7a537beadc4ea | 454 | describe Travis::Yml, 'perl' do
subject { described_class.apply(parse(yaml)) }
describe 'perl' do
describe 'given a seq of strs' do
yaml %(
perl:
- str
)
it { should serialize_to perl: ['str'] }
it { should_not have_msg }
end
describe 'given a str' do
... | 19.73913 | 48 | 0.539648 |
91306a323fc5eb4fe573865e5228cb224e8b89e9 | 153 | require 'test/unit'
class SexyActionsTest < Test::Unit::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
end
| 17 | 44 | 0.712418 |
ff273dae05e02ff6d13d3214402a4545d7ae8119 | 478 | class Date
def day_name
strftime("%A")
end
def tuesday
monday + 1
end
def wednesday
monday + 2
end
def thursday
monday + 3
end
def friday
monday + 4
end
def current_week?
cweek == Date.today.cweek
end
def less_than_a_week_away?
(self - Date.today).to_i <= 7
... | 12.918919 | 60 | 0.635983 |
e9a6facb5b8a9092d22aa06a54435d0d5e0c7d39 | 20,520 | # encoding: UTF-8
# frozen_string_literal: true
describe WalletService do
let!(:blockchain) { create(:blockchain, 'fake-testnet') }
let!(:currency) { create(:currency, :fake) }
let(:wallet) { create(:wallet, :fake_hot) }
let(:fake_wallet_adapter) { FakeWallet.new }
let(:fake_blockchain_adapter) { FakeBlockc... | 32.51981 | 178 | 0.584162 |
e2652515acb01d00ca08f0723fb273b50a9495ce | 1,013 | module Wukong
class Dataflow < Hanuman::Tree
def self.configure(settings)
settings.description = builder.description if builder.description
end
end
class DataflowBuilder < Hanuman::TreeBuilder
def description desc=nil
@description = desc if desc
@description
end
def... | 23.022727 | 71 | 0.613031 |
f75576fd75ac6bc2b751ad66aacb749381ce8b13 | 441 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Subscriptions::Mgmt::V2016_06_01
module Models
#
# Defines values for SubscriptionState
#
module SubscriptionState
Enabled = "Enabled"
... | 23.210526 | 70 | 0.678005 |
4a00450a4f8cf016710098dc405382b7c6f5ebd8 | 546 | module RR
module WildcardMatchers
class Satisfy
attr_reader :expectation_proc
def initialize(expectation_proc)
@expectation_proc = expectation_proc
end
def wildcard_match?(other)
return true if self == other
!!expectation_proc.call(other)
end
def insp... | 21 | 55 | 0.622711 |
616ab330c39c49e09e2836dbe70d8d45a772f2c1 | 2,916 | # frozen_string_literal: true
module Ferrum
class Page
module Net
AUTHORIZE_TYPE = %i[server proxy]
RESOURCE_TYPES = %w[Document Stylesheet Image Media Font Script TextTrack
XHR Fetch EventSource WebSocket Manifest
SignedExchange Ping CSPViolationRe... | 32.043956 | 79 | 0.600823 |
bba7205bf6acf830ea1e8b02a309ad1332fdf653 | 2,178 | require 'puppet/resource_api'
# rubocop:disable Style/StringLiterals
# Manage storage containers. A storage container is a logical grouping of related storage objects in a cluster. A storage container corresponds to a vVol datastore in vCenter and is used to group related vVols and track the amount of space that is u... | 48.4 | 260 | 0.678145 |
6a6f9922dc7927e5a80d7c5d5b14bb8fa6fe8033 | 168 | require 'rails_helper'
RSpec.describe User, type: :model do
it { should have_many(:activities).dependent(:destroy) }
it { should validate_presence_of(:name) }
end
| 24 | 58 | 0.744048 |
872071b6c910b24fcc9d2d0f16c3b80467bdb796 | 944 | class PlacesController < ApplicationController
def index
@places = Place.order('created_at DESC')
end
def edit_index
@places = Place.order('created_at DESC')
end
def show
@place = Place.find(params[:id])
end
def new
@place = Place.new
end
def edit
@place = Place.find(params[:id... | 18.88 | 91 | 0.639831 |
bfd18be982609be89e06ae9ce95c880dd20dd68b | 325 | require 'test/unit'
require 'io/nonblock'
$-w = true
require 'kgio'
class TestPipePopen < Test::Unit::TestCase
def test_popen
io = Kgio::Pipe.popen("sleep 1 && echo HI")
assert_equal :wait_readable, io.kgio_tryread(2)
sleep 1.5
assert_equal "HI\n", io.kgio_read(3)
assert_nil io.kgio_read(5)
end... | 21.666667 | 51 | 0.689231 |
d5012e0bc41c0e07d6f2d2ea5d747e880f90de40 | 1,053 | # coding: utf-8
Gem::Specification.new do |spec|
spec.name = "type-on-strap"
spec.version = "0.6.0"
spec.authors = ["Sylhare","Rohan Chandra"]
spec.email = ["sylhare@outlook.com", "hellorohan@outlook.com"]
spec.summary = "A simple and responsive jekyll theme template"
s... | 37.607143 | 145 | 0.650522 |
e8aa37325b0eaf30439ade456af6ed77fc202480 | 68 | class ClassWithOneIncludedMixin
include ModuleWithNoRelations
end
| 17 | 31 | 0.897059 |
8779a5bb5a958759c85d978d9b739a6a79fef0b6 | 2,326 | require 'ostruct'
module VersionInfo
STORAGE_CLASS = {text: TextStorage, yaml: YamlStorage, module: ModuleStorage}
class Data < OpenStruct
def initialize(segments)
super()
@segments = segments
reset
end
def storage
unless @storage
@storage ||= STORAGE_CLASS[VersionI... | 20.226087 | 79 | 0.551161 |
91fa569ce908d7fbe01233697bbf82c018a2e6a6 | 270 | # frozen_string_literal: true
RSpec.describe Karafka::Extensions::SidekiqAttributesMap do
subject(:attributes_map) { Karafka::AttributesMap }
it { expect(attributes_map.topic).to include :interchanger }
it { expect(attributes_map.topic).to include :worker }
end
| 30 | 62 | 0.781481 |
ff0d132134a0de0d5bdbdf019624fad7cb3628bd | 93 | class BooksController < ApplicationController
def index
@products = Book.all
end
end
| 15.5 | 45 | 0.752688 |
6141fc74f2838bedad4ebbd8368a6d4d3a9bdd93 | 1,477 | #!/usr/bin/env ruby
# -*- coding: utf-8 -*-
#######################################################################
#
# A demo of a Line chart with a secondary axis in WriteXLSX.
#
# reverse(c), March 2011, John McNamara, jmcnamara@cpan.org
# convert to ruby by Hideo NAKAMURA, nakamura.hideo@gmail.com
#
require 'writ... | 25.465517 | 76 | 0.619499 |
791b9ded909ceb5e1ed6acd198c71dc0ef471604 | 2,891 | require 'formula'
class NoBdb5 < Requirement
satisfy(:build_env => false) { !Formula["berkeley-db"].installed? }
def message; <<-EOS.undent
This software can fail to compile when Berkeley-DB 5.x is installed.
You may need to try:
brew unlink berkeley-db
brew install dsniff
brew link berk... | 49 | 104 | 0.704946 |
26c623d922346a2145b01faeada98352d033ad01 | 492 | namespace :m do
desc 'Load the seed data from db/seeds.rb'
task :seed => 'db:abort_if_pending_migrations' do
seed_file = File.join(File.dirname(__FILE__), '..', '..', 'db', 'seeds.rb')
load(seed_file) if File.exist?(seed_file)
end
task :schema => :environment do
ENV['SCHEMA'] = File.join(File.... | 28.941176 | 84 | 0.615854 |
ac2d24eb8f1152890050d7ef7c9587af99aac4f1 | 794 | class OmniauthCallbacksController < Devise::OmniauthCallbacksController
def self.provides_callback_for(provider)
class_eval %Q{
def #{provider}
auth = env["omniauth.auth"]
@user = User.find_for_oauth(env["omniauth.auth"], current_user)
if @user.persisted?
session[:access_to... | 36.090909 | 105 | 0.677582 |
334d02697b740b1d354635ff7fd728b6d1e946b6 | 168 | class CreateIngredients < ActiveRecord::Migration[6.0]
def change
create_table :ingredients do |t|
t.string :ing_name
t.timestamps
end
end
end
| 16.8 | 54 | 0.684524 |
e8dc881f8be56b66b72b3085f8eb3be5b955bdc9 | 1,382 | # frozen_string_literal: true
require 'spec_helper'
describe API::GroupMilestones do
let(:user) { create(:user) }
let(:group) { create(:group, :private) }
let(:project) { create(:project, namespace: group) }
let!(:group_member) { create(:group_member, group: group, user: user) }
let!(:closed_milestone) { cr... | 44.580645 | 160 | 0.718524 |
01f654be55a54eab04c51f3a1354f2e36511f35d | 81 | class MangaGenre < ApplicationRecord
belongs_to :manga
belongs_to :genre
end
| 16.2 | 36 | 0.802469 |
ac84ef94b1cebf25d255cd96327d356ca81edb51 | 4,131 | # frozen_string_literal: true
module Avatarable
extend ActiveSupport::Concern
included do
prepend ShadowMethods
include ObjectStorage::BackgroundMove
include Gitlab::Utils::StrongMemoize
validate :avatar_type, if: ->(user) { user.avatar.present? && user.avatar_changed? }
validates :avatar, fi... | 33.048 | 153 | 0.710724 |
21c172f1a51936716ffe5003ac37bc62ac516292 | 6,296 | Hadean::Application.routes.draw do
resources :image_groups
# mount Resque::Server.new, at: "/resque"
namespace(:admin){ namespace(:customer_service){ resources :comments } }
resources :user_sessions, only: [:new, :create, :destroy]
get 'admin' => 'admin/overviews#index'
get 'login' => 'user_... | 26.233333 | 97 | 0.595775 |
91dd92b7c679aa06af80e1c27c365a27ac950039 | 11,919 | # == Schema Information
#
# Table name: services
#
# id :integer not null, primary key
# type :string(255)
# title :string(255)
# project_id :integer
# created_at :datetime
# updated_at :datetime
# active ... | 37.958599 | 161 | 0.606427 |
f855d39101f02ec4c6a2a5d8cf35b43f7280bf44 | 189 | class Alexa < ApplicationRecord
belongs_to :chat, optional: true
validates_presence_of :device_user
validates_uniqueness_of :device_user
def display_name
device_user
end
end
| 18.9 | 38 | 0.798942 |
ab36051f8b8f7e164a324d49d956b40163c7ade2 | 586 | # Time Complexity: O(n)
# Space Complexity: O(1)
def max_sub_array(nums)
result = nil
if nums == nil
result = 0
elsif nums.length > 0
max_so_far = 0
max_ending_here = 0
largest_element = nums[0]
nums.each do |element|
max_ending_here = max_ending_here + element
max_ending_he... | 26.636364 | 74 | 0.674061 |
18aff995bdf6ee1bd28f4575b87aea3c964fc192 | 3,578 | require 'test_helper'
class PracticalSupportsControllerTest < ActionDispatch::IntegrationTest
before do
@patient = create :patient
@user = create :user
sign_in @user
end
describe 'create' do
before do
with_versioning(@user) do
@support = attributes_for :practical_support
po... | 32.234234 | 106 | 0.622415 |
6adc70d8553cb8cc96d48a8eeb91b175d2760c91 | 1,561 | # 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... | 30.607843 | 85 | 0.650865 |
1a25fdb453594fd81e7e86b8aedd3594f94eb459 | 162 | class Api::V1::ApplicationsController < ApiController
before_filter :require_ssl
before_filter :require_api_key
respond_to :json
def index
end
end
| 14.727273 | 53 | 0.771605 |
f767b07e7593f3109f9ba71183c1c00b42352360 | 1,212 | require 'abstract_unit'
class DispatcherTest < ActiveSupport::TestCase
class Foo
cattr_accessor :a, :b
end
class DummyApp
def call(env)
[200, {}, 'response']
end
end
def setup
Foo.a, Foo.b = 0, 0
ActionDispatch::Callbacks.reset_callbacks(:call)
end
def test_before_and_after_c... | 20.542373 | 71 | 0.658416 |
b9deaa2af3a6b2907ab5b78b674f520fd125d966 | 1,084 | # Taken from bunto/bunto-mentions (Copyright (c) 2016-present GitHub, Inc. Licensened under the MIT).
require 'rubygems'
require 'minitest/autorun'
require 'shoulda'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'bunto-archives'
TEST_DIR = ... | 24.088889 | 101 | 0.643911 |
bf094cd50df45158fd4b36722d77ec1c92ed8673 | 500 | class AddSettings < ActiveRecord::Migration
def self.up
Radiant::Config.create :key => 'google_search.api_key', :description => "Required. Your Google search API key"
Radiant::Config.create :key => 'google_search.custom_search_id', :description => "Optional. The Google Custom Search Engine ID if you want to u... | 41.666667 | 154 | 0.752 |
ed552e80965d4d9de75c1b5e6afc261b8cfa50bf | 7,437 | # Task file for tests
ref_file = 'tasks/kernel.yml'
control 'kernel-01' do
title 'Prevent unprivileged users from seeing dmesg output'
impact 'low'
ref ref_file
describe kernel_parameter('kernel.dmesg_restrict') do
its('value') { should eq 1 }
end
end
control 'kernel-02' do
title 'Prevent users from r... | 22.536364 | 93 | 0.698669 |
21b9b20b5de0816ac076766cd0318a952ac26579 | 1,362 | require_relative "../test_client"
require "launchy"
module InfluxDB
module Rails
module Matchers
def expect_metric(name: "rails", **options)
expect(metrics).to include(
a_hash_including(options.merge(name: name))
)
end
def expect_no_metric(name: "rails", **options)
... | 27.795918 | 96 | 0.629956 |
6a419357c4b91ae0fe2f6b0088e1834b39f4c818 | 283 | # DO NOT EDIT THIS FILE!
# This file is managed by ModuleSync.
#
# frozen_string_literal: true
require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'
include RspecPuppetFacts
RSpec.configure do |c|
c.hiera_config = 'spec/fixtures/hiera/hiera.yaml'
end
| 20.214286 | 51 | 0.787986 |
616bced258df37717f599cb3c3826999e43da192 | 3,356 | module FHIR
# fhir/explanation_of_benefit_benefit_balance.rb
class ExplanationOfBenefitBenefitBalance < BackboneElement
include Mongoid::Document
embeds_one :category, class_name: 'FHIR::CodeableConcept'
embeds_one :excluded, class_name: 'FHIR::PrimitiveBoolean'
embeds_one :name, class_name:... | 47.942857 | 163 | 0.68236 |
bb2d051a45f3631a964ace20b50b9f01eede7ab7 | 2,423 | # Userモデルのバリデーションテスト(name, email)
require 'rails_helper'
RSpec.describe User, type: :model do
#facrory botが存在するかのテスト
it 'has a valid factory bot' do
expect(build(:user)).to be_valid
end
#ここからバリデーションのテスト
describe 'validations' do
it { is_expected.to validate_presence_of(:name) }
... | 36.712121 | 74 | 0.543541 |
03dd7cbbb84a4ddf60e361ebf3e7e5b12209297e | 1,105 | class GitHooksGo < Formula
desc "Git hooks manager"
homepage "https://git-hooks.github.io/git-hooks"
url "https://github.com/git-hooks/git-hooks/archive/v1.3.0.tar.gz"
sha256 "518eadf3229d9db16d603290634af8ae66461ec021edf646e8bca49deee81850"
license "MIT"
head "https://github.com/git-hooks/git-hooks.git"
... | 35.645161 | 94 | 0.753846 |
01d780a9e75c2592405f6facf7a4a3bf6253a59a | 1,706 | require 'test_helper'
class TwitterFeedRefresherTest < ActiveSupport::TestCase
setup do
@user = users(:ben)
@feed = @user.feeds.first
@keys = {"twitter_access_token" => "token", "twitter_access_secret" => "secret"}
@feed.update(feed_type: :twitter)
@user.update(@keys)
end
test "feed gets sc... | 29.929825 | 93 | 0.694021 |
61ff99132894b50e1caeba4c800e1498f0e29774 | 1,238 | # Copyright 2015 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 applicable law or agreed to in writing, ... | 32.578947 | 83 | 0.727787 |
1d380af389fd705bcd0397a94cdac14fe59b03e6 | 1,405 | class Dolt < Formula
desc "Git for Data"
homepage "https://github.com/liquidata-inc/dolt"
url "https://github.com/liquidata-inc/dolt/archive/v0.21.0.tar.gz"
sha256 "788aa1d906d4ee4e93ed576607a971f803b6fabf2aeb7394cf5b2b1940c4a8e9"
license "Apache-2.0"
livecheck do
url "https://github.com/liquidata-inc/... | 35.125 | 113 | 0.683274 |
aba69a2014b97c0414c0240f0183b36b9d9f8901 | 2,524 | # frozen_string_literal: true
# See LICENSE.txt at root of repository
# GENERATED FILE - DO NOT EDIT!!
require 'ansible/ruby/modules/base'
module Ansible
module Ruby
module Modules
# Create, update and remove hosts.
class Cs_host < Base
# @return [String] Name of the host.
attribute :... | 45.890909 | 266 | 0.654913 |
bb0603e7bc9624328d6d4002ae84a25a47d10de8 | 6,924 | require 'prime'
x = 0
10.times do |x|
x ** x
x+=1
puts Math.log(x)
puts x.prime_division
Prime::Generator23.new
end
def highest_biPrimefac(p1, p2, n)
result = []
d = p1* p2 * 2
(n).downto(d).detect do |n|
if n.prime_division.length ==2
if n.prime_division[0][0] == p1 && n.prime_division[1][0] ... | 26.128302 | 187 | 0.563836 |
28bb20d688021ea2dd758bbad0d4bb8211986031 | 384 | # frozen_string_literal: true
module ActionDispatch
module Routing
class Endpoint # :nodoc:
def dispatcher?; false; end
def redirect?; false; end
def matches?(req); true; end
def app; self; end
def rack_app; app; end
def engine?
rack_app.is_a?... | 21.333333 | 57 | 0.580729 |
794e6d3092404ec8a030669596945b3100b63053 | 559 | # frozen_string_literal: true
module WaterDrop
# Namespace for all the things related with WaterDrop instrumentation process
module Instrumentation
class << self
# Builds a manager for statistics callbacks
# @return [WaterDrop::CallbacksManager]
def statistics_callbacks
@statistics_ca... | 26.619048 | 79 | 0.70483 |
f860f3a29c1da68e861edf821b48750de9a808d4 | 5,542 | =begin
#NSX-T Manager API
#VMware NSX-T Manager REST API
OpenAPI spec version: 2.5.1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.19
=end
require 'date'
module NSXT
# Duplicate IP detection and control
class DuplicateIPDetection
# Indicates whether dupl... | 29.322751 | 107 | 0.634248 |
912e68b426f8cbaf4fb4e1106e0ef7d8d224b67e | 2,350 | #-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2013 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of ... | 34.057971 | 91 | 0.742128 |
878ed74bb3589d89aacddbdae2292a0fe07e2734 | 27 | module CurationsHelper
end
| 9 | 22 | 0.888889 |
abf815c3923a23a57fbbf10d64d2a6f939d62215 | 7,423 | #! /usr/bin/env ruby
require 'spec_helper'
describe Puppet::Parser::AST::Resource do
ast = Puppet::Parser::AST
describe "for builtin types" do
before :each do
@title = Puppet::Parser::AST::String.new(:value => "mytitle")
@compiler = Puppet::Parser::Compiler.new(Puppet::Node.new("mynode"))
@s... | 40.342391 | 159 | 0.645157 |
4ada8b26aad326e6c456f72f7aa9abaf1e15eb18 | 3,886 | module CandyCheck
module PlayStore
# Describes a successfully validated subscription
class Subscription
include Utils::AttributeReader
# @return [Hash] the raw attributes returned from the server
attr_reader :attributes
# The payment of the subscription is pending (payment_state)
... | 26.8 | 79 | 0.638446 |
f8e8cf7588111d1cdffdf504b39185e5188a3afb | 158 | class AddFirstLegislationNumberToDistrict < ActiveRecord::Migration[6.0]
def change
add_column :districts, :first_legislation_number, :string
end
end
| 26.333333 | 72 | 0.803797 |
f8188d3417b69d23347c3a67f20ad3ee187be9e8 | 2,695 | #
# Cookbook:: sc-mongodb
# Recipe:: mongodb_org_repo
#
# Copyright:: 2011, edelight GmbH
# Authors:
# Miquel Torres <miquel.torres@edelight.de>
#
# Copyright:: 2016-2017, Grant Ridder
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lic... | 42.109375 | 168 | 0.693506 |
79414a77b28fd9b89d6a1bb4c8e8d306a3bde5db | 388 | # frozen_string_literal: true
module EE
module Gitlab
module GitAccessDesign
extend ::Gitlab::Utils::Override
private
override :check_protocol!
def check_protocol!
return if geo?
super
end
override :check_can_create_design!
def check_can_create_design... | 14.923077 | 40 | 0.621134 |
5d24a99c52d4430cee27d3b7649e9632e6a2b2d7 | 7,914 | module NOVAHawk::Providers
module Openstack
module RefreshParserCommon
module OrchestrationStacks
def stack_resources(stack)
return @resources[stack.id] if @resources && !@resources.fetch_path(stack.id).blank?
@resources = {} unless @resources
@resources[stack.id] = saf... | 40.172589 | 133 | 0.592747 |
91701e9ea3c07cefc53edb605ae7c7ccb324bfc1 | 14,457 | # frozen_string_literal: true
# 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 inv... | 48.19 | 154 | 0.751262 |
ac9ff154e042c90058f8c02cc62c8bbfc1f88e5a | 1,158 | #!/usr/bin/env ruby -w
require 'rmagick'
imgl = Magick::ImageList.new
imgl.new_image(400, 150) { self.background_color = 'white' }
gc = Magick::Draw.new
gc.stroke('black').stroke_width(15)
gc.fill_opacity(0)
gc.stroke_linecap('butt')
# Draw lines with miter join
gc.stroke_linejoin('miter')
gc.polyline(25, 100, 75, ... | 23.632653 | 60 | 0.699482 |
38dbe62fde72995fd310a4c596433e237d4b55c5 | 5,769 | # encoding: utf-8
module Mongoid #:nodoc:
# Observer classes respond to life cycle callbacks to implement trigger-like
# behavior outside the original class. This is a great way to reduce the
# clutter that normally comes when the model class is burdened with
# functionality that doesn't pertain to the core re... | 31.697802 | 83 | 0.664067 |
87088658bf37e2282e9a9f66e7b3e79b7b6ce7db | 356 | name 'disabled'
maintainer 'Josiah Kiehl'
maintainer_email 'jkiehl@riotgames.com'
license 'Apache 2.0'
description 'Prevents a node from running chef-client as having this on the run list indicates that the node is disabled'
long_description IO.read(File.join(File.dirname(__FILE__), 'REA... | 39.555556 | 126 | 0.696629 |
edf3bcc0dcb7904a3bc6fcd4ec799139ce82b134 | 950 | # encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
module NewRelic
class Control
# Structs holding info for the remote server and proxy server
class Server < Struct.new :name, :port #:nodoc:
def ... | 28.787879 | 103 | 0.681053 |
e8f591ec3b02c018eaa9037b2c23b244e91ece95 | 764 | require File.expand_path('test_helper', File.dirname(__FILE__))
class TestHTMLOutputter < MiniTest::Unit::TestCase
def setup
@parser = Hippo_eyeDoc::Parser.new
@sample_835 = @parser.parse_file('samples/005010X221A1_business_scenario_1.edi').first
@sample_837 = @parser.parse_file('samples/005010X231A1_01.... | 33.217391 | 90 | 0.790576 |
ed5ba5f4c6044b99ccacee5d86131dfde2fc4290 | 1,108 | require "jp_jis_code/mapping"
module JpJisCode
class Code
attr_accessor :code, :prefecture_name, :city_name, :prefecture_name_h, :city_name_h
def self.build(ret)
city = self.new
city.code = ret[:code]
city.prefecture_name = ret[:prefecture_name]
city.city_name ... | 27.7 | 117 | 0.617329 |
e8bd6b8d7643c05054488dc7f4907998d1f91c6d | 497 | class StripeReview < StripeModelCallbacks::ApplicationRecord
belongs_to :stripe_charge, optional: true, primary_key: "stripe_id"
def self.stripe_class
Stripe::Review
end
def assign_from_stripe(object)
check_object_is_stripe_class(object)
assign_attributes(
stripe_charge_id: object.charge
... | 24.85 | 69 | 0.748491 |
f7cf2ec055c6c8ca3a50db9ba9b6cccb78ca3b06 | 4,933 | module RailsKindeditor
module Helper
def kindeditor_tag(name, content = nil, options = {})
id = sanitize_to_id(name)
input_html = { :id => id }.merge(options.delete(:input_html) || {})
input_html[:class] = "#{input_html[:class]} rails_kindeditor"
output = ActiveSupport::SafeBuffer.new
... | 42.162393 | 216 | 0.672005 |
916cdac218cc87b8dcccf5acdfc4c41471c79536 | 492 | require 'bio-ucsc'
describe "Bio::Ucsc::Hg18::EncodeUppsalaChipUsf1" do
describe "#find_by_interval" do
context "given range chr1:1-150,000,000" do
it 'returns a record (r.chrom == "chr1")' do
Bio::Ucsc::Hg18::DBConnection.default
Bio::Ucsc::Hg18::DBConnection.connect
i = Bio::Geno... | 30.75 | 70 | 0.648374 |
91e81ae64272dc7b63e55301c1c3d259c00dabf1 | 3,105 | require 'fileutils'
require 'json'
require 'rake'
require 'rubygems/package'
require 'tmpdir'
require 'yaml'
require 'zlib'
load File.expand_path('../../../../lib/tasks/build/aws.rake', __FILE__)
describe 'Aws' do
before(:each) do
@original_env = ENV.to_hash
@build_dir = File.expand_path('../../../../build'... | 33.75 | 126 | 0.633494 |
abc3f95cf21a52cf64d4b93ef4b0d83e5d506222 | 2,445 | # frozen_string_literal: true
require 'find'
require 'pathname'
module Reek
module Source
#
# Finds Ruby source files in a filesystem.
#
class SourceLocator
# Initialize with the paths we want to search.
#
# paths - a list of paths as Strings
def initialize(paths, configurati... | 25.46875 | 116 | 0.593047 |
e86bd10c2981cb2529245e3549f7d050578d8cd4 | 1,310 | module Cryptoexchange::Exchanges
module Bitsonic
module Services
class OrderBook < Cryptoexchange::Services::Market
class << self
def supports_individual_ticker_query?
true
end
end
def fetch(market_pair)
output = super(ticker_url(market_pair... | 30.465116 | 130 | 0.6 |
5de2accafc44723d86ff0de3e679965f08f9a017 | 220 | # frozen_string_literal: true
module DropletKit
class Account < BaseModel
attribute :droplet_limit
attribute :floating_ip_limit
attribute :email
attribute :uuid
attribute :email_verified
end
end
| 18.333333 | 32 | 0.754545 |
61103b833b03281bee71bab16c8ece3617fdd964 | 1,128 | #!/bin/ruby
require 'yaml'
require 'pp'
if ARGV.count < 1
puts "Usage: volume_planner.rb (path)"
puts " path == a directory containing docker swarm compose files"
puts ""
puts "This tool counts how many times volumes are shared between containers"
exit 1
end
volumes = []
Dir.glob("#{ARGV.first}/*.yaml") d... | 27.512195 | 78 | 0.653369 |
086e78c125cdfe58dfb9f7c6b099c17588ec1e3b | 2,781 | module Kontena::Cli::Grids
class LogsCommand < Clamp::Command
include Kontena::Cli::Common
option ["-t", "--tail"], :flag, "Tail (follow) logs", default: false
option ["-s", "--search"], "SEARCH", "Search from logs"
option "--lines", "LINES", "Number of lines to show from the end of the logs"
opt... | 31.602273 | 87 | 0.598706 |
33bcd501a7380288b91870ec0bf91185f3a7b820 | 358 | require 'fileutils'
include FileUtils
require 'rubygems'
%w[rake hoe newgem rubigen].each do |req_gem|
begin
require req_gem
rescue LoadError
puts "This Rakefile requires the '#{req_gem}' RubyGem."
puts "Installation: gem install #{req_gem} -y"
exit
end
end
$:.unshift(File.join(File.dirname(__FI... | 21.058824 | 59 | 0.703911 |
796e40b6518b0f250f44be7920aa4d22f0adbd53 | 1,268 | class Sshs < Formula
desc "Graphical command-line client for SSH"
homepage "https://github.com/quantumsheep/sshs"
url "https://github.com/quantumsheep/sshs/archive/refs/tags/3.2.0.tar.gz"
sha256 "8b3127178c7bff19c1ea1a5fd2c5758137863c7e7cfbc4900cdf3fa2f13007a6"
license "MIT"
bottle do
root_url "https:/... | 23.481481 | 115 | 0.647476 |
18716d633941306fe25c6a3e4333b1606e04f5ba | 765 | module Fog
module Parsers
module Zerigo
module DNS
class ListZones < Fog::Parsers::Base
def reset
@zone = {}
@response = { 'zones' => [] }
end
def end_element(name)
case name
when 'default-ttl', 'id', 'nx-ttl', 'hosts-c... | 24.677419 | 200 | 0.470588 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.