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
e933b7ea9468073590d5f2b4232018857a2f7e41
48,228
# frozen_string_literal: true require "active_record/relation/from_clause" require "active_record/relation/query_attribute" require "active_record/relation/where_clause" require "active_record/relation/where_clause_factory" require "active_model/forbidden_attributes_protection" module ActiveRecord module QueryMetho...
34.301565
161
0.614166
e81b3b0583da71f125493d24cbfcdfd05fa7a594
1,161
require 'json' MyApp.add_route('GET', '/api/v2/berry-flavor/', { "resourcePath" => "/BerryFlavor", "summary" => "", "nickname" => "berry_flavor_list", "responseClass" => "String", "endpoint" => "/api/v2/berry-flavor/", "notes" => "", "parameters" => [ { "name" => "limit", "description" =...
21.109091
54
0.512489
21cedca89d931e30bb6643812dfcf4743482f8b0
742
class Repo < Formula include Language::Python::Shebang desc "Repository tool for Android development" homepage "https://source.android.com/source/developing.html" url "https://gerrit.googlesource.com/git-repo.git", tag: "v2.16.4", revision: "9122bfc3a80367ed303e8e2d3b3b3d7a8851c904" license ...
25.586207
112
0.729111
ffda6f2a183261f536dc105ffb19c49d4997be76
143
# Be sure to restart your server when you modify this file. Rails.application.config.session_store :cookie_store, key: '_TestWebsite_session'
35.75
81
0.811189
1ac02888274eb5814dfd47b65f6f18f04197abe5
168
require 'active_support/concern' require "patterns/version" require "patterns/service" require "patterns/api_request" require "patterns/notifier" module Patterns end
16.8
32
0.821429
1ab7d6be2150bb96f342fe95266f1a083a1c8b66
893
require 'operation/rabbit_mq' class Operation::RabbitMq::DelNodeAccount < Operation::RabbitMq def steps steps = super steps << Operation::Step.new('delete_user') do timeout_in(5.minutes) raise ArgumentError, "Missing required :username argument!" unless self[:args][:username] ...
23.5
95
0.611422
e22d46cc824570f60b37993bced613f52e68cd56
565
require 'open-uri' require 'nokogiri' class Videos include Cinch::Plugin listen_to :channel, method: :query def query(m) urls = m.message.split.grep URI.regexp if urls.any? urls.each do |url| url = URI.parse(url) rescue next next unless ['http', 'https'].include?(url.scheme) ...
20.925926
77
0.59469
216aaf1b042899abb4d85e95ddcaea2d74cd775d
118
class AddParentTask < ActiveRecord::Migration[4.2] def change add_column :tasks, :parend_id, :integer end end
19.666667
50
0.737288
61713e79ced44cde102e6517a5e1543f093c2bda
1,605
# -*- coding: UTF-8 -*- module RRD class Builder attr_accessor :output, :parameters, :datasources, :archives DATASOURCE_TYPES = [:gauge, :counter, :derive, :absolute] ARCHIVE_TYPES = [:average, :min, :max, :last] def initialize(output, parameters = {}) @output = output ...
34.148936
118
0.609346
d5ab4001187c6e1a075e7aad57f7aba2a792d5d4
316
class CreateTravelers < ActiveRecord::Migration[5.2] def change create_table :travelers do |t| t.string :name t.string :email t.string :password t.integer :budget t.string :nationality t.string :interests t.string :password_digest t.timestamps end end end
21.066667
52
0.64557
26fd084fc137c45ce549675d7427eff04cae7b93
223
require 'mollie-api-ruby' begin payment = Mollie::Payment.get( "tr_7UhSN1zuXS", api_key: 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM' ) rescue Mollie::Exception => e puts 'An error has occurred: ' << e.message end
20.272727
51
0.70852
6a965bd0ed1d051178eaf28c2ac742e1231d2891
245
if platform?("centos") cookbook_file "/etc/sysconfig/iptables" do source "iptables" notifies :run, "execute[restart iptables]", :immediately end execute "restart iptables" do command "/etc/init.d/iptables restart" end end
18.846154
60
0.702041
fff428c917b1633a22df4120c0669cc1db02b48d
9,329
# frozen_string_literal: true namespace :benchmarks do # https://github.com/evanphx/benchmark-ips # Enable and start GC before each job run. Disable GC afterwards. # # Inspired by https://www.omniref.com/ruby/2.2.1/symbols/Benchmark/bm?#annotation=4095926&line=182 class GCSuite def warming(*) run_gc...
28.882353
122
0.665452
62840335c86045ef254bac5b1103fbd3b3e84967
98
class DropRolesTable < ActiveRecord::Migration[5.2] def change drop_table :roles end end
16.333333
51
0.734694
e95192397c700c9a45b4d40bb08b230c49c70ac0
91,513
# 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 module Aws::XRay module Types # An alias for an edge. # # @!attrib...
31.22245
125
0.608657
394aa0fc8f964f0dd8293a8605d8e0ac50ef0aa9
484
require 'generator/exercise_case' class CollatzConjectureCase < Generator::ExerciseCase def workload case expected when Integer standard_assertion when Hash error_assertion end end def standard_assertion assert_equal { subject_of_test } end def error_assertion "assert_r...
15.612903
57
0.71281
1c7d156b286fb881b2b9ed5186774ff0314d2ac9
1,141
# Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
32.6
83
0.732691
ab9057e0244b6454079efa48a69a16f27fe63946
12,433
require 'spec_helper' module Alchemy describe Element do describe '#new_from_scratch' do it "should initialize an element by name from scratch" do el = Element.new_from_scratch({'name' => 'article'}) el.should be_valid end it "should raise an error if the given name is not de...
30.698765
192
0.603314
110b79eb8b3284c51aa54554947930ac8ad30cc5
3,982
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with this # work for additional information regarding copyright ownership. The ASF # licenses this file to you under the Apache License, Version 2.0 (the # "License"); you may not use...
29.93985
128
0.685334
abdec945deb608ea06eefc09e44bdc676c9639da
138
module Noticent module Testing class Exclusive < ::Noticent::Channel def only_here render end end end end
13.8
41
0.623188
bf84b845793259e687b5f48eabbde743e1f4b655
350
# frozen_string_literal: true require 'rails_helper' RSpec.describe UpdateAllIssuesJob, type: :job do Sidekiq::Testing.inline! before do 2.times { FactoryBot.create(:issue) } end it 'calls the IssueUpdateJob for all issues' do expect(IssueUpdateJob).to receive(:perform_async).twice UpdateAllIssu...
20.588235
59
0.754286
e985798b3812cf320b08bb4665153353e41b1d3a
3,071
module NestedRelatedItemFixtures def related_item_host_fixture <<-XML <mods> <relatedItem type="host"> <titleInfo>A host type related item</titleInfo> <note displayLabel="Custom Notes">A note content</note> </relatedItem> <relatedItem type="host"> <title...
47.246154
188
0.6366
62aa4709a4f531bc7fe629d67183ea31d3fad2f5
5,232
# # Be sure to run `pod spec lint QuintypeFramework.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://...
37.640288
147
0.593654
0347b367608fcf47340ded3a40458dad9578d298
879
class PoisonCentres::NotificationsController < ApplicationController def index result = search_notifications(10) @notifications = result.records end def show @notification = Notification.find_by reference_number: params[:reference_number] authorize @notification, policy_class: PoisonCentreNotific...
26.636364
86
0.763367
0123ee2460f8f879991ed1145efe1abf0edd0316
7,134
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper')) if RUBY_VERSION >= '1.9.0' require 'csv' else gem 'fastercsv', '~>1.4.0' require 'fastercsv' end if ADAPTER module ::TypeTests class Impostor < DataMapper::Type primitive String end class Coconut include ...
25.847826
128
0.621951
ac9ba89f12090cc96d8bc8639726561c46ca3e67
1,901
# frozen_string_literal: true # == Schema Information # # Table name: assignments # # id :integer not null, primary key # created_at :datetime # updated_at :datetime # user_id :integer # course_id :integer # article_id :integer # article_title :string(255) # role ...
29.246154
75
0.610205
bb7cbfc23b03d404ed341fbe12ddb7a2a994fac8
11,171
require "formula_versions" require "migrator" require "formulary" require "descriptions" require "cleanup" module Homebrew def update_preinstall_header @header_already_printed ||= begin ohai "Auto-updated Homebrew!" if ARGV.include?("--preinstall") true end end def update_report HOMEBREW...
29.789333
114
0.657954
1873edff4c45204299e4ad2849f46863ba3d5f96
1,190
class Liblastfm < Formula desc "Libraries for Last.fm site services" homepage "https://github.com/lastfm/liblastfm/" url "https://github.com/lastfm/liblastfm/archive/1.0.9.tar.gz" sha256 "5276b5fe00932479ce6fe370ba3213f3ab842d70a7d55e4bead6e26738425f7b" revision 2 bottle do cellar :any sha256 "666b...
30.512821
93
0.739496
ff06b7ff9a7412d50ce186020fd73ee3bde4f260
1,430
require 'spec_helper' describe Puppet::Type.type(:mongodb_database).provider(:mongodb) do let(:raw_dbs) { { "databases" => [ { "name" => "admin", "sizeOnDisk" => 83886080, "empty" => false }, { "name" => "local", "sizeOnDis...
21.029412
96
0.572028
bf9cc1f2f0acf369c6e940ef3dc165fa9b4acaf0
3,676
class Contribution < ApplicationRecord belongs_to :user belongs_to :merger, class_name: 'User', foreign_key: :merged_by_id, primary_key: :uid after_save { if user then user.update_contribution_count end } after_destroy { if user then user.update_contribution_count end } validates :issue_url, uniqueness: { sc...
35.346154
116
0.675734
38b7a3f32518a2c5746e64e6f6d8d93b061e78e8
1,223
class Evil::Client # Utility to format body/query into one of formats: :json, :form, :multipart module Formatter extend self # Loads concrete formatters called by factory method [#call] require_relative "formatter/text" require_relative "formatter/form" require_relative "formatter/multipart" ...
23.980392
78
0.6574
6229c5f1fdb89c4ccdc699eacb4c001f21288fc1
224
class Container::Jar < Container def self.valid_parents ['Container::Drawer', 'Container::UnitTray', 'Container::Cabinet', 'Container::Shelf', 'Container::Virtual', 'Container::VialRack', 'Container::Box'] end end
28
153
0.709821
accd501d748b2f33a9c4040eb48da8f7df66ef3c
3,219
# Copyright (c) 2017-present, Facebook, Inc. All rights reserved. # # You are hereby granted a non-exclusive, worldwide, royalty-free license to use, # copy, modify, and distribute this software in source code or binary form for use # in connection with the web services and APIs provided by Facebook. # # As with any so...
31.252427
82
0.663249
1dab402db480749ee0122453d8d2a8ff12d4ef9f
2,467
class RecipesController < ApplicationController # GET: /recipes get "/recipes" do if logged_in? erb :"/recipes/index.html" else redirect "/users/new" end end # GET: /recipes/new get "/recipes/new" do if logged_in? erb :"/recipes/new.html" else redirect "/users/new...
22.427273
135
0.576003
4a64a51121e0ad3bd65666473c676ddeed74e1d2
52
module NintendoEshop VERSION = "0.2.1".freeze end
13
26
0.730769
08f369e1eb137e5076345e6c2dbdceb7ef35126c
455
require_relative './lib/books_dl' # 如何取得 book_id # 進入你要下載的書的閱讀頁面,取得網址列中網址 # 例如: # https://viewer-ebook.books.com.tw/viewer/epub/web/?book_uni_id=E050017049_reflowable_normal # book_uni_id= 之後的字串就是這本書的 book_id 了 # # book_id = 'E050017049_reflowable_normal' downloader = BooksDL::Downloader.new('E050113792_reflowable_...
26.764706
95
0.808791
623d49930bf640c1e52c5655f931a0f10db8dc04
394
# Be sure to restart your server when you modify this file. #S13::Application.config.session_store :cookie_store, :key => '_s13_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the session table with "rake db:ses...
43.777778
76
0.794416
08e0d357c8f050b452b40c1e6b11912f04231fa3
40,088
require "kitchen" autoload :MsRestAzure, "ms_rest_azure" require_relative "azure_credentials" require "securerandom" unless defined?(SecureRandom) module Azure autoload :Resources, "azure_mgmt_resources" autoload :Network, "azure_mgmt_network" end require "base64" unless defined?(Base64) autoload :SSHKey, "sshkey"...
42.874866
796
0.676487
bbbc8218706268e7687632a0003a62fe4ceb7907
185
AccountCred.blueprint do financial_inst { FinancialInst.make } account_key { 'abc123' } cred_key { 'abc123' } cred_guid { ActiveSupport::SecureRandom.hex(16) } end
30.833333
56
0.681081
e2a95f2c1737576c306e7862a557c30707b1f35d
85,967
# Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
40.417019
239
0.658032
915900fbb9a5e215a8ec8f0c06452a307e1172cb
61
module Erp module Contacts VERSION = '0.1.0' end end
10.166667
21
0.639344
1163a1cfea717b1e747a1b0db17903228f9ae8ac
7,266
describe :net_ftp_putbinaryfile, shared: :true do before :each do @server = NetFTPSpecs::DummyFTP.new @server.serve_once @local_fixture_file = File.dirname(__FILE__) + "/../fixtures/putbinaryfile" @remote_tmp_file = tmp("binaryfile", false) @ftp = Net::FTP.new @ftp.connect(@server.hostname,...
43.25
107
0.686485
91525a726b5dc35f0662fd747086a8224ad7f4e2
4,162
require "eventmachine" require "sensu/extension/constants" module Sensu module Extension class Base # @!attribute [rw] logger # @return [Array] logger provided by Sensu. attr_accessor :logger # @!attribute [rw] settings # @return [Array] settings hash provided by Sensu. a...
31.530303
77
0.606439
3902a314785cdcfae7c68b250278c5b98d8f4a93
7,185
###################################### # Test databases support ###################################### require 'test_helper' class DatabasesTest < Minitest::Test def test_database # PATHs options hashes setup_databases db_path = File.join(OUTPUT_PATH,'DB') ...
62.478261
138
0.578427
6103d66b6240cca9a421b40dd3c6d69af2e9ebfc
190
require 'cmor/tags/configuration' require 'cmor/tags/engine' module Cmor module Tags extend Configuration end end Cmor.configure { |c| c.register_configuration(:tags, Cmor::Tags) }
19
66
0.752632
792505d0c6b3b2a2db8a6f412b608c66e803b17f
1,355
# # Be sure to run `pod lib lint XibView.podspec' to ensure this is a # valid spec before submitting. # # Any lines starting with a # are optional, but their use is encouraged # To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html # Pod::Spec.new do |s| s.name = 'XibView' ...
37.638889
99
0.63321
26ba290a0e439fa7a524f5b881e45bfebb4ebba2
2,063
class ImageFileUploader < CarrierWave::Uploader::Base # Include RMagick or MiniMagick support: # include CarrierWave::RMagick include CarrierWave::MiniMagick # Choose what kind of storage to use for this uploader: storage :file # storage :fog # Override the directory where uploaded files will be stored....
29.471429
112
0.667475
79daa2993cd8f655e9a829549eae45f33271b4d2
182
require 'test_helper' class AggregateControllerTest < ActionDispatch::IntegrationTest test "should get show" do get aggregate_show_url assert_response :success end end
18.2
63
0.785714
61e04faca8d6377c6ba5add8a8cd2030d4c6e816
3,163
# -*- encoding: us-ascii -*- describe :string_succ, shared: true do it "returns an empty string for empty strings" do "".send(@method).should == "" end it "returns the successor by increasing the rightmost alphanumeric (digit => digit, letter => letter with same case)" do "abcd".send(@method).should == "...
35.539326
130
0.628201
ab825c6c63fb5a1643b8f1cb5d46244cf1575853
333
# frozen_string_literal: true require 'test_helper' class JobApiTest < ActiveSupport::TestCase it 'should get the jobs for a given project_id' do VCR.use_cassette('project_jobs', match_requests_on: [:path]) do api = JobApi.new(id: 1, page: 1).fetch assert JSON.parse(api)['entries'].length < 20 e...
25.615385
67
0.705706
acfca8394671a35f90f47356d3d266e85201d0ac
11,251
# encoding: UTF-8 # This file contains data derived from the IANA Time Zone Database # (http://www.iana.org/time-zones). module TZInfo module Data module Definitions module Africa module Ceuta include TimezoneDefinition timezone 'Africa/Ceuta' do |tz| tz....
52.574766
66
0.580482
f76f2108da0556a7a67c4a5597d29d5b084f82e2
327
if Rails.env.production? CarrierWave.configure do |config| config.fog_credentials = { :provider => 'AWS', :region => ENV['S3_REGION'], :aws_access_key_id => ENV['S3_ACCESS_KEY'], :aws_secret_access_key => ENV['S3_SECRET_KEY'] } config.fog_directory = ENV['S3_BUCKET'] e...
27.25
50
0.626911
032e7f07d8d75bdacbd146001ec06870171568a7
216
class AddAttachmentSnippetToQuotes < ActiveRecord::Migration def self.up change_table :quotes do |t| t.attachment :snippet end end def self.down remove_attachment :quotes, :snippet end end
18
60
0.717593
1a44c9a94009898b1744c735a6b19af1eb72b208
288
class RedcasePatchJournal < Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2] def self.up add_column :execution_journals, :executor_id, :integer, :null => false end def self.down remove_column :execution_journals, :executor_id end end
22.153846
106
0.722222
2197733b2b2a04682413de54cb6bffe918c9b97e
3,922
module GitlabCtl class Backup attr_reader :etc_backup_path, :etc_path, :backup_keep_time, :remove_timestamp def initialize(options = {}) backup_path = options[:backup_path].nil? ? '/etc/gitlab/config_backup' : options[:backup_path] @etc_backup_path = File.expand_path(backup_path) @etc_path ...
31.376
119
0.657318
283eca72b605dbcaa4c1c780e3e6c2130728c7db
534
group 'docker' do action :create end docker_service 'default' do action [:create, :start] end execute 'install_docker_compose' do command 'curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docke...
29.666667
235
0.73221
6a4f50acaf7b03b4991c2e4c1a8cf2cfa7a2d90a
823
require "seqtrim_action" ######################################################## # Author: Almudena Bocinos Rioboo # # Defines the main methods that are necessary to execute PluginPairedReads # Inherit: Plugin ################################...
28.37931
127
0.523694
39927212588690c37a7f3cd1ced7ba316eada0dc
2,341
class Expense < ApplicationRecord belongs_to :user belongs_to :category validates :exp_amount, presence: true validates :exp_amount, numericality: true validates :category_name, presence: true validates :payee, presence: true validate :exp_date_valid def exp_date_valid if exp_date.nil? || exp_d...
25.445652
115
0.710807
03a78da86dcbed33a502e37d587183acc0e17cb5
2,568
# coding:utf-8 require_relative '../test_helper' require 'ostruct' module SmartAnswer class DateQuestionTest < ActiveSupport::TestCase def setup @initial_state = State.new(:example) end test "dates are parsed from hash form before being saved" do q = Question::Date.new(:example) do ...
26.474227
84
0.616044
91b6c2335f96c172877a7d9956fcae18c0283592
7,778
=begin #Datadog API V1 Collection #Collection of all Datadog Public endpoints. The version of the OpenAPI document: 1.0 Contact: support@datadoghq.com Generated by: https://openapi-generator.tech Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. This product...
30.382813
216
0.631911
1d06ef1cc7bbb6daae1ff7a1fb260b59f0c4acbd
251
class CreateSmsDetails < ActiveRecord::Migration[5.2] def change create_table :sms_details do |t| t.string :status t.text :failure_message t.references :attendance_entry, foreign_key: true t.timestamps end end end
20.916667
55
0.693227
1adeb1bd05eeecea14895751062a118defd3bf3f
1,081
cask 'omnigraffle' do if MacOS.version <= :snow_leopard version '5.4.4' sha256 '7bcc64093f46bd4808b1a4cb86cf90c0380a5c5ffffd55ce8f742712818558df' url "http://www.omnigroup.com/ftp1/pub/software/MacOSX/10.6/OmniGraffle-#{version}.dmg" elsif MacOS.version <= :mavericks version '6.0.5' sha256 'a2ef...
40.037037
92
0.760407
6297b07433e2efbe246af5c05a9bebb9b1fa8d1a
4,648
require 'puppet/application' require 'puppet/util' class Puppet::Application::Queue < Puppet::Application should_parse_config attr_accessor :daemon def preinit require 'puppet/daemon' @daemon = Puppet::Daemon.new @daemon.argv = ARGV.dup # Do an initial trap, so that cancels don't get a stack t...
25.538462
148
0.69062
1d56ca3e13711fdf0038c2a2e1151247ac864eb1
1,626
# frozen_string_literal: true # encoding: utf-8 # Copyright (C) 2014-2020 MongoDB 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 # # Un...
31.269231
80
0.663592
f8f39811d40c4ffc8391baa80d7bb579cf1cfa90
746
# frozen_string_literal: true # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
37.3
82
0.768097
62e0a6ff60f6bf3d8e51fb514dd8fe6d1fc30b71
1,427
module SessionsHelper # Logs in the given user. def log_in(user) session[:user_id] = user.id end # Remembers a user in a persistant Session def remember(user) user.remember cookies.permanent.signed[:user_id] = user.id cookies.permanent[:remember_token] = user.remember_token end # ...
23.393443
73
0.680448
1833ffd9cb8586a750ea48e64a0eeb22f6c38486
323
Aws.add_service(:IAM, { api: "#{Aws::API_DIR}/iam/2010-05-08/api-2.json", docs: "#{Aws::API_DIR}/iam/2010-05-08/docs-2.json", paginators: "#{Aws::API_DIR}/iam/2010-05-08/paginators-1.json", resources: "#{Aws::API_DIR}/iam/2010-05-08/resources-1.json", waiters: "#{Aws::API_DIR}/iam/2010-05-08/waiters-2.json", ...
40.375
65
0.659443
b99cdb6d4c4b827a25b05201a4c3f61caaf4982f
2,807
# frozen_string_literal: true RSpec.describe RuboCop::Cop::Layout::AssignmentIndentation, :config do let(:config) do RuboCop::Config.new('Layout/AssignmentIndentation' => { 'IndentationWidth' => cop_indent }, 'Layout/IndentationWidth' => {...
23.008197
93
0.56751
acd4ed1283ef03904f17c0230309f52c9cbc1438
5,887
# encoding: UTF-8 require File.expand_path('../test_helper', __FILE__) require 'stringio' class TestXml < Minitest::Test # ----- Constants ------ def test_lib_versions assert(XML.check_lib_versions) end def test_debug_entities original = XML.debug_entities XML.debug_entities = fa...
23.548
86
0.711738
18ea58fffe7d2be5d4e2fa6e46b272f4c315969c
155
module G2crowd class Product < Base has_many :survey_responses has_many :categories has_one :main_category, class_name: 'Category' end end
19.375
50
0.741935
f70abaceeaa8be966b5e43f82a9d96b46841bddf
378
maintainer "VMware, Inc" maintainer_email "serengeti-dev@googlegroups.com" license "Apache 2.0" description "Allow nodes to discover the location for a given service at runtime, adapting when new services register." long_description IO.read(File.join(File.dirname(__FILE__), 'README.textile')) v...
47.25
125
0.706349
e915df042c91d100dff848b2954d4f5291142f7a
1,553
require 'spec_helper' describe Activity do subject do FactoryGirl.build(:activity) end it "creates a valid object given valid attributes" do subject.save subject.should be_persisted end it "does not create a valid object given invalid attributes" do subject.message = "" subject.save ...
33.76087
124
0.716033
6a075b06e8034ebc95e7b509f408681724fae3c1
1,351
class Cglm < Formula desc "Optimized OpenGL/Graphics Math (glm) for C" homepage "https://github.com/recp/cglm" url "https://github.com/recp/cglm/archive/v0.6.2.tar.gz" sha256 "6d097f16fecd55d301bda2a3ac51df1ce514195a1671dfab84a8a2d0170ea7ac" bottle do cellar :any sha256 "d03dbd49ca7c4eaf65c79d8baf9ba...
29.369565
93
0.621021
012e804dc823ab0a2fd75338f073528dd05a0857
2,652
module EventStore class EventRepository def initialize(adapter: ::Event) @adapter = adapter end attr_reader :adapter def create(event, stream_name) data = event.to_h.merge!(stream: stream_name) adapter.create(data) # Notify observers of new event event.emit if event.res...
27.340206
66
0.670437
b934743c0a785a1ba097d5e0deb9b225adcf53c3
377
class Pd::FitWeekendRegistrationMailer < ActionMailer::Base default from: 'Sarah Fairweather <facilitators@code.org>' default bcc: MailerConstants::PLC_EMAIL_LOG def confirmation(registration) @registration = registration mail( to: registration.pd_application.user.email, subject: "We've rece...
26.928571
66
0.748011
ed4698fa7109011c6a3423a6c14a714f67c6181d
1,434
module Inch module Language module Ruby module Evaluation module Role # Roles assigned to class variables module ClassVariable class WithDoc < Object::WithDoc applicable_if :has_doc? end class WithoutDoc < Object::WithoutDoc ...
26.555556
77
0.527894
ac295e672a046aa2904a736e49d5e03182c153e7
2,323
class Blueprint < ApplicationRecord include PgSearch::Model extend FriendlyId acts_as_votable acts_as_taggable_on :tags paginates_per 32 # Pictures include PictureUploader::Attachment(:cover_picture) has_many :additional_pictures, dependent: :destroy, class_name: "Picture" accepts_nested_attributes_...
28.329268
147
0.726647
1882d34279034328af47bde7714be2837501a792
388
Rails.application.routes.draw do # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html namespace :api do namespace :v1 do resources :posts resources :users, only: [:create] post '/login', to: 'auth#create' get '/profile', to: 'users#profil...
29.846154
102
0.657216
334db09eab83ec60c11660a677205a3bc33a17cf
1,723
# Manages settings in OpenSSH's sshd_config file # # Copyright (c) 2012 Raphaël Pinson # Licensed under the Apache License, Version 2.0 Puppet::Type.newtype(:sshd_config) do @doc = "Manages settings in an OpenSSH sshd_config file. The resource name is used for the setting name, but if the `condition` is given, then...
26.507692
133
0.719095
38082cadfbf51055c8223b394e318dd1090b8b95
914
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |spec| spec.name = "sinatra_sample_provider" spec.version = "0.0.1" spec.authors = ["James Bowes"] spec.email = ["jbowes@repl.ca"] spec.su...
35.153846
83
0.633479
f8e7b8b5d42fc6a73a8cb5e7b0c71af017fe8e61
610
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
43.571429
119
0.727869
21016ec5677a233d71401ce6c294b6f2a15c589f
151
class CreateTeams < ActiveRecord::Migration[5.1] def change create_table :teams do |t| t.string :name t.timestamps end end end
16.777778
48
0.655629
4aacc84518abdeb378d7fef55422ce23432a3856
1,416
module Panda module Api class UsersController < BaseController skip_before_action :authenticate_user!, only: :create def create user = Panda::User.create! params.require(:user).permit(:name, :nickname, :email, :mobile, :password) render json: user, methods: :auth_token end # TODO: Fix...
21.134328
107
0.639124
795c8e901ee66bb011545340b428914f3c13a39f
15,166
require "os/linux/glibc" class Llvm < Formula desc "Next-gen compiler infrastructure" homepage "https://llvm.org/" # The LLVM Project is under the Apache License v2.0 with LLVM Exceptions license "Apache-2.0" stable do url "https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.1/llvm-10.0....
36.900243
156
0.652051
6ae76cf0befc3b29c7cf07d8da15cb755368069b
293
class Hpuload < Cask url 'http://www.fernlightning.com/lib/exe/fetch.php?id=software%3Ahpuload%3Astart&cache=cache&media=software:hpuload:hpuload.dmg' homepage 'http://www.fernlightning.com/doku.php?id=software:hpuload:start' version 'latest' sha256 :no_check link 'HPULoad.app' end
36.625
131
0.771331
7af7f2b3d6617d2ae2f4bf1143de02c7e1f01902
30,638
class Ansible < Formula include Language::Python::Virtualenv desc "Automate deployment, configuration, and upgrading" homepage "https://www.ansible.com/" url "https://releases.ansible.com/ansible/ansible-2.9.0.tar.gz" sha256 "9f9a9ace1d63cd8a4692ab6ee6ed04823743f1bd339a6ef188860c02cf7f46f1" head "https://g...
48.172956
160
0.81709
7a41d582bca1685984f8a0c1d770f4085ae9e390
1,472
module Discretion class << self def can_see_record?(viewer, record) return true unless record.is_a?(Discretion::DiscreetModel) return true if Discretion.currently_acting_as?(Discretion::OMNISCIENT_VIEWER) || Discretion.currently_acting_as?(Discretion::OMNIPOTENT_VIEWER) rec...
35.902439
89
0.726223
d58e27a066d729297f5a32f95e4a68bba3dec2c6
321
class CreateUsers < ActiveRecord::Migration[5.1] def change create_table :users do |t| t.string :name t.string :password_hash t.string :token t.datetime :token_expiration_date t.string :refresh_token t.datetime :refresh_token_expiration_date t.timestamps end end end...
22.928571
48
0.682243
035ad3f4d8426cd789ec482453c8569622ced19b
95
# frozen_string_literal: true module Facter VERSION = '4.0.39' unless defined?(VERSION) end
15.833333
45
0.747368
62b2faf505be7730c62c3c5c16dd6d5b2cfd7aae
585
module RoutingHelper def registration_url request.subdomain.present? ? new_users_registrations_path : new_users_registrations_url(subdomain: 'it') end def session_url if request.subdomain.present? new_passwordless_sessions_path('user') else new_passwordless_sessions_url('user', ...
25.434783
108
0.700855
1a6c3d14fdab90ab11759a9a382c81d1dde7b08e
2,548
class RecipeIngredientsUnitsController < ApplicationController before_action :set_recipe_ingredients_unit, only: [:show, :edit, :update, :destroy] # GET /recipe_ingredients_units # GET /recipe_ingredients_units.json def index @recipe_ingredients_units = RecipeIngredientsUnit.all end # GET /recipe_ingr...
33.973333
126
0.746075
ff3bbde90912bfcaa85a6320e39df1c201c5e1d5
880
# frozen_string_literal: true require "utils/repology" describe Repology do describe "formula_data" do it "returns nil for invalid Homebrew Formula" do expect(described_class.formula_data("invalidName")).to be_nil end end describe "single_package_query" do it "returns nil for non-existent pac...
23.783784
68
0.714773
084af8e486e6484153ce042d6b9cbd4aebaa156a
603
def sort_itself(array) result = [] for i in 1...array.size current = array[i] j = i - 1 while j >= 0 && current < array[j] array[j + 1] = array[j] j -= 1 end array[j + 1] = current # print result << array.clone end result end describe 'sort_itself' do let(:array) { [1,...
21.535714
79
0.500829
08d83da9f6a606006d1b37fb194cd5c95dccded3
1,075
class Exempi < Formula desc "Library to parse XMP metadata" homepage "https://wiki.freedesktop.org/libopenraw/Exempi/" url "https://libopenraw.freedesktop.org/download/exempi-2.5.2.tar.bz2" sha256 "52f54314aefd45945d47a6ecf4bd21f362e6467fa5d0538b0d45a06bc6eaaed5" livecheck do url "https://libopenraw.free...
34.677419
94
0.71907
e9737a4e0cadf48e16e7a936220998c52f24c2d6
248
class CreateEvidences < ActiveRecord::Migration[5.2] def change create_table :evidences, id: :uuid do |t| t.text :description t.belongs_to :defect, foreign_key: true, index: true, type: :uuid t.timestamps end end end
22.545455
71
0.673387
874b31c3c15bd1af5eeebb98d44972d6db9be6bf
2,881
require 'coveralls' Coveralls.wear! # Configure Rails Environment ENV['RAILS_ENV'] = 'test' require File.expand_path('../dummy/config/environment.rb', __FILE__) require 'rspec/rails' require 'database_cleaner' require 'factory_girl' FactoryGirl.find_definitions require 'ffaker' require 'shoulda-matchers' # Require...
35.134146
124
0.782714
188d7c6c834801bf9bdce6f60608fb406f5a2621
615
module Rsync class Change def file_type t = case raw_file_type when 'f' :file when 'd' :directory when 'L' :symlink when 'D' :device when 'S' :special end # custom return t unless t == :directory ...
18.088235
70
0.500813
bb8380bfda01db214dd986e7fb5dcaed0eae23eb
1,938
module Importing class CsvUserParser class << self REQUIRED_USER_HEADERS = %w( kw_id first_name last_name email phone ) def parse(file:) parsed_data = [] invalid_lines = {} return Failure.new(:invalid, message: I18n.t('.empty_file')) if file.size.zero? CS...
27.295775
97
0.576367
ff2b6fbb8eca368e24f449d10e42cdbf05857cb3
3,586
# frozen_string_literal: true require 'spec_helper' describe MetricsDashboard do include MetricsDashboardHelpers describe 'GET #metrics_dashboard' do let_it_be(:user) { create(:user) } let_it_be(:project) { project_with_dashboard('.gitlab/dashboards/test.yml') } let_it_be(:environment) { create(:envi...
35.156863
150
0.653653
4a00f36d57138f128a9937a81a98862fe6e9d220
1,118
# Copyright (c) 2008-2013 Michael Dvorkin and contributors. # # Fat Free CRM is freely distributable under the terms of MIT license. # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php #------------------------------------------------------------------------------ require 'spec_helper' describ...
33.878788
112
0.660107