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
261da42d2d3a1bb34fc097742633c1bd958bcf4e
2,087
require 'spec_helper' describe SingaporeCPFCalculator::Year2015::SPR2FG::Age60To65ContributionCalculator do subject(:calculator) { described_class.new ordinary_wages: ordinary_wages, additional_wages: additional_wages } let(:result) { calculator.calculate } let(:additional_wages)...
32.609375
90
0.655486
ffaac854ede3d2c4504e8166cd56d8bf7215d711
587
# DRUNKWATER TEMPLATE(add description and prototypes) # Question Title and Description on leetcode.com # Function Declaration and Function Prototypes on leetcode.com #201. Bitwise AND of Numbers Range #Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive. ...
34.529412
118
0.741056
03e1421dffc24fef60ea3e71244748ac3130859a
489
class TestLab # Source Error Class class SourceError < TestLabError; end # Source Class # # @author Zachary Patten <zachary AT jovelabs DOT com> class Source < ZTK::DSL::Base # Associations and Attributes belongs_to :labfile, :class_name => 'TestLab::Labfile' def initialize(*args) ...
20.375
64
0.625767
9179019cd6a67973001196fb6fc6d77fb4dba0a4
5,622
# frozen_string_literal: true require "spec_helper" describe AuthHelper do describe "button_based_providers" do it 'returns all enabled providers from devise' do allow(helper).to receive(:auth_providers) { [:twitter, :github] } expect(helper.button_based_providers).to include(*[:twitter, :github]) ...
35.582278
103
0.710423
1d21c8772c093fda7b2a0720fdcaa4121258663a
290
class PathwayImage < ActiveRecord::Base has_attached_file :background, :styles => { :thumb => "80x80>" }, :default_url => "/images/:style/missing.png" validates_attachment_content_type :background, :content_type => /\Aimage\/.*\Z/ has_many :pathway_maps, :foreign_key => 'xref' end
36.25
112
0.717241
611cfa35abdb22697b97b436f76db239850cfef6
3,107
# encoding: utf-8 require "logstash/namespace" require "logstash/logging" require_relative "file_reader" require_relative "kibana_resource" require_relative "kibana_base_resource" module LogStash module Modules class KibanaConfig include LogStash::Util::Loggable ALLOWED_DIRECTORIES = ["search", "visualization"] ...
29.590476
99
0.68748
1d9b749273fe79cb1d64b8160fe43994a59484f0
12,362
class ArchivesSpaceService def self.create_system_user(username, name, password, hidden = false) if User[:username => username].nil? User.create_from_json(JSONModel(:user).from_hash(:username => username, :name => name), { ...
40.267101
158
0.583401
7ad8dd2c5f521916e73bcfa738daaf740e63719b
129
class ActiveRecordUser < ActiveRecord::Base include Tenacity belongs_to :active_record_organization, :autosave => true end
25.8
59
0.79845
28f1299fea7e3fb56eddd504178068de820e0544
613
module ApplicationHelper def angular_safe_link_to(path_method, path_args = {}, *args) link_to( angular_path_to( public_send("#{path_method.to_s.gsub(/(_path)?$/, '_safe_path')}", path_args) ), *args ) do yield end end def angular_path_to(path) "##{path}" end d...
20.433333
85
0.637847
1de01cdbf6adfd02e0ee9efe2c9e68930aaf2f56
2,464
# Very low level interface to tidy # This file must be lazy loaded! class TidyFFI::LibTidy #:nodoc: extend FFI::Library LIB_NAME = 'tidy'.freeze PATHS = Array([LIB_NAME] + Dir['/{opt,usr}/{,local/}lib{,64}/libtidy{,-*}.{dylib,so*}']).freeze begin ffi_lib(TidyFFI.library_path || PATHS) rescue LoadError ...
32
130
0.687906
aba2a61d03c06f61e6b96af1a321b66ff3ce1524
4,878
# frozen_string_literal: true require 'stronger_parameters/constraints' module StrongerParameters module ControllerSupport module PermittedParameters def self.included(klass) klass.extend ClassMethods klass.public_send :before_action, :permit_parameters end def self.sugar(value...
34.595745
113
0.650882
872ba4cd4003249e8ce8507307e27b97084d6c1a
2,376
module Ckeditor module Rails class Asset attr_reader :name, :root def initialize name = 'ckeditor', path = '../vendor/assets' @name = name @root = Ckeditor::Rails.root_path.join path end def image_files path = root.join('images', name) files = Dir.glob(pa...
26.4
91
0.550926
91b9759b99684e2464bb1405243fbdea31748c55
729
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "braavos/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "braavos" s.version = Braavos::VERSION s.authors = ["Fabiano Beselga"] s.email = ["fabianobeselga@...
29.16
85
0.650206
1844ac969e6285377f9bdbc4f218cd041b025298
4,920
module RI class ClassEntry attr_reader :name attr_reader :path_names def initialize(path_name, name, in_class) @path_names = [ path_name ] @name = name @in_class = in_class @class_methods = [] @instance_methods = [] @inferior_classes = [] end # We fou...
26.170213
78
0.627642
1afde0f7b0de2ebac26b097231950341b99286ac
2,764
## # $Id: vuplayer_m3u.rb 10998 2010-11-11 22:43:22Z jduck $ ## ## # 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/frame...
28.791667
101
0.626628
e28e6ceb38b8a7a8fba95f0e2c5eeaf7082fe10d
595
# frozen_string_literal: true module HomesHelper def user_name session[:mastodon][:extra][:raw_info][:username] end def display_name session[:mastodon][:extra][:raw_info][:display_name] end def avatar session[:mastodon][:extra][:raw_info][:avatar] end def domain URI.parse(session[:mast...
18.59375
71
0.705882
334b78de4e23515da81df5b303066781dbae90a6
444
cask :v1 => 'xtorrent' do version '2.1 (v171)' sha256 '26ea235dcb827c6e58ab3409bec83396e86704d742d517e527016ecd44672379' url "http://acquisition.dreamhosters.com/xtorrent/Xtorrent#{version.gsub(' ','')}.dmg" appcast 'http://xtorrent.s3.amazonaws.com/appcast.xml', :sha256 => '21d8752a39782479a9f6f2485...
34.153846
88
0.75
6170ef9f8cc368a4e716a0ddb4725e9df8c21224
954
# frozen_string_literal: true Rails.application.routes.draw do get 'password_resets/new' get 'password_resets/edit' get 'sessions/new' # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html root 'static_pages#home' get '/home', to: 'static_pages#home' get '...
30.774194
101
0.677149
acd5aa5bfb1a0cfeae19c8fa35b21c094b5e6dbb
233
module RailsHooks module Hooks def self.table_name_prefix 'hooks_' end end end RailsHooks::Observer::Event.when_triggered do |record, event| event.hooks.each do |hook| hook.notify(record, event.id) end end
16.642857
61
0.708155
d523c054db58e880aa759d67b6bf5503f73a7519
1,898
module Xeroizer class OAuth2 attr_reader :client, :access_token attr_accessor :tenant_id def initialize(client_key, client_secret, options = {}) @client = ::OAuth2::Client.new(client_key, client_secret, options) end def authorize_url(options) @client.auth_code.authorize_url(options...
22.86747
90
0.649104
7a7a5ae072dccc784e66e096762a8d84e2975380
12,686
# Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| # The secret key used by Devise. Devise uses this key to generate # random tokens. Changing this key will render invalid all existing # confirmat...
48.792308
150
0.748542
ffd721b18286216b66f7ed60aca2faab84f7b3dc
274
module Rbexy module Nodes class AbstractElement < AbstractNode attr_accessor :name, :members, :children def initialize(name, members, children) @name = name @members = members || [] @children = children end end end end
19.571429
46
0.613139
d5376441129c5190c70f900524ddd37f9d12df50
3,755
# encoding: utf-8 disable_slow_controls = attribute( 'disable_slow_controls', default: false, description: 'If enabled, this attribute disables this control and other controls that consistently take a long time to complete.' ) exempt_home_users = attribute( 'exempt_home_users', description: ...
37.178218
112
0.71265
0148fd1c64e20c0e4117a510020dd020b31f39b7
4,252
require 'zabbix_receiver' # This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause this # file to always be loaded, without a need to explicit...
46.217391
129
0.745061
116ab951b58e7ec4b60e006a2f578c0c0d6a4fb0
3,621
class Lock < ActiveRecord::Base # Get an atomic lock if value matches or is nil. Block until lock was successful if args[:blocking] was set to true def self.get name, args = {} poll_time = args[:poll_time] || 10 start_time = Time.now until (lock = get_lock_for(name, args)) || args[:blocking] != true |...
29.92562
137
0.582988
878e852f2f6024610a61d0c26cc0234da8e5203c
356
require 'rubygems' require 'jquery-fileupload-rails' require 'paperclip' require 'bourbon' require 'ruby_gallery/attachments_controller' module RubyGallery class Engine < Rails::Engine ActionController::Base.send(:extend, RubyGallery::AttachmentsController) # same as ActionController::Base.extend(RubyGalle...
29.666667
79
0.800562
1af383bf50b1b010e31226d0252a976d6418599c
835
require 'authzed/api/v0/acl_service_pb' require 'authzed/api/v0/acl_service_services_pb' require 'authzed/api/v0/core_pb' require 'authzed/api/v0/developer_pb' require 'authzed/api/v0/developer_services_pb' require 'authzed/api/v0/namespace_pb' require 'authzed/api/v0/namespace_service_pb' require 'authzed/api/v0/names...
36.304348
55
0.838323
9131ab64dbe062bc7637484f305b0d284eb3a0fe
14,277
require 'rails_helper' RSpec.describe Mentor::Application, type: :model do describe 'attributes' do subject { described_class.new } it { is_expected.to respond_to :id } it { is_expected.to respond_to :team_name } it { is_expected.to respond_to :project_name } ...
36.05303
128
0.658822
7adbd1f526bcc96a09d57b6f185fbb48f0051325
585
# frozen_string_literal: true require 'ffaker' FactoryBot.define do factory :team_passage_template do team pool_type_id { ((rand * 10) % 2).to_i + 1 } # ASSERT: 25 and 50 meters type should exists event_type_id do EventsByPoolType.only_for_meetings .for_pool_type_code(pool_ty...
29.25
93
0.509402
87d60e7ac586f9cae2d01e8fd4a85293a08ac67a
405
# frozen_string_literal: true # Controller for Over Morgens fabulous Energy Mix infographic class EnergyMixController < ApplicationController layout 'energy_mix' def show @scenario = Api::Scenario.find(params[:id]) @saved_scenario = SavedScenario.find_by(scenario_id: @scenario.id) rescue ActiveResource:...
27
70
0.767901
6a2461d3c0672efaf13138a48efc008e66d971f6
5,987
module Calfresh FORM_FIELDS = { name: 'Text1 PG 1', \ name_page3: 'Text3 PG 3', \ home_address: 'Text4 PG 1', \ home_city: 'Text5 PG 1', \ home_state: 'Text6 PG 1', \ home_zip_code: 'Text7 PG 1', \ date: 'Text32 PG 1', \ home_phone_number: 'Text12 PG 1', \ email: 'Text13 PG 1', \ d...
35.426036
145
0.704694
18898c1f5a84b922b2bfc6ca5b4f5c215c8825a7
384
module Highrise class Person < Subject include Pagination include Taggable def self.find_all_across_pages_since(time) find_all_across_pages(:params => { :since => time.to_s(:db).gsub(/[^\d]/, '') }) end def company Company.find(company_id) if company_id end def name ...
19.2
86
0.619792
ffb6e13e97d56bca47e963b6777c11ef579712d7
34
include_recipe "jupyter::default"
17
33
0.823529
7ab6092b226b05bf1423295c284e0fb8e8682032
250
class CreateTestDbs < ActiveRecord::Migration def change create_table :test_dbs do |t| t.integer :city_code t.integer :cs t.integer :count t.integer :status t.integer :user_id t.timestamps end end end
17.857143
45
0.64
1d8ce747f5b385edb8b0826c81fcbfff68831052
1,733
# Copyright (c) 2007-2015, Evan Phoenix and contributors # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list ...
38.511111
80
0.773226
abe98d59d3f3939a5139bd77b85e096097ee3dde
7,864
module Fog module AWS class RDS class Server < Fog::Model identity :id, :aliases => 'DBInstanceIdentifier' attribute :allocated_storage, :aliases => 'AllocatedStorage', :type => :integer attribute :auto_minor_version_upgrade, :aliases => 'AutoMinorVersionUpgrade' ...
45.456647
112
0.570448
ffaaf73ba121afa4bf083511f01f1f0696c99c19
3,078
Pod::Spec.new do |s| # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # s.name = "MapboxNavigation-Documentation" s.version = '1.3.0' s.summary = "Complete turn-by-turn navigation interface for iOS." s.description = <<-DESC The Mapbox Navigation SDK for iOS is a drop-in i...
43.971429
218
0.598765
1a2d043177fe0dcf9f2e4f44f11cffc5171c19cb
863
Given /^I have input file\(s\) named "(.*?)"$/ do |arg1| @filenames = arg1.split(/,/) end When /^I execute "(.*?)"$/ do |arg1| @cmd = arg1 + ' < ' + @filenames[0] end Then(/^I expect the named output to match the named output "(.*?)"$/) do |arg1| RegressionTest::CliExec::exec(@cmd,arg1,ignore: '(##BioVcf|date|...
39.227273
148
0.66628
1abe047ee30d1dcc5a865d97be495b52d4842721
2,072
# encoding: UTF-8 # 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 sou...
37
86
0.688707
d5410cdd6a4298bbf9b42788a5fc34a84a434981
5,260
module UnitTests module Matchers def match_against(object) MatchAgainstMatcher.new(object) end class MatchAgainstMatcher DIVIDER = ('-' * Shoulda::Matchers::WordWrap::TERMINAL_WIDTH).freeze attr_reader :failure_message, :failure_message_when_negated def initialize(object) ...
24.239631
83
0.598289
33974720f970a7683264598f6041665f7848752e
177
class CreateLists < ActiveRecord::Migration[5.2] def change create_table :lists do |t| t.string :name t.string :category t.timestamps end end end
16.090909
48
0.644068
b9143c49a8c5df935a00a457fc5a9d008fde9470
857
# Copyright 2008-2009 Amazon.com, Inc. or its affiliates. All Rights # Reserved. Licensed under the Amazon Software License (the # "License"). You may not use this file except in compliance with the # License. A copy of the License is located at # http://aws.amazon.com/asl or in the "license" file accompanying this ...
31.740741
70
0.677946
b90a28e18256954f63d50fca51032038beb4bbe4
1,184
# No head build supported; if you need head builds of Mercurial, do so outside # of Homebrew. class Mercurial < Formula desc "Scalable distributed version control system" homepage "https://mercurial.selenic.com/" url "https://mercurial.selenic.com/release/mercurial-3.4.1.tar.gz" sha256 "7a8acf7329beda38ceea29c6...
35.878788
95
0.757601
391f5a0545f37a10d4e990a7dd4f7ec743b55942
514
require File.join(File.dirname(__FILE__), "..", "spec_helper.rb") module Crunchbase describe NewItem, :vcr do subject { NewItem.lists_for_permalink("facebook") } it_has_behavior 'pagination' it_behaves_like 'a container', 1000 describe 'paging' do let(:page) { 4 } subject { NewItem.lis...
25.7
71
0.655642
1d3bb2677a5648e71dbc6cc067ddeab30d7c9bef
552
ActiveRecord::Schema.define do create_table :audits, force: true do |t| t.column :auditable_id, :integer t.column :auditable_type, :string t.column :user_id, :integer t.column :user_type, :string t.column :username, :string t.column :action, :string t.column :audited_changes, :text t.c...
29.052632
43
0.692029
330f43d2c54c8760f63838b596417abe4845c77e
148
json.extract! monitored_service_log, :id, :delay, :delivery_ratio, :created_at json.url monitored_service_url(monitored_service_log, format: :json)
49.333333
78
0.824324
6299b96a9b30282e9731ec90b81e2cdefdbd39b6
636
require 'fog/core/collection' require 'fog/openstack/models/compute/tenant' module Fog module Compute class OpenStack class Tenants < Fog::Collection model Fog::Compute::OpenStack::Tenant def all load(service.list_tenants.body['tenants']) end def usages(start_dat...
25.44
82
0.638365
612bcc95738bd0eb8780d6f62d572be9df8f8394
551
module GrapedMoviez module Models DB = Sequel.connect(GrapedMoviez::Configuration.config.db_url) class Day < Sequel::Model one_to_many :functions def validate super errors.add(:day, "can't be blank") if day.nil? end def self.by_day(day = Date.new) Day.where(da...
22.958333
69
0.629764
1d9c6a9d649ed64191c1ed0e714dff43e8c2eb7f
2,398
# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Updating an escalation policy' do include GraphqlHelpers let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project) } let_it_be(:escalation_policy) { create(:incident_management_escalation_policy, project: project) } let_it_...
26.351648
100
0.647206
010091381544b61f282a8f4c2f2e11bffb411a77
1,281
=begin Example: # fonts :system.nsfont => NSFont.systemFontOfSize(NSFont.systemFontSize) :label.nsfont => NSFont.systemFontOfSize(NSFont.labelFontSize) You can extend the defaults by adding entries: Symbol.nsfontsize[:big] = 40 :big.nsfont => NSFont =end class Symbol def nsfont(size=nil) ...
19.119403
68
0.637783
18d22cc7943efa56771fb72ed9b994331b83326d
22,617
# encoding: utf-8 module Mongoid module Relations module Referenced # This class defines the behaviour for all relations that are a # one-to-many between documents in different collections. class Many < Relations::Many delegate :count, to: :criteria delegate :first, :in_memory,...
32.49569
91
0.535084
919e80f9ab2d5350a256843551f115625428be63
932
module Zoomus module Actions module User def user_list(*args) options = Utils.extract_options!(args) Utils.parse_response self.class.post('/user/list', :query => options) end def user_create(*args) options = Utils.extract_options!(args) Utils.require_params([:ty...
28.242424
83
0.641631
ed78d5a31976fa9be0c32a684cfb6d16db3e66e9
461
# frozen_string_literal: true Hcaptcha.configure do |config| # Disable hcaptcha if it is not configured if Rails.configuration.hcaptcha_site_key.nil? || Rails.configuration.hcaptcha_secret.nil? config.skip_verify_env << Rails.env.to_s config.site_key = "FAKE_SITE_KEY" config.secret_key = "FAKE_SECRET_K...
32.928571
91
0.778742
219b365c449f167fa3b16adb4f2efc6ae1fab4c6
4,511
class Filebeat < Formula desc "File harvester to ship log files to Elasticsearch or Logstash" homepage "https://www.elastic.co/products/beats/filebeat" url "https://github.com/elastic/beats.git", tag: "v7.9.0", revision: "b2ee705fc4a59c023136c046803b56bc82a16c8d" # Outside of the "x-pack" folde...
32.688406
141
0.651075
61ed78b192b91ea0386e99ab67f495218ce1f8f0
1,981
require "testing_env" require "formula" require "compat/formula_specialties" require "formula_installer" require "keg" require "testball_bottle" require "testball" class InstallBottleTests < Homebrew::TestCase def temporary_bottle_install(formula) refute_predicate formula, :installed? assert_predicate formul...
25.075949
75
0.715295
7af1272e605392d8539317919a1e2d6037922119
14,598
require 'zip' require 'nokogiri' require 'octokit' require 'pathname' def expand(content, path, &get_content) content.gsub(/include::(\S+)\[\]/) do |line| if File.dirname(path)=="." new_fname = $1 else new_fname = (Pathname.new(path).dirname + Pathname.new($1)).cleanpath.to_s end new_cont...
31.393548
118
0.574599
e9dc758e46a93c8001d9be70cc0a87f1ad8d1433
205
module Qapi class Error < RuntimeError def initialize(body) @body = JSON(body) end def message @body['problem'] end def details @body['details'] end end end
12.8125
28
0.57561
4abc56459903335c1eb8235b2730fdff52ac700b
485
if ENV["COVERALL"] require "coveralls" Coveralls.wear! end require "minitest/autorun" require "minitest/reporters" require "mocha/setup" Minitest::Reporters.use! Minitest::Reporters::DefaultReporter.new(color: true) $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__) require "public_suffix" Minitest::Tes...
22.045455
78
0.736082
ab78cd74eafc53f3117c62075b6fe10a08f3fc8a
905
#!/usr/bin/env ruby # Identical to Part 1 require 'set' file_path = File.expand_path("../day-19-input.txt", __FILE__) input = File.read(file_path) grid = input.split("\n").map do |row| row.split("") end y = 0 x = grid[y].index("|") direction = :down steps = 0 visited = Set.new chars = [] until grid[y][x] == ' ...
14.836066
67
0.519337
38004aab8ce3d6ec922e88f254c00f7877c6f9a2
434
cask 'comictagger' do version '1.2.1' sha256 '31b36527b9415544e2f956c849309320bb955524eaa1ebddab6b97d55c5da4f8' url "https://github.com/davide-romanini/comictagger/releases/download/#{version}/ComicTagger-#{version}-osx-10.12.6-x86_64.app.zip" appcast 'https://github.com/davide-romanini/comictagger/releases.at...
36.166667
133
0.78341
bbd236dc307d755ae96a01c0c24e2b97a132c129
426
module ActionClient class ClientsController < ActionClient::ApplicationController def index render locals: { clients: ActionClient::Preview.all } end def show preview = ActionClient::Preview.find(params[:id]) if preview.present? render locals: { client: ...
19.363636
63
0.619718
611fd261751b12715d62a6db13ec1b3a01f2b3cc
6,302
module PaypalService::Store::PaypalPayment PaypalPaymentModel = ::PaypalPayment InitialPaymentData = EntityUtils.define_builder( [:community_id, :mandatory, :fixnum], [:transaction_id, :mandatory, :fixnum], [:payer_id, :mandatory, :string], [:receiver_id, :mandatory, :string], [:merchant_id, :...
29.041475
159
0.688353
1da17cbde22e654c66a4c9ba5209c04460e7e5b3
875
module Errors extend ActiveSupport::Concern included do # 参数值不在允许的范围内 # HTTP Status 400 # # { error: 'ParameterInvalid', message: '原因' } class ParameterValueNotAllowed < ActionController::ParameterMissing attr_reader :values def initialize(param, values) # :nodoc: ...
22.435897
71
0.598857
f7a2db0b25fad8f12d3f61e4cc6ceb10162bb1ed
13,550
# encoding: UTF-8 # # Copyright (c) 2010-2015 GoodData Corporation. All rights reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. require_relative '../rest/resource' require_relative '../extensions/hash' require_relative '../mixin...
26.93837
159
0.600812
abef1edcb482a64175f5262d92c9c31649f7be0b
894
require 'yaml' module FlipTheSwitch module Reader class Defaults def defaults if valid_file? base_defaults.merge(file_defaults) else raise Error::InvalidFile.new(defaults_file_name) end end private def valid_file? file_defaults.is_a?(H...
19.434783
62
0.526846
e9f2e885b0a7c0be5f1eaafd60ed8e50f9216652
583
require 'mongoid/cases/test_base' class Mongoid::ValidationsTest < ClientSideValidations::MongoidTestBase class ::Book3 < Book validates :author_name, :presence => true end def test_validations_to_client_side_hash book = Book3.new expected_hash = { :author_email => { :uniqueness => [{...
25.347826
71
0.646655
18566717084425fd00db5309be37fb89102664c9
1,428
=begin The PostFinance Checkout API allows an easy interaction with the PostFinance Checkout web service. 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 ...
32.454545
104
0.738095
26f71f1cf06460662b50b6b2aece3f433049a850
109
FactoryBot.define do factory :investigation_kind do name "MyString" description "MyText" end end
15.571429
32
0.733945
87e0b37ae36a7a417885e178aefc085dc4ef84fe
1,733
# MIT License # # Copyright 2019 Niklas Schultz. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, ...
38.511111
79
0.732833
79f1c69a08d253c4fe5f9f96a33896b39880b597
928
# frozen_string_literal: true RSpec.shared_context 'with associated error handler setup' do let(:association_name) { 'foos' } let(:record_num) { 0 } let(:error) { instance_double(ActiveModel::Error) } before { allow(error).to receive(:attribute).and_return('bar') } end RSpec.shared_examples 'a govuk design s...
30.933333
89
0.762931
ac0372279b0c73c2d6a6c6881d97971847e0ef72
1,256
# 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::Storage::Mgmt::V2018_03_01_preview module Models # # The List service SAS credentials operation response. # class ListServic...
26.166667
75
0.575637
28da9a8f30b056a8b6da9898cabb251d0f73b8b0
336
require 'test_helper' class InboxControllerTest < ActionController::TestCase =begin test "should get index" do get :index assert_response :success end test "should get show" do get :show assert_response :success end test "should get destroy" do get :destroy assert_response :success ...
15.272727
54
0.708333
f8fd316314d4b486c477d77103cd065346027bf7
1,224
# 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/master/CONTRIBUTING.md # # WARNING ABOUT GENERATED CODE Gem::Specification.new do |spec| spec.name = 'aws-sdk-directoryservic...
38.25
135
0.675654
7aba2f1a3d543fbfd47d6d9b58906b2129bc4d58
576
# frozen_string_literal: true require 'semlogr/self_logger' module Semlogr module Sinks class Filtering def initialize(filters, sink) @filters = filters @sink = sink end def emit(log_event) filtered = @filters.any? do |filter| begin filter.call(lo...
19.862069
90
0.585069
bb6319321dd652f146b13b3c9c0a7d752143e37e
2,969
#!/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 # # ...
34.523256
79
0.687774
21fbb68cda5fe419cf5766675868083ed5f3c60a
2,502
require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb') class TestFakerMeasurement < Test::Unit::TestCase def setup @tester = Faker::Measurement end def height assert @tester.height.match(/\d\s[a-z]/) assert @tester.height(1).match(/\d\s[a-z]/) end def height_all assert @tester...
21.02521
68
0.671463
26426ac9df226b4eb6df95a97bd0b5ce86dae4b3
553
class CspcrGel < ActiveRecord::Base belongs_to :user belongs_to :protocol belongs_to :status has_many :cspcr_gel_lanes has_many :cspcr_products, :through => :cspcr_gel_lanes has_many :cspcr_gel_images scope :pendings, where(:status_id => Status.find_by_process_and_name(CspcrGel.to_s,:pending)) ...
27.65
102
0.77396
ffd38ca826d6b5d909147a76af4c0be9745a94b6
840
require "spec_helper" describe Docks::Tags::Factory do subject { Docks::Tags::Factory.instance } it "does not allow multiline content" do expect(subject.multiline?).to be false end it "only allows one tag per block" do expect(subject.multiple_allowed?).to be false end describe "#process" do ...
28
72
0.684524
61ff6e2eddca09b5f703ea221493d3fa097bbe59
1,672
require 'rails_helper' RSpec.configure do |config| # Specify a root folder where Swagger JSON files are generated # NOTE: If you're using the rswag-api to serve API descriptions, you'll need # to ensure that it's configured to serve Swagger from the same folder config.swagger_root = Rails.root.to_s + '/swagger...
39.809524
279
0.649522
1db4072a56982b691bb5e9b6ef61dac1919832d6
7,005
#! /usr/bin/env ruby # -*- coding: UTF-8 -*- # require 'efl/native' require 'efl/native/edje' require 'efl/native/elementary' # module Efl # module ElmLayout # FCT_PREFIX = 'elm_layout_' unless const_defined? :FCT_PREFIX # def self.method_missing meth, *args, &block s...
68.009709
195
0.683369
bf5d05de5ac5e0c9bcf5c9b0e570d4e7270c54bb
477
module ActiveMerchant module Billing class AmazonResponse < Response attr_reader :constraints, :state, :destination, :email, :total def initialize(success, message, params = {}, options = {}) @constraints = options[:constraints] @state = options[:state] @destination = options[...
28.058824
68
0.631027
b9028f3ce3f92767ca8fc83a582de964b2927344
613
module PuppetX module Sensuclassic module ToType def to_type(value) if value.is_a?(Hash) new = Hash.new value.each { |k,v| new[k] = to_type v } new elsif value.is_a?(Array) value.collect { |v| to_type v } else case value whe...
20.433333
49
0.442088
ac19f8230806e092ed530ce6f0b393715766eef7
2,476
class Api::V1::GamesController < ApplicationController before_action :set_game, only: [:show, :show_genre, :update, :destroy, :wishlist, :destroy_wishlist] # acts_as_token_authentication_handler_for User, only: [:create, :update, :destroy, :wishlist, :destroy_wishlist] # before_action :isAdmin?, only: [:create...
28.136364
127
0.67084
ed42a017ca945eb102f01222a0cad607d34ccef6
53
class City < ApplicationRecord has_many :works end
13.25
30
0.792453
6aafdcf69435c3cceb5770eb3d1e1e6bf9b1185a
175
json.extract!(person,:id, :name, :surname, :cpf, :date_of_birth, :email, :created_at, :updated_at, :license, :phones) json.url person_url(person, format: :json)
43.75
98
0.668571
abe3dc02a032cda7ab78b4053fb6d84a42068f1f
3,363
# 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::KeyVault::V2015_06_01 module Models # # Properties of the X509 component of a certificate. # class X509CertificateProperties...
30.026786
79
0.475171
e299f5a4ade6988d93ef166d7bc226c387d82120
1,312
require 'guard/dsl' require 'guardfile/dsl/action' require 'guardfile/dsl/change' module Guard class Dsl def run action Action.new(self, action) end def on_change_in *patterns, &action return Change.new(self, patterns) unless block_given? patterns.each do |pattern| UI.info "W...
22.62069
72
0.615091
6113c3179d4c2e0167e1a5d7344983374c5056b9
1,148
module Store module Assocs def to_associations_pk(field, val) @models[:assoc] ||= {} @models[:assoc][:resource_pk] = val end def to_associations_occurrence_fk(field, val) @models[:assoc] ||= {} @models[:assoc][:occurrence_resource_fk] = val end def to_associations_target_...
25.511111
59
0.608885
e9d69373fe98502c02ab4ec9a4baf5131d73ed9d
807
require 'daimon/exhibition/model' require 'daimon/exhibition/controller' module Daimon module Exhibition class Engine < ::Rails::Engine isolate_namespace Daimon::Exhibition initializer 'daimon-exhibition.setup' do |app| ActiveSupport.on_load :active_record do ActiveRecord::Base.sin...
24.454545
69
0.608426
5d2fbab328aef7a0a45e22ab522a1d6de29b411a
115
class HeartbeatController < CalsBaseController skip_before_action :authenticate_with_cwds def show end end
14.375
46
0.826087
1166f8caeaf698c11ae0b195eb933de56508a0c9
1,771
module RSpec module Matchers module Sequel # TODO: refactor with Sequel API # http://www.rubydoc.info/gems/sequel/4.13.0/Sequel/Postgres/EnumDatabaseMethods class HaveEnum def matches?(db) @db = db enum_exists? && with_valid_values? end def failure_m...
25.3
124
0.539243
5dbad98d53efcb327f26b34620ac53736197b001
513
Rails.application.routes.draw do # Authetication Route - JWT Token post 'auth' => 'authentication#auth' # District Routes resources :districts, only: [:index, :show] do # Judging Body Routes resources :judging_bodies, only: [:index] end resources :judging_bodies, only: [:show] # Process Class R...
24.428571
55
0.709552
21bd9c23014f6fb42d8c71688160982ef8114f6a
895
require "spec_helper" module Stachio describe TemplatesController do describe "routing" do it "routes to #index" do get("/").should route_to("stachio/templates#index") end it "routes to #new" do get("/new").should route_to("stachio/templates#new") end it "routes t...
23.552632
77
0.579888
1a71ddc2a0e3c077ba25c9d0a320cca75c278cc0
448
# == Schema Information # # Table name: newsletters # # created_at :datetime not null # id :bigint(8) not null, primary key # published_on :date not null # title :text not null # updated_at :datetime not null # url :text not ...
24.888889
55
0.587054
6a15cf3da3f2b949d840c6b7ba49d59f1a034cfa
1,367
@@max = ARGV[0] || 100 @@max = @@max.to_i @@input = 0 @@output = 0 @@others = [] def commas n n.to_s.reverse.gsub(/...(?=.)/,'\&,').reverse end class Counter def initialize @count = 0 @fanout = 0 @subsequent = {} end def value @count end def subsequent seg unless @subsequent.ha...
18.726027
111
0.561083
0318170b22591d07d624e12d7d54f39938465642
597
STDOUT.sync = true Signal.trap("TERM") do say "exiting" exit end def say msg puts "\t[inc] #{Time.now.strftime("%T")} #{$$} #{msg}" end class Inc def initialize file @file = file end def run launched = Time.now.to_i say "launching in #{File.dirname(@file)}" i = 0 while i < 100 ...
16.135135
63
0.537688
117cddb70945e0077bcea3cdbc24814a4bf274ec
5,937
# frozen_string_literal: true require 'spec_helper' require 'webmock/rspec' WebMock.disable_net_connect!(allow_localhost: true) describe Bosh::AzureCloud::AzureClient do let(:logger) { Bosh::Clouds::Config.logger } let(:azure_client) do Bosh::AzureCloud::AzureClient.new( mock_azure_config, logger...
31.247368
223
0.556847
e856acafe9465f45759751b1bc4c88cd20508be4
916
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "altria/processing_time/version" Gem::Specification.new do |spec| spec.name = "altria-processing_time" spec.version = Altria::ProcessingTime::VERSION spec.authors = ["Ryo Nakamura"] s...
38.166667
75
0.675764
28a3876810a57999ab904d05a7c5fb9e9fed4beb
688
# frozen_string_literal: true module ImportUrlParams def import_url_params return {} unless params.dig(:project, :import_url).present? { import_url: import_params_to_full_url(params[:project]), # We need to set import_type because attempting to retry an import by URL # could leave a stale ...
26.461538
82
0.68314
f8a4c834e7e84f336fe421bb681c514008ad1dd4
131
class AddUserIdToDiscussions < ActiveRecord::Migration[5.2] def change add_column :discussions, :user_id, :integer end end
21.833333
59
0.763359