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 |
|---|---|---|---|---|---|
6126fa9b3e69c7d33b79e0cd548933cddc705221 | 96,779 | # frozen_string_literal: true
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 44.619179 | 388 | 0.722336 |
4af0431b68e58bc365ec728f87da6412c6ecf34e | 75 | require 'test_helper'
class ContentsHelperTest < ActionView::TestCase
end
| 15 | 47 | 0.826667 |
012468e127766e0847185840e9e68a28050922b7 | 139 | require 'test_helper'
class UserContactsControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end
| 17.375 | 61 | 0.741007 |
1179652d720b9e1076d2b3c5ecb7bb9165eabd91 | 636 | if defined?(Enumerator::Lazy)
covers 'facets/enumerator/lazy/squeeze'
test_case Enumerator::Lazy do
method :squeeze do
# make an Enumerable class to test
eC = Class.new do
include Enumerable
def initialize(*a)
@a = a
end
def each(&b)
@a.each(&b)... | 18.705882 | 57 | 0.523585 |
8798de6e517a20fd085fb18eac82f80cf961cd20 | 597 | # 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 37.3125 | 74 | 0.758794 |
39b7d5bcca305aed929f8e5b88f19bdf1453a220 | 1,202 | # frozen_string_literal: true
module Script
module Layers
module Domain
module Errors
class PushPackageNotFoundError < ScriptProjectError; end
class InvalidExtensionPointError < ScriptProjectError
attr_reader :type
def initialize(type)
super()
@t... | 25.041667 | 64 | 0.591514 |
bb34b926a3e5055221905726812dd60e29d53630 | 623 | module EventHelper
def past_due(event)
if !event.follow_up_date.nil? && event.follow_up_date < Date.today
link_to "PAST DUE", event_path(event)
else
link_to event.name, event_path(event)
end
end
def li_id_past_due(event)
if !event.follow_up_date.nil? && event.follow_up_date < Date.to... | 18.323529 | 70 | 0.654896 |
2606cb77f4c601c1a5a2d1c624e274a87e2cd206 | 545 | # Policy for team members. It does not authorize anything unless the author of
# the action is an owner. An owner is either an admin of Portus or an owner of
# the team itself.
class TeamUserPolicy
attr_reader :user, :team_user
def initialize(user, team_user)
raise Pundit::NotAuthorizedError, "must be logged i... | 24.772727 | 78 | 0.713761 |
79a1cf038c8fd4aa645f8730532d1895abaf87d4 | 41,288 | require "tmpdir"
require "digest/md5"
require "benchmark"
require "rubygems"
require "language_pack"
require "language_pack/base"
require "language_pack/ruby_version"
require "language_pack/helpers/nodebin"
require "language_pack/helpers/node_installer"
require "language_pack/helpers/yarn_installer"
require "language_p... | 32.306729 | 185 | 0.677679 |
1a5552a70e89769225e22ef6198451d7b3a6a687 | 20,093 | # encoding: utf-8
# author: Christoph Hartmann
# author: Dominik Richter
require 'helper'
require 'inspec/resource'
require 'hashie'
describe 'Inspec::Resources::Service' do
let(:runlevels) { {0=>false, 1=>false, 2=>true, 3=>true, 4=>true, 5=>true, 6=>false} }
# windows
it 'verify service parsing' do
resou... | 43.871179 | 233 | 0.702981 |
1ac1d1b7cb060e9c82a293feaa8fbd781548e351 | 275 | class CreateInvitations < ActiveRecord::Migration[5.2]
def change
create_table :invitations do |t|
t.integer :user_invita
t.integer :user_invitado
t.date :fecha
t.integer :local_id
t.boolean :confirma
t.timestamps
end
end
end
| 19.642857 | 54 | 0.661818 |
e82cc30b6b98651c69c510ff7835169719bdceb0 | 226 | require 'spec_helper_system'
describe 'basic tests' do
it 'class should work without errors' do
pp = <<-EOS
class { 'phpapc': }
EOS
puppet_apply(pp) do |r|
r.exit_code.should == 2
end
end
end
| 16.142857 | 42 | 0.615044 |
5d2d98c628975235e249622c59ba03d76e9e2d5e | 1,133 | module QuickSearch::OnCampus
extend ActiveSupport::Concern
private
# Search for "Nucleation and growth mechanism of ferroelectric domain wall motion"
# To test this. Result should not show up in Summon results off campus.
### WHY THIS IS HERE ###
# There is a subset of Summon results that cannot be shown... | 25.75 | 88 | 0.690203 |
081c2e825d0feeffd13b4cde3048ebb363546088 | 882 | # Test coverage startup
if ENV['SIMPLECOV']
# Set the environment variable if you want to generate a detailed
# coverage report on your local box
require "simplecov"
SimpleCov.start
end
def stub_random_iv
before do
cipher = OpenSSL::Cipher.new(ClaimToken.configuration.cipher_type)
allow(cipher).to re... | 25.941176 | 111 | 0.772109 |
bf8261feebd3c0ae1cef0bdd87ed1c32068415a4 | 1,314 | # 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... | 32.04878 | 89 | 0.728311 |
ab29212ef4ee8778a44024e0fb40b6eedf2f3e40 | 762 | # Puma is a fast, concurrent web server for Ruby & Rack
#
# Learn more at: https://puma.io
#
port ENV.fetch("BRIDGETOWN_PORT") { 4000 }
# You can adjust the number of workers (separate processes) and threads
# (per process) based on your production system
#
if ENV["BRIDGETOWN_ENV"] == "production"
workers ENV.fetch(... | 27.214286 | 77 | 0.769029 |
21244762bb53dd5595283d86e156a711cc72ea90 | 4,992 | # enabling the load of files from root (on RSpec)
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../')
require 'rubygems'
require 'spec'
require 'mocha'
require 'restclient'
require 'lib/waz-tables'
describe "Table object behavior" do
it "should initialize a new table" do
table = WAZ::Tables::Table.new({:name =>... | 48.941176 | 196 | 0.689303 |
035f44d10206d570627221494963f4d294e62e9b | 74 |
class TopTwo < Top
def initialize
puts 'Depends on Top'
end
end
| 9.25 | 25 | 0.662162 |
e92ab80ddcd5e56cfc4f1b41305c6e6dcee6fd8e | 114 | class AddAboutToUser < ActiveRecord::Migration[5.1]
def change
add_column :users, :about, :string
end
end
| 19 | 51 | 0.72807 |
bba3093ebbd4628317928c0ec13d9b368f7f0e71 | 365 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::CDN::Mgmt::V2020_04_15
module Models
#
# Defines values for MinimumTlsVersion
#
module MinimumTlsVersion
None = "None"
TLS10 = "TL... | 21.470588 | 70 | 0.676712 |
876172bd9acc9569340ea3b149510662f85838f5 | 1,458 | class Allegro < Formula
desc "C/C++ multimedia library for cross-platform game development"
homepage "https://liballeg.org/"
url "https://github.com/liballeg/allegro5/releases/download/5.2.6.0/allegro-5.2.6.0.tar.gz"
sha256 "5de8189ec051e1865f359654f86ec68e2a12a94edd00ad06d1106caa5ff27763"
head "https://githu... | 28.588235 | 93 | 0.679012 |
796860a5315bbbe00b2db2bda41bde77f04b036a | 5,241 | #
# Copyright:: Copyright (c) Chef Software Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 36.65035 | 128 | 0.643007 |
016871fe83fd24078cb1254be625b641fe91eb81 | 2,555 | require 'logger'
require 'rest_client'
require 'multi_json'
require 'time'
require 'date'
require 'zlib'
class BackdropReporter
def initialize(aggregated_dir, posted_dir, options = {})
@aggregated_dir = aggregated_dir
@posted_dir = posted_dir
@logger = options[:logger] || Logger.new(nil)
@backdrop_en... | 33.618421 | 107 | 0.607828 |
ff599b6a01d6c84b0aeed1ddb155bb6612e8b1ef | 214 | module WoodShop
class Filter < ApplicationRecord
has_many :filter_values, dependent: :destroy
has_many :products, through: :filter_values
has_many :sub_products, through: :filter_values
end
end
| 26.75 | 51 | 0.752336 |
ab3d63a01945f75a487efc2a7e35c8de6fb103c5 | 1,566 | # -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'aliyun/version'
Gem::Specification.new do |spec|
spec.name = 'aliyun-sdk'
spec.version = Aliyun::VERSION
spec.authors = ['Tianlong Wu']
spec.email ... | 39.15 | 109 | 0.64304 |
bbb3d44619eb1a1999ba2eda33b9fc81eaf95f1d | 24,718 | require 'spec_helper'
require 'wordlist/cli'
describe Wordlist::CLI do
describe "#initialize" do
it "must default #mode to :read" do
expect(subject.mode).to eq(:read)
end
it "must default #format to nil" do
expect(subject.format).to be(nil)
end
it "must default #command to nil" do
... | 30.782067 | 126 | 0.571001 |
21e81013d086b324fe324833cdc29a8d35cb8c66 | 5,224 | require "thor"
module Jets::Commands
class Main < Base
class_option :noop, type: :boolean
desc "build", "Builds and packages project for AWS Lambda"
long_desc Help.text(:build)
option :templates, type: :boolean, default: false, desc: "Only build the CloudFormation templates. Skip code building"
... | 36.277778 | 205 | 0.67611 |
26c464177c7267189574be3a2fa76350fdc4b948 | 298 | require './config/environment'
if ActiveRecord::Base.connection.migration_context.needs_migration?
raise 'Migrations are pending. Run `rake db:migrate` to resolve the issue.'
end
use Rack::MethodOverride
use SessionsController
use TweetsController
use UsersController
run ApplicationController
| 24.833333 | 77 | 0.832215 |
918adafe80eb0480cb60c928a46894a0c7126db4 | 674 | require 'spec_helper'
describe ROM::Adapter do
subject(:adapter) { rom.postgres.adapter }
let(:setup) { ROM.setup(postgres: "postgres://localhost/rom") }
let(:rom) { setup.finalize }
describe '#dataset?' do
it 'returns true if a table exists' do
expect(adapter.dataset?(:users)).to be(true)
end
... | 24.962963 | 65 | 0.672107 |
f7de4b5a88c1573229f07217d1512e62e04ba1f6 | 3,188 | require 'spec_helper'
RSpec.describe Togls::FeatureToggleRegistryManager do
let(:klass) { Class.new { include Togls::FeatureToggleRegistryManager } }
describe ".release" do
context "when features have NOT been defined" do
it "creates a new empty release toggle registry" do
expect(Togls::ToggleRe... | 33.914894 | 89 | 0.705772 |
7a556c6c99b4eea9e85518c22fc04fdeb5023d31 | 2,038 | # encoding: utf-8
#
# Copyright 2017, Joe Gardiner
#
# 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 ... | 29.970588 | 183 | 0.736506 |
6285f3c0a5e956b8218b303e3b6cb5ff211a1d5f | 12,358 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rai... | 41.056478 | 126 | 0.709905 |
e88583c1dc22ce3787dbb5a7ac6186ccef58ef1c | 1,782 | class CantsController < ApplicationController
before_action :set_cant, only: [:show, :edit, :update, :destroy]
# GET /cants
# GET /cants.json
def index
@cants = Cant.all
end
# GET /cants/1
# GET /cants/1.json
def show
end
# GET /cants/new
def new
@cant = Cant.new
end
# GET /cants/1... | 23.76 | 88 | 0.637486 |
abdea4fc53c3d786ebce9b9583158a9a0d9ea9fd | 5,499 | class User < ApplicationRecord
# Include default devise modules. Others available are:
# :lockable
# :rememberable
devise :database_authenticatable,
:trackable,
:timeoutable
devise :omniauthable, omniauth_providers: Rails.configuration.x.omniauth.providers
belongs_to :organization, optio... | 29.095238 | 167 | 0.70231 |
878f90c3dcc077dfc0c600f983f62460071c0809 | 3,225 | require 'spec_helper'
require 'nokogiri'
describe LiquidInterpolatable::Filters do
before do
@filter = Class.new do
include LiquidInterpolatable::Filters
end.new
end
describe 'uri_escape' do
it 'should escape a string for use in URI' do
expect(@filter.uri_escape('abc:/?=')).to eq('abc%3A... | 32.25 | 133 | 0.64062 |
1c5263c1941a541375f4b52755f96d1e2e0672b1 | 743 | require 'spec_helper'
describe CarrierWave::Uploader::Base do
let(:uploader) do
Class.new(CarrierWave::Uploader::Base)
end
let(:derived_uploader) do
Class.new(uploader)
end
it 'inserts :gcloud as a known storage engine' do
uploader.configure do |config|
expect(config.storage_engines).to h... | 24.766667 | 72 | 0.748318 |
bbac728602223a7e5bf8a8985442b0e09217b26f | 337 | class CreatePosts < ActiveRecord::Migration
def change
create_table :posts do |t|
t.integer :author_id
t.string :title
t.text :content
t.string :intention_type
t.string :intention_statement
t.boolean :published, default: false
t.datetime :published_at
t.timestamps
... | 22.466667 | 43 | 0.664688 |
abeeb579e9b5f1cdb2bf5d4dae8f4bd84484657c | 3,412 | #-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2015 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,... | 39.674419 | 93 | 0.67966 |
f8ebc0bc2aa847458d0e93710e8135ee3d2a0f8e | 71 | module Dry
module Validation
VERSION = '0.12.2'.freeze
end
end
| 11.833333 | 29 | 0.676056 |
e8f2f417b30df65f84c2c28c7dcd87cc72f072e5 | 1,403 | module RdsDbBackup
module Factory
class Export
include Concerns::Resources
def fetch
last_backup_filename = find_last_backup
tmp_file_path = File.join(File.dirname(__FILE__), '../tmp', last_backup_filename)
if !File.exists?(tmp_file_path)
s3_file_path = "s3://#{db_b... | 24.614035 | 120 | 0.571632 |
269e7c1cb99e30dbd87d5963bfe07e3a3a60f639 | 5,667 | module Termclock
FILESYSTEM, FILESYSTEM_LABEL = if LS::FS.stat('/')[:blocks].to_i == 0
_pwd = Dir.pwd
pwd = _pwd.length > 8 ? _pwd[0..5] + '...' : _pwd
[?..freeze, pwd]
else
[?/.freeze, ?/.freeze]
end.freeze
@@cpu_usage = 0
@@cpu_usage_t = Thread.new { }.join
_tr = translate('Curr. DL/UL')
@@current_n... | 25.995413 | 147 | 0.57226 |
bbc2bf5e7568f9cc422920a2115a7adbb9e7d28f | 401 | cask 'prizmo' do
version '3.7'
sha256 'd77cf9bfe7adff4e5bd6de6971f5d81d4dfbf9177c6abed62f71d70408aaada2'
url "https://www.creaceed.com/downloads/prizmo#{version.major}_#{version}.zip"
appcast "https://www.creaceed.com/appcasts/prizmo#{version.major}.xml"
name 'Prizmo'
homepage 'https://creaceed.com/prizmo'... | 26.733333 | 80 | 0.74813 |
1d41ce14c2554772ef96dd04131d8967a3e1244f | 1,617 | module Paperclip
# The Upfile module is a convenience module for adding uploaded-file-type methods
# to the +File+ class. Useful for testing.
# user.avatar = File.new("test/test_avatar.jpg")
module Upfile
# Infer the MIME-type of the file from the extension.
def content_type
type = (self.path.m... | 29.944444 | 127 | 0.592455 |
ac7ceaedb7c09a8a5d1eaa03eff52827c0daf004 | 299 | require 'rails_helper'
RSpec.describe Contenticus::Block, type: :model do
subject {described_class}
it 'can serialize the fields' do
page = Fabricate.create(:page)
expect{described_class.create!(blockable: page, layout: "pages/frontpage")}.to change(subject, :count).by(1)
end
end
| 23 | 112 | 0.729097 |
2683afb6cbee74d1ea2a68b53b0f68fa5edd73cd | 1,158 | require "." / "lib" / "resolvers" / "core_lib_resolver"
describe WarningShot::CoreLibResolver do
before :all do
WarningShot::CoreLibResolver.logger = $logger
end
it 'should have tests registered' do
WarningShot::CoreLibResolver.tests.empty?.should be(false)
end
it 'should not have resolution... | 29.692308 | 101 | 0.717617 |
39771bccfda395d1e917f9ffe630be4603f35329 | 5,410 | require 'rails_helper'
RSpec.feature 'Candidate entering GCSE details' do
include CandidateHelper
scenario 'Candidate submits their maths GCSE details and then update them' do
given_i_am_signed_in
when_i_visit_the_candidate_application_page
and_i_click_on_the_maths_gcse_link
then_i_see_the_add_gc... | 27.18593 | 132 | 0.80573 |
1a510f72fe760a75ed6fa2a6f82c191b9feb6015 | 3,372 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::HttpClient
include Msf::Auxiliary::Report
include Msf::Auxiliary::AuthBrute
include Msf::Auxiliary::S... | 32.423077 | 189 | 0.591934 |
4a3e5d9f9e59aba278ff8be62a1fed748ca67f54 | 333 | class AdoptADog::Dogs
attr_accessor :name, :breed, :location, :url, :story, :shelter
@@all = []
def initialize(name, breed, location, url)
@name = name
@breed = breed
@location = location
@url = url
@@all << self
end
def self.all
@@all
end
def self.limit_nine
@@all.slice(0,... | 15.136364 | 64 | 0.594595 |
aca8724bb05c4e27904f45351604e72c460c3b3a | 12,819 | # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic... | 43.750853 | 245 | 0.696076 |
280a4c04481d96fa29be4f3cd55202e7f52766f5 | 126 | require 'rails_helper'
RSpec.describe PetSkill, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
| 21 | 56 | 0.746032 |
390ff8edc62a3198efeeedbc36bbd5b3a8af1681 | 119 | class EventSerializer < ActiveModel::Serializer
attributes :id, :title, :content, :entity, :schedule, :lat, :lng
end
| 29.75 | 66 | 0.739496 |
4a89534ec318bd23ec0dca5eecf4c42a510e5d7a | 993 | require 'spec_helper'
RSpec.describe NotificationPolicy, type: :policy do
let(:user){ }
let(:record){ create :notification }
subject{ NotificationPolicy.new user, record }
context 'without a user' do
it_behaves_like 'a policy forbidding', :index, :show, :create, :update, :destroy
end
context 'with a ... | 30.090909 | 84 | 0.696878 |
6aae233d33681f23b3e251b837fc20acc400ad18 | 30,527 | #!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'rubygems'
require 'json'
require 'mysql2'
require 'timeout'
##<<<[2013/09/04 I.Noda]
## for exclusive connection use
require 'thread'
##>>>[2013/09/04 I.Noda]
require 'practis'
require 'practis/database'
require 'practis/database_command'
require 'practis/database_... | 36.298454 | 85 | 0.519671 |
62b6d3d338bf6efa41b0cfee90905d4ec33bee2f | 1,759 | class Cdrdao < Formula
desc "Record CDs in Disk-At-Once mode"
homepage "http://cdrdao.sourceforge.net/"
url "https://downloads.sourceforge.net/project/cdrdao/cdrdao/1.2.3/cdrdao-1.2.3.tar.bz2"
sha256 "8193cb8fa6998ac362c55807e89ad0b3c63edc6b01afaeb3d5042519527fb75e"
depends_on "pkg-config" => :build
depend... | 29.813559 | 108 | 0.678226 |
4a0385703d3a3a9b70dc607184ce0bae3e6013d9 | 544 | # frozen_string_literal: true
require 'simplecov'
require 'simplecov-cobertura'
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
SimpleCov.start do
add_filter '/spec/'
add_filter '/features/'
end
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'conjur-policy-parser'
require 'logge... | 21.76 | 66 | 0.762868 |
62eda3b876b980c6942991ea930150d72f1de1ee | 1,962 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# dat... | 47.853659 | 129 | 0.703874 |
18abdd674c58e28c258afd5a94bde3af5888c763 | 2,734 | require_relative 'common'
module Kontena::Cli::Apps
class MonitorCommand < Kontena::Command
include Kontena::Cli::Common
include Kontena::Cli::GridOptions
include Common
option ['-f', '--file'], 'FILE', 'Specify an alternate Kontena compose file', attribute_name: :filename, default: 'kontena.yml'
... | 29.085106 | 131 | 0.579371 |
39547c3e7f774024c023c6350a9f344ab2b4f960 | 1,509 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'motion_flux/version'
Gem::Specification.new do |spec|
spec.name = 'motion_flux'
spec.version = MotionFlux::VERSION
spec.authors = ['kayhide']
spec.email = ['k... | 40.783784 | 104 | 0.720345 |
034a66e5a0180efabeb75931b06d71722aa67168 | 3,183 | # frozen_string_literal: true
module Grape
module Validations
class Base
attr_reader :attrs
# Creates a new Validator from options specified
# by a +requires+ or +optional+ directive during
# parameter definition.
# @param attrs [Array] names of attributes to which the Validator ap... | 34.978022 | 89 | 0.623311 |
080845976bdaf3216bc35a9c304dc8b848d6b1d2 | 276 | require "scanf.rb"
for i in (1 .. 3) do
(a, b) = STDIN.readline.split(" ").map{ |x| x.to_i(10) }
printf "a = %d b = %d\n", a, b
end
l = STDIN.readline.split(" ").map{ |x| x.to_i(10) }
for j in (0 .. 9) do
printf "%d\n", l[j]
end
| 25.090909 | 60 | 0.449275 |
ab9c3b56ddceccc7587ffffe1d631d1e6caf0213 | 2,833 | class Gitless < Formula
include Language::Python::Virtualenv
desc "Simplified version control system on top of git"
homepage "http://gitless.com/"
url "https://github.com/sdg-mit/gitless/archive/v0.8.5.tar.gz"
sha256 "c93f8f558d05f41777ae36fab7434cfcdb13035ae2220893d5ee222ced1e7b9f"
bottle do
cellar :... | 41.661765 | 138 | 0.791387 |
035ca71b809852e9a119888f15d5c56ef4f827ba | 5,492 | require "faraday"
require "json"
module Blade::SauceLabsPlugin::Client
extend self
delegate :config, :username, :access_key, :debug?, to: Blade::SauceLabsPlugin
def request(method, path, params = {})
connection.send(method) do |req|
req.url path
req.headers["Content-Type"] = "application/json"
... | 30.853933 | 121 | 0.599417 |
e2144132401f97e0a5e9455c21e9aaf1b74c6f9b | 2,902 | # Cookbook Name: pris
# Provider: mapper
#
# Copyright (c) 2015 ConvergeOne Holdings Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... | 29.313131 | 115 | 0.740179 |
1845acaa1c5b086a1e99391e6865b2a6d2c096b6 | 1,022 | module Fog
module Parsers
module Compute
module AWS
class DescribeReservedInstances < Fog::Parsers::Base
def reset
@reserved_instance = {}
@response = { 'reservedInstancesSet' => [] }
end
def end_element(name)
case name
... | 27.621622 | 121 | 0.540117 |
9161e7f7b3d2603259a1758cecfb227e70a47da2 | 147 | module FormtasticAutoSelect2
module Infectors
module Formtastic
extend ActiveSupport::Autoload
autoload :Inputs
end
end
end | 18.375 | 36 | 0.734694 |
6aecfbd34bdeea66757e92de558b7845638d62d6 | 10,237 | class PaypalAccountsController < ApplicationController
include PaypalService::PermissionsInjector
include PaypalService::MerchantInjector
before_filter do |controller|
controller.ensure_logged_in t("layouts.notifications.you_must_log_in_to_view_your_settings")
end
before_filter :ensure_paypal_enabled
... | 37.498168 | 139 | 0.77298 |
38feb7b37474804c42e80631426005c7549ec486 | 2,558 | # encoding: utf-8
module Pulo
module Steam
class Boiler
attr_reader :feedwater, :steam, :blowdown
attr_reader :blowdown_rate, :combustion_efficiency
attr_reader :boiler_power, :fuel_power
def initialize(feedwater_pressure: nil,blowdown_rate: nil,combustion_efficiency:nil,steam_p... | 41.934426 | 111 | 0.685301 |
0821aecc8f639f884606614f13125be2f00712ba | 995 | SparkleFormation.dynamic(:files_tower_callback) do | id, config = {} |
set!('/usr/local/bin/tower-callback') do
content join!([
"#!/bin/bash\n",
"retry_attempts=10\n",
"attempt=0\n",
"while [[ $attempt -lt $retry_attempts ]]\... | 41.458333 | 159 | 0.38392 |
91950d8e2ba7c7afeb17e62d938e469076498e3f | 223 |
class CreateArtists < ActiveRecord::Migration[4.2]
def change
create_table :artists do |t|
t.string :name
t.string :genre
t.integer :age
t.string :hometown
end
end
end | 20.272727 | 50 | 0.58296 |
6a03a8ecd02591ca1164e75429cd5fc6d9dbcba9 | 7,560 | require 'socket'
describe 'Socket.getaddrinfo' do
describe 'without global reverse lookups' do
it 'returns an Array' do
Socket.getaddrinfo(nil, 'http').should be_an_instance_of(Array)
end
it 'accepts a Fixnum as the address family' do
array = Socket.getaddrinfo(nil, 'http', Socket::AF_INET)[... | 28.745247 | 83 | 0.584921 |
abb01f1f606274c44392ba80fa3ca6c0cb291f1d | 1,832 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "bcrypt"
s.version = "3.1.10"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Coda Hale"]
s.date = "2015-01-29"
s.description = " bcrypt() is a sophisticated and secure... | 45.8 | 221 | 0.646288 |
214217ae3ecefce528eb96ee2f379cfbbbe60201 | 6,135 | require 'test_helper'
require 'active_record'
Mongo.setup!
module Elasticsearch
module Model
class MultipleModelsIntegration < Elasticsearch::Test::IntegrationTestCase
context "Multiple models" do
setup do
ActiveRecord::Schema.define(:version => 1) do
create_table :episodes d... | 37.181818 | 122 | 0.599348 |
acaf0492e74010af0e856457e52568435ddbf005 | 1,876 | require_relative 'skyscanner_api'
module Skyscanner
class FlightInfo
attr_reader :flightInfo
def initialize(originData)
carrierId2Carrier = getCarrierId2Carrier(originData)
placeId2Place = getPlaceId2Place(originData)
@flightInfo = extractFlightInfo(carrierId2Carrier, placeId2Place, origin... | 31.266667 | 124 | 0.668977 |
1abb96206eb5260c8a7d6747967ab4276fbf3d86 | 195 | Rails.application.routes.draw do
resources :workouts, only: [] do
resources :entries, only: [:index, :create, :destroy] do
collection { post :create_from_nickname }
end
end
end
| 24.375 | 60 | 0.687179 |
87e6578c0236a8918a6c95d3c2bc4f13e31b1a16 | 641 | # frozen_string_literal: true
RSpec.describe FiniteMachine::HookEvent, "#new" do
it "reads event name" do
hook_event = described_class.new(:green, :go, :green)
expect(hook_event.name).to eql(:green)
end
it "reads event type" do
hook_event = described_class.new(:green, :go, :green)
expect(hook_ev... | 26.708333 | 60 | 0.697348 |
ab57ce6c2f0c132de62840291b3a121f5e385b37 | 510 | module BetterRecord
module InjectMethods
def self.included(base)
base.extend self
end
def method_missing(method, *args, &block)
begin
if BetterRecord.attributes[method.to_sym]
m = method.to_sym
self.class.define_method m do
BetterRecord.__send__ m
... | 21.25 | 49 | 0.598039 |
1c97d934ea81934859142094d1438c07a0f29fb7 | 172 | # frozen_string_literal: true
module Alchemy
VERSION = "6.0.0-rc2"
def self.version
VERSION
end
def self.gem_version
Gem::Version.new(VERSION)
end
end
| 12.285714 | 29 | 0.69186 |
1d3c588af023921e6d3cb5496dd0974a6979ae0b | 187 |
SpecialistSector.where(['edition_id IS NOT NULL AND tag LIKE ?', 'nhs-population-screening-programmes%']).each do |sector|
sector.tag = sector.tag.sub(/\Anhs-/, '')
sector.save!
end
| 31.166667 | 122 | 0.705882 |
e25b8842072d2e6e116a063f33cfd5316311fade | 68 | def init
super
sections.last.place(:specs).before(:source)
end
| 11.333333 | 45 | 0.720588 |
acdfbe33a6fb67afe9961066ec7bd85834838a31 | 5,806 | # 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::DataFactory::Mgmt::V2018_06_01
module Models
#
# Execute data flow activity.
#
class ExecuteDataFlowActivity < ExecutionActi... | 31.215054 | 76 | 0.44609 |
1808085838c9df8cef1dca9b9cfb333768a06481 | 288 | class ChangeEventInitToDefault < ActiveRecord::Migration[4.2]
def up
change_column :events, :visible, :boolean, null: false, default: true
execute "UPDATE events SET visible = true WHERE visible IS NULL"
end
def down
raise ActiveRecord::IrreversibleMigration
end
end
| 26.181818 | 73 | 0.746528 |
287f4ae4e7f8592a31fd41f38825eca9fdedb00b | 2,615 | require 'spec_helper'
describe HawatelPS::Windows::ProcTable do
let(:win32_data) { FactoryGirl.build(:win32_data) }
before do
allow(HawatelPS::Windows::ProcFetch).to receive(:get_process).and_return(Array.new([win32_data[:proc_attrs]]))
end
it "return all process instances" do
process = HawatelPS::W... | 36.830986 | 128 | 0.676482 |
bb465cc4ea45abb3e7aee3731c85696e8f7b73c4 | 1,595 | class Doctl < Formula
desc "Command-line tool for DigitalOcean"
homepage "https://github.com/digitalocean/doctl"
url "https://github.com/digitalocean/doctl/archive/v1.40.0.tar.gz"
sha256 "2a1877097183b9a47bad7a0942174b4a98ad6182db29d7d76720ee709fcf4c02"
head "https://github.com/digitalocean/doctl.git"
bott... | 36.25 | 109 | 0.721003 |
4a959535f238a26320d3158876ae2edb1ae9f774 | 9,998 | class Auth::OmniauthCallbacksController < Devise::OmniauthCallbacksController
# Disable CSRF since the token information is lost.
skip_before_action :verify_authenticity_token
# ==> Failure route.
def failure
# Find the error message and log it for analysis.
error_message = failure_message ||
... | 32.888158 | 226 | 0.704441 |
e950c987b900f1d04550be5d332396760d4f69cd | 1,589 | module VagrantPlugins
module GuestRedHat
module Cap
class ChangeHostName
def self.change_host_name(machine, name)
comm = machine.communicate
if !comm.test("hostname -f | grep '^#{name}$'", sudo: false)
basename = name.split('.', 2)[0]
comm.sudo <<-EOH.gsu... | 33.808511 | 106 | 0.49528 |
03c9792ac486002a86eb908192bc5c365e3507a0 | 723 | module TrueSkill::MathGeneral
def ierfcc(p)
return -100 if p >= 2.0
return 100 if p <= 0.0
pp = p < 1.0 ? p : 2 - p
t = Math.sqrt(-2*Math.log(pp/2.0)) # Initial guess
x = -0.70711*((2.30753 + t*0.27061)/(1.0 + t*(0.99229 + t*0.04481)) - t)
[0,1].each do |j|
err = Math.erfc(x) - pp
... | 21.264706 | 83 | 0.53112 |
61ef8235ea3fece719d06b9fefa8b78a1718d1e8 | 2,223 | class Frpc < Formula
desc "Client app of fast reverse proxy to expose a local server to the internet"
homepage "https://github.com/fatedier/frp"
url "https://github.com/fatedier/frp.git",
tag: "v0.43.0",
revision: "fe5fb0326b2aa7741d5b5d8f8c4c3ca12bb4ed91"
license "Apache-2.0"
bottle do
... | 44.46 | 123 | 0.728745 |
5d5024d4ceeaaf51e9609f10e5599f9311c8b0c6 | 249 | class AdministrationsController < ApplicationController
def show
@administartion = Administration.find_by(id: params[:id])
@city = @administartion.city
if current_user.admin?
@suggestions = PendingSuggestion.all
end
end
end | 27.666667 | 61 | 0.738956 |
383cb970c3668037febc9dba1a68d7221d87794d | 725 | module ActionPanel
module Initializers
# Formtastic Initializers
module Formtastic
BASE_FILES = %w[wrapping html choices].freeze
INPUTS_FILES = %w[
select_input select2_input check_boxes_input radio_input
boolean_input switch_input file_input color_picker_input
date_pi... | 23.387097 | 65 | 0.696552 |
4a6aeda361b6490aa464117dfccdad17e70cf3f8 | 48,355 | #!/usr/bin/env ruby
# Encoding: utf-8
#
# Copyright 2018 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 ... | 39.66776 | 86 | 0.754172 |
01ccce2cf94b10232c2c529ac914b36d0eab1996 | 970 | require Rails.root.join('app', 'helpers', 'application_helper')
module ApplicationHelper
# Checks the current route using the format 'ControllerName#ActionName'
# Used as a shorter way of calling current_controller and current_action together
# Defaults to using current_page? if the route doesn't include a '#'
... | 31.290323 | 105 | 0.713402 |
28eb81cc39819dfd791f7d58d05292a24678a5ac | 528 | module DwollaSwagger
#
class Id < BaseObject
attr_accessor
# attribute mapping from ruby-style variable name to JSON key
def self.attribute_map
{
}
end
# attribute type
def self.swagger_types
{
}
end
def initialize(attributes = {})
... | 18.206897 | 79 | 0.587121 |
218b9442cbbc10da0dd06357045cb2dbd23c12fc | 531 | # frozen_string_literal: true
class OtherDoiByIdJob < ApplicationJob
queue_as :lupo_background
# retry_on ActiveRecord::Deadlocked, wait: 10.seconds, attempts: 3
# retry_on Faraday::TimeoutError, wait: 10.minutes, attempts: 3
# discard_on ActiveJob::DeserializationError
rescue_from ActiveJob::Deserializat... | 26.55 | 80 | 0.745763 |
287cf2bdd5b7a8f009da67a64a1c5826e29ad6be | 1,028 | class AddEslCategories < ActiveRecord::DataMigration
def up
esl_categories = [
{name: 'Heavy-Duty Large Bus', class_name: 'RevenueVehicle', active: true},
{name: 'Heavy-Duty Small Bus', class_name: 'RevenueVehicle', active: true},
{name: 'Medium-Duty and Purpose-Built Bus', class_name: 'Re... | 51.4 | 111 | 0.664397 |
5d3f9cc670ca7bb5497f15389cf7954d56c01c51 | 894 | cask "opera-developer" do
version "78.0.4072.0"
sha256 "62e14a35da67800c6214c16dd4fa37f5653457418c1312a6c7122a4159074022"
url "https://get.geo.opera.com/pub/opera-developer/#{version}/mac/Opera_Developer_#{version}_Setup.dmg"
name "Opera Developer"
desc "Web browser"
homepage "https://www.opera.com/compute... | 31.928571 | 105 | 0.738255 |
ab7cd9c5eeea325531a9d92af351443c07af44c6 | 3,343 | require_relative 'common'
# Inspired by RubyGems's Gem::List [implem](https://github.com/rubygems/rubygems/blob/master/lib/rubygems/util/list.rb)
class CupCircle
include Enumerable
attr_accessor :tail
attr_reader :value, :tail, :length, :last, :links
def initialize(value, tail = nil)
@value = value
@... | 22.741497 | 119 | 0.650015 |
acf1f86c01d78ec20e458a37e633989799ef0e23 | 6,625 | require_relative 'base_command'
require_relative '../../atmos/source_path'
require_relative '../../atmos/generator'
require_relative '../../atmos/utils'
module SimplyGenius
module Atmos
module Commands
# From https://github.com/rubber/rubber/blob/master/lib/rubber/commands/vulcanize.rb
class Generat... | 35.239362 | 103 | 0.514717 |
260fa90d46fd6e176ec49806290b76ca62c78713 | 8,569 | require './spec/spec_helper'
require './lib/neutrino/api/client'
require 'fakeweb'
require 'net/http'
require 'uri'
describe Neutrino::Api::Client do
before(:each) do
Neutrino::Api::Client.config = TestConfig.to_hash
end
describe 'self.config' do
it 'returns a config dictionary when one has been set' ... | 28.658863 | 105 | 0.675108 |
1812242055b1b852f3882900b5f4b65544c523f2 | 728 | # This code is free software; you can redistribute it and/or modify it under
# the terms of the new BSD License.
#
# Copyright (c) 2008-2012, Sebastian Staudt
require 'steam-condenser/servers/packets/base_packet'
module SteamCondenser::Servers::Packets
# This packet class class represents a A2S_INFO request send t... | 26 | 79 | 0.741758 |
ab060339fdc5e01cf78ef9b9cec48cc14b1c8e0d | 20,915 | # frozen_string_literal: true
require 'spec_helper'
require 'bolt_spec/conn'
require 'bolt_spec/files'
require 'bolt_spec/integration'
require 'bolt_spec/puppet_agent'
require 'bolt_spec/run'
describe "apply", expensive: true do
include BoltSpec::Conn
include BoltSpec::Files
include BoltSpec::Integration
incl... | 41.83 | 119 | 0.568826 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.