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 |
|---|---|---|---|---|---|
ed42b2d102be5771cafdf44790e474890f89cd9a | 53 | class Abc
def hello
puts 'I am here'
end
end
| 8.833333 | 20 | 0.622642 |
914542a79a9cad14ff92afccbb8cf64313570539 | 9,683 | module Slackmos
module Commands
# Random motivational dance images
# rubocop:disable Metrics/ClassLength
class DanceParty
attr_reader :command
def initialize(command)
@command = command
end
def image
self.class.images.sample
end
def count
resul... | 58.331325 | 117 | 0.667562 |
1c7b7496c1b45b3e414592fcb4db9a9766f290f2 | 2,478 | Clahub::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_... | 36.441176 | 104 | 0.760291 |
bb9488742896d6136d3e3b7d6017d69411fd943b | 985 | # -*- coding: utf-8 -*-
require 'date'
# 同じアイテムは各配列を同じにする
titles = ["本のタイトル1", "本のタイトル2", ]
authors = ["著者1", "著者2", ]
yomies = ["ちょしゃいち", "ちょしゃに", ]
publishers = ["出版社1", "出版社2", ]
pages = ["100", "200", ]
prices = ["1000", "2000", ]
purchase_prices = ["1080", "2160", ]
isbn_10s = ["1234567890", "1234567890", ]
isbn... | 28.142857 | 70 | 0.577665 |
f88579b3a95859323fb2a6caae74df4a324288b9 | 349 | # frozen_string_literal: true
module Hyrax
module Admin
class StrategiesController < Flipflop::StrategiesController
before_action do
authorize! :manage, Hyrax::Feature
end
# TODO: we could remove this if we used an isolated engine
def features_url
hyrax.admin_features_path... | 21.8125 | 64 | 0.690544 |
33ef150b25783dc7056ffbaaaaee7100be276493 | 129 | module Ironfan
class Provider
class VirtualBox < Ironfan::IaasProvider
self.handle = :virtualbox
end
end
end
| 12.9 | 44 | 0.689922 |
26e3ef56b70d270b73a10178c50b7d6e9dd40e7b | 2,473 | require 'test_helper'
require 'yopta_switcher/cli/operation_builder'
class OperationBuilderTest < Minitest::Test
attr_reader :options, :builder, :client, :driver
def setup
@options = Minitest::Mock.new
@driver = Minitest::Mock.new
@client = Minitest::Mock.new
builder_class = YoptaSwitcher::CLI::Op... | 24.245098 | 79 | 0.727861 |
33c624e12136f50dd9809b7c00f775223fd88b9e | 620 | # frozen_string_literal: true
module Rack
class TimeZone
Javascript = <<-EOJ
function setTimezoneCookie() {
var offset = (new Date()).getTimezoneOffset()
var date = new Date();
date.setTime(date.getTime()+3600000);
document.cookie = "utc_offset="+offset+"; expires="+date.toGMTString()... | 22.142857 | 89 | 0.61129 |
084a90cd0557a9d00a6a28f8afe82b2076aba85e | 5,444 | require File.expand_path('../spec_helper', __FILE__)
describe Servolux::Threaded do
base = Class.new do
include Servolux::Threaded
def initialize
self.interval = 0
@mutex = Mutex.new
@signal = ConditionVariable.new
end
def pass( val = 'sleep' )
Thread.pass until status == val
... | 23.364807 | 160 | 0.592763 |
1d8ad02deb22ad83202b2a4dc9697ca38183ea88 | 607 | require_relative '../../spec_helper'
describe "ObjectSpace._id2ref" do
it "converts an object id to a reference to the object" do
s = "I am a string"
r = ObjectSpace._id2ref(s.object_id)
r.should == s
end
it "retrieves a Fixnum by object_id" do
f = 1
r = ObjectSpace._id2ref(f.object_id)
... | 23.346154 | 72 | 0.665568 |
0834bba7ae0dfa4b988593cc8b34b96338a145e2 | 2,295 | # Copyright 2015 Google 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
#
# Unless required by applicable law or agreed to in writing,... | 38.25 | 100 | 0.727669 |
18b9b38c39bbc8a87bec361fe26c57144f31fcf0 | 1,365 | require 'spec_helper'
require 'blazing/config'
require 'blazing/cli'
require 'blazing/dsl'
describe '$ blazing setup' do
before :each do
setup_sandbox
@config = Blazing::Config.new
@config.targets << Blazing::Target.new(:production, "#{@sandbox_directory}/production", @config)
@config.targets << Blaz... | 32.5 | 116 | 0.689377 |
793794425fcf50e776ebc5137d98c5401d743262 | 53 | default[:composer] = {
:github_oauth_token => nil
} | 17.666667 | 28 | 0.679245 |
4ada1938feb74ee4f332d26574788225f665b7c9 | 5,705 | require 'tempfile'
require 'stringio'
require 'mime/types'
module RestClient
module Payload
extend self
def generate(params)
if params.is_a?(String)
Base.new(params)
elsif params.is_a?(Hash)
if params.delete(:multipart) == true || has_file?(params)
Multipart.new(params)... | 23.870293 | 123 | 0.537774 |
3865b488bfeeaf4b08d17670c6bd922f92d879db | 6,408 | require 'test_helper'
class TestIroRubyParser < Minitest::Test
include UnificationAssertion
def assert_parse(expected, source)
got = Iro::Ruby::Parser.tokens(source)
got.each do |_key, value|
value.sort!
end
assert_unifiable(expected, got)
end
def test_tokens_string
assert_parse(
... | 19.014837 | 90 | 0.376404 |
791ed6a8168930da5d9c41398a990fe894a378c1 | 38 | module GitBrd
VERSION = '1.0.0'
end
| 9.5 | 19 | 0.657895 |
b90ed78d8842ffa694e58797273893912155c1e0 | 10,050 | Shindo.tests('Fog::Compute[:aws] | volume requests', ['aws']) do
@volume_format = {
'availabilityZone' => String,
'createTime' => Time,
'encrypted' => Fog::Boolean,
'iops' => Fog::Nullable::Integer,
'requestId' => String,
'size' => Integer,
'sna... | 38.068182 | 156 | 0.608458 |
1db46333ff395494d6ea6963daf7dcfb870fb841 | 7,750 | # frozen_string_literal: true
require "test_helper"
class ReplyTest < ActiveSupport::TestCase
include ActiveJob::TestHelper
attr_accessor :user
setup do
@user = create(:user)
end
test "should not valid when Topic was closed" do
t = create :topic, closed_at: Time.now
r = build(:reply)
asse... | 30.511811 | 123 | 0.689548 |
d5db31a8cb46f168829d297ef8bb85b104148be0 | 3,871 | module Authlogic
module Session
# Think about financial websites, if you are inactive for a certain period of time you will be asked to
# log back in on your next request. You can do this with Authlogic easily, there are 2 parts to this:
#
# 1. Define the timeout threshold:
#
# acts_as_authe... | 46.638554 | 171 | 0.668044 |
bb543ce56aae14cb4f06bf7a96d96284801aadd4 | 1,140 | class ApplicationHelper::Toolbar::CompareCenter < ApplicationHelper::Toolbar::Basic
button_group('comapre_tasks', [
twostate(
:compare_all,
'product product-compare_all fa-lg',
N_('All attributes'),
nil,
:url => "compare_miq_all",
:url_parms => "?id=\#{$vms_comp}&compare_... | 28.5 | 83 | 0.591228 |
4ab9d263b9c42d855d9bd0c847eaaa8276d3f6a8 | 30,645 |
module SearchFlip
# The SearchFlip::Criteria class serves the purpose of chaining various
# filtering and aggregation methods. Each chainable method creates a new
# criteria object until a method is called that finally sends the respective
# request to ElasticSearch and returns the result.
#
# @example
#... | 37.055623 | 145 | 0.657823 |
ffca93875453f14a66115b311961d25b96a06a05 | 960 | module YolQyWeixin
module Connection
module User
def get_users_by_department(department_id, fetch_child=0)
http_get(get_users_by_department_url(department_id, fetch_child))
end
def get_user_id(code)
http_get(user_info_url(open_id))
end
def get_user_info(o... | 30 | 153 | 0.676042 |
f8541e5a7e0370f43f52d8bf67ac6431e2299037 | 1,295 | #-- 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 ... | 38.088235 | 91 | 0.758301 |
21126ea3420fc68acfee8b8a5fa3715714e8830a | 1,390 |
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "coming_soon_refactored/version"
Gem::Specification.new do |spec|
spec.name = "coming_soon_refactored"
spec.version = ComingSoonRefactored::VERSION
spec.authors = ["Cynthia Rittenbach"... | 37.567568 | 96 | 0.685612 |
33e39987f26a8e9fdb874ae6ebc0d9865db196e4 | 444 | Gem::Specification.new do |s|
s.name = 'puppet-module-win-default-r2.1'
s.version = '0.3.4'
s.summary = 'A gem used to manage Puppet module dependencies.'
s.authors = 'Puppet, Inc.'
s.email = 'puppet-module-gems-maintainers@puppet.com'
s.homepage = 'https://github.com/puppetlabs/... | 34.153846 | 68 | 0.646396 |
bf79fbde5815dfc26ac8183fb27b34577699a256 | 250 | require 'xml'
require 'test/unit'
class TestWellFormed < Test::Unit::TestCase
def test_xml_node_doc_get()
parser = XML::Parser.new
parser.string = "<p>I am well formed</p>"
parser.parse
assert(parser.context.well_formed?)
end
end | 22.727273 | 45 | 0.704 |
e8a13cd1462556331f20cb8235a6c335b2f14009 | 3,122 | # frozen_string_literal: true
module YDB
class Row
INTERNAL_VARS = %i[@id @source].freeze
attr_reader :id, :source
def initialize(source, schema_path)
@id = File.basename(source, '.yml')
@source = source
validate_filename
build(source, schema_path)
end
def build_relati... | 29.733333 | 102 | 0.589686 |
1d63c14530e4797048220cb86d281744fc2527cd | 909 | require 'spec_helper'
module Bullet
module Notification
describe NPlusOneQuery do
subject { NPlusOneQuery.new([%w[caller1 caller2]], Post, %i[comments votes], 'path') }
it { expect(subject.body_with_caller).to eq(" Post => [:comments, :votes]\n Add to your finder: :includes => [:comments, :votes]\... | 60.6 | 331 | 0.657866 |
1a648bcaecc69029b30125eb9da223301e81e03a | 1,164 | module Dawn
module Kb
# Automatically created with rake on 2015-07-29
class CVE_2015_2963
include DependencyCheck
def initialize
message = "The thoughtbot paperclip gem before 4.2.2 for Ruby does not consider the content-type value during media-type validation, which allows remote attackers t... | 41.571429 | 297 | 0.634021 |
4a0aea659847cc4a4e95813c73459c06f8fe2f26 | 1,542 | class Blog::Gem::Post < Blog::Gem::ApplicationRecord
include ::PgSearch
belongs_to :author
acts_as_taggable
has_attached_file :thumbnail, styles: { medium: "750x300#", square: "80x80#"}, path: ":rails_root/public#{Blog::Gem.image_path}/posts/:id/:style.:extension", url: "#{Blog::Gem.image_path}/posts/:id/:st... | 29.09434 | 218 | 0.663424 |
1caa1fafaa3ff529a5e1f2bedbdc4cad64f59f14 | 2,413 | require_relative 'spec_helper'
describe 'Outbox Replication Agent' do
before do
init_client
@sling = SwaggerAemClient::SlingApi.new
# ensure agent doesn't exist prior to testing
begin
data, status_code, headers = @sling.delete_agent_with_http_info(
runmode = 'publish',
name = '... | 32.608108 | 93 | 0.657688 |
ac4e1c98c079da3479fbfc146b7df5792ff3e244 | 12,686 | #
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under ... | 47.335821 | 166 | 0.5968 |
28078332da989f798e6291bb8e4d9588bdcac61b | 854 | cask 'r' do
version '3.6.0'
sha256 '51e58a2766e091a85776ab8e44598e4fdd99b066b25b439777f3d4089803a5f1'
url "https://cloud.r-project.org/bin/macosx/R-#{version}.pkg"
appcast 'https://cloud.r-project.org/'
name 'R'
homepage 'https://www.r-project.org/'
depends_on macos: '>= :el_capitan'
pkg "R-#{version... | 24.4 | 75 | 0.48829 |
bfd8688dc51fe41abd5b1496f8ab3351cf803a31 | 465 | class OrganisationReportsController < ApplicationController
layout 'full_width', except: [:without_users_index]
before_action :authorize
def without_users_index
@resend_invitation = false
@mail_template = MailTemplate.find_by(name: 'Invitation instructions')
@orphans = Organisation.not_null_email.nul... | 38.75 | 97 | 0.8 |
1c6ba3a482f2751a946172fc1dbd5329d5a5f510 | 4,035 | class Guile < Formula
desc "GNU Ubiquitous Intelligent Language for Extensions"
homepage "https://www.gnu.org/software/guile/"
url "https://ftp.gnu.org/gnu/guile/guile-3.0.4.tar.xz"
mirror "https://ftpmirror.gnu.org/guile/guile-3.0.4.tar.xz"
sha256 "6b7947dc2e3d115983846a268b8f5753c12fd5547e42fbf2b97d75a3b79f... | 35.086957 | 96 | 0.687732 |
03515dcbb6473b52b421f6cffb6a0c74dae64425 | 5,255 | #-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2017 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,... | 38.357664 | 150 | 0.651951 |
213a5ad6b4d09cbadaf4c478f743959f7b414505 | 66 | module Simplecov
module Summary
VERSION = "0.0.6"
end
end
| 11 | 21 | 0.666667 |
f7e6cab51bd98e11e6ba0816970378d6b1b86ffc | 180 | require "spec_helper"
module ChefAPI
describe Resource::Node do
it_behaves_like "a Chef API resource", :node,
update: { chef_environment: "my_environment" }
end
end
| 20 | 52 | 0.722222 |
ab22e0e391be977089f32f2dca3e7b6d29b9685d | 827 | require 'spec_helper'
describe Tikarb do
let(:file_path) { 'spec/data/test.html' }
before { Tikarb.path = 'bin/tika-app.jar' }
it 'has a version number' do
expect(Tikarb::VERSION).not_to be nil
end
it 'detects media type' do
type = Tikarb.detect(file_path)
expect(type).to eq('text/html')
t... | 23.628571 | 55 | 0.665054 |
5db546766822f4e4a4be31110c1f3b07eae99e44 | 1,608 | require 'aws-sdk'
class AwsSecurityGroup
attr_reader :sg
def initialize(id:, region:)
@sg = Aws::EC2::SecurityGroup.new(id: id, region: region)
end
def update_ip(to_ip:, port:, description:)
from_ip = original_ip(description)
change_ip(from_ip: from_ip, to_ip: to_ip, port: port, description: descr... | 26.360656 | 110 | 0.643657 |
ac213abccd9346492bf0ec15379aff8d5dee17c2 | 4,567 | # frozen_string_literal: true
require "test_helper"
require_relative "ruby2d_object_faker"
require_relative "note_box_asserts"
module Fet
module Ui
module GameTestHelper
include NoteBoxAsserts
include Ruby2dObjectFaker
private
def select_correct_note_with_tests(game, select_using_mouse... | 32.856115 | 102 | 0.672871 |
1a64bb582e34c69586c8991433d0944d4b73b6d0 | 400 | # frozen_string_literal: true
class ThinkingSphinx::RealTime::Attribute < ThinkingSphinx::RealTime::Property
def multi?
@options[:multi]
end
def type
@options[:type]
end
def translate(object)
output = super || default_value
json? ? output.to_json : output
end
private
def default_va... | 14.285714 | 78 | 0.6525 |
1a3e04e499ad797956650c6f95c8189818f09ee1 | 385 | class HomeController < ApplicationController
def index
@categories = Category.order(:name)
end
def search
if params[:search].blank?
redirect_to root_path
elsif params[:search] == "unsorted recipes"
@recipes = Recipe.unsorted.sort_by(&:title)
else
@recipes = Recipe.where(archived... | 24.0625 | 84 | 0.683117 |
edf495b1e90f62198b52501de66dd8fa8a8957e8 | 215 | class StaticController < ApplicationController
skip_after_action :verify_authorized
skip_after_action :verify_policy_scoped
skip_before_action :authenticate_user!
def about
end
def not_found
end
end
| 17.916667 | 46 | 0.823256 |
f8b9b289ea90bdd7b7ed493b7c5b969931035321 | 611 | # frozen_string_literal: true
module EloBrain
module EloCalculations
RSpec.describe Looser do
let(:instance) { described_class.new }
let(:elo) { 100 }
let(:development_coefficient) { 10 }
let(:win_probability) { 0.5 }
describe '#new_elo' do
subject do
instance.new... | 23.5 | 61 | 0.595745 |
28edb8a838598fe30dafa79b6d99d00fb1e9a9f8 | 1,047 | # -*- encoding: utf-8 -*-
# stub: coderay 1.1.1 ruby lib
Gem::Specification.new do |s|
s.name = "coderay"
s.version = "1.1.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"]
s.authors = ["Kornelius Kalnbach"]
s.date = "2016-... | 38.777778 | 143 | 0.69723 |
5da49dc1d95739228e02f9206db53569f54a6761 | 217 | class AddStateFieldToReleaseFields < ActiveRecord::Migration
def self.up
add_column :release_files, :state, :string, :default => 'draft'
end
def self.down
remove_column :release_files, :state
end
end
| 21.7 | 67 | 0.737327 |
1a48eed9050a2ae32393440f11a8ec38efe625b8 | 742 | require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'test/unit'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$... | 20.054054 | 75 | 0.661725 |
872cb883f0f49928568aabd71fb6e3595f88aa7e | 7,449 | require "etc"
# Bugfixed and interface-patched Nethack.
#
# This formula is based on the Nethack formula, and includes the
# patches from same. The original notes from the Nethack formula
# follow:
# - @jterk
#
# Nethack the way God intended it to be played: from a terminal.
# This build script was created referencing... | 33.705882 | 198 | 0.653645 |
79fc9f1fd4f54434c5e41842f3d79154ebedaa01 | 4,932 | require File.dirname(__FILE__) + '/../spec_helper'
module Propel
# Dynamically, globally enable/disable breakpoints
DEBUGGING = false
# Invoke this (dynamically) when you need to turn on debugging
# Propel.const_set(:DEBUGGING, true)
# And put this at points where you want to break:
# debugger if Propel:... | 26.804348 | 90 | 0.651257 |
7a8d0f6c1b21f0dd38193cda3e60d0a0e689688e | 2,798 | module Hoe::DevSupport
def define_devsupport_tasks # name by hoe framework
CLEAN.include "spec/reports"
CLOBBER.include "spec/index.html"
CLEAN.include "coverage", "emigma.log"
CLEAN.include "features/result.json", "features/reports"
CLOBBER.include "features/index.html"
CLOBBER.include "tags... | 25.907407 | 159 | 0.572194 |
bf1444e5387944765c242ca51666f6b6d76d9b56 | 1,939 | module Helpers
def generate_partition_key
"spec_pk_#{Random.rand(999)}"
end
def generate_row_key
Random.rand(999).to_s
end
def write(driver, dynamic_table_name=nil)
table_name = dynamic_table_name || driver.instance.table_name
pk = generate_partition_key
key1 = generate_row_key
key2... | 36.584906 | 110 | 0.669417 |
2802fc60ac657d76e0a2d854511538637631bb3a | 740 | require "test_helper"
require "minitest/mock"
def stub()
mock = MiniTest::Mock.new
mock.expect(:is_a?, data, [CharactersFetcher::URL])
end
class CharactersFetcherTest < ActiveSupport::TestCase
setup do
@mock_client = mock('object')
@mock_parser = mock('object')
@subject = CharactersFetcher.new(... | 23.870968 | 73 | 0.690541 |
3963625b6a61b7f421c3662279008c2f48099444 | 1,470 | # frozen_string_literal: true
class DeviseCreateUsers < ActiveRecord::Migration[5.2]
def change
create_table :users do |t|
## Database authenticatable
t.string :email, null: false, default: ''
t.string :encrypted_password, null: false, default: ''
## Recoverable
t.stri... | 31.276596 | 104 | 0.658503 |
3342c1b027b2bf292eee5ac523714d540cf00eae | 6,020 |
require_relative 'opcodes'
require_relative 'eda_utils'
#-------should be removed--------
require_relative 'disassembler'
#---------------------------------
require 'gtk3' # === for timers that can be paused
module SIMJI
class ISS
attr_accessor :mem_instr,:data,:reg
attr_accessor :old_pc,:addr
attr_... | 25.083333 | 92 | 0.525581 |
1d8bd6bfbcd2960b7c74a840355adc61e66953bf | 969 | require 'selenium-webdriver'
module BrowserInstance
class << self
def base_url=(new_value)
@base_url = new_value
@browser.navigate.base_url = @base_url if @browser
end
def base_url
@base_url || ENV['BASE_URL'] || ''
end
def browser_instance
@browser ||= create_... | 15.885246 | 58 | 0.633643 |
8782fa9bcd974942b96424a3215382395b76917b | 918 | # frozen_string_literal: true
require 'rails_helper'
require "#{Rails.root}/lib/importers/assigned_article_importer"
describe AssignedArticleImporter do
it 'imports articles based on assignment titles' do
create(:course, id: 1)
create(:assignment, id: 101, article_title: 'Selfie', article_id: nil, course_id:... | 36.72 | 88 | 0.720044 |
1d69d5d38761ce297e16f1e3643a1ddb683cba8b | 6,548 | =begin
#Selling Partner API for Services
#With the Services API, you can build applications that help service providers get and modify their service orders.
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 3.0.33
=end
require 'date'
module AmzSpApi:... | 30.175115 | 220 | 0.623702 |
6a82a47be7678e23eb1cabe4fdb80f937f349651 | 123 | require 'test_helper'
class TraditionTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 15.375 | 45 | 0.707317 |
08681970b19593899385a271d8c7e931165b3cb6 | 771 | name 'proftpd-ii'
maintainer 'Hugo Cisneiros (Eitch)'
maintainer_email 'hugo.cisneiros@movile.com'
license 'Apache 2.0'
description 'Installs/Configures proftpd-ii'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
chef_version '>= 11.0' if respond_to?(:chef_ve... | 40.578947 | 120 | 0.725032 |
e99dee3e431f816c3e77776ebda4f478582faf47 | 3,445 | #! /usr/bin/ruby
$: << File.dirname(__FILE__) + '/../lib'
require 'test/unit'
require 'ole/support'
class TestSupport < Test::Unit::TestCase
TEST_DIR = File.dirname __FILE__
def test_file
assert_equal 4096, open("#{TEST_DIR}/oleWithDirs.ole") { |f| f.size }
# point is to have same interface as:
assert_equal... | 21.53125 | 90 | 0.642671 |
18d20fddf144fca1d9c87204534669f19343dde9 | 810 | cask 'flash-player' do
version '26.0.0.151'
sha256 '9b612bde45b637085eeb025fc36832361998d48cf50bc6731a7a7dfdff25eb72'
# macromedia.com was verified as official when first introduced to the cask
url "https://fpdownload.macromedia.com/pub/flashplayer/updaters/#{version.major}/flashplayer_#{version.major}_sa.dmg"... | 42.631579 | 119 | 0.745679 |
33cffe474dc87d4b9ded1c5fba95757babee5169 | 890 | # (C) Copyright 2021 Hewlett Packard Enterprise Development LP
#
# 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... | 38.695652 | 85 | 0.767416 |
79c07880656ce16f7e1cb01b5cb953a52a5fbf58 | 287 | # frozen_string_literal: true
module Logux
class Actions < Action
class << self
extend Gem::Deprecate
deprecate :new, 'Logux::Action.new', 2020, 9
def warn(message)
Logux.logger.warn(message)
end
end
private_class_method :warn
end
end
| 15.944444 | 50 | 0.641115 |
380f9584ff783277de246b14b782459c569d5647 | 780 | # frozen_string_literal: true
class Course < ApplicationRecord
has_many :levels, dependent: :destroy
has_many :events, dependent: :nullify
validates :name, presence: true
validates :title, presence: true
validates :description, presence: true
accepts_nested_attributes_for :levels, allow_destroy: true
va... | 25.16129 | 73 | 0.75641 |
4a71499e87256aa80125245f262dc9bf82b44e69 | 5,097 | #
# Author:: John Keiser (<jkeiser@opscode.com>)
# Copyright:: Copyright (c) 2013 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | 30.339286 | 141 | 0.629782 |
217991bc2c1575c5c8d89cc45785465458a6657b | 1,454 | require_relative '../../../search_test'
require_relative '../../../generator/group_metadata'
module USCoreTestKit
module USCoreV311
class EncounterClassPatientSearchTest < Inferno::Test
include USCoreTestKit::SearchTest
title 'Server returns valid results for Encounter search by class + patient'
... | 29.08 | 114 | 0.686382 |
f729574e7ccf69f669d13191e77916d9707c402d | 1,700 | # frozen_string_literal: true
unless defined?(Solidus::InstallGenerator)
require 'generators/solidus/install/install_generator'
end
require 'generators/spree/dummy/dummy_generator'
class CommonRakeTasks
include Rake::DSL
def initialize
namespace :common do
task :test_app, :user_class do |_t, args|
... | 27.419355 | 247 | 0.677059 |
e231f222d6e6bed997f231552443754e62f61c30 | 658 | # Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to diction... | 50.615385 | 173 | 0.81459 |
61cdedf08f6a1b5913f647a103137ac1ded7911e | 662 | module DiabeticToolbox
#:enddoc:
class NutritionalFact < ActiveRecord::Base
belongs_to :recipe, class_name: 'DiabeticToolbox::Recipe', counter_cache: true
validates :nutrient, inclusion: { in: ReferenceStandard.nutrients.keys.map {|s| s.to_s}, message: I18n.t('activerecord.validations.common.illegal_value'... | 60.181818 | 171 | 0.777946 |
791139af83970fea0ffca82a56e2f84c9f05d345 | 628 | RSpec::Matchers.define :exit do |expected|
match do |actual|
begin
actual.call
rescue StandardError => e
@error = e
rescue SystemExit => e
@error = e
end
@error.is_a?(SystemExit) && @error.status == expected
end
def supports_block_expectations?
true
end
description... | 20.258065 | 60 | 0.574841 |
014a2b35c887a42962579fd54dbc2ac512aecb45 | 944 | class Pdf2json < Formula
desc "PDF to JSON and XML converter"
homepage "https://github.com/flexpaper/pdf2json"
url "https://github.com/flexpaper/pdf2json/archive/0.71.tar.gz"
sha256 "54878473a2afb568caf2da11d6804cabe0abe505da77584a3f8f52bcd37d9c55"
bottle do
cellar :any_skip_relocation
sha256 "035c69... | 36.307692 | 94 | 0.771186 |
1a8a3f7a54c2341daac294289b1d13eef086b132 | 7,040 | # frozen_string_literal: true
require_dependency 'alert_management'
module AlertManagement
class Alert < ApplicationRecord
include IidRoutes
include AtomicInternalId
include ShaAttribute
include Sortable
include Noteable
include Gitlab::SQL::Pattern
include Presentable
STATUSES = {
... | 33.207547 | 125 | 0.669744 |
180dac4324275f9ebdc97e6ea8e6ce88768315df | 349 | def foo(x)
x
end
alias bar foo
class Test
def baz(x)
x
end
alias qux baz
end
foo(1)
bar("str")
Test.new.baz(1)
Test.new.qux("str")
__END__
# Classes
class Object
private
def foo: (Integer | String x) -> (Integer | String)
alias bar foo
end
class Test
def baz: (Integer | String x) -> (Integer |... | 10.90625 | 53 | 0.644699 |
4a2f94b6a8df0cccfb33a0582805d2aad9368fa6 | 188 | class CreateSubject < ActiveRecord::Migration[5.2]
def change
create_table :subjects do |t|
t.string :name
t.timestamps
end
add_index :subjects, :name
end
end
| 17.090909 | 50 | 0.664894 |
1dafccee526a7b01c0f566493e24af7ca1e1cf64 | 1,362 | # encoding: UTF-8'
class AutomaticGeocoding < Sequel::Model
MAX_RETRIES = 5
many_to_one :table
one_to_many :geocodings, order: :created_at
def self.active
AutomaticGeocoding.where("state IN ?", ['created', 'idle']).all.select do |ag|
last_modified = ag.table.data_last_modified || 1.year.ago
l... | 25.222222 | 82 | 0.653451 |
18aded8d40789b36c1bdc17842545fd0b2497356 | 1,309 | module Spec
module Runner
class ExampleGroupRunner
def initialize(options)
@options = options
end
def load_files(files)
# It's important that loading files (or choosing not to) stays the
# responsibility of the ExampleGroupRunner. Some implementations (like)
# th... | 22.186441 | 79 | 0.607334 |
1c63284794027c8cb828127e7d13ef55e749a3cd | 1,631 | require 'spec_helper'
describe MergeRequests::DeleteNonLatestDiffsService, :clean_gitlab_redis_shared_state do
let(:merge_request) { create(:merge_request) }
let!(:subject) { described_class.new(merge_request) }
describe '#execute' do
before do
stub_const("#{described_class.name}::BATCH_SIZE", 2)
... | 27.183333 | 88 | 0.692213 |
ede6b7e0c2ae2957490b1aa55a651246375b1d77 | 4,799 | =begin
#Selling Partner API for Feeds
#The Selling Partner API for Feeds lets you upload data to Amazon on behalf of a selling partner.
OpenAPI spec version: 2021-06-30
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 3.0.26
=end
# load the gem
require 'feeds-api-model'
# T... | 43.234234 | 97 | 0.743071 |
283dc2e1b9866626fc633dced752ad03020f15a5 | 569 | require 'bundler/setup'
if ENV['COVERAGE'] == 'true' && RUBY_ENGINE == "ruby"
require 'simplecov'
SimpleCov.start do
add_filter '/spec/'
end
end
require 'telecine'
require 'celluloid/rspec'
Celluloid::Actor[:default_event_reporter].terminate if Celluloid::Actor[:default_event_reporter]
Celluloid::Actor[:de... | 25.863636 | 102 | 0.757469 |
1aa9e079406ee425176800d120696f453e25ca59 | 1,478 | class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
protected
#This is a routine to extract basic share data from Moneycontrol website.
def readShareBasic(shareLink)... | 38.894737 | 109 | 0.702977 |
2620c9f49e1b5e7df06bf41e602f261de3804dfb | 4,559 | require 'aws-sdk'
require 'rspec/retry'
require 'quarantine/rspec_adapter'
require 'quarantine/test'
require 'quarantine/databases/base'
require 'quarantine/databases/dynamo_db'
class Quarantine
extend RSpecAdapter
attr_accessor :database
attr_reader :quarantine_map
attr_reader :failed_tests
attr_reader :fl... | 31.881119 | 118 | 0.697083 |
016539c491439a0de7d440bf438d8a65d55abacd | 2,461 | require "google/apis/drive_v3"
class Publishers::Vacancies::ApplicationFormsController < Publishers::Vacancies::BaseController
helper_method :form
def create
if applying_for_the_job_details_form_params[:application_form]
create_application_form
else
update_vacancy
end
end
def destroy
... | 30.7625 | 149 | 0.76026 |
e8247503740bc78bd50dc4f08fa0dbae2f246b41 | 1,266 | ###
# Class MobileObject
#
# This is the root Class for all Game Objects, such as players, other characters, items, etc. Basically, anything that is not
# an Area or a Gate. Objects may or may not be able to move around. Objects may or may not be able to be acquired by other
# Objects and carried around.
#
class Mo... | 16.88 | 126 | 0.703002 |
f8485986876e3f7dec38431d824701d189f1e1be | 797 | =begin
#Tatum API
## Authentication <!-- ReDoc-Inject: <security-definitions> -->
OpenAPI spec version: 3.9.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 3.0.31
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Tatum::TronTransferBody
# Automat... | 22.771429 | 85 | 0.741531 |
39f33752c78af31ea2300d44eaa6b439cb74952d | 17,212 | require File.expand_path File.join(File.dirname(__FILE__), 'test_helper')
require 'date'
URL = "http://toto.oz"
AUTHOR = "toto"
context Toto do
setup do
@config = Toto::Config.new(:markdown => true, :author => AUTHOR, :url => URL)
@toto = Rack::MockRequest.new(Toto::Server.new(@config))
Toto::Paths[:art... | 41.177033 | 146 | 0.583023 |
1abe619cc0e74d2ad502b220d01c3bc009258ba9 | 62 | class Workout < ApplicationRecord
belongs_to :journal
end
| 15.5 | 33 | 0.790323 |
21ce455a2beaecd928a5cdb3518a1ef506a9f3e3 | 879 | class Package
def initialize(str)
cols = str.split("-")
if str.size < 3
$stderr.puts "ERROR : cols.size<3...name=#{l}"
return
end
# name1-name2-name3-version-package_version
name = cols.slice(0, cols.size-2).join("-")
version = cols[-2]
package_version = co... | 20.44186 | 106 | 0.594994 |
d5d297905478156ad746e4287b84cc115a630ac9 | 124 | # frozen_string_literal: true
class DeployPin::Record < DeployPin::ApplicationRecord
self.table_name = 'deploy_pins'
end
| 20.666667 | 54 | 0.798387 |
03adab5596f3b41be9ef215900597c681492e2a8 | 912 | Rails.application.routes.draw do
root "sessions#home"
get 'signup' => 'readers#new'
get 'login' => 'sessions#new'
post 'login' => 'sessions#create'
delete 'logout' => 'sessions#destroy'
get '/auth/:provider/callback', to: 'sessions#omniauth'
get 'five_star' => 'books#five_star'
# resources :... | 31.448276 | 112 | 0.678728 |
f8625fb0dadd1c0f6e4ae6aa6299ba0fe257ddbe | 128 | # frozen_string_literal: true
module Users
module Profile
class ShowController < ApplicationController
end
end
end
| 14.222222 | 48 | 0.765625 |
7a4479814353f80515982355bd34a068dc79b975 | 4,556 | # ------------------------------------------------------------------------------------
# <copyright company="Aspose" file="DocumentProperties_tests.rb">
# Copyright (c) 2020 Aspose.Words for Cloud
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this sof... | 41.418182 | 196 | 0.721247 |
ab0df76aa3258824ab57792d43e4c00fb7d094c6 | 352 | # frozen_string_literal: true
module Shmup
module Entities
module Bullet
class Sound
class << self
def play
sound.play
end
private
def sound
@@sound ||= Gosu::Sample.new(Utils.asset_path('sounds/shoot_01.wav'))
end
... | 16 | 81 | 0.519886 |
ffbb479d076b7ff7b59faf56b27f8bc30e471e83 | 1,152 | require 'medieval/attributes'
module Medieval
class Battalion
extend Attributes
class << self
def name
FORMATS.rand.call.join(' ')
end
protected
def creature_name
super.pluralize
end
end
FORMATS = [
Proc.new { ["The", name_of_order, formation_name,... | 29.538462 | 102 | 0.642361 |
616951810518d046d6a90be22c48654275b44c15 | 4,355 | #
# Cookbook: hashicorp-vault
# License: Apache 2.0
#
# Copyright 2015-2016, Bloomberg Finance L.P.
#
require 'poise'
module VaultCookbook
module Resource
# A `vault_config` resource for managing Vault's configuration
# files.
# @action create
# @provides vault_config
# @since 1.0
class VaultConfig ... | 35.120968 | 127 | 0.663835 |
5d949f887b86d50a6a78c1113329829da191b8b6 | 340 | class CreateMappings < ActiveRecord::Migration
def change
create_table :mappings do |t|
t.string :user, null: false
t.string :app, null: false
t.string :dataset, null: false
t.text :extensions
t.timestamps null: false
end
add_index :mappings, [:user, :app, :dataset], :uniqu... | 22.666667 | 65 | 0.644118 |
e8f88bdf5f4daa70f77c9033bb239ac27c7745ee | 645 | #---
# Excerpted from "Agile Web Development with Rails, 4rd Ed.",
# published by The Pragmatic Bookshelf.
# Copyrights apply to this code. It may not be used to create training material,
# courses, books, articles, and the like. Contact us if you are in doubt.
# We make no guarantees that this code is fit for any pur... | 35.833333 | 83 | 0.762791 |
f71ff5b4c16637f625905d1514aedeed6aafe03a | 624 | # 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'
Rails.application.config.assets.precompile += %w( d3-timeline.js )
Rails.application.config.assets.precompile += %w( test-d3-timeline.... | 48 | 93 | 0.769231 |
26d247a860f8cdc51572fc53a803c73047875bce | 1,244 | # Creates a clickable cover tile used in galleries
class Tile
include ActionView::Helpers
def initialize(caption: nil, img: nil, path: nil, title: nil, date_string: nil, theme: nil, columns: nil)
@path = path
@title = title
@img = img
@caption = caption
@date_string = date_string
@theme =... | 20.064516 | 107 | 0.646302 |
0127a925ecf66b44f9b7a202195fc2d870a91876 | 711 | module Clubhouse
module Concerns
module Services
module CreateMembership
extend ActiveSupport::Concern
include Servitore::Service
included do
param_reader :membership, :user, :params
end
def call
ActiveRecord::Base.transaction do
mem... | 21.545455 | 68 | 0.544304 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.