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
38cf84fc8273e98da38210470f86d7a40b0862e0
554
require_relative 'python' module LanguageHandler class Python5 < Python LANG_CNAME = '5.x.py'.freeze private def execute(file) execute_command(file) end def text_with_custom_header(file_content) cert_path = ENV['FAKE_CERT_PATH'] file_content.prepend( "import twilio.re...
23.083333
82
0.658845
e988cfcdd212bfd42468be4656722768a164eeb3
1,258
# frozen_string_literal: true # WARNING ABOUT GENERATED CODE # # This file is generated. See the contributing guide for more information: # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md # # WARNING ABOUT GENERATED CODE Gem::Specification.new do |spec| spec.name = 'aws-sdk-acmpca' sp...
39.3125
157
0.668521
e90811c3a22cc7b926f388dad48ed044784947bc
1,011
class Mdbook < Formula desc "Create modern online books from Markdown files" homepage "https://rust-lang.github.io/mdBook/" url "https://github.com/rust-lang/mdBook/archive/v0.4.4.tar.gz" sha256 "eaf01085bd25e2efa07b561148afa5e3da3386e5f2c35b245961dc485562c154" license "MPL-2.0" head "https://github.com/rus...
34.862069
93
0.755687
08ec0073e65133bc8b48378d30ef2bbfa2b97861
356
# frozen_string_literal: true FactoryBot.define do factory :org_thirty_day_activity do name { Faker::Company.name + rand(999_999).to_s } vanity_url { Faker::Lorem.word + rand(999_999).to_s } org_type { 1 } project_count { 2 } affiliate_count { 20 } thirty_day_commit_count { 200 } ...
25.428571
60
0.685393
7a81ce3409256c3b8914b129b8a71b4f01fb803f
27
module GameUsersHelper end
9
22
0.888889
4afbcbf374a022313d74e57c44b4257bdb53afea
7,304
#-- encoding: UTF-8 #-- copyright # OpenProject is a project management system. # Copyright (C) 2012-2018 the OpenProject Foundation (OPF) # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProject...
29.691057
91
0.614732
9127ab3e3eca32a4b3dbf6faedb31e90741f84dc
2,061
# Copyright (c) 2013-2014 Irrational Industries Inc. d.b.a. Nitrous.IO # This software is licensed under the [BSD 2-Clause license](https://raw.github.com/nitrous-io/autoparts/master/LICENSE). require 'pathname' HOME_PATH = Pathname.new(Dir.home) AUTOPARTS_ROOT_PATH = HOME_PATH + '.parts' AUTOPARTS_APP_PATH = AUTOPAR...
31.707692
185
0.737021
edc044795f71e7f769607426a1c97ca473809bbc
141
Dir["#{File.dirname(path = File.expand_path(__FILE__))}/*.rb"]. each { |test| next if test == path || test =~ /_test.rb$/; require test }
47
75
0.617021
5d585c7fac988050d6dcaaefd37cd061642d24f6
953
# coding: utf-8 # vim: et ts=2 sw=2 RSpec.describe HrrRbNetconf::Server::Error::PartialOperation do let(:tag){ 'partial-operation' } let(:type){ ['application'] } let(:severity){ ['error'] } let(:info){ ['ok-element', 'err-element', 'noop-element'] } it "can be looked up in HrrRbNetconf::Server::Error dicti...
28.029412
91
0.697796
0181b20b42b1109af5306f3d12cac69f543884a3
709
class RailsBlogController < ApplicationController # USE THIS METHODS WHEN YOU NEED TO SKIP AUTH FILTERS # # skip_before_filter :authenticate_user!, only: [:method_name] # skip_before_filter :blog_admin_required!, only: [:method_name] before_action :authenticate_user!, except: %w[ index show ] before_ac...
30.826087
74
0.74189
b91ab592691f04e70270e46b22cc87ff3df2b019
19,481
class Fdroidserver < Formula include Language::Python::Virtualenv desc "Create and manage Android app repositories for F-Droid" homepage "https://f-droid.org" url "https://files.pythonhosted.org/packages/63/a9/327d10e876b7c5750564035151bae9f65268e3b6aa6163cd519f43b48bf3/fdroidserver-1.1.9.tar.gz" sha256 "420...
45.622951
147
0.792208
876ccc69d8d0ad50cada764b52fd2ffcef6437b4
26,171
require 'carrierwave/orm/activerecord' class User < ActiveRecord::Base extend Gitlab::ConfigHelper include Gitlab::ConfigHelper include Gitlab::CurrentSettings include Referable include Sortable include CaseSensitivity include TokenAuthenticatable DEFAULT_NOTIFICATION_LEVEL = :participating add_au...
29.605204
160
0.704673
d589e24a47a1ea9743f6d1854aa8561f19a5e062
1,076
require 'devise/hooks/timeoutable' module Devise module Models # Timeoutable takes care of verifying whether a user session has already # expired or not. When a session expires after the configured time, the user # will be asked for credentials again, it means, they will be redirected # to the sign i...
24.454545
82
0.64777
6a3b212b72b9c6ef6798147afc7f09bc6ade2b7b
2,184
# encoding: UTF-8 =begin Assistant de demande des informations générales =end def exec(options = nil) # Les informations générales dont on a besoin clear notice "\n===Informations générales ===" ask_for_titre unless titre ask_for_titre_en unless titre_en ask_for_description unless des...
22.285714
107
0.705586
ac7b05fff234e2f1c2880c944f026e3ebf9fbb65
1,592
require 'graphviz' class PetriNet::CoverabilityGraph < PetriNet::Base def initialize(net, options = Hash.new) @objects = Array.new @nodes = Hash.new @edges = Hash.new @name = net.name if options['unlimited'].nil? @unlimited = true else @unl...
28.945455
77
0.485553
610f878f21595d1297633819e1d29e7cacec1484
377
class User < ApplicationRecord # Associations has_many :businesses has_many :donations has_many :reviews has_secure_password # validates :email, presence: true, uniqueness: true # Validations # validates :name, :email, :password, presence: true # # validates :password, length: { minimum: 6, allow_blank: true } # v...
17.952381
66
0.763926
01932e224006de829401b71de14cc28fa7384a8b
3,802
=begin #Topological Inventory #Topological Inventory OpenAPI spec version: 0.1.0 Contact: you@your-company.com Generated by: https://openapi-generator.tech OpenAPI Generator version: 3.3.4 =end require 'spec_helper' require 'json' require 'date' # Unit tests for TopologicalInventoryApiClient::ContainerNode # Autom...
28.80303
102
0.714361
d58a35b98b86eee6d549ac91add3ec34b97178d2
3,116
class ShadowsocksLibev < Formula desc "Libev port of shadowsocks" homepage "https://github.com/shadowsocks/shadowsocks-libev" url "https://github.com/shadowsocks/shadowsocks-libev/releases/download/v3.3.5/shadowsocks-libev-3.3.5.tar.gz" sha256 "cfc8eded35360f4b67e18dc447b0c00cddb29cc57a3cec48b135e5fb87433488" ...
29.396226
128
0.62163
ac465b3c069e051876f0eb5ca41e0f59cf539765
1,471
require 'rails_helper' describe Schools::OnBoarding::SubjectList, type: :model do context '#attibutes' do it { is_expected.to respond_to :subject_ids } end context '#subject_ids' do it 'removes blank values' do expect(described_class.new(subject_ids: [""]).subject_ids).to eq [] end it 'co...
27.240741
82
0.692726
1115fcfc00c2864f64aeb82f863001bac1723165
46,809
require File.expand_path('../../../../spec_helper', __FILE__) module Pod describe TargetIntegrator = Installer::UserProjectIntegrator::TargetIntegrator do describe 'In general' do # The project contains a `PBXReferenceProxy` in the build files of the # frameworks build phase which implicitly checks f...
56.260817
156
0.64791
ac0d3bb44e069a8a1e14bf0d9a081a6545c54eb6
7,652
# frozen_string_literal: true require 'rubygems/text' class Gem::Licenses extend Gem::Text NONSTANDARD = 'Nonstandard'.freeze # Software Package Data Exchange (SPDX) standard open-source software # license identifiers LICENSE_IDENTIFIERS = %w( 0BSD AAL ADSL AFL-1.1 AFL-1.2 ...
17.390909
71
0.509671
4abcfb3162cb8597bca9ee096b38e52ebfea71c7
598
require "formula" class Fleetctl < Formula homepage "https://github.com/coreos/fleet" url "https://github.com/coreos/fleet/archive/v0.5.4.tar.gz" sha1 "1fec5e4d23627446bce52eae691cb233ef03e17b" head "https://github.com/coreos/fleet.git" bottle do sha1 "80417f9cb656b30100f5fb06bb4d4067a6cd3d93" => :maver...
26
69
0.734114
082b090ea9b7b082db8c6e42569347398b3ba9a1
51,656
require 'puppet' require 'getoptlong' require 'puppet/util/watched_file' require 'puppet/util/command_line/puppet_option_parser' require 'forwardable' require 'fileutils' # The class for handling configuration files. class Puppet::Settings extend Forwardable include Enumerable require 'puppet/settings/errors' ...
33.369509
161
0.68056
1d1bb385e551d7f8fe2d3090d614f4ab87f38800
1,592
class Mozjpeg < Formula desc "Improved JPEG encoder" homepage "https://github.com/mozilla/mozjpeg" url "https://github.com/mozilla/mozjpeg/archive/v4.0.3.tar.gz" sha256 "4f22731db2afa14531a5bf2633d8af79ca5cb697a550f678bf43f24e5e409ef0" license "BSD-3-Clause" livecheck do url :stable regex(/^v?(\d+(...
37.023256
122
0.640704
3852f8fcc76b9bb8158798b12f3ba77c871ea959
510
module DomoscioViz # @abstract class Resource class << self def class_name name.split('::')[-1] end def url(util_name = nil, on_self = nil ) if self == Resource raise NotImplementedError.new('Resource is an abstract class. Do not use it directly.') end ...
21.25
97
0.52549
e89ab70d9ef1a6ead2c7cf4a5533535a7d47542a
3,966
# -*- encoding: utf-8 -*- # stub: sprockets 3.7.0 ruby lib Gem::Specification.new do |s| s.name = "sprockets".freeze s.version = "3.7.0" s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["Sam Stephenso...
50.202532
157
0.63414
abd965ea63bfb8a3de42ead1d9c0795f8128fae5
168
class AddCommunityManagerToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :community_manager, :boolean, null: false, default: false end end
28
80
0.767857
110c303b86e83a92132e5bb788c23f9490e311ba
9,265
class Mitmproxy < Formula desc "Intercept, modify, replay, save HTTP/S traffic" homepage "https://mitmproxy.org" url "https://github.com/mitmproxy/mitmproxy/archive/v0.16.tar.gz" sha256 "d4ed9b27377431fc3d6241b43588279cb7e41e64a134a981938e162143c1ec72" head "https://github.com/mitmproxy/mitmproxy.git" bott...
37.358871
124
0.764274
7ad60fe3a60f598ec303c264d80ee1b7cd014fd5
187
class String def prepend_at "@#{self}" end def strip_ats tr('@', '') end alias_method :old_to_i, :to_i def to_i(base = 10) tr(',', '').old_to_i(base) end end
11.6875
31
0.561497
3878270770cb9a7bc3981bbd69c405be6925111b
716
module ActiveRecord module TypeCaster class Connection def initialize(klass, table_name) @klass = klass @table_name = table_name end def type_cast_for_database(attribute_name, value) return value if value.is_a?(Arel::Nodes::BindParam) column = column_for(attribut...
23.866667
79
0.671788
62c2f49e76edc0884085bd53bd851cf2b0f8aa0e
7,756
require 'cdo/chat_client' require 'cdo/google_drive' #require src_dir 'database' class CsvToSqlTable def initialize(path, params={}) @db = params[:db] || DB @path = path @table = File.basename(@path, File.extname(@path)).tr('-', '_').to_sym end def up_to_date? seed = DB[:seed_info].where(table: ...
26.114478
155
0.599794
e28a5455bac4f193261be15b1431ea10bbe32bce
4,474
## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / # # frozen_string_literal: true module Twilio module REST class Voice < Domain class V1 < Version ## # PLEASE NOTE that this class contains preview products that are subject to change....
34.152672
201
0.594993
7a688023d3650d0c7b1ffa724797a985e1aecefc
1,752
class UsersController < ApplicationController before_action :logged_in_user, only: [:edit, :update, :index, :destroy, :following, :followers] before_action :correct_user, only: [:edit, :update] before_action :admin_user, only: :destroy def index @users = User.where(activated: true).paginate(page: params[:p...
22.461538
97
0.672374
2820ea515f77f1d0570de661e4fa7192a5a50e8e
2,196
RSpec.describe ETG::Exporter::Context do def create_context **attrs ETG::Exporter::Context.new ETG::FakeGcloudClient.new, **attrs end describe '#set' do it 'base' end describe '#set_dump_path' do it 'sets dump_path as String' do context = create_context dump_path: '/tmp' expect(con...
31.371429
94
0.689891
795fe127943ca5d56a517b075ed065850c24a875
2,292
# frozen_string_literal: true require_relative 'choose_ability_on_or' module Engine module Game module G18ZOO module Step class Dividend < Engine::Step::Dividend include Engine::Game::G18ZOO::ChooseAbilityOnOr def dividend_options(entity) revenue = @game.routes_rev...
29.384615
104
0.569372
e815373b9d06d98c560f32c7f46a3a7b9982907c
1,303
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'xeroizer/version' Gem::Specification.new do |s| s.name = "xeroizer" s.version = Xeroizer::VERSION.dup s.date = "2014-09-26" s.authors = ["Wayne Robinson"] s.email = "wayne.robinson@gmai...
33.410256
68
0.714505
7a09d744559d368cbba27f68166f6edd62fbc9a1
132
require 'spec_helper' describe "users_controller/destroy.html.erb" do pending "add some examples to (or delete) #{__FILE__}" end
22
56
0.765152
ed43140974a319840a7f489bac2fbcebfc2e2c38
1,392
require 'perfmon/config' module Perfmon class Middleware def initialize(app) @app = app @csv_path = Perfmon.config.csv_path @csv_name = Perfmon.config.csv_name end def call(env) # Time request came initial_request = Time.now request = Rack::Request.new(env) # Req...
29
139
0.59842
039c591035ebe2c83de4a3709b87a51806b9751c
1,839
# # The MIT License # Copyright (c) 2018 Estonian Information System Authority (RIA), # Nordic Institute for Interoperability Solutions (NIIS), Population Register Centre (VRK) # Copyright (c) 2015-2017 Estonian Information System Authority (RIA), Population Register Centre (VRK) # # Permission is hereby granted, free ...
41.795455
103
0.770527
33b17550a88e810dc28c7cf5f6d2817923001aad
186
class CreateDonors < ActiveRecord::Migration def change create_table :donors do |t| t.string :name t.string :industry t.timestamps null: false end end end
16.909091
44
0.66129
f77086a0a6f1c02fcd7473763a60ee2c3a164f2e
6,158
# frozen_string_literal: true require 'spec_helper' require 'json' require 'bolt' require 'bolt/result' describe Bolt::Result do let(:target) { "foo" } describe :initialize do it 'sets default values' do result = Bolt::Result.new(target) expect(result.target).to eq('foo') expect(result.valu...
36.654762
113
0.596297
d57ba556c55020d13d58a79a2b0af84873be7c37
4,430
require 'test_helper' require 'pd/jot_form/matrix_question' module Pd module JotForm class MatrixQuestionTest < ActiveSupport::TestCase include Constants test 'parse jotform question data for matrix' do jotform_question = { qid: '1', type: TYPE_MATRIX, name: 'sa...
30.979021
131
0.56772
33b56b4093b9f0f062fb6e14e6a5d310ea7d6c8c
4,958
# -*- coding: utf-8 -*- defined? PROJECT or abort "PROJECT required." defined? RELEASE or abort "RELEASE required." defined? COPYRIGHT or abort "COPYRIGHT required." defined? LICENSE or abort "LICENSE required." RELEASE =~ /\A\d+\.\d+\.\d+/ or abort "RELEASE=#{RELEASE}: invalid release number." $ruby_ver...
26.513369
91
0.585317
acba1a5a2bee9c0f0fe165201c3d2c37a39c7379
5,567
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic...
34.57764
245
0.666427
d56d9062bc76beb666b318d2ce911ad0c8c79dad
46
module Jupiter VERSION = '2.3.1'.freeze end
11.5
26
0.695652
e9918d7f6ca63621bdcf1bca6cdf54ffd1bb9b3f
563
require File.dirname(__FILE__) + '/models/locale' require File.dirname(__FILE__) + '/models/translation' require File.dirname(__FILE__) + '/models/translation_option' require File.dirname(__FILE__) + '/routing' require File.dirname(__FILE__) + '/controllers/locales_controller' require File.dirname(__FILE__) + '/co...
56.3
92
0.783304
03e696576125c74bcced0acc1a0ad0acf674883a
597
require_relative 'boot' require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module Fakeinstag class Application < Rails::Application # Initialize configuration defaults for originally generated Rail...
31.421053
82
0.767169
33d6a4cf90e1ac30980a31ff906e70b26e630cd5
1,016
# frozen_string_literal: true # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
28.222222
74
0.726378
626f49c2d3731b601ebe0f89c5d0dfe4a0279eaa
200
$:.push File.expand_path('../', __FILE__) require 'plugins/testflight' require 'plugins/hockeyapp' require 'plugins/ftp' require 'plugins/s3' require 'commands/build' require 'commands/distribute'
18.181818
41
0.76
01e8d9173ff1079a82b43586465bb838f3077d18
484
require "ruby_poker/version" require "active_support/all" require "rainbow" Dir[__dir__ + "/ruby_poker/*.rb"].each { |p| require p } module RubyPoker NUMBERS = ([1] + [*2..13].reverse).freeze SUITS = %i[spade heart diamond club].freeze HAND_TYPES = %i[ royal_straight_flush straight_flush four_of_a_ki...
18.615385
56
0.683884
e988fffcb95bc766158474555ae3836f7b90fddf
1,768
require "abstract_unit" require "active_job" require "mailers/params_mailer" class ParameterizedTest < ActiveSupport::TestCase include ActiveJob::TestHelper setup do @previous_logger = ActiveJob::Base.logger ActiveJob::Base.logger = Logger.new(nil) @previous_delivery_method = ActionMailer::Base.deliv...
32.145455
195
0.75
1a53feaec4705d8feba96b5e5830d4bc88884c66
1,576
CookieClickerGenerator::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"...
42.594595
85
0.77665
28b292d13729aa25173e378d767a9e6994e7e90c
278
class Seed < ActiveRecord::Base store :payload, accessors: [:uri, :cache, :headers, :delimiter, :server, :host, :port, :database, :username, :password, :query, :selectors, :checked] store :memory has_many :seed_mapping has_many :agents, :through => :seed_mapping end
34.75
152
0.705036
ed5be7961f80a09fcadabcacfa3370e992a03fbd
301
begin require 'rspec' rescue LoadError require 'rubygems' gem 'rspec' require 'rspec' end $:.unshift(File.dirname(__FILE__) + '/../lib') $:.unshift(File.dirname(__FILE__) + '/../lib/hudson_erb') require 'hudson_erb' require 'mocha' RSpec.configure do |config| config.mock_with :mocha end
16.722222
57
0.704319
1a8374afb894aa8f2220f71a007c27c6d26ac89b
1,193
require File.dirname(__FILE__) + '/spec_helper.rb' describe Rhino::ColumnFamily do before do @page = Page.new('yahoo.com', :title=>"Yahoo!", :contents=>"<p>yahoo</p>", :meta_author=>'filo & yang', :meta_language=>'en-US') end it "should structure columns properly even before saving them to the db" do pe...
32.243243
132
0.715842
e8a14773b7d78fb2a9e6189bcf2ffee5c9b3d01e
605
require './viewer' Zootrope.new.trace class Baseball def toss(receiver) receiver.catch_ball(self) end end class Player attr_accessor :ball def catch_ball(ball) self.ball = ball end def toss(receiver) ball.toss(receiver) self.ball = nil end def has_ball? !!ball end end class B...
12.87234
37
0.639669
6af77b77fdb952038ec4c3f020ffb7ee8b206fcf
360
# typed: false class RemoveParentChildAndAddFolderFromFolderContent < ActiveRecord::Migration def change begin add_column :folder_contents, :folder_id, :integer rescue puts "Column folder_id already added to folder_contents" end remove_column :folder_contents, :parent_id remove_colum...
27.692308
78
0.758333
f85a4c690b9781eac62bb94936361b68ed3fe0a0
1,440
class RancherCli < Formula desc "Unified tool to manage your Rancher server" homepage "https://github.com/rancher/cli" url "https://github.com/rancher/cli/archive/v2.4.12.tar.gz" sha256 "7fb2fb7d8e210198b0829de169ccec1ba882c872ec8cd28ae905ab4460e94fc7" license "Apache-2.0" head "https://github.com/rancher/c...
43.636364
122
0.750694
1a6513984787bb3091f09d434a3670b79ab911b5
1,278
# frozen_string_literal: true # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
37.588235
76
0.786385
28a19d338e91318c3a48c1b38be855c82adff71f
13,675
# Copyright 2019 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 applicable law or agreed to in writing, ...
47.982456
160
0.605484
5d7344308a7a8227128f824d9c90ac57a3ca55cc
115
require "the_bullet/generator/version" module TheBullet module Generator # Your code goes here... end end
14.375
38
0.73913
f7e5ab71769bea20a385656f52c1c68e034943be
25,563
module DayTwo def self.call puts "Running #{self.to_s}" exercise_1 exercise_2 end private def self.exercise_1 puts "exercise 1" parser = DayTwo::Parser.new validator = DayTwo::Validator.new valid_pwds = self.input.filter { |line| validator.validate(:occurrences, *parser.parse(line))...
24.67471
99
0.636271
0181314fafc89dcd877fb03dbeb5bc6c08570c0e
255
class AddOptionsToAdvancedSearchConfigurations < ActiveRecord::Migration[5.2] def up add_column :advanced_search_configurations, :options, :jsonb, :null => true end def down remove_column :advanced_search_configurations, :options end end
25.5
79
0.780392
f7a92266d5ef7075c113a92d32cd621e379f4fc0
1,422
# Licensed to Elasticsearch B.V. under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright # ownership. Elasticsearch B.V. licenses this file to you under # the Apache License, Version 2.0 (the "License"); you may # not use this f...
34.682927
79
0.708158
abe44faf165370012bb0b4c20b36ea624d7048b8
740
Sequel.migration do change do create_table :tests do # Keys primary_key :id foreign_key :participant_id, :participants, null: false, on_delete: :cascade foreign_key :statement_id, :statements, null: false, on_delete: :cascade # Data Boolean :statement_read, null: fals...
28.461538
84
0.647297
3879e12b41a1f2c5b74be2ff89913643fbe9adce
3,033
require "ios_localizer/version" require 'uri' require 'net/https' require 'json' require 'cgi' require 'htmlentities' module IosLocalizer class HelperMethods # setup regular expressions $regex = /^".*" = "(.*)";$/ # Helper functions def getDataFromURL(url) uri = URI.parse(url.strip) http = Net::HTT...
22.804511
134
0.66238
3872ca7cd2dd3ae0a6e079964e5f5386f3b7a4c5
775
# Cookbook Name:: kernel-modules # Author:: Jeremy MAURO <j.mauro@criteo.com> # # Copyright 2016, Criteo. # # 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/license...
33.695652
74
0.741935
1cc20316e864e1880f70ce2d6f3193c16ad0bdca
829
# frozen_string_literal: true require 'spec_helper' if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 describe 'Stdlib::IP::Address::V6::CIDR' do describe 'accepts ipv6 addresses in cidr format' do [ 'FF01:0:0:0:0:0:0:101/32', 'FF01::101/60', '::/0', ].each do...
23.685714
65
0.547648
7948d353bc7cd465292fef60687b77ffb4ee22d8
1,094
require 'test_helper' class ShowsControllerTest < ActionController::TestCase setup do @user = users(:one) sign_in @user @show = shows(:hamlet) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:shows) end test "should get new" do get :new ...
21.038462
88
0.677331
7ade9ca5085de051c6d8b26713ade0b49063c647
1,683
# frozen_string_literal: true module Gitlab module Ci module Build module Policy class Refs < Policy::Specification def initialize(refs) @patterns = Array(refs) end def satisfied_by?(pipeline, context = nil) @patterns.any? do |pattern| ...
29.526316
80
0.562686
bb44b1c9d5f98090709ccf6aaea1e42c897f98aa
57
module Naturally # Gem version VERSION = '2.2.0' end
11.4
19
0.666667
ac6f80b3210fe5c2c5b07404083e4edc213dca4d
1,296
# frozen_string_literal: true ENV['RACK_ENV'] ||= 'test' require 'simplecov' SimpleCov.start { add_filter '/spec/' add_filter '/test_helpers/' } require 'bundler/setup' require 'rspec/expectations' require 'pry-byebug' require 'rspec/expectations' require 'capybara' require 'capybara/rspec' require 'capybara/s...
25.411765
81
0.753086
3394efc5da46ee3063667c30349a626f06a7526f
8,894
=begin #NSX-T Manager API #VMware NSX-T Manager REST API OpenAPI spec version: 2.5.1.0.0 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.19 =end require 'date' module NSXT # Traffic statistics for a logical switch. class L2VPNPerLSTrafficStatistics # Total num...
30.989547
178
0.632899
3974b85bebeff96bf1c6b93e3c7565b6fe38b319
209
module Cwl class ClassValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) return if value == 'Workflow' record.errors.add(attribute, :format) end end end
23.222222
51
0.708134
5dd1ae877cba8de6d6164c84e68cd33b8e4528f8
1,171
class ContactsController < ApplicationController before_filter :can_write_entries?, only: [:new, :create, :edit, :update] before_filter :find_contacts, only: [:index] before_filter :find_contact, only: [:show, :edit, :update] respond_to :html, :json # GET /contacts # GET /contacts.json def index end ...
21.685185
104
0.682323
bbd8dba8cb94521f9604ea0e0fcb1d95f6521f98
812
require 'prime' def powerMod(b, p, m) p.to_s(2).each_char.inject(1) do |result, bit| result = (result * result) % m bit=='1' ? (result * b) % m : result end end def multOrder_(a, p, k) pk = p ** k t = (p - 1) * p ** (k - 1) r = 1 for q, e in t.prime_division x = powerMod(a, t / q**e, pk) w...
19.333333
59
0.584975
bb9fa5e80b1a3055842bdf1a5cf2d30b1ff1c784
547
Rails.application.routes.draw do get 'pages/index' post 'pages/parse_gml' # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html root 'pages#index' defaults format: :json do constraints( id: /\d+/) do get 'topologies/current', to: 'topologies#current' ...
30.388889
101
0.652651
874791e08c40da54786e062dba14ab37b0af2080
23
module SkillHelper end
7.666667
18
0.869565
39c355193d4cd30cf069483cc358fcaa098215a9
3,746
# Ruby bindings for brotli library. # Copyright (c) 2019 AUTHORS, MIT License. require "brs/file" require_relative "common" require_relative "minitest" require_relative "option" require_relative "validation" module BRS module Test class File < Minitest::Test Target = BRS::File SOURCE_PATH = Commo...
31.478992
100
0.681794
0307fa1554218ff74f608380e749f978099977de
95
class RoleGrant < ApplicationRecord belongs_to :role belongs_to :user, touch: true end
19
36
0.747368
28d14e9e8e2c94a0dbf86dd8df5e3980cc76f04e
1,233
lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'lobbyist/version' spec = Gem::Specification.new do |s| s.name = 'lobbyist-ruby' s.version = Lobbyist::Version s.summary = 'Ruby client library for the Customer ...
41.1
115
0.609084
397e52b38c3a30c06fe1ba3e801aa49e40d82eb7
331
class CreateComments < ActiveRecord::Migration[5.0] def change create_table :comments do |t| t.references :post, foreign_key: true, null: false t.references :user, foreign_key: true, null: false t.text :content, null: false t.timestamps end add_index :comments, [:post_id, :user_id]...
27.583333
56
0.676737
6a983669a45b1b8c67ad834f7e3702a1e01b0620
240
class CreateVersions < ActiveRecord::Migration def change create_table :versions do |t| t.references :component, index: true t.string :string, index: true t.hstore :dependencies t.timestamps end end end
20
46
0.675
01913ee32223a5b5a5bde2a802ba72dce8834cc2
1,496
require 'spec_helper' # Generators are not automatically loaded by Rails require 'generators/rspec/model/model_generator' describe Rspec::Generators::ModelGenerator, :type => :generator do # Tell the generator where to put its output (what it thinks of as Rails.root) destination File.expand_path("../../../../../t...
28.226415
141
0.657754
1cbcb5b32940bedef1a58550375660648860f2d8
16,820
# depends on: class.rb array.rb ## # A wrapper for a calling a function in a shared library that has been # attached via rb_define_method(). # # The primitive slot for a NativeMethod points to the nmethod_call primitive # which dispatches to the underlying C function. class NativeMethod def lines nil end d...
24.918519
96
0.634602
3340fc0f51aaf2041c2912a8161f30cee83dfa0f
1,216
lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'heartcheck/activerecord/version' Gem::Specification.new do |spec| spec.name = 'heartcheck-activerecord' spec.version = Heartcheck::Activerecord::VERSION spec.authors = ['Locaweb'] spec.email = ['desenvol...
35.764706
77
0.722862
4a14dfbec564349aebac4a29a6ba0ebcb38f07b4
6,491
require 'spec_helper' describe Gitlab::Sherlock::Transaction do let(:transaction) { described_class.new('POST', '/cat_pictures') } describe '#id' do it 'returns the transaction ID' do expect(transaction.id).to be_an_instance_of(String) end end describe '#type' do it 'returns the type' do ...
27.504237
78
0.671545
d53bc2030ea42078892d627a00c548b3ef46bbb3
382
require 'rakuten_web_service/resource' require 'rakuten_web_service/ichiba/item' module RakutenWebService module Ichiba class Shop < Resource attribute :shopName, :shopCode, :shopUrl, :shopAffiliateUrl def items(options={}) options = options.merge(shop_code: self.code) RakutenWebServ...
23.875
65
0.71466
e922cbbf44e7717ca8ae2ed382fb9bc7a10b58bf
3,268
class Cased < Formula include Language::Python::Virtualenv desc "Cased command-line client" homepage "https://github.com/cased/cli" url "https://files.pythonhosted.org/packages/84/03/4f13363146b1c0f85f2f0ee88ba8dd338436ee20fc5bdf2f0c51879695d5/cased-0.6.6.tar.gz" sha256 "9ef325a0789e0f36cb86f982c3e96d9ea9003...
43.573333
149
0.824663
01521a1b7db52882ef9580868973553ae1ddc3ea
125
require "oyaji/version" require "rest-client" require "json" require "hashie" require "oyaji/helper" require "oyaji/client"
15.625
23
0.768
7a52edc53093cf966ad0af0013e3b7c441c1b7d7
6,440
module Rubinius module Stats module Units # Time unit factors, where one second is # 10^9 nanoseconds (ns) # 10^6 microseconds (us) # 10^3 milliseconds (ms) SEC_PER_NS = 1.0e-9 MSEC_PER_NS = 1.0e-6 USEC_PER_NS = 1.0e-3 KBYTES = 1024 def usec(ns) ns...
28.75
89
0.562267
4ab65f1874c0367caa186767240460459d8d107d
270
class Foreground def initialize @image = Gosu::Image.new("#{ROOT_PATH}/assets/images/foreground.png") @x = 0 end def move(speed) @x -= speed * 0.5 if @x < WIDTH - @image.width @x = 0 end end def draw @image.draw(@x, 0, ZOrder::FOREGROUND) end end
15
71
0.62963
08b6fbed718aa2f997b0b1627a88d9f019a16a49
96
module Matestack::Ui::Core::S class S < Matestack::Ui::Core::Component::Static end end
16
50
0.666667
38ad21760ab36892fdfde45a0397a0d3e021b76f
314
module UsersHelper # Returns the Gravatar for the given user. def gravatar_for(user, size: 80) gravatar_id = Digest::MD5::hexdigest(user.email.downcase) gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}" image_tag(gravatar_url, alt: user.name, class: "gravatar") end end
39.25
80
0.726115
bf822114d74f825147291440821167dcacaf6248
1,915
# -*- encoding: utf-8 -*- # stub: faraday 1.3.0 ruby libspec/external_adapters Gem::Specification.new do |s| s.name = "faraday".freeze s.version = "1.3.0" s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.metadata = { "bug_tracker_uri" => "https:...
47.875
314
0.675718
f7c911b57458727989824c2bd196de949e6f024b
1,986
require 'fog/core/collection' require 'fog/hp/models/meta_parent' require 'fog/hp/models/compute/meta' require 'fog/hp/models/compute/image' require 'fog/hp/models/compute/server' module Fog module Compute class HP class Metadata < Fog::Collection model Fog::Compute::HP::Meta include Fog...
24.825
90
0.531722
21606e0c7b8b79559592f95963bc9d4f051f4662
1,184
# frozen_string_literal: true require 'spec_helper' require 'bolt/executor' require 'bolt/target' describe 'add_facts' do include PuppetlabsSpec::Fixtures let(:executor) { Bolt::Executor.new } let(:inventory) { mock('inventory') } let(:target) { Bolt::Target.new('example') } around(:each) do |example| ...
28.878049
105
0.666385
03aaa911728c6d220712a399ed13c953e07e9f4a
1,225
# frozen_string_literal: true class CreateDelayedJobs < ActiveRecord::Migration[6.1] def self.up create_table :delayed_jobs do |table| # Allows some jobs to jump to the front of the queue table.integer :priority, default: 0, null: false # Provides for retries, but still fail eventually. t...
36.029412
94
0.682449
7a2368ceefc9f9144cad332dfc0d8e095fb2d5fd
103,927
require "rexml/document" class MiqAeClassController < ApplicationController include MiqAeClassHelper include AutomateTreeHelper include Mixins::GenericSessionMixin include Mixins::BreadcrumbsMixin before_action :check_privileges before_action :get_session_data after_action :cleanup_action after_action ...
36.414506
236
0.640026
edcb1a8de836accad80babbbeaff277e38ce4e9e
1,544
require 'rails_helper' RSpec.describe Project::BaseValidator, type: :model do let(:project_state) { 'draft' } let(:project) { create(:project, state: project_state, mode: 'flex') } context "when project is going to online to end state" do subject { project } Project::ON_ONLINE_TO_END_STATES.each do |st...
30.27451
139
0.621114