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 |
|---|---|---|---|---|---|
08c23a3f8c515538caad5bb275254f390951e2ab | 2,313 | #!/usr/bin/env ruby
# Encoding: utf-8
#
# Copyright:: Copyright 2016, Google Inc. All Rights Reserved.
#
# License:: Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | 33.042857 | 79 | 0.702983 |
d5ca8470381f04281505c7e2bc85abba381ed0bd | 1,311 | require 'spec_helper'
RSpec.xdescribe Yoda::Store::Objects::ProjectStatus do
describe 'serialization' do
subject { JSON.load(project_status.to_json) }
let(:project_status) do
Yoda::Store::Objects::ProjectStatus.new(
version: 1,
bundle: Yoda::Store::Objects::ProjectStatus::BundleStatus.n... | 32.775 | 96 | 0.577422 |
e822a89c4d3c5559f69662c14e6d91cc258ebf64 | 204 | module GpgKeys
class CreateService < Keys::BaseService
def execute
key = user.gpg_keys.create(params)
notification_service.new_gpg_key(key) if key.persisted?
key
end
end
end
| 20.4 | 61 | 0.70098 |
0179f4694bfb0d350e83ba066f2d234245f48a5f | 289 | module Cucumber
module Generators
class InstallGenerator < ::Rails::Generators::Base
source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
def copy_rails_support
copy_file "rails.rb", "features/support/env.rb"
end
end
end
end
| 22.230769 | 82 | 0.695502 |
282803acd92fff94d8aabc7e1762d0a4f447a7cd | 1,227 | require "rails_helper"
describe "As an Admin" do
before :each do
@admin = create(:admin)
@station = create(:station)
allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(@admin)
end
describe "when I visit the station show page" do
it "I can see all the attributes" do
... | 27.266667 | 93 | 0.690302 |
26301c3f745b939bec5050de4a253b0e7f3c1841 | 4,529 | require 'spec_helper'
describe Blacklight::SearchBuilder do
let(:processor_chain) { [] }
let(:blacklight_config) { Blacklight::Configuration.new }
let(:scope) { double blacklight_config: blacklight_config }
subject { described_class.new processor_chain, scope }
describe "#with" do
it "should set the blac... | 31.234483 | 108 | 0.668359 |
f7a712e56873cc7aa8c399983ed5bf62e72cfcfe | 165 | class RenameUsersToLogins < ActiveRecord::Migration
def self.up
rename_table :users, :logins
end
def self.down
rename_table :logins, :users
end
end
| 16.5 | 51 | 0.727273 |
ed291af8417ed0b5ce7b5ce038e9b1011dc4b8ff | 16,954 | # encoding: utf-8
require 'spec_helper'
require 'data/sample_data'
describe CarrierWaveDirect::Uploader do
include UploaderHelpers
include ModelHelpers
let(:subject) { DirectUploader.new }
let(:mounted_model) { MountedClass.new }
let(:mounted_subject) { DirectUploader.new(mounted_model, sample(:mounted_as))... | 32.231939 | 153 | 0.628347 |
1dcec5528dfbf28b0ef5bb37f7404480be78fa86 | 144 | require 'test_helper'
class SendableRails::Test < ActiveSupport::TestCase
test "truth" do
assert_kind_of Module, SendableRails
end
end
| 18 | 51 | 0.770833 |
030de593298b861abeb808397e2fef7240084973 | 720 | require_relative "boot"
require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Unnamedrailsproject
class Application < Rails::Application
# Initialize configuration defaults for originally gener... | 36 | 82 | 0.772222 |
61f9604ebbe560d767ef82c11e7e839c6f0f5486 | 1,394 | require "json"
RSpec.describe "grafana dashboards" do
grafana_dashboards.each do |dashboard_name, dashboard_contents|
it "ends in .json" do
expect(dashboard_name).to match(/[.]json$/)
end
it "is valid json" do
expect { JSON.parse dashboard_contents }.not_to raise_error
end
it "is ov... | 25.345455 | 78 | 0.637733 |
182194ebc2a0f63cceb18d3aa857ebc3216754b0 | 681 | module Ruboty
module Handlers
class Base
class << self
include Mem
def inherited(child)
Ruboty.handlers << child
end
def on(pattern, options = {})
actions << Action.new(pattern, options)
end
def actions
[]
end
m... | 17.921053 | 61 | 0.534508 |
08763e33cb3ed8ba13d4d3dc6919db413d68a329 | 1,509 | # frozen_string_literal: true
require "compilers"
describe CompilerFailure do
alias_matcher :fail_with, :be_fails_with
describe "::create" do
it "creates a failure when given a symbol" do
failure = described_class.create(:clang)
expect(failure).to fail_with(double("Compiler", name: :clang, versio... | 38.692308 | 89 | 0.667329 |
ff6d494730845b3f4940d13f6abfdb9ccbfb4bcb | 593 | # encoding: utf-8
require "logstash/filters/base"
require "logstash/namespace"
class LogStash::Filters::Unique < LogStash::Filters::Base
config_name "unique"
# The fields on which to run the unique filter.
config :fields, :validate => :array, :required => true
public
def register
# Nothing to do
end ... | 22.807692 | 57 | 0.689713 |
bbd1bbec0a491a9e6ecffbe0847efbb571b189b5 | 552 | require 'trollop'
module RailsLogDeinterleaver
class Cli
def initialize
opts = Trollop::options do
opt :output, "Output file (if unspecified, output will go to stdout)", type: :string
opt :backward, "Limit how many lines to go backward (default: no limit)", type: :integer
end
in... | 27.6 | 96 | 0.63587 |
ac9fff4ab3adae562a853689ce5cd1d236d13970 | 609 | #
# Cookbook Name:: java_wrapper
# Attributes:: default
#
#
default["java"]["install_flavor"] = "oracle"
default["java"]["jdk_version"] = "8"
#default["java"]["jdk"]["8"]["x86_64"]["url"] = "#{node[:nexus_url]}/nexus/content/repositories/filerepo/third-party/project/oracle/jdk/8u92-linux/jdk-8u92-linux-x64.tar.gz"
def... | 46.846154 | 173 | 0.688013 |
bf2f0dc3248efb7bfd15ba764b4e456fd9972991 | 198,799 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
require 'seahorse/client/plugins/content_length.rb'
require 'aws-sdk-core/plug... | 44.404512 | 179 | 0.665305 |
03175dc679b91e5545789869722040ae89b62f0d | 163 | class CreateTrips < ActiveRecord::Migration[5.2]
def change
create_table :trips do |t|
t.string :name
t.timestamps null: false
end
end
end
| 18.111111 | 48 | 0.662577 |
38dd384d5f3d74440d4cf5a409c095543a191ac8 | 449 | Gem::Specification.new do |s|
s.name = "cloudseed"
s.version = "0.1.2"
s.summary = "Rack-based helper for CloudFront custom origins"
s.description = "CloudSeed is a Rack-based utility to manage backend delivery of CloudFront custom origins."
s.files = Dir["Rakefile", "lib/**/*"]
s.add_dependency "rack", "... | 29.933333 | 110 | 0.67706 |
5d0bd1264fae0b512b4c0e4c639a2b610d0f2639 | 1,352 | require_relative "../test_helper"
require_relative "smart_answers_controller_test_helper"
class SmartAnswersControllerValueQuestionTest < ActionController::TestCase
tests SmartAnswersController
include SmartAnswersControllerTestHelper
setup { setup_fixture_flows }
teardown { teardown_fixture_flows }
conte... | 32.97561 | 90 | 0.698964 |
4a73930586672f089b5ff70ca4568e46871c98f5 | 18,710 | require "test_helper"
require "down/net_http"
require "http"
require "stringio"
require "json"
require "base64"
describe Down do
describe "#download" do
it "downloads content from url" do
tempfile = Down::NetHttp.download("#{$httpbin}/bytes/#{20*1024}?seed=0")
assert_equal HTTP.get("#{$httpbin}/byt... | 40.585683 | 179 | 0.661037 |
38da4d84f94860b57223561149c5e4e90f83d6ec | 954 | # A control used when no framework is detected.
# Looks for a newrelic.yml file in several locations
# including ./, ./config, $HOME/.newrelic and $HOME/.
# It loads the settings from the newrelic.yml section
# based on the value of RUBY_ENV or RAILS_ENV.
class NewRelic::Control::Ruby < NewRelic::Control
def env
... | 28.909091 | 65 | 0.665618 |
acde735ad58a8ab23a78e958da6d8c4741c80bc6 | 130 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'i18n'
require 'active_support'
require 'i18n_backend_mongoid'
| 26 | 58 | 0.776923 |
e99e62443a6abb7cd97cdd5fdb3150c6a6b3b051 | 1,021 | #
# Be sure to run `pod spec lint CLKit.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github.com/C... | 31.90625 | 98 | 0.636631 |
18c739674ae967e7388ff33d88612a2f90aa8af0 | 23,644 | require 'abstract_unit'
class FormTagHelperTest < ActionView::TestCase
include RenderERBUtils
tests ActionView::Helpers::FormTagHelper
def setup
super
@controller = BasicController.new
end
def hidden_fields(options = {})
method = options[:method]
enforce_utf8 = options.fetch(:enforce_utf8,... | 37.059561 | 214 | 0.687828 |
e8e4905796293df99eb21d721dedbe80835d282a | 1,974 | # coding: utf-8
# frozen_string_literal: true
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'dato/version'
Gem::Specification.new do |spec|
spec.name = 'dato'
spec.version = Dato::VERSION
spec.authors = ['Stefano Verna']
spec.ema... | 39.48 | 110 | 0.729483 |
f7521ff2e43a872f4f19f92d124b28a06de651f9 | 718 | cask 'font-monoid-halfloose-small-dollar-1' do
version :latest
sha256 :no_check
# github.com/larsenwork/monoid was verified as official when first introduced to the cask
url 'https://github.com/larsenwork/monoid/blob/release/Monoid-HalfLoose-Small-Dollar-1.zip?raw=true'
name 'Monoid-HalfLoose-Small-Dollar-1'... | 35.9 | 102 | 0.756267 |
4ac1c8bd13cd97c2b402a147c7f160388b7c7b7c | 1,546 | describe UseCase::SearchAddressesByPostcode, set_with_timecop: true do
include RSpecRegisterApiServiceMixin
subject(:use_case) { described_class.new }
context "when arguments include non token characters" do
before do
scheme_id = add_scheme_and_get_id
add_assessor(
scheme_id:,
as... | 30.92 | 89 | 0.636481 |
1a053dae7d3dbe98c2fa3413e6ee6adb4104030c | 805 | module Smartfocus
# Relation is used for API-chained call
#
# e.g. emv.get.campaign.last(:limit => 5).call
#
class Relation
def initialize(instance, request)
@instance = instance
@request = request
@uri = []
@options = {}
end
# Trigger the API call
#
# @param [... | 20.125 | 56 | 0.593789 |
266dc74728e022302d3444b3d5b545473de78ab0 | 108 | namespace :db do
desc "Fires up a Pry console"
task console: :environment do
binding.pry
end
end
| 13.5 | 31 | 0.694444 |
bf2dbeadb6f035e6b082699c12e7db6bbd43da51 | 481 | # encoding: utf-8
# frozen_string_literal: true
module Crunchbase::Model
class Organization < Base
endpoint 'organizations'
relations %w(primary_image founders featured_team current_team past_team board_members_and_advisors
investors owned_by sub_organizations headquarters offices categories
... | 26.722222 | 103 | 0.767152 |
bb4f4b4531def504419bf510cd72c8e9ddf33339 | 471 | module Pod
module Generator
class BridgeSupport
extend Executable
executable :gen_bridge_metadata
attr_reader :headers
def initialize(headers)
@headers = headers
end
def search_paths
@headers.map { |header| "-I '#{header.dirname}'" }.uniq
end
def... | 20.478261 | 103 | 0.59448 |
39b912c3358be99eff22d04c3c806ff56db063be | 981 | require 'faraday'
require 'faraday_middleware'
module IssueGraph
module Connection
END_POINT = 'https://api.zenhub.io'.freeze
def get(path)
response = api_connection.get(path)
if response.status != 200
p response
raise "GET #{path} failed: #{response.reason_phrase}"
end
... | 21.8 | 78 | 0.626911 |
1a44641af188dc475be64d79535d3ea4a14d7004 | 7,697 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Vulnerabilities::Feedback do
it {
is_expected.to(
define_enum_for(:feedback_type)
.with_values(dismissal: 0, issue: 1, merge_request: 2)
.with_prefix(:for)
)
}
it { is_expected.to define_enum_for(:category) }
describ... | 32.205021 | 133 | 0.684423 |
266cd2bf9136aec60884f511821cde7be1ab0597 | 137 | require 'test_helper'
class FlashTeamsControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end
| 17.125 | 59 | 0.737226 |
4af51af992ebeac7063af4986f95388fc9519152 | 2,397 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Network::Mgmt::V2017_03_01
module Models
#
# A web application firewall rule group.
#
class ApplicationGatewayFirewallRuleGr... | 29.9625 | 83 | 0.521902 |
7af54960d1ed7623aadc963d13803f27c74a6b7e | 149 | json.array!(@bookmarks) do |bookmark|
json.extract! bookmark, :id, :title, :description, :url
json.url bookmark_url(bookmark, format: :json)
end
| 29.8 | 57 | 0.724832 |
280b2f9aa1f73fd3dcfe40dd9302515258570521 | 1,395 | require File.dirname(__FILE__) + '/support/setup'
class ReindexEverything < CloudCrowd::Action
def process
outcomes = {:succeeded=>[], :failed => []}
docs = Document.where({:id => input}).includes(:pages, :docdata)
ids = []
docs.find_each do |document|
counter = 0
begin
Sunspot... | 27.9 | 142 | 0.645161 |
793c437984083d926d63471ade6c7f41d84eecb9 | 194 | # frozen_string_literal: true
class AddHighlightedToProjects < ActiveRecord::Migration[5.2]
def change
add_column :projects, :highlighted, :boolean, null: false, default: false
end
end
| 24.25 | 77 | 0.768041 |
d576ae5ab70c2c8b9569269abb497dd509d5bc2c | 814 | class AddRabbitHost < ActiveRecord::Migration[5.1]
def up
return if HostGenome.find_by(name: "Rabbit")
hg = HostGenome.new
hg.name = "Rabbit"
hg.s3_star_index_path = "s3://idseq-database/host_filter/rabbit/2019-07-24/rabbit_STAR_genome.tar"
hg.s3_bowtie2_index_path = "s3://idseq-database/host_fil... | 35.391304 | 108 | 0.734644 |
1c4957064deeb0388d9dcc517622bee0cf693305 | 260 | class CreateWards < ActiveRecord::Migration[6.1]
def change
create_table :wards, id: :uuid do |t|
t.string :name
t.bigint :number
t.references :lsg_body, null: false, foreign_key: true, type: :uuid
t.timestamps
end
end
end
| 21.666667 | 73 | 0.65 |
e906e05a0cfe4a32ce33a3891ac6ac05c4dc6374 | 395 | # frozen_string_literal: true
module SeleniumPage
# Errors
class Errors
# UnexpectedSchemeAndAuthority
class UnexpectedSchemeAndAuthority < StandardError
def message
"Only 'String' are accepted"
end
end
# UnexpectedWaitTime
class UnexpectedWaitTime < StandardError
def... | 18.809524 | 54 | 0.681013 |
e92b241466eb86d2d6c562116bb1f9a34146edc9 | 9,284 | require 'spec_helper'
describe Bosh::HuaweiCloud::FloatingIp do
let(:logger) { double('logger', info: nil) }
before(:each) {
allow(Bosh::Clouds::Config).to receive(:logger).and_return(logger)
}
let(:network) { double('network', get_server: nil, list_floating_ips: nil, associate_floating_ip: nil, disassoci... | 36.695652 | 164 | 0.609866 |
5d60a29f47dda05ae1facc0c2687f6b5d9281d90 | 1,845 | module Fog
module Vsphere
class Compute
class Real
def create_resource_pool(attributes = {})
cluster = get_raw_cluster(attributes[:cluster], attributes[:datacenter])
root_resource_pool = if attributes[:root_resource_pool_name]
cluster.resourcePoo... | 35.480769 | 112 | 0.604878 |
088ab71b326fec751e9ef99c8b1eb5d368b8892e | 78 | module Synthesizer
module Quality
HIGH = :High
LOW = :Low
end
end
| 11.142857 | 18 | 0.641026 |
b9778ec972c8ef60e673014fc7fb02b5ba6a6da3 | 1,387 | class CreateVendorProductTriggers < ActiveRecord::Migration[5.2]
def up
execute <<-SQL
CREATE OR REPLACE FUNCTION vendor_product_matches_updated_function()
RETURNS TRIGGER AS $$
BEGIN
UPDATE products_list
SET match_error_count = (
SELECT count(*)
... | 32.255814 | 74 | 0.66186 |
612fb133e9ec77bc4bce8d7ac702f0d5cca15c2c | 854 | #
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint soundpool.podspec' to validate before publishing.
#
Pod::Spec.new do |s|
s.name = 'soundpool'
s.version = '1.0.1'
s.summary = 'No-op implementation of soundpool MacOS plugin to ... | 37.130435 | 102 | 0.599532 |
f88e2134c0819eb565e43f49235b5bd05b9bfbc1 | 5,457 | ##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##
##
# This module is based on, inspired by, or is a port of a ... | 35.435065 | 181 | 0.599597 |
6aea9962b5867924373b2f1a03f58c8a1dead4a2 | 2,357 | # frozen_string_literal: true
require "immigrant"
Immigrant.ignore_keys = [
# Add FK to column file_number in veterans table
{ from_table: "available_hearing_locations", column: "veteran_file_number" },
# Add FK to legacy_appeals
{ from_table: "worksheet_issues", column: "appeal_id" },
# Add FK to dispatc... | 49.104167 | 107 | 0.735257 |
1aaded4e3880fb0a28f03aed9300459bf7779264 | 75 | module Puppet
module ResourceApi
VERSION = '1.8.10'.freeze
end
end
| 12.5 | 29 | 0.693333 |
e2908879ebe837fb0bcb8a67097d8ed85aed7b7b | 2,018 | # frozen_string_literal: true
RSpec.describe JWT::ClaimsValidator do
let(:validator) { described_class.new(claims) }
describe '#validate!' do
subject { validator.validate! }
shared_examples_for 'a NumericDate claim' do |claim|
context "when #{claim} payload is an integer" do
let(:claims) { ... | 25.225 | 65 | 0.569871 |
61157cc56e0836728e143b17e64378d2fe82a8ce | 3,029 | require 'test_helper'
class JsonSimilarityControllerTest < ActionDispatch::IntegrationTest
include JsonSimilarityHelper
test "should raise an error for invalid json input" do
hash1 = [] # Array instead of Hash
hash2 = [] # Array instead of Hash
assert_raises RuntimeError do
compare_hashes(hash... | 23.850394 | 74 | 0.536811 |
bff72ecbf8b1d7b912673f361590a34ab3332f66 | 3,148 | ########################################################################################################################
# OpenStudio(R), Copyright (c) 2008-2017, Alliance for Sustainable Energy, LLC. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitt... | 52.466667 | 120 | 0.701398 |
26df0cdc4a5777585e0d280fba5bc82ada6bf2d9 | 1,101 | require File.expand_path '../../../spec_helper.rb', __FILE__
RSpec.describe Types::ColorType do
let(:headers) do
{ 'Content-Type' => 'application/json', 'Accept' => 'application/json' }
end
let(:query) do
{ "query" => query_string }
end
# Call `result` to execute the query
let(:result) do
po... | 22.02 | 133 | 0.606721 |
3824301b6d84d20acd54b65a0f3c599861e0322a | 1,371 | class Kytea < Formula
desc "Toolkit for analyzing text, especially Japanese and Chinese"
homepage "http://www.phontron.com/kytea/"
url "http://www.phontron.com/kytea/download/kytea-0.4.7.tar.gz"
sha256 "534a33d40c4dc5421f053c71a75695c377df737169f965573175df5d2cff9f46"
bottle do
sha256 "57c8c3acf60417d44d... | 39.171429 | 95 | 0.754923 |
28d1ca390caf7c84982c8161d8f1380dc0bda6eb | 1,535 | module ComponentSerializer
class SearchFormComponentSerializer < ComponentSerializer::BaseComponentSerializer
# Initialise a search form component.
#
# @param [String] query string to passed in as the value attribute of the input element.
# @param [Array<Object>] components components that are intende... | 39.358974 | 188 | 0.710098 |
017d57b27c8d1c40f84b7a7de3600adcd00c49b6 | 825 | # frozen_string_literal: true
module Xlsxtream
module IO
class Hash
def initialize(stream)
@stream = stream
@hash = {}
@path = nil
end
def <<(data)
@stream << data
end
def add_file(path)
close
@path = path
@hash[@path] = [@str... | 17.1875 | 60 | 0.483636 |
ff5364d31c3fb9176cffd85b7ecc1aac5f2aedf7 | 458 | class Mailer < ActionMailer::Base
include GhostInThePost::Mailer
default from: 'john@example.com'
def normal
mail(to: 'example@example.org', subject: "Notification for you")
end
def multi
mail(to: 'example@example.org', subject: "Notification for you") do |format|
format.html
format.text... | 20.818182 | 80 | 0.687773 |
bb7780edc7ca34d16541c33ce1b7dff084d86b97 | 943 | Pod::Spec.new do |s|
s.name = 'PlayerCore'
s.version = '1.0.4'
s.summary = 'PlayerCore contains important player logic which is used by Verizon Video Partner SDK.'
s.license = { type: 'MIT', file: 'LICENSE' }
s.swift_version = '4.2'
s.homepage = 'https://... | 36.269231 | 111 | 0.623542 |
f78463b5f98c68d0fa9f1ec3b893a6a6a53dc7c8 | 198 | require 'spec_helper'
describe RpcBench do
it 'has a version number' do
expect(RpcBench::VERSION).not_to be nil
end
it 'does something useful' do
expect(false).to eq(true)
end
end
| 16.5 | 43 | 0.707071 |
5df5bee31a7248642c5e90dc2959d6f6815bd451 | 148 | # frozen_string_literal: true
require "test_helper"
class JmxTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 14.8 | 39 | 0.716216 |
ff70113545710b6af0418b94b38123476dbd8de3 | 557 | # == Schema Information
#
# Table name: events
#
# id :bigint not null, primary key
# action :string
# payload :jsonb not null
# created_at :datetime not null
# updated_at :datetime not null
# issue_id :bigint not null
#
# Indexes
#
# index_events_o... | 17.967742 | 53 | 0.628366 |
01cecb2e6580d86442d20d6233c894404f48aec9 | 2,434 | #
# Author:: Bryan McLellan <btm@loftninjas.org>
# Copyright:: Copyright 2012-2020, Chef Software 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
... | 49.673469 | 195 | 0.715694 |
e2ea4f4b00e8d238d1ed870abc70826e0ba5f491 | 342 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Security::Mgmt::V2020_01_01
module Models
#
# Defines values for TransportProtocol
#
module TransportProtocol
TCP = "TCP"
UDP = "U... | 21.375 | 70 | 0.690058 |
7a9ec34003891b89515213a707f42066551ebb93 | 1,094 | # This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'rspec/rails'
require "json_matchers/... | 30.388889 | 86 | 0.76691 |
183b188f60a57b585f689968c0626731fae3c259 | 651 | # -*- encoding : utf-8 -*-
module ControllerSpecHelper
# AuthenticatedTestHelperを書き換える
def login_as(user)
@current_user = user.kind_of?(Symbol) ? users(user) : user
@request.session[:user_id] = @current_user.try(:id)
end
# ログインしていないときのスペックの記述を簡単にする
def response_should_be_redirected_without_login(&bl... | 23.25 | 62 | 0.725038 |
91216723b97d6e9caef262e7525804e6a32b5b98 | 1,105 | Pod::Spec.new do |s|
s.name = "ElasticTransition"
s.version = "2.1.0"
s.summary = "A UIKit custom modal transition that simulates an elastic drag. Written in Swift."
s.description = <<-DESC
A UIKit custom modal transition that simulates an elastic drag... | 39.464286 | 108 | 0.59819 |
6203ff8663a5494b0fb573f7faccb938d1e967ea | 2,608 | #encoding: utf-8
require 'rubygems'
require 'sinatra'
require 'sinatra/reloader'
require 'sinatra/activerecord'
require 'sqlite3'
set :database, 'sqlite3:barbershop.db'
class Client < ActiveRecord::Base
validates :name, presence: {message: "Введите имя!"}, length: {minimum: 3}
validates :phoneno, presence: true
... | 22.678261 | 147 | 0.624233 |
d55df463bcac474b6c6e36eb74349bffe580b7ae | 1,074 | class Snobol4 < Formula
desc "String oriented and symbolic programming language"
homepage "http://www.snobol4.org/"
url "ftp://ftp.ultimate.com/snobol/snobol4-1.5.tar.gz"
mirror "https://src.fedoraproject.org/lookaside/pkgs/snobol/snobol4-1.5.tar.gz/54ac3ddd51fb34ec63b1eb0ae7b99794/snobol4-1.5.tar.gz"
sha256 ... | 48.818182 | 133 | 0.801676 |
bb74a4852d62ba277dba1413bcfc713301ec56f2 | 1,647 | # snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.]
# snippet-sourceauthor:[Doug-AWS]
# snippet-sourcedescription:[Uploads an encrypted item to an S3 bucket.]
# snippet-keyword:[Amazon Simple Storage Service]
# snippet-keyword:[put_object method]
# snippet-keyword:[Ruby]
# snip... | 31.075472 | 89 | 0.715847 |
edc17ffc218c3b94eeebb8d7909b5b0a1418ac0c | 4,080 | # frozen_string_literal: true
module ThemeCheck
class Position
include PositionHelper
attr_reader :contents
def initialize(
needle_arg,
contents_arg,
line_number_1_indexed: nil,
node_markup: nil,
node_markup_offset: 0 # the index of markup inside the node_markup
)
... | 23.181818 | 107 | 0.677206 |
874ed2d114e5070f132afbe5c919c29857a362fa | 628 | require 'rubygems'
# require at least 1.1.4 to fix a bug with describing Modules
gem 'rspec', '>= 1.1.4'
require 'spec'
# pretend we already loaded fastthread, otherwise the nonblockingserver_spec
# will get screwed up
# $" << 'fastthread.bundle'
# turn on deprecation so we can test it
module Thrift
DEPRECATION = t... | 20.933333 | 76 | 0.718153 |
7a4c4b6967fae8380cfc82b59c4cef3a3e451481 | 94 | Dir["#{__dir__}/helper/*.rb"].each { |f| require f }
module Jinaki
module Helper
end
end
| 13.428571 | 52 | 0.648936 |
61db91f8554a34689113f9f24ba47b91007ea194 | 5,377 | =begin
#DocuSign REST API
#The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign.
OpenAPI spec version: v2.1
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end
require 'date'
module DocuSign_eSign... | 28.601064 | 123 | 0.619304 |
e83b2bae6e36278dc8daa99821f35e786518b0c2 | 147 | require 'gem2deb/rake/testtask'
Gem2Deb::Rake::TestTask.new do |t|
t.libs << 'lib' << 'test'
t.test_files = FileList['test/**/*_test.rb']
end
| 21 | 46 | 0.653061 |
1dec405ca136329d6e4bbba5698be09de9f5a2e3 | 890 | class Glslviewer < Formula
desc "Live-coding console tool that renders GLSL Shaders"
homepage "http://patriciogonzalezvivo.com/2015/glslViewer/"
url "https://github.com/patriciogonzalezvivo/glslViewer/archive/1.6.1.tar.gz"
sha256 "2408e1662f2d4dd1922f00a747090c13ee8aff561123bdc86aff9da77b3ccf74"
license "BSD-... | 31.785714 | 93 | 0.769663 |
01fa0992ba8ce0c705b292b4700374ca38dc7203 | 671 | require_relative '../spec_helper'
describe 'Addrinfo#ipv6_mc_global?' do
it 'returns true for a multi-cast address in the global scope' do
Addrinfo.ip('ff1e::').should.ipv6_mc_global?
Addrinfo.ip('fffe::').should.ipv6_mc_global?
Addrinfo.ip('ff0e::').should.ipv6_mc_global?
Addrinfo.ip('ff1e::1').shou... | 31.952381 | 67 | 0.716841 |
033110bb745fb7895178c409b9f6dbf5933fdba8 | 365 | require "bundler/setup"
require "primalize"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.expect_with :r... | 24.333333 | 66 | 0.753425 |
ab1cbcd0c2149b5e2d2a7df05ebd6fadb8c498b5 | 2,533 | module Effective
class LogsController < ApplicationController
skip_log_page_views
before_action :authenticate_user!, only: [:index, :show]
# This is a post from our Javascript
def create
EffectiveLogging.authorize!(self, :create, Effective::Log.new)
@log = Effective::Log.new.tap do |log|... | 30.154762 | 120 | 0.620608 |
edccb5a69e3ba6b438d72fdc2a3cd5ffe0172a38 | 4,898 | # wrap the action rendering for ActiveScaffold views
module ActionView #:nodoc:
class Base
# Adds two rendering options.
#
# ==render :super
#
# This syntax skips all template overrides and goes directly to the provided ActiveScaffold templates.
# Useful if you want to wrap an existing templat... | 48.98 | 129 | 0.707636 |
b96b5c21488cdad71ecbd620c733171d3276ae44 | 1,286 | require_relative "symbol_container.rb"
module Docks
module Containers
# Public: a container for Class symbols.
class Klass < Symbol
# Public: the type of symbols that should be encapsulated by this
# container. This is compared against a symbol's `symbol_type` to
# determine which contain... | 32.15 | 76 | 0.685848 |
281aa3a9b4d80b15363267a2c7450a521f9f9982 | 347 | cask "font-titan-one" do
version :latest
sha256 :no_check
# github.com/google/fonts/ was verified as official when first introduced to the cask
url "https://github.com/google/fonts/raw/master/ofl/titanone/TitanOne-Regular.ttf"
name "Titan One"
homepage "https://fonts.google.com/specimen/Titan+One"
font ... | 28.916667 | 87 | 0.74928 |
f7309bfbdf803e7c58008e2553f2dee424854778 | 2,500 | # Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
require 'spec_helper'
describe 'client#exists' do
let(:expected_args) do
[
'HEAD',
url,
... | 21.929825 | 101 | 0.6328 |
015ef92ef30415fbe9d6932fca8c14f94cd6e344 | 6,842 | class ManageIQ::Providers::IbmCloud::VPC::CloudManager::MetricsCapture < ManageIQ::Providers::CloudManager::MetricsCapture
delegate :ext_management_system, :to => :target
VIM_STYLE_COUNTERS = {
"cpu_usage_rate_average" => {
:counter_key => "cpu_usage_rate_average",
:instance ... | 40.485207 | 184 | 0.613125 |
6115adab449142b3bb7b7a451fb04d125bcab1ee | 209 | name 'demoapp'
maintainer 'naveed'
description 'Install demo app'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '1.0'
depends 'apache2'
| 26.125 | 73 | 0.631579 |
e9869c2dd0d163bcab6bd2fa2ee54290fee7c0ee | 451 | # frozen_string_literal: true
FactoryBot.define do
factory :air_quality_log do
reading_time { Time.now.utc }
current_average { Faker::Number.between(from: 0, to: 100) }
ten_min_average { Faker::Number.between(from: 0, to: 100) }
thirty_min_average { Faker::Number.between(from: 0, to: 100) }
hour_... | 32.214286 | 66 | 0.687361 |
ff0d6e1ced4056c72b57802a2d923aa8c665052d | 970 | # frozen_string_literal: true
class ApplicationController < ActionController::API
rescue_from Exception, :with => :rescue_global_exceptions
def rescue_global_exceptions(exception)
render_exception_response(exception)
end
def render_exception_response(exception)
if [ActionController::RoutingError, Act... | 29.393939 | 116 | 0.75567 |
e9c9796827e26aa842eeea88f974e2f3bd4d5c0a | 296 | module HealthSeven::V2_6
class Sad < ::HealthSeven::DataType
# Street or Mailing Address
attribute :street_or_mailing_address, St, position: "SAD.1"
# Street Name
attribute :street_name, St, position: "SAD.2"
# Dwelling Number
attribute :dwelling_number, St, position: "SAD.3"
end
end | 29.6 | 61 | 0.743243 |
185f5b6ce96c056ae2d3fcc888b1e6561f482080 | 376 | =begin
name : ex12.rb
author : laoling
email : <838618014@qq.com>
------------------------------------
description:本实例我们演示的是ruby中
模块的基本使用。
------------------------------------
=end
require 'open-uri'
open("http://laoling.96.lt") do |f|
f.each_line{|line| p line}
puts f.base_uri
puts f.content_type
puts f.char... | 18.8 | 36 | 0.587766 |
28a4353be4403bec61680c92a04c364fbcd7fed6 | 4,787 | # frozen_string_literal: true
require 'spec_helper'
describe SFRest::Role do
before :each do
@conn = SFRest.new "http://#{@mock_endpoint}", @mock_user, @mock_pass
end
describe '#get_role_id' do
roles_data = generate_roles_data
role_ary = roles_data['roles'].to_a.sample
role = { role_ary[0] => r... | 34.438849 | 115 | 0.632338 |
38f395acf3b43f54e8c2602408f4e39c088be838 | 149 | if ARGV.length == 0
puts "No parameters"
elsif ARGV.length == 1
puts "Parameters is " + ARGV[0]
else
puts "Too many parameters"
end | 21.285714 | 36 | 0.630872 |
626284d69c304200d08ebb4aef703551031268a8 | 1,203 | class OrganisationsController < ApplicationController
def index
@organisations = Organisation.all
end
def show
@organisation = organisation
end
def new
@organisation = Organisation.new
end
def create
@organisation = Organisation.new(organisation_params)
if @organisation.save
... | 20.05 | 64 | 0.551953 |
01ebf64e9e5bfe8ee88ced190856df136d174441 | 590 | class News < ActiveRecord::Base
validates :title, presence: true
validates :body, presence: true, length: { minimum: 20 }
validates :short, presence: true
belongs_to :edition
validates :edition, presence: true
before_validation do
self.short = ActionController::Base.helpers.strip_tags(self.body)[0..12... | 20.344828 | 77 | 0.657627 |
bf3774b0904292f0dac0c83d77fa8c71dbb1291a | 233 | class CreateNotes < ActiveRecord::Migration[6.0]
def change
create_table :notes do |t|
t.references :color, null: false, foreign_key: true
t.string :title
t.text :content
t.timestamps
end
end
end
| 19.416667 | 57 | 0.652361 |
62cd90d6c86c4ad29d1e10f9df3064e503a81269 | 1,390 | require_relative "boot"
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "active_storage/engine"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_mailbox/engine"
require "action_text/en... | 33.095238 | 79 | 0.760432 |
38f7ba338cc2070e6df6726c0048b18670726a9c | 13,792 | # frozen_string_literal: true
module DevelopmentApp
class GridInteractor < BaseInteractor
def debug_list_grids
path = File.join(ENV['ROOT'], '/grid_definitions/lists/')
ymlfiles = File.join(path, '**', '*.yml')
yml_list = Dir.glob(ymlfiles).sort
rows = []
yml_list.each do |yml|
... | 37.580381 | 190 | 0.604553 |
2611543b38587c7569d2c9f7219c59c36408aa74 | 881 | # 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... | 46.368421 | 86 | 0.790011 |
6ad7357cff061eb0ec854a0ebc5144b7f99df137 | 15,025 | module Quickbooks
module Service
class BaseService
include Quickbooks::Util::Logging
include ServiceCrud
attr_accessor :company_id
attr_accessor :oauth
attr_reader :base_uri
attr_reader :last_response_xml
attr_reader :last_response_intuit_tid
attr_accessor :before_... | 32.805677 | 115 | 0.593544 |
2114fd88b5c6bf342d2b67c74b01479fbd05b2a5 | 100 | require 'sfn-parameters'
module Sfn
class Config
class Parameters < Config
end
end
end
| 11.111111 | 29 | 0.7 |
f76ee24a9323e197558c72810375b9aa0ffc6523 | 1,926 | # -*- coding: utf-8 -*-
require 'test_helper'
class TripcodeTest < Minitest::Test
def test_that_it_has_a_version_number
refute_nil ::Tripcode::VERSION
end
def test_nil_passwords
assert_equal '', Tripcode.hash(nil)
assert_equal '', Tripcode.secure(nil)
end
def test_blank_passwords
assert_equ... | 33.206897 | 82 | 0.663032 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.