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
87e13aba63d288a1cf5a28e9a43cf3d15c0b97d0
484
module OpenActive module Models module Schema class TrackAction < ::OpenActive::Models::Schema::FindAction # @!attribute type # @return [String] def type "schema:TrackAction" end # @return [OpenActive::Enums::Schema::DeliveryMethod,nil] define_prope...
24.2
72
0.590909
acc0e8b43142c75539fd546fe930109656be5407
834
{ 'in the main navigation bar': '#main_nav', 'in the breadcrumbs': '.breadcrumbs', 'in the page header': 'h1', 'in the user menu': '.user-menu', 'in the search navbar': '#search-nav', 'in the boosted contents section': '#best-bets', 'in the Super Admin page': '.container', 'in the twitter govbox': '#twe...
36.26087
83
0.66307
33cd7d856462842d9670c69020bd6377cd70a669
922
module Transifex module ResourceComponents class Source include Transifex::CrudRequests::Fetch include Transifex::CrudRequests::Update include Transifex::ResourceComponents::TranslationComponents::Utilities attr_accessor :project_slug, :resource_slug, :source_slug def initial...
40.086957
110
0.71692
ff126fb8e91d1c78a59c31f98f24586cb7761980
139
class AddIsSendToMessages < ActiveRecord::Migration def change add_column :messages, :is_send, :boolean, :default => false end end
23.166667
63
0.748201
1a9c037029324c28bef2d15051d0f9145115d966
2,702
# This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) # Prevent database truncation if the environment is production abort("The Rails environment is running in production mode!") if Rail...
45.79661
86
0.750555
87a32a2df6c9107178a0ecd8eba28de78daa5f33
3,959
require "rails_helper" describe Events::EventBoxComponent, type: "component" do include_context "stub types api" let(:event) { build(:event_api) } let(:date_text) { event.start_at.to_date.to_formatted_s(:long) } let(:start_at_text) { event.start_at.to_formatted_s(:time) } let(:end_at_text) { event.end_at.to_...
34.12931
95
0.686032
f8fce406e2986468a8127be9338f267169c6dc35
6,792
# frozen_string_literal: true require 'spec_helper' describe PersonalAccessToken do describe 'scopes' do let_it_be(:expired_token) { create(:personal_access_token, expires_at: 1.day.ago) } let_it_be(:valid_token) { create(:personal_access_token, expires_at: 1.day.from_now) } let!(:pat) { create(:persona...
33.96
118
0.689782
f769015ede1c428c0ed9be5e5b5c0f3872619f21
9,698
class Mitmproxy < Formula include Language::Python::Virtualenv desc "Intercept, modify, replay, save HTTP/S traffic" homepage "https://mitmproxy.org" url "https://github.com/mitmproxy/mitmproxy/archive/v6.0.1.tar.gz" sha256 "094c1481583ae27f96bbd93f117cbd3e9cc64b2a2a4fa386ccd2b615735c1f94" license "MIT" ...
45.962085
148
0.822644
612b18c8e6ca4bacd0c0c6209c859ea77f7dfeee
372
class ProconBypassMan::ReportPressedButtonsJob < ProconBypassMan::BaseJob extend ProconBypassMan::HasInternalApiSetting # @param [String] body def self.perform(body) ProconBypassMan::ReportHttpClient.new( path: path, server_pool: server_pool, ).post(body: body, event_type: :internal) end ...
23.25
73
0.731183
d5bf805c6eaa74374a309070f13abef1a8c91c19
157
require 'test_helper' module ApiAuthentication class UserTest < ActiveSupport::TestCase # test "the truth" do # assert true # end end end
15.7
42
0.687898
1d93eb099010e36819c9ba7ac0f9f92b39b6108e
638
require 'spec_helper' describe Of do it 'has a version number' do expect(Of::VERSION).not_to be nil end it 'gives n of a block value' do expect(5.of { 'something' }).to eq(['something', 'something', 'something', 'something', 'something']) end it 'gives n of a Class that responds to new' do expe...
26.583333
105
0.659875
7a70210f970baebc75cc2278297c4e38a421e3d8
256
class CreateTimeTables < ActiveRecord::Migration def change create_table :time_tables do |t| t.references :course, index: true, foreign_key: true t.date :start_date t.text :comments t.timestamps null: false end end end
21.333333
58
0.683594
ab7bb232f9eeba217957df0610986572dee68da0
78
class Tblskills < ActiveRecord::Base # attr_accessible :title, :body end
19.5
37
0.730769
62a5aa8d165c450eae33ef895697c3ceb67283ab
1,074
ci = node.workorder.rfcCi compute_index = ci[:ciName].split('-').last.to_i cloud_index = ci[:ciName].split('-').reverse[1].to_i computes = node.workorder.payLoad.RequiresComputes local_ip = node.workorder.payLoad.ManagedVia[0][:ciAttributes][:private_ip] exit_with_error "unsupported, missing SecuredBy key in deploymen...
34.645161
137
0.72905
5dda537dd00114ae95e4f9941da3fa0f1610da3f
275
class Sidplay < Cask version :latest sha256 :no_check url 'http://www.twinbirds.com/sidplay/SIDPLAY4.zip' appcast 'http://www.sidmusic.org/sidplay/mac/sidplay_appcast.xml' homepage 'http://www.sidmusic.org/sidplay/mac/' license :unknown app 'SIDPLAY.app' end
22.916667
67
0.734545
1d9b34ea6c87c2d9973dfde7ec640f9d019eb65d
249
# # Cookbook Name:: usermgm # Recipe:: default # # Copyright 2017, YOUR_COMPANY_NAME # # All rights reserved - Do Not Redistribute # execute 'useradd artij' do not_if 'ls -ld /home/artij' end execute 'echo "Dinesh#786"|passwd artij --stdin' do end
16.6
51
0.722892
87938b026c88b9310f23c3e02a6bcb0080294f08
600
# Parameters: # dir - Relative to the current working directory of the app. # allow_only - Optional. It is an array of ruby file names without # an extension. def require_these( dir, allow_only=nil ) if allow_only allow_only.uniq.each { |file_name| require File.join(dir, file_name.to_s) } el...
26.086957
70
0.673333
abf2f2a8aa74cd553d5bb4f9ac6e0c0a1adc57b4
454
# Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :upload do end # Use `create :upload, :with_file_fixture, image_fixture: "Composition7_horizontal.jpg"` trait :with_file_fixture do transient do image_fixture "" end initialize_with do fi...
25.222222
90
0.72467
bbd4760becaf3d0c2e035462aa6cda2c6d3bf004
322
# frozen_string_literal: true require 'rails_helper' RSpec.describe DruidConcern do let(:document) { SolrDocument.new(document_attributes) } let(:document_attributes) { { id: 'druid:abc123456' } } describe '#druid' do it 'returns the druid' do expect(document.druid).to eq 'abc123456' end end en...
21.466667
58
0.71118
186253c459706cab9096ee79f6df72a16c88227b
5,687
require File.join(File.dirname(__FILE__), "..", "..", "test_helper") class PersonTest < Test::Unit::TestCase def setup_resources @person_xml = {:id => 1, :name => "Joe Coder"}.to_xml(:root => "person") @people = [{:id => 1, :name => "Joe Coder"}].to_xml(:root => "people") @entry = ...
37.662252
95
0.608581
1a5772aaef112497cd91e7b5be6b76fcb44ff9bd
816
class Service attr_accessor :messages @messages def hasPost messages.each do |message| if message.isPost || message.isPostJSON return true end end return false end def hasGet messages.each do |message| if message.isGet return true end end re...
17.73913
49
0.604167
f8100b1391d68c3779b223043718ccdab4efe21f
13,080
## # $Id$ ## ## # This file is part of the Metasploit Framework and may be subject to # redistribution and commercial restrictions. Please see the Metasploit # Framework web site for more information on licensing and terms of use. # http://metasploit.com/framework/ ## require 'msf/core' #require 'rex/exploitation/jav...
28.496732
141
0.650994
1a0c440b5dfbcd5e4c97c3b0f154d8a1993302cc
7,349
require File.dirname(__FILE__) + "/../spec_helper" describe "Collection Ruby extensions" do before(:each) do @data = ['foo', 'baz', 'bar', ''] end it 'iterates using each' do set = java.util.LinkedHashSet.new @data.each { |elem| set.add elem } data = [] set.each { |elem| data << elem } e...
32.517699
90
0.619268
b98ed26f9efeaf5842d6620fc03755087cbb37bf
940
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "apipie/version" Gem::Specification.new do |s| s.name = "apipie-rails" s.version = Apipie::VERSION s.authors = ["Pavel Pokorny","Ivan Necas"] s.email = ["pajkycz@gmail.com", "inecas@redhat.com"] s.homepage ...
34.814815
72
0.679787
398bc2d609cf782632b4823f774d9bde76ed5bf2
3,881
require 'spec_helper' describe GithubUserAccount do def example_repo_data repo_data = Hashie::Mash.new repo_data.default_branch = 'master' repo_data.forks_count = 25 repo_data.watchers_count = 15 repo_data.language = 'Ruby' repo_data.fork = false repo_data.name = 'test name' repo_data...
36.271028
118
0.710899
e2e60179eaeffa5fa5e30c25409cc33d24a66d4c
4,811
require_relative '../models/address_book' class MenuController attr_reader :address_book def initialize @address_book = AddressBook.new end def main_menu puts "Main Menu - #{address_book.entries.count} entries" puts "1 - View all entries" puts '2 - View Entry Number n' puts "3 - Create a...
22.068807
94
0.606942
e940922cafc4efcd8c14c314f0733197574c005c
1,664
class Profiles::TalksController < ApplicationController include Secured before_action :set_profile def new @talks = Talk.all # register end def edit end def create RegisteredTalk.transaction do RegisteredTalk.where(profile_id: @profile.id).delete_all if params[:talks].present? ...
24.115942
135
0.596154
abd5f3a391a76985c06315c58743cdba035bf82b
886
class User < ApplicationRecord has_many :teachers has_many :links has_many :teachings, through: :teachers validates :email, presence: true validates :password, length: { in: 6..20 } validates :email, uniqueness: true # Include default devise modules. Others available are: # :confirmable, :lockable, :t...
31.642857
115
0.723476
031638120fdb05a752170522df5b365b655ca0a0
71
default.nodejs[:version] = "6.0.0" default.nodejs[:dir] = "/usr/local"
23.666667
35
0.661972
916022a90048d2ef3498394a00c808e0b1a2ca55
1,170
module HttpdCookbook class HttpdModule < ChefCompat::Resource property :filename, String, default: lazy { case node['platform_family'] when 'debian' return 'libphp5.so' if module_name == 'php5' when 'rhel' return 'libmodnss.so' if module_name == 'nss' return 'mod_rev.so' ...
33.428571
77
0.64188
e9276eba057808e8b15439e68f4bb2afc57df604
1,515
require 'spec_helper' describe "Favorites - Product Page", js: true do let!(:product) { create(:product) } context 'as Guest' do before do visit spree.product_path(product) end it 'should allow adding and removing favorites' do click_link 'Add Favorite' expect(page).to have_conten...
24.047619
64
0.675248
bb7b739492b5b0b720efca7714071db5630874d0
389
# frozen_string_literal: true module HttpAuthConcern extend ActiveSupport::Concern included do before_action :http_authenticate end def http_authenticate return true unless %w[production test].include? Rails.env authenticate_or_request_with_http_basic do |username, password| username == ENV[...
24.3125
72
0.753213
e90fe430e14ed0ea11751a6eae86fad2335f20b8
5,134
require 'simple_form' # Use this setup block to configure all options available in SimpleForm. SimpleForm.setup do |config| config.error_notification_class = 'alert alert-danger' config.button_class = 'btn btn-default' config.boolean_label_class = nil config.wrappers :vertical_form, tag: 'div', class: 'form-gr...
34
116
0.640047
263918ffcf66cbb24c7a864a28c405bd40307844
569
# frozen_string_literal: true # app/serializers/tour_serializer.rb class V3::TourSerializer < ActiveModel::Serializer has_many :tour_stops has_many :stops belongs_to :mode belongs_to :theme has_many :modes has_many :media has_many :tour_media has_many :flat_pages has_many :tour_flat_pages attribute...
35.5625
255
0.778559
e998d306591ebbdb76aaf4063356eb9086993dec
965
module Fog module AWS class RDS class Real require 'fog/aws/parsers/rds/restore_db_instance_from_db_snapshot' # Restores a DB Instance from a DB Snapshot # http://docs.amazonwebservices.com/AmazonRDS/latest/APIReference/index.html?API_RestoreDBInstanceFromDBSnapshot.html # =...
32.166667
125
0.631088
ed67c59f4a6b71363f64a7f94b3de303ca084957
251
class RelatorioPolicy < ApplicationPolicy def index? end def show? end def new? end def edit? end def create? end def update? end def destroy? end class Scope < Scope def resolve scope end end end
8.366667
41
0.609562
388677e9295dfb4134d0fbb7262677ec32ff3941
1,348
module Refinery module Images extend Refinery::Dragonfly::ExtensionConfiguration include ActiveSupport::Configurable config_accessor :max_image_size, :pages_per_dialog, :pages_per_admin_index, :pages_per_dialog_that_have_size_options, :user_image_sizes, :user_image_ratios, ...
32.095238
101
0.66543
ffc16eeb9d150a4733e99d6c2be97bf8d258b0e5
1,752
Pod::Spec.new do |s| s.name = "PSPDFKit" s.version = "3.6.4" s.homepage = "http://pspdfkit.com" s.license = { :type => 'Commercial', :file => 'PSPDFKit.embeddedframework/PSPDFKit.framework/Resources/LICENSE' } s.author = { "PSPDFKit GmbH" => "support@pspdfkit.com" } s.summary ...
58.4
158
0.658676
18b10ee5962b0412990be6854f1c259e9becdc6f
367
# frozen_string_literal: true module Types class VulnerabilityReportTypeEnum < BaseEnum graphql_name 'VulnerabilityReportType' description 'The type of the security scan that found the vulnerability.' ::Vulnerabilities::Occurrence::REPORT_TYPES.keys.each do |report_type| value report_type.to_s.upc...
28.230769
77
0.773842
3961a6f38488e4b3c0c035e628c83cae6ec95467
815
require "test_helper" require "active_record" require "active_support" class ActiveSupportTest < Minitest::Test def setup ActiveSupport::Dependencies.autoload_paths = Dir["{__dir__}/test_blog/app/*"] end def test_search_for_file file = ActiveSupport::Dependencies.search_for_file("application_controller") as...
29.107143
85
0.792638
3870fe729f8f1c1dad8681d05abb313f8c2305e0
572
# This migration comes from pwb (originally 20170716110121) class TranslatePages < ActiveRecord::Migration[5.0] # translated cols are not needed in original table # but need to have translations declared in model def self.up Pwb::Page.create_translation_table!({ :raw_html => {:type => :text, :default => ''}...
30.105263
59
0.646853
1d0a2385017b0b9825fe9f60eb36cc9474572ca9
793
require 'spec_helper' describe Hydra::Derivatives::TempfileService do let(:class_with_metadata_extraction) do Class.new do attr_reader :content, :mime_type, :uri def initialize(options = {}) @content = options.fetch(:content, '') @mime_uype = options.fetch(:mime_type, nil) @u...
25.580645
78
0.662043
1dd239e5002c09a48c4dd18946eb1d6a3c9b3bab
76
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'es_top'
25.333333
58
0.723684
79586bc21dc8858b06d3ce265afcf08654afc898
2,243
class Day01 def self.title '--- Day 1: Sonar Sweep ---' end def initialize(state) @state = state setup end def tick(args) render(args) process_input(args) end class Calculation def initialize(depths) @depths = depths end def number_of_increases @depths.each_...
24.11828
116
0.664289
e936e86bc5cc73b7b9794df340359e03447b9873
502
require "rails_helper" RSpec.describe JSONValidator do it "validates json" do validatable_klass = Struct.new(:json_attribute) do include ActiveModel::Validations def self.model_name ActiveModel::Name.new(self, nil, "temp") end validates :json_attribute, json: true end e...
25.1
60
0.695219
5d2b7075062643ca143406ebad3050ef4ac52330
499
require 'helper' describe Twitter::GeoFactory do describe '.new' do it 'generates a Point' do geo = Twitter::GeoFactory.new(:type => 'Point') expect(geo).to be_a Twitter::Geo::Point end it 'generates a Polygon' do geo = Twitter::GeoFactory.new(:type => 'Polygon') expect(geo).to be...
27.722222
67
0.659319
d5175761ccbaf631b778ea49aaf76d81fcbb5d66
667
Pod::Spec.new do |s| s.name = "MaterialCatalog" s.version = "119.1.1" s.summary = "Helper Objective-C classes for the MDC catalog." s.description = "This spec is made for use in the MDC Catalog." s.homepage = "https://github.com/material-components/material-components-ios" s.license ...
44.466667
124
0.649175
1c686625ee3f09ff1beb3a8d8086833882b3da47
915
module HasStar # take logic out of has_star helper method # makes it easy to override class Builder < ::Struct.new(:model, :h) # content based on model.star status, already html safed def content (model.star? ? starred : unstarred).html_safe end # html code for solid star, could be &hearts;...
20.333333
82
0.614208
e81e1334528373cfaa54d1257cdd6a8651d9904d
123
# # Here should be state_machine and different workflow ? # # Here should live logic to clone Deal with all properties # #
17.571429
58
0.747967
d5b3c7a9907e37b8552204be799932665b483b8b
9,213
# frozen_string_literal: true require "benchmark" shared_examples "#uninstall_phase or #zap_phase" do subject { artifact } let(:artifact_dsl_key) { described_class.dsl_key } let(:artifact) { cask.artifacts.find { |a| a.is_a?(described_class) } } let(:fake_system_command) { FakeSystemCommand } context "usi...
35.298851
112
0.639097
acdd695a825ea5dffedeb3b1b0c3f55049d89f64
1,735
class Libresample < Formula desc "Audio resampling C library" homepage "https://ccrma.stanford.edu/~jos/resample/Available_Software.html" url "https://deb.debian.org/debian/pool/main/libr/libresample/libresample_0.1.3.orig.tar.gz" sha256 "20222a84e3b4246c36b8a0b74834bb5674026ffdb8b9093a76aaf01560ad4815" licen...
59.827586
139
0.795965
1aff39e2fcd88ab7154b13730a0c5521a0ad5de6
3,384
class CourseSummariesController < ApplicationController include CourseSummariesHelper before_action :authorize_only_for_admin, except: [:populate] layout 'assignment_content' def index end def populate render json: { data: get_table_json_data(current_user), columns: popul...
30.214286
100
0.691489
6a2bc14d12c204c83d424b4f8572d429c7642fdf
1,354
if RUBY_ENGINE == 'opal' require 'hyperloop/string' require 'hyperloop/client_stubs' require 'hyperloop/context' require 'hyperloop/js_imports' require 'hyperloop/on_client' require 'hyperloop/active_support_string_inquirer.rb' require 'hyperloop_env' else require 'opal' require 'opal-browser' begin...
37.611111
100
0.776219
ac84d2ff34fcc01807ceba7afec537bbb57bde0c
2,929
## # This module requires Metasploit: http://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## require 'msf/core' class Metasploit3 < Msf::Exploit::Remote Rank = GreatRanking # NOTE: BadBlue doesn't give any HTTP headers when requesting '/'. # However, a proper Server ...
31.494624
135
0.580744
1d1000470e4ba38b589960da79d4bfa3c3f352b0
1,684
class Rsync < Formula desc "Utility that provides fast incremental file transfer" homepage "https://rsync.samba.org/" url "https://rsync.samba.org/ftp/rsync/rsync-3.1.2.tar.gz" mirror "https://mirrors.kernel.org/gentoo/distfiles/rsync-3.1.2.tar.gz" mirror "https://www.mirrorservice.org/sites/rsync.samba.org/r...
40.095238
107
0.705463
e2fc13cbca91a022860d2ab6b1df0185007840f5
1,981
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P. # # 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...
25.397436
76
0.662292
3329f6c11f1507a36db55e14cfb0753d65fd7e08
106
require "NUFORC/version" module NUFORC class Error < StandardError; end # Your code goes here... end
15.142857
34
0.726415
380f0dd0451b9a2fcfa592ab4a44ab698ea6a581
2,038
# frozen_string_literal: true class EstimatesJob < BaseJob include ActiveSupport::Inflector attr_reader :command, :args def perform(command, hostname) @command = command @args = url_to_api_params(command.text) validate_args || return (time_sum, issues, issues_without_estimates) = load_issues ...
39.192308
129
0.605986
4a7d4e8cb573004627c4140127018c385b3681d0
34,700
class BasicPrimitive attr_accessor :pass_state attr_accessor :pass_self attr_accessor :pass_call_frame attr_accessor :pass_message attr_accessor :pass_arguments attr_accessor :pass_gctoken attr_accessor :raw attr_accessor :safe attr_accessor :can_fail def emit_counter @@counter ||= 0 str = ...
26.129518
125
0.551643
38f82a6a61804658a12e0ca3b1a5d01206267898
442
# frozen_string_literal: true require 'spec_helper' require 'bolt_spec/options' require 'bolt/config/transport/options' context 'Bolt::Config::Transport::Options::TRANSPORT_OPTIONS' do include BoltSpec::Options it 'has a type and description for each option' do expect(Bolt::Config::Transport::Options::TRANSP...
29.466667
81
0.782805
1d20b23845ee54a5f914544ff57c5c7790b325e7
793
class MultipleLibrariesPerUser < ActiveRecord::Migration def change create_table :library_memberships do |t| t.belongs_to :user t.belongs_to :library t.timestamps end reversible do |dir| dir.up do execute <<-SQL.squish INSERT INTO library_memberships (user_id, li...
26.433333
87
0.64691
f8d54333a09aef679553b7d1d93f4316cde09d10
561
module SidebarHelpers # This helps by setting the "current" class for sidebar nav elements # if the YAML frontmatter matches the expected value. def sidebar_current(expected) current = current_page.data.sidebar_current if current == expected || sidebar_section == expected return " class=\"current\""...
28.05
70
0.707665
2103c4324e23103c2985431786ad09a4e874716e
4,959
require_dependency "commenteux/application_controller" module Commenteux class NotesController < ApplicationController helper UsersHelper def index resource = fetch_resource fetch_params list_roles = manage_roles_parameter(params[:roles]) @comments = get_comments(resource, list_roles...
30.237805
176
0.633595
5d91312e57b94283d87f9642181fb802dcf0faa3
567
cask 'processing' do version '3.5.4' sha256 '4d64fe42a6c5c0863cc82e93a036e73731999ee9448be45bc322f91b0010bb6b' url "https://download.processing.org/processing-#{version}-macosx.zip" appcast 'https://github.com/processing/processing/releases.atom' name 'Processing' homepage 'https://processing.org/' app ...
28.35
75
0.675485
1c73b809d34b31597a7cdfb1e12c39532b5deedb
231
class TextileParserController < ApplicationController skip_filter :login_required, :only => [:parse] def parse @data = params[:data] end private def allow_to super :all, :only => [:parse] end end
14.4375
53
0.645022
ac9fd041416999f81915b21870a3fcdffb73df59
162
require "language_pack" module LanguagePack::Test end require "language_pack/test/ruby" require "language_pack/test/rails2" require "language_pack/test/rails6"
18
35
0.820988
3375b1a0cca911d50857e79a604ceb9a6c5b80fd
1,094
require 'spec_helper_acceptance' command = case fact('osfamily') when 'Windows' 'cmd.exe /c echo triggered' else 'echo triggered' end describe 'concat_file with metaparameters with resources to notify' do basedir = default.tmpdir('concat') context 'should noti...
27.35
98
0.566728
ab1918dfd3660840b1ce0b50d92a31c90700e4f2
212
Puppet::Type.type(:neutron_plugin_nvp).provide( :ini_setting, :parent => Puppet::Type.type(:openstack_config).provider(:ini_setting) ) do def file_path '/etc/neutron/plugins/nicira/nvp.ini' end end
19.272727
72
0.726415
6ac263a2a43fd5649170428300caf0c1b93aef87
1,151
version = File.read(File.expand_path('../asf.version', __FILE__)).strip Gem::Specification.new do |s| # Change these as appropriate s.name = "whimsy-asf" s.license = 'Apache License, Version 2.0' s.version = version s.summary = "Whimsy 'model' of the ASF" s.author = ...
32.885714
71
0.648132
bb063760f1936c663343f2acd19877971b440eb6
5,014
#!/opt/puppetlabs/puppet/bin/ruby require 'json' require 'puppet' def factories_get(*args) header_params = {} argstring = args[0].delete('\\') arg_hash = JSON.parse(argstring) # Remove task name from arguments - should contain all necessary parameters for URI arg_hash.delete('_task') operation_verb = 'Ge...
32.141026
189
0.665736
ac572c6c7ead3d384bc7be2b7de51eda5f470524
157
class AddKindToTrainingModules < ActiveRecord::Migration[6.0] def change add_column :training_modules, :kind, :integer, default: 0, limit: 1 end end
26.166667
71
0.751592
d51034f47d42f028419c944a4808979159b05c4c
186
module MCFDI def self.payment_ways [ ['Pago en una sola exhibicion', 'Pago en una sola exhibicion'], ['Pago en parcialidades', 'Pago en parcialidades'] ] end end
20.666667
69
0.645161
4a5b016b2ca56d038b84609d2287bc794ae49eb4
4,386
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') module ICU describe TieBreak do context "#identify which rule" do it "should recognize Buchholz" do expect(TieBreak.identify(:buchholz).id).to eq(:buchholz) expect(TieBreak.identify(" BucholtS ").id).to eq(:buchholz) ...
43.425743
85
0.646831
b9df1efa192e0599d0275cc5186cecab54d55954
1,075
class AzureWebAppFunction < AzureGenericResource name 'azure_web_app_function' desc 'Verifies settings and configuration for an Azure Function' example <<-EXAMPLE describe azure_web_app_function(resource_group: 'rg-nm1', site_name: "my-site", function_name: 'HttpTriggerJS1') do it { should ex...
38.392857
119
0.72186
e873520d0731807b402edb5b283d7690e42e756d
730
require "zlib" module RocketJob module Sliced # Compress the records within a slice class CompressedSlice < ::RocketJob::Sliced::Slice private def parse_records records = attributes.delete("records") # Convert BSON::Binary to a string binary_str = records.data st...
24.333333
65
0.617808
ac66865713bba5e218916e9a45612b0334d0faa5
1,264
require "test/unit" require "ply" class TestPly < Test::Unit::TestCase def test_ascii verify_cube_file "examples/cube_ascii.ply" end def test_binary_big_endian verify_cube_file "examples/cube_binary_big_endian.ply" end def test_binary_little_endian verify_cube_file "examples/cube_binary_little_...
22.175439
65
0.69462
b919f4b44651a17f13795bf41d57d41f699f420d
1,165
require 'test_helper' class TwilioControllerTest < ActionController::TestCase setup do # Put setup steps here end test "should get index" do get :index assert_response :success end test "should serve up TwiMl at ivr/welcome" do post :ivr_welcome, :From => "15556505813" assert response.b...
26.477273
69
0.71073
398878a6e5060e4069a8f6f8b7e4162a5f00781c
1,847
# frozen_string_literal: true module RuboCop module Cop module RSpec # Checks if there is a let/subject that overwrites an existing one. # # @example # # bad # let(:foo) { bar } # let(:foo) { baz } # # subject(:foo) { bar } # let(:foo) { baz } ...
26.385714
80
0.516513
ed5525ef09976ce16db28d888b94c419b7f3c58b
606
module GOVUKDesignSystemFormBuilder module Traits module Label private def label_element @label_element ||= if @label.nil? Elements::Null.new else Elements::Label.new(*bound, caption: @caption, **label_content)...
22.444444
92
0.481848
6a38480ab7496daa3f28c6cc324cf0696e61f565
2,447
class Volunteer attr_accessor :name, :project_id, :id def initialize(attributes) @name = attributes.fetch(:name) @project_id = attributes.fetch(:project_id) @id = attributes.fetch(:id) end def self.all returned_volunteers = DB.exec("SELECT * FROM volunteers;") volunteers = [] returned_...
32.197368
115
0.638741
187534965aaf6af0f2657a91d6836c5bedba3f91
60
require 'algorithms/sorting' require 'algorithms/recursion'
20
30
0.833333
f8db741421460ebffaf5f376022e0347eeaccb53
350
class AddDefaultValuesForGa < ActiveRecord::Migration[5.1] class Facts::Metric < ApplicationRecord end def up Facts::Metric.update_all(pageviews: 0, unique_pageviews: 0) change_column :facts_metrics, :pageviews, :integer, default: 0 change_column :facts_metrics, :unique_pageviews, :integer, default:...
25
73
0.745714
61b16f6a9b6228d82ffe48cd63049c7423f39612
573
require 'webrick' class NonCachingFileHandler < WEBrick::HTTPServlet::FileHandler def prevent_caching(res) res['ETag'] = nil res['Last-Modified'] = Time.now + 100**4 res['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0' res['Pragma'] = 'no-cache' r...
27.285714
91
0.638743
1d41da4bf4fc4fa02430cf755ad28f215d2fe761
121
class MessageType < EnumerateIt::Base associate_values( sent: [1, "Enviada"], received: [2, "Recebida"] ) end
20.166667
37
0.652893
87b2b38916dad81d780dc26fc4f7225ec2471d35
2,944
class Submission < ApplicationRecord ERRORED_ROW_LIMIT = 10 include AASM belongs_to :framework belongs_to :supplier belongs_to :created_by, class_name: 'User', optional: true belongs_to :submitted_by, class_name: 'User', optional: true belongs_to :task has_many :files, dependent: :nullify, class_name...
23.552
90
0.702785
629ddf3e26179a9fe9920c8d8a3a6a430caaca96
177
class Admin::ContactsController < Admin::ApplicationController def index authorize Contact @contacts = Contact.includes(:sponsor).all.order('sponsors.name') end end
25.285714
69
0.757062
385318ac165676bd471279fb69ffccc472252292
394,924
# 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::DynamoDB module Types # Contains details of a table archival operation. # # @!attribu...
39.342897
155
0.62666
01c0d28b4258d09d472a0e6ef0ba9a03f3782539
15,728
# = NMatrix # # A linear algebra library for scientific computation in Ruby. # NMatrix is part of SciRuby. # # NMatrix was originally inspired by and derived from NArray, by # Masahiro Tanaka: http://narray.rubyforge.org # # == Copyright Information # # SciRuby is Copyright (c) 2010 - 2012, Ruby Science Foundation # NM...
32.630705
216
0.567269
1c899f7a77cf26e620061066f2274fbacd2c9e8f
6,862
require 'spec_helper' describe 'Association Cache' do before(:each) do clear_model_memory_caches stub_active_node_class('Student') do property :name has_many :out, :lessons, type: :has_student, model_class: 'Lesson' has_many :in, :exams, model_class: 'Exam', origin: :students has_one...
35.010204
117
0.660595
0307c987b45f59b64a991278b3bd20b6a777cd4c
241
class CreateProGifts < ActiveRecord::Migration def change create_table :pro_gifts do |t| t.references :from, null: false t.references :to, null: false t.text :message t.timestamps null: false end end end
20.083333
46
0.6639
1abcc401bd34dd4a2e2378f5f1349ad78dfd755d
2,229
class Communications::HistoryCell < Cell::Rails def display(args) @place = args.has_key?(:place) ? args[:place] : "mail-history" @pager = args.has_key?(:pager) ? args[:pager] : 'pager' render end def javascript(args) @place = args.has_key?(:place) ? args[:place] : "mail-history" @caption = a...
46.4375
106
0.645581
79af27f22235a2bc87217a30567238c042a570ba
4,499
require 'spec_helper' describe Fabrication::Cucumber::StepFabricator do let(:name) { 'dogs' } describe '#klass' do context 'with a schematic for class "Boom"' do subject { described_class.new(name).klass } let(:fabricator_name) { :dog } before do allow(Fabricate).to receive(:schema...
31.461538
85
0.609024
268fd4f58948a217c2c4458a744238d1ff73e8b0
14,315
require "omniauth-facebook" # frozen_string_literal: true # 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. Chang...
48.525424
154
0.751519
ed2b620a4299fe91fec35cad1dca7eb1634c51bf
732
require 'eventmachine' require 'http/parser' require 'socket' module HTTPServer def post_init @parser = Http::Parser.new @pending_requests = [] @parser.on_message_complete = proc { @pending_requests << @parser } end def receive_data(data) @parser << data write_response while @pending_request...
21.529412
80
0.681694
62a768401ee83b5063dac20b2a83d805edd46e1b
280
#!/usr/bin/env ruby require "net/http" require "uri" uri = ARGV[0] print uri while true do threads = [] 5.times do threads << Thread.new do Net::HTTP.get_response(URI.parse(uri)) print "hitting #{uri}\n" end end threads.join sleep rand(2) end
11.666667
44
0.617857
eda1ee674918376cdd35c2e91bfbdb3554c733e2
1,095
require "ipaddr" module IpSupport def is_lp_office?(ip_string) begin ip = IPAddr.new(ip_string) IpSupport.ip_ranges['lp_offices'].each do |range| return true if range === ip end false rescue ArgumentError end end def true_client_ip(request) headers_list = ["True-...
24.333333
97
0.580822
e835864063bf838c9a79fd0df87d4945e8f59375
3,608
require 'fileutils' module Rack::MiniProfilerRails # call direct if needed to do a defer init def self.initialize!(app) raise "MiniProfilerRails initialized twice. Set `require: false' for rack-mini-profiler in your Gemfile" if @already_initialized c = Rack::MiniProfiler.config # By defau...
33.719626
132
0.655211
260c0f98dfd2bac747e40445d55199aac6584728
1,202
#!/usr/bin/env ruby # Simple Choose/8ball/lotto type script # Input sanitation is done by wrapper. # Calling actions from the DB class Choose # This method is called when the plugin is first loaded def initialize( status, config, output, irc, timer ) @status = status @config = config @output...
30.05
132
0.609817
2812c5e1423ada4e12979ffb863da46ca0cd752c
1,519
order = 962713854 pipe = order.to_s.split("").collect(&:to_i) pre = 10 maxv = 1000000 # need to rethink this (maybe use a linked list?) class Node attr_reader :val attr_accessor :link def initialize(val) @val = val @link = nil end end def printnodes(head) c = head.link print head.val while c !=...
16.692308
67
0.629361
f709f152c9257d925335299fff648a40f5f3c5bf
7,802
require 'spec_helper' describe BlobHelper do include TreeHelper describe '#highlight' do it 'wraps highlighted content' do expect(helper.highlight('test.rb', '52')).to eq(%q[<pre class="code highlight"><code><span id="LC1" class="line" lang="ruby"><span class="mi">52</span></span></code></pre>]) end...
34.370044
179
0.645091