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 |
|---|---|---|---|---|---|
bf2669016f7cc58e5cde0271a14fe7d0b4690dfe | 3,366 | module Bosh::Director
class ProblemScanner::VmScanStage
AGENT_TIMEOUT_IN_SECONDS = 10
attr_reader :agent_disks
def initialize(instance_manager, problem_register, cloud, deployment, event_logger, logger)
@instance_manager = instance_manager
@problem_register = problem_register
@cloud =... | 29.017241 | 114 | 0.615865 |
625c67886ef416ffb752cfda00f80f227ca2603e | 591 | class Tasks::Sources::NewSourceController < ApplicationController
include TaskControllerConfiguration
def index
end
# GET /sources/new_source/crossref_preview.json
def crossref_preview
if citation_param.blank?
render json: :invalid_request
else
@source = TaxonWorks::Vendor::Serrano.new_f... | 20.37931 | 87 | 0.71912 |
085e85e0eb492a184ee500c83f6460cfc1f8ee2a | 370 | # frozen_string_literal: true
module SolidusTailwindFrontend
class Configuration
# Define here the settings for this extension, e.g.:
#
# attr_accessor :my_setting
end
class << self
def configuration
@configuration ||= Configuration.new
end
alias config configuration
def conf... | 16.818182 | 56 | 0.694595 |
7a44156962125b403ccb7ca30794ee59fffbf5cb | 166 | class CreateTags < ActiveRecord::Migration[4.2]
def change
create_table :tags do |t|
t.string :title
t.string :image
t.timestamps
end
end
end
| 16.6 | 47 | 0.662651 |
e9f0366901a861355bdaa94e8acb3ed4f9b9bf8c | 3,506 | # 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::NetApp::Mgmt::V2019_07_01
module Models
#
# NetApp account resource
#
class NetAppAccount
include MsRestAzure
... | 27.825397 | 70 | 0.454079 |
01e85911353980350a757390f4e93450daf479d3 | 402 | # frozen_string_literal: true
FactoryBot.define do
factory :calendar_protocol, class: "Calendars::Protocol" do
transient do
calendars { [] }
end
sequence(:name) { |i| "Protocol #{i}" }
kinds { nil }
community { calendars.first&.community || Defaults.community }
after(:create) do |prot... | 22.333333 | 66 | 0.664179 |
aba92c10b06588bf71c656e0ca0068eb3b1df884 | 1,675 | ENV['RC_ARCHS'] = '' if RUBY_PLATFORM =~ /darwin/
# :stopdoc:
require 'mkmf'
ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
specified_curl = ARGV[0] =~ /^--with-curl/ ? ARGV[0].split("=")[1] : nil
LIBDIR = specified_curl ? "#{specified_curl}/lib": RbConfig::CONFIG['libdir']
INCLUDEDIR = speci... | 28.87931 | 92 | 0.670448 |
1889ab8bfc49cfe77b0c1b5b94c7387c10ed2b89 | 401 | require 'spec_helper'
describe API do
include Rack::Test::Methods
def app
API
end
describe "get" do
before do
get("/")
end
it "should return Hello world" do
expect(last_response.body).to eq("\"Hello world\"")
end
it "should return json format" do
expect(last_respon... | 13.827586 | 66 | 0.63591 |
e295d009e37bec4f2acbb07dd7c96059841a4444 | 255 | class CreateMicroposts < ActiveRecord::Migration[5.1]
def change
create_table :microposts do |t|
t.text :content
t.references :user, foreign_key: true
t.timestamps
end
add_index :microposts, [:user_id, :created_at]
end
end
| 21.25 | 53 | 0.690196 |
bb8d0e8796b29973c773b2b1f8bb2aa1a8c81a18 | 1,892 | #https://sandbox-api.brewerydb.com/v2/
class API
BEER_URL = 'https://sandbox-api.brewerydb.com/v2/beers/'
def fetch_data_beer
url = BEER_URL + '/?key=' + API_KEY + "&withBreweries=Y"
uri = URI.parse(url)
body = uri.read
brewery = JSON.parse(body)
b... | 37.098039 | 199 | 0.530655 |
abfa742610f490e9a9b3b60a1d58ba9d3139246d | 229 | class ExceptionTestController < ApplicationController
def index
test = "Test"
test_method
end
def xhr
raise "asda" if request.xhr?
end
def test_method
test2 = "Test2"
raise StandardError
end
end
| 14.3125 | 53 | 0.68559 |
5d944d73c1555796a5ac6cd73b477d17f5d09c24 | 2,126 | # Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum, this matches ... | 43.387755 | 115 | 0.767639 |
6258c6a925297cb65dc67d42f2e0625b4a461654 | 1,202 | class Admin::PlansController < Admin::ApplicationController
before_action :set_conference
before_action :set_plan, only: [:show, :edit, :update, :destroy]
def new
@plan = Plan.new(conference: @conference)
end
def edit
end
def create
@plan = Plan.new(plan_params)
@plan.conference = @conferen... | 20.724138 | 123 | 0.642263 |
ac2605b38fa0cb0e116e02c3f2d92f8d75e9226e | 422 | # 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::RecoveryServicesBackup::Mgmt::V2019_06_15
module Models
#
# Defines values for RetentionScheduleFormat
#
module RetentionSch... | 23.444444 | 70 | 0.706161 |
bf50fdad2d5121b7aeb9a064591013f0070b0ca5 | 603 | Pod::Spec.new do |s|
s.name = 'Nimbus'
s.version = '0.0.8'
s.summary = 'Nimbus is a framework for building cross-platform hybrid applications.'
s.homepage = 'https://github.com/salesforce/nimbus'
s.source = { :git => 'https://github.com/salesforce/nimbus.git', :... | 43.071429 | 101 | 0.593698 |
e223009c2d6b42fa292782fb12ecc3eacc27b58c | 14,248 | # frozen_string_literal: true
#-------------------------------------------------------------------------
# # Copyright (c) Microsoft and contributors. All rights reserved.
#
# The MIT License(MIT)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated document... | 44.111455 | 135 | 0.625842 |
acef5d2e643943ac3262b43f108032f53ae94dde | 22,373 | # frozen_string_literal: true
module Ci
class Pipeline < ActiveRecord::Base
extend Gitlab::Ci::Model
include HasStatus
include Importable
include AfterCommitQueue
include Presentable
include Gitlab::OptimisticLocking
include Gitlab::Utils::StrongMemoize
include AtomicInternalId
in... | 29.554822 | 134 | 0.662495 |
87e39cec5bf6035f237ba470ca62a550b9dd5943 | 366 | module ActionView::Helpers
module ChartrHelpers
# easy way to include Chartr assets
def chartr_includes
return "<!--[if IE]>\n" +
javascript_include_tag('chartr/excanvas.js', 'chartr/base64.js') +
"\n<![endif]-->" +
javascript_include_tag("chartr/canvas2image.js", "chartr/canvast... | 30.5 | 99 | 0.653005 |
1deaee0dd35a54b7d0a5982b5c4514230aee486c | 4,593 | require './lib/feed_into'
require 'active_support/core_ext/hash/indifferent_access'
channel = {
name: :blockchain,
sym: :web,
options: {},
regexs: [ [ /https:\/\/raw.githubusercontent.com/ ] ],
download: :general,
mining: :rss_one,
pre: [],
transform: nil,
post: [ :pre_titles ]
}
... | 33.772059 | 123 | 0.573264 |
21f784a1aecfdb8cbcdb4e66b0e67f4e7d4e2936 | 654 | cask 'touchosc-editor' do
version '1.7.0'
sha256 'c23baa9eb9f3c15bb71f83f713a6b2e9aa01cc0ffe0acc15f23a6a8042acb766'
url "http://hexler.net/pub/touchosc/touchosc-editor-#{version}-osx.zip"
name 'TouchOSC Editor'
homepage 'http://hexler.net/software/touchosc'
license :unknown # TODO: change license and remov... | 43.6 | 158 | 0.756881 |
87e7b56d3d5c25323d34ac3c26e06fa58702bba4 | 1,745 | require 'user_agent'
describe "UserAgent: 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'" do
before do
@useragent = UserAgent.parse("Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)")
end
it { expect(@useragent).to be_bot }
end
describe "UserAgent: 'Mozil... | 41.547619 | 234 | 0.711748 |
61fbef0317db942f5ac5a8ccafa9a60da3ad4906 | 472 | require "json"
class RubySnake < Sinatra::Base
def initialize(*)
@@moves = Hash.new(0)
super
end
def move(id)
@@moves[id] = (@@moves[id] + 1) % 4
%w(up left down right)[@@moves[id]]
end
post "/*/start" do
{
name: name(params),
color: "#123123"
}.to_json
end
post "/*... | 14.30303 | 39 | 0.548729 |
1abc2aec9ba80d344d166963c316fcd7abae2ad9 | 519 | require 'rails_helper'
RSpec.feature 'User login', type: :feature do
background do
login_user
visit root_path
end
scenario 'Can see welcome message' do
expect(page).to have_content "Welcome to the Recipe App, #{@user.name}"
end
scenario 'Can see Logout button' do
expect(page).to have_conten... | 20.76 | 75 | 0.705202 |
e92a76cce9345b87b1c69e1da76c5e655ecbd9aa | 85 | # desc "Explaining what the task does"
# task :carload do
# # Task goes here
# end
| 17 | 38 | 0.670588 |
d57f6ce4f3fe3fca7f3883edc519bfb08192a38b | 234 | class CreateSubscriber < SpreeExtension::Migration[4.2]
def change
create_table :spree_chimpy_subscribers do |t|
t.string :email, null: false
t.boolean :subscribed, default: true
t.timestamps
end
end
end
| 23.4 | 55 | 0.700855 |
9122bfaa0fc5aff5b8a85fe787d4ae8f717739d9 | 8,748 | # -*- encoding: utf-8 -*-
shared_examples_for 'cnab240' do
let(:pagamento) do
Brcobranca::Remessa::Pagamento.new(valor: 199.9,
data_vencimento: Date.today,
nosso_numero: 123,
documento_sacado: '12345678901',
nome_sacado: 'PABLO DIEGO JOSÉ FRANCISCO DE PAULA JUAN NEPOMUCENO MARÍA DE LOS REM... | 44.861538 | 145 | 0.680155 |
1d7d301b85e7feebb237613f81f2b8189f026a9d | 1,421 | describe Unidom::Accession::PostFulfillment, type: :model do
before :each do
end
after :each do
end
context do
model_attributes = {
fulfilled_id: SecureRandom.uuid,
fulfilled_type: 'Unidom::Accession::Fulfilled::Mock',
fulfiller_id: SecureRandom.uuid,
fulfiller_type: 'Unido... | 40.6 | 110 | 0.630542 |
aca06abb1906919cbe664d125e803d327825a5d8 | 5,256 | =begin
PureCloud Platform API
With the PureCloud Platform API, you can control all aspects of your PureCloud environment. With the APIs you can access the system configuration, manage conversations and more.
OpenAPI spec version: v2
Contact: DeveloperEvangelists@genesys.com
Generated by: https://github.com/swagger-ap... | 23.154185 | 177 | 0.576294 |
219c087c41de0b7a829a2709c5dfcd3ab74a2986 | 5,775 | module ApplicationHelper::PageLayouts
def layout_uses_listnav?
return false if @in_a_form
return false if %w[
about
all_tasks
chargeback
configuration
container_dashboard
container_topology
ems_infra_dashboard
infra_topology
network_topology
cloud_to... | 26.25 | 142 | 0.645022 |
ff7cd9ec23427a8f88fc903f1fdbbf60e07ea6c2 | 145 | require 'test_helper'
module Blogg
class PostTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
end
| 14.5 | 42 | 0.662069 |
18dc5d4f73a1f345b07f24fe425cf973c48afe82 | 64 | module Junctions
module Rails
VERSION = '0.0.1'
end
end
| 10.666667 | 21 | 0.65625 |
f7cf2f8b6cdcf302f12fa13ad2d7a7e4e5edd80b | 291 | # frozen_string_literal: true
class CreatePages < ActiveRecord::Migration[7.0]
def change
create_table :pages, id: :uuid do |t|
t.string :name
t.integer :page_order
t.belongs_to :app, null: false, foreign_key: true, type: :uuid
t.timestamps
end
end
end
| 20.785714 | 68 | 0.666667 |
7a2549451f79687168db41f9b503869bcfcabe78 | 1,577 | class RubricCriteriaController < ApplicationController
before_action :authorize_only_for_admin
def download_csv
@assignment = Assignment.find(params[:assignment_id])
file_out = MarkusCsv.generate(@assignment.get_criteria(:all, :rubric)) do |criterion|
criterion_array = [criterion.name, criterion.max... | 34.282609 | 89 | 0.680406 |
e2e5c0f996d8ef370a3eeb000ae8b402018f0cf6 | 414 | # frozen_string_literal: true
require 'bundler/setup'
require 'service_actor'
require 'pry'
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.... | 23 | 66 | 0.758454 |
38fecac1bfe21e394697a474a2d00cd5c7e37200 | 4,319 | # frozen_string_literal: true
# rubocop:disable Style/Documentation
module Gitlab
module BackgroundMigration
# Class that migrates events for the new push event payloads setup. All
# events are copied to a shadow table, and push events will also have a row
# created in the push_event_payloads table.
... | 23.994444 | 112 | 0.557768 |
6a752707e474458b34ea0f5f53a16a2e865c7b09 | 4,541 | require 'rails_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to test the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
# ... | 35.476563 | 87 | 0.677604 |
1a5f8907f18de8c348e792876675f4ca6c0b7816 | 2,250 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... | 35.714286 | 87 | 0.763556 |
1c3b17b3a728cf7efcc36b8c156ea4b9a414a96b | 2,815 | module MCollective
# Wrapper around systemu that handles executing of system commands
# in a way that makes stdout, stderr and status available. Supports
# timeouts and sets a default sane environment.
#
# s = Shell.new("date", opts)
# s.runcommand
# puts s.stdout
# puts s.stderr
# puts s.s... | 30.934066 | 101 | 0.569805 |
03318a89599084b4c6673b4a0594b07dce4c9938 | 1,837 | # it is war-file
packaging 'war'
# get jruby dependencies
properties( 'jruby.version' => '@project.version@',
'project.build.sourceEncoding' => 'utf-8' )
pom( 'org.jruby:jruby', '${jruby.version}' )
# a gem to be used
gem 'flickraw', '0.9.7'
repository( :url => 'https://otto.takari.io/content/repositori... | 30.616667 | 99 | 0.659227 |
b92f5e68676670d002fea076476aa095c869a453 | 15,370 | # encoding: utf-8
require "logstash/namespace"
require "logstash/config/registry"
require "logstash/logging"
require "logstash/util/password"
require "logstash/version"
require "i18n"
# This module is meant as a mixin to classes wishing to be configurable from
# config files
#
# The idea is that you can do this:
#
# ... | 33.196544 | 130 | 0.571243 |
1a7e8dd1c0bc4444b802a7e61898d5211164be83 | 106 | require 'range_operators/array_operator_definitions'
require 'range_operators/range_operator_definitions'
| 35.333333 | 52 | 0.90566 |
bf30a826ca77e2afd97d76eb528510537577fccf | 147 | module Homebrew
def __cellar
if ARGV.named.empty?
puts HOMEBREW_CELLAR
else
puts ARGV.formulae.map(&:rack)
end
end
end
| 14.7 | 36 | 0.653061 |
39381697b1fbbc82c6a207eb25b3b9ae83893b0b | 13,868 | # encoding: UTF-8
class Fluent::StatsOutput < Fluent::Output
Fluent::Plugin.register_output('stats', self)
# To support log_level option implemented by Fluentd v0.10.43
unless method_defined?(:log)
define_method("log") { $log }
end
# Define `router` method of v0.12 to support v0.10 or earlier
unless m... | 34.583541 | 149 | 0.61285 |
d5ba2079365af6be66c1ad9f5273fcbcf3f0f53f | 1,420 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'i18n/backend/side_by_side'
require 'minitest/autorun'
I18n.load_path = Dir['test/locales/*.yml']
I18n.backend = I18n::Backend::SideBySide.new
class Test < Minitest::Test
def test_oldschool
assert_equal('Still here', I18n.t('oldschool', loc... | 34.634146 | 83 | 0.672535 |
e8e95e98b92a97905f456b88f754c4b36ae92339 | 385 | namespace :event do
desc 'Delete events by subj_id'
task :detete_by_sub_id, [:subj_id] => :environment do |task, args|
logger = Logger.new(STDOUT)
events= Event.where(subj_id: args[:subj_id])
total = events.size
events.find_each do |event|
event.destroy
end
logger.info "[Event Data] De... | 25.666667 | 84 | 0.675325 |
d53e136effb2df0532357c0158bc54a522c32a0d | 7,522 | # frozen_string_literal: true
module Ci
class CreatePipelineService < BaseService
attr_reader :pipeline, :logger
CreateError = Class.new(StandardError)
LOG_MAX_DURATION_THRESHOLD = 3.seconds
LOG_MAX_PIPELINE_SIZE = 2_000
LOG_MAX_CREATION_THRESHOLD = 20.seconds
SEQUENCE = [Gitlab::Ci::Pipel... | 42.497175 | 185 | 0.614198 |
7aef80f59db7ee879116c0f901b12c036a879408 | 219 | ENV['SINATRA_ENV'] ||= "development"
require 'bundler/setup'
Bundler.require(:default, ENV['SINATRA_ENV'])
configure :development do
set :database, 'sqlite3:db/database.db'
end
require_all 'models'
require './app'
| 18.25 | 45 | 0.73516 |
4abf69bee4cf1be381ac38437aa134c156aee92b | 1,057 | # -*- ruby -*-
#encoding: utf-8
require 'sequel/model'
require 'thingfish/mixins'
require 'thingfish/metastore/pggraph' unless defined?( Thingfish::Metastore::PgGraph )
### A row representing a relationship between two node objects.
###
class Thingfish::Metastore::PgGraph::Edge < Sequel::Model( :edges )
# Related... | 19.943396 | 86 | 0.663198 |
031aa9c77fd7ed44a8a765bdc1c9cd563fc75c41 | 3,583 | Rails.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
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... | 41.183908 | 102 | 0.758861 |
627c796a0049305ac7923495ad2de65df9375265 | 1,444 | # frozen_string_literal: true
# This migration comes from active_storage (originally 20170806125915)
class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
def change
create_table :active_storage_blobs do |t|
t.string :key, null: false
t.string :filename, null: false
t.... | 33.581395 | 74 | 0.654432 |
ede52e98ecdba8869063d3376e4c9cc3cddf2565 | 781 | class Locomotive::Translation
include Locomotive::Mongoid::Document
## fields ##
field :key
field :values, type: Hash, default: {}
## associations ##
belongs_to :site, class_name: 'Locomotive::Site'
## validations ##
validates_uniqueness_of :key, scope: :site_id
validates_presence_of :site, :key... | 19.525 | 62 | 0.683739 |
2108e8a6ef403fa7259b245ca349a47ca44170ac | 136 | # frozen_string_literal: true
ActiveModelSerializers.config.adapter = :json
ActiveModelSerializers.config.key_transform = :camel_lower
| 27.2 | 58 | 0.852941 |
1a3732bbdf9c90f112835d1e82adf91954b379da | 1,125 | # frozen_string_literal: true
class MergeRequest::MetricsFinder
include Gitlab::Allowable
def initialize(current_user, params = {})
@current_user = current_user
@params = params
end
def execute
return klass.none if target_project.blank? || user_not_authorized?
items = init_collection
ite... | 17.578125 | 70 | 0.736 |
336470a09f3dcce18ff0679898f0d84451f09bd1 | 1,209 | # frozen_string_literal: true
require_dependency "renalware/hd"
module Renalware
module HD
class Patient < ActiveType::Record[Renalware::Patient]
has_one :hd_profile, class_name: "Profile"
has_one :hd_preference_set, class_name: "PreferenceSet"
has_many :hd_sessions, class_name: "Session"
... | 28.785714 | 92 | 0.685691 |
e821905f31e5ad7f35680b76a3b475a5a9428a7d | 1,249 | require 'cucumber'
require 'flatware/cucumber/formatter'
require 'flatware/cucumber/result'
require 'flatware/cucumber/step_result'
require 'flatware/cucumber/formatters/console'
require 'flatware/cucumber/cli'
module Flatware
module Cucumber
class Config
attr_reader :config, :args
def initialize(cu... | 24.019231 | 79 | 0.682146 |
e85b0168d2d606191f6281ed8c6f06de8ddf2a48 | 331 | # frozen_string_literal: true
module Settings
# Security rules plan export settings
class PlanPolicy < ApplicationPolicy
# NOTE: @user is the signed_in_user and @record is an instance of Plan
def show?
@record.readable_by(@user.id)
end
def update?
@record.editable_by(@user.id)
end... | 19.470588 | 74 | 0.694864 |
1a3804043db1af689a07e60c69d78a68e84fce4f | 16,994 | require 'test/unit'
require 'rubygems'
gem 'activerecord', '>= 3.0.0'
require 'active_record'
require 'ruby-debug'
require File.join(File.dirname(__FILE__), '../lib/has_features')
require File.join(File.dirname(__FILE__), 'schema')
class FeaturedTest < Test::Unit::TestCase
def setup
setup_db
(1..4).each {... | 32.431298 | 131 | 0.699011 |
e85751d5c36126b604a2be5633b2136140d24dda | 1,560 | Supply::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test su... | 42.162162 | 85 | 0.774359 |
870bb157fd84cc3e27035d81dd5c30bed5eebb9e | 2,022 | $:.push File.expand_path('../lib', __FILE__)
# Maintain your gem's version:
require 'voluntary_survey/version'
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = 'voluntary_survey'
s.version = VoluntarySurvey::VERSION
s.authors = ['Mathias Gawlista']
s.emai... | 39.647059 | 96 | 0.696835 |
e8a693d0c175ce8b1c5f6d7ea99de42fc90a9770 | 1,483 | require "spec_helper"
require "shamu/attributes"
describe Shamu::Attributes::Validation do
let( :klass ) do
Class.new do
include Shamu::Attributes
include Shamu::Attributes::Assignment
include Shamu::Attributes::Validation
attribute :name, presence: true
def self.name
"Exa... | 23.919355 | 88 | 0.67296 |
615670ec9876c54868f7ebae094092fedeb57cb8 | 501 | module Lobbyist
module V2
class CustomInvitation < Lobbyist::V2::Base
attr_accessor :contact_id, :company_id, :first_name, :last_name, :phone_daytime, :email
attr_accessor :city, :state, :last_service_date, :created_at, :updated_at, :abbreviated_name
attr_accessor :review_id, :review_status
... | 29.470588 | 107 | 0.716567 |
ffd39f91d6dca3d596cbc7da125b188c90ce0968 | 888 | # frozen_string_literal: true
module ElasticAPM
RSpec.describe Util do
describe '.nearest_minute', :mock_time do
it 'normalizes to nearest minute' do
travel 125_000 # two minutes five secs
expect(Util.nearest_minute).to eq Time.utc(1992, 1, 1, 0, 2)
end
end
describe '.ms', mo... | 25.371429 | 68 | 0.622748 |
189dd536fd6237e420cf37cf612719b8fa5acd87 | 8,955 | # frozen_string_literal: true
RSpec.shared_context 'clean-up builder' do
after(:all) do
RgGen.disable_all
end
end
RSpec.shared_context 'configuration common' do
class ConfigurationDummyLoader < RgGen::Core::Configuration::Loader
class << self
attr_accessor :values
attr_accessor :data_block
... | 28.980583 | 113 | 0.686097 |
ed908c577414e6531abd32df8ce7ffeedc71f100 | 8,497 | require File.expand_path( File.join( File.dirname( __FILE__ ), '..', 'spec_helper.rb' ) )
require 'tempfile'
describe "GraphiteStorage::Whisper::WhisperFile" do
it "should know its header information" do
whisper_file = GraphiteStorage::Whisper.open(EMPTY_WSP[:file])
whisper_file.archive_count.should == EMPT... | 43.798969 | 150 | 0.722843 |
210b64dacb7a4f503137ee07e9c97702b35bbff7 | 1,842 | module ScoutApm
module LayerConverters
class DatabaseConverter < ConverterBase
def initialize(*)
super
@db_query_metric_set = DbQueryMetricSet.new(context)
end
def register_hooks(walker)
super
return unless scope_layer
walker.on do |layer|
nex... | 25.943662 | 81 | 0.588491 |
1a0fcfc088a28cbf5815540bba8fab12a5096d1c | 40,283 | # Copyright (C) 2010 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 agr... | 33.879731 | 137 | 0.593575 |
e27eea0a93b7a14c8b2aaedf84e499fe19c197d6 | 3,177 | # encoding: UTF-8
require 'spec_helper'
require 'mongo'
require 'polipus/storage/memory_store'
describe Polipus::Storage::MemoryStore do
let(:storage) { Polipus::Storage.memory_store }
it 'should store a page' do
p = page_factory 'http://www.google.com', code: 200, body: '<html></html>'
uuid = storage.add ... | 36.102273 | 105 | 0.676739 |
7ab13cbcc3378984f4d15cd1c2e92a28121772af | 3,156 | require 'ruby_crypto_etf'
module RubyCryptoETF
describe Coin do
context "initialization" do
it "should create a new Coin" do
coin = Coin.new(symbol: 'btc',
amount: BigDecimal("0.001"),
exchange: 'BiNaNcE',
value: BigDecimal("88... | 29.773585 | 109 | 0.615653 |
d5eb5b42a3a2b2f16c14a767ee2978178b82e91f | 844 | # frozen_string_literal: true
RSpec.describe Fear::Struct do
describe "pattern matching" do
subject do
case struct
in Fear::Struct(a: 42)
"a = 42"
in Fear::Struct(a: 43, **rest)
"a = 43, #{rest}"
in Fear::Struct(a:)
"a = #{a}"
end
end
let(:struct_cla... | 22.810811 | 66 | 0.562796 |
621daead7e4c7a8c0355ac19c4e9c9967234c14a | 924 | # frozen_string_literal: true
require "datadog/statsd" if Rails.env.production?
require "./lib/github_classroom/null_statsd"
module GitHubClassroom
APP_NAME = ENV["HEROKU_APP_NAME"] || "github-classroom"
DYNO = ENV["DYNO"] || 1
def self.statsd
@statsd ||= if Rails.env.production?
::Datado... | 30.8 | 116 | 0.678571 |
bfdbe857dd4e3d164ff6bd09e1551b4de6fcaa9e | 13,295 | require 'test_helper'
module Sources
class TwitterTest < ActiveSupport::TestCase
setup do
skip "Twitter credentials are not configured" if !Source::Extractor::Twitter.enabled?
end
context "An extended tweet" do
should "extract the correct image url" do
@site = Source::Extractor.find(... | 42.206349 | 187 | 0.684167 |
335cbe911b7f42f77ed3eaa6fc9ce0bfad357dc7 | 3,387 |
# Copyright 2018 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, s... | 33.87 | 83 | 0.677 |
d514cb71f4887d4f7198f961ff96354b148d6546 | 156 | HUSH_ENCRYPTION_KEY = String(ENV['HUSH_ENCRYPTION_KEY'])
if HUSH_ENCRYPTION_KEY.blank?
raise 'You must set environment variable HUSH_ENCRYPTION_KEY'
end
| 26 | 63 | 0.826923 |
1aa715ac9cd247e4477806b485e4de7d08c78e85 | 3,344 | # encoding: utf-8
# frozen_string_literal: true
module RuboCop
module Cop
module Performance
# This cop identifies places where `Hash#merge!` can be replaced by
# `Hash#[]=`.
#
# @example
# hash.merge!(a: 1)
# hash.merge!({'key' => 'value'})
# hash.merge!(a: 1, b: ... | 31.54717 | 80 | 0.532596 |
4a54f9da3c5a53c60b89fa97ee6900694b4b3b28 | 5,138 | # 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::V2020_06_01
module Models
#
# Route table resource.
#
class RouteTable < Resource
include MsRestAzure
... | 30.766467 | 79 | 0.43441 |
4ae0176166176b2cdf613694b756093d32629e97 | 5,352 | #!/usr/bin/env ruby
# Copyright (c) 2004-2020 Microchip Technology Inc. and its subsidiaries.
# SPDX-License-Identifier: MIT
require_relative 'libeasy/et'
$ts = get_test_setup("mesa_pc_b2b_2x")
#---------- Configuration -----------------------------------------------------
$idx_npi = 0
$idx_rx = 1
test "conf" do... | 25.485714 | 117 | 0.55867 |
26416be624c857a32a372349cfaf591325a26886 | 364 | # frozen_string_literal: true
# This will guess the User class
FactoryBot.define do
factory :user do
name { Faker::Name.name }
sequence :email do |n|
"person#{n}@example.com"
end
password { 'password' }
password_confirmation { 'password' }
factory :admin do
admin { true }
end
... | 20.222222 | 40 | 0.642857 |
bffd99c9a45eab28ba0fc924f7281218a1b30a16 | 707 | # encoding: utf-8
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# /spec/fixtures/responses/whois.dns.pl/pl/property_expires_on_not_defined.expected
#
# and regenerate the tests with the following rake task
#
# $ rake spec:generate
#
require 'spec_help... | 26.185185 | 86 | 0.739745 |
7917dc218600c1191c85a200c1992f7014c5d7b5 | 6,228 | # $Id$
module Projects
module Api
require File.dirname(__FILE__).chomp("/projects/api") + '/projects/api/API'
require File.dirname(__FILE__).chomp("/projects/api") + '/projects/util/ZohoHTTPClient'
require File.dirname(__FILE__).chomp("/projects/api") + '/projects/parser/TaskParser'
# * TasksAPI is... | 24.519685 | 111 | 0.57097 |
26c3af350355e86aa3dd95560606bb4d236074f0 | 368 | require "bundler/setup"
require "gym_schedule"
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... | 24.533333 | 66 | 0.755435 |
018919154d22115bfda0bfd974deb9af0430b418 | 374 | # frozen_string_literal: true
require "rediscratch"
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.expec... | 23.375 | 66 | 0.756684 |
79ae1bb43624c92766c6ef82338465d7abed96bd | 236 | class AddChangedFieldsToVulnerability < ActiveRecord::Migration[5.1]
def change
add_column :vulnerabilities, :changed_fields, :text, array: true, default: []
add_index :vulnerabilities, :changed_fields, using: :gin
end
end
| 33.714286 | 81 | 0.758475 |
ffce610fc10cd725feb56eb591e84777980fd4d5 | 619 | # frozen_string_literal: true
require "fileutils"
module FoxPage
class SiteBuilder
include Builders::Assets
include Builders::FileCopy
include Builders::Models
include Builders::Pages
def self.build(app)
new(app).build
end
attr_reader :app, :output_directory
def initialize(a... | 17.685714 | 57 | 0.672052 |
e2c9edd4a4a19981df0a9ef5710361989c79424c | 1,231 | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Checks for uses of the `then` keyword in multi-line if statements.
#
# @example
# # bad
# # This is considered bad practice.
# if cond then
# end
#
# # good
# # If statem... | 24.137255 | 78 | 0.552396 |
39f1d9bed7a05b3ad44413409f0782529f6b7027 | 50 | module RailsParam #:nodoc
VERSION = "1.0.1"
end
| 12.5 | 25 | 0.68 |
62d7dcccf85194d96a94c091c5c845d15c2eac7b | 1,612 | require "capybara/rspec"
require "capybara/rails"
require "capybara/poltergeist"
require "capybara-screenshot/rspec"
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, {
:phantomjs_logger => File.open("#{Rails.root}/log/test_phantomjs.log", "a"),
})
end
Capybara.javascript_d... | 25.1875 | 82 | 0.716501 |
87987cedc2a2517a239aabe625a89f2c361b29d7 | 340 | class DigestMailer < ApplicationMailer
add_template_helper(UsersHelper)
add_template_helper(PostsHelper)
# TODO: change mail to: @user.email when it's production ready
def daily_email(user)
@user = user
@recommended = Post.latest(4).published
mail to: "jerrynil.tw@gmail.com", subject: "Stories Dail... | 28.333333 | 69 | 0.744118 |
7ad425aca9776deaa989aea5f8487bed7e83a032 | 6,113 | require 'spec_helper'
describe 'Checking Out', :js do
let!(:user) { create(:user) }
let!(:other_buying_user) { create(:user) }
let!(:buyer) { create(:organization, :single_location, :buyer, users: [user, other_buying_user]) }
let!(:credit_card) { create(:bank_account, :credit_card, bankable: buyer) }
let!(... | 37.048485 | 363 | 0.675282 |
39471144f16889368e933fc256b289ba009b1a87 | 381 | # frozen_string_literal: true
# Sends broadcast emails.
class BroadcastMailer < ApplicationMailer
def broadcast(to:, subject:, body:, mission:)
@body = body
@mission = mission
@site_name = site_name
# TODO: We should send a separate email to each recipient
# like we do with an SMS broadcast
... | 25.4 | 61 | 0.687664 |
d56e615db1f5f8a661c241b46d3b07a6b9889b45 | 14,383 | # Copyright (c) 2016, 2022, 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... | 44.119632 | 245 | 0.702009 |
f8f3cd5109e292993e4d4f6e1b1f604d53f7d082 | 1,428 | # frozen_string_literal: true
require_relative 'git_path'
module Travis
module PackerBuild
class GitPath
def initialize(repo, path, default_ref = 'HEAD')
@repo = repo
@path = path
@default_ref = default_ref
end
attr_reader :repo, :path, :default_ref
def namespac... | 22.666667 | 62 | 0.539216 |
4a3155d8d07239ad5950f385d395a1c2984f27e3 | 1,299 | class PatchBlocks < Patch
MagicBlocks = [
["KZD", nil, "Khaliz-Dorahn", "KZD", "AFM"],
["IMP", nil, "Imperial Legacies", "IMP", "PSA", "TOJ"],
["TWR", nil, "A Tourney at Whiterun", "TWR", "PFP"],
["GNJ", nil, "Goliaths of Nangjiao", "GNJ", "SUR"],
["OPH", nil, "Ophorio", "OPH", "ORP",],
["CAC"... | 30.209302 | 59 | 0.52271 |
ac7224e4b245df122696bc33445e6fc5a2332f7f | 21,403 | # encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
require 'new_relic/agent/transaction'
require 'new_relic/agent/instrumentation/queue_time'
module NewRelic
module Agent
# @api public
module Instrument... | 41.802734 | 178 | 0.599402 |
18c9e63c8d4d4943327564b72a931baf3e4aa9f4 | 422 | require 'pp'
# Note: test not needed, simply work up from the generated list of triangular numbers
def is_triangular?(i)
root = Math.sqrt(i*2)
return (!(root % 1).zero? and 0.5 * root.floor() * root.ceil() == i)
end
def is_pentagonal?(i)
return (((Math.sqrt(24 * i + 1) + 1) / 6) % 1).zero?
end
def is_hexagonal?(... | 22.210526 | 85 | 0.623223 |
0891ae7c6b261b110d3c0c7ad7af7cc507c8464f | 1,067 | Новая книга Джоан Роулинг "Гарри Поттер и проклятое дитя" стала самой продаваемой в Великобритании, сообщает The Daily Mail.
Роман обогнал по популярности пьесу "Ромео и Джульетта" Уильяма Шекспира.
По информации издания, за первую неделю после выхода восьмой части саги о волшебнике было продано 847,9 тысяч экземпляров... | 88.916667 | 140 | 0.819119 |
e9e5ca121b4bc95ed18d0a7a3fb756ed84476b54 | 956 |
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "unifonic_sms/version"
Gem::Specification.new do |spec|
spec.name = "unifonic_sms"
spec.version = UnifonicSms::VERSION
spec.required_ruby_version = '>= 2.3.0'
spec.authors = ["Assen... | 32.965517 | 74 | 0.643305 |
18f12840b9f4abefd136bbd2c562ac036eaf12f7 | 2,248 | describe ManageIQ::Providers::AzureStack::CloudManager do
let(:url) { "https://#{Rails.application.secrets.azure_stack.try(:[], 'host') || 'AZURE_STACK_HOST'}" }
let(:tenant) { Rails.application.secrets.azure_stack.try(:[], 'tenant') || 'AZURE_STACK_TENANT' }
let(:userid) { Rails.applicati... | 46.833333 | 133 | 0.657028 |
1891449a586ae6662fc014c16787ca7f734516fa | 95 | FactoryGirl.define do
factory :user do
email "test@mail.com"
password "123456"
end
end | 11.875 | 23 | 0.715789 |
18a34b1be87afc26fa2d60ebe31734a12d231f83 | 7,484 |
def print_zpl_str(name, label)
zpl = ''
label.dump_contents zpl
puts "\n#{name}:\n#{zpl}\n\n"
end
def new_label
Zebra::Zpl::Label.new(
width: 600,
length: 305,
print_speed: 6,
print_density: 5,
copies: 1
)
end
#####################################################... | 26.920863 | 139 | 0.514965 |
08bf77940c527ae059849bb9167ad21994a04069 | 634 | # Quick script to get 'interesting' 11-circle patterns.
# for ticker-tape level
require 'HendecagonUtils.rb'
include HendecagonUtils
s1 = getUniqStates(false)
complex = []
for key in s1.keys
if (key.length > 5)
sum = 0
str = dec2bin(s1[key])
for i in 0..str.size-1
if str[i,1] == "1"
sum ... | 17.135135 | 55 | 0.637224 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.