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
01c4893bc27d83db9a501c6370844ad63958e6b0
4,305
# Copyright © 2011-2020 MUSC Foundation for Research Development~ # All rights reserved.~ # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:~ # 1. Redistributions of source code must retain the above copyright notice, this l...
37.112069
155
0.757724
1c7a94fbb5358fbd7d29359da9a0d5492cee6809
260
# frozen_string_literal: true class RunConsistencyChecksJob < ApplicationJob queue_as :default def perform(*_args) ConsistencyCheck.all.each do |consistency_check| Dttp::CheckConsistencyJob.perform_later(consistency_check.id) end end end
21.666667
67
0.780769
bb4de7dd548a96c5d795e8e4a07aa32221790888
962
# Submitting Private Code # 1. run for simulator # 2. run for device # 3. archive project # 4. upload libMonyx.framework to github # 5. create new release with version like in .podspec (for example 2.0.0) # 6. run: pod repo push https://github.com/paveljo/Specs.git libMonyx.podspec Pod::Spec.new do |s| s.name = '...
35.62963
91
0.650728
ab6feb53fb6a85071d40566e362d40220af697d1
428
require 'test_helper' class Cms::Fortress::SettingsTest < ActiveSupport::TestCase test "it_should_raise_MissingConfigFile_exception" do assert_raises (Cms::Fortress::Error::MissingSettingsFile) { Cms::Fortress::Settings.new(:bla) } end test "test_it_should_return_the_config_file" do settings ...
25.176471
63
0.752336
bb77f986329f512722d02e7d3aaa1291a28b6518
804
# # Cookbook Name:: attribute_settings # Recipe:: default # # Copyright 2009, Opscode # # 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 # ...
25.935484
74
0.747512
eddd0b2fca6ec51ab8bdfd280df67a2d7c5ba8ca
67
require "maor/version" module Maor # Your code goes here... end
11.166667
26
0.701493
e2c8eede18dfbbbb06c6fac59917bca18c408544
132
require 'test_helper' class EmailCertificationTest < ActiveSupport::TestCase # test "the truth" do # assert true # end end
16.5
54
0.727273
edc2e8c7b1d030ff5ceed26794fde268856c3088
264
# frozen_string_literal: true module GithubEventsExport # Save each Event to disk class Export def initialize(client) @client = client end def run Event.all(client).each(&:save) end private attr_reader :client end end
13.894737
36
0.659091
edecece72a18c283a45c95d1400eef5d5f254291
191
require 'link_previewer/version' require 'link_previewer/parser' require 'link_previewer/previewer' module LinkPreviewer def self.init(url) LinkPreviewer::Previewer.new(url) end end
19.1
37
0.795812
79334b1622453cf2ad2de16e1313ad65a9c7064e
899
module Services module Hubspot class HandleWebhook def initialize(webhook:) @webhook = webhook end def call case @webhook['subscriptionType'] when 'contact.propertyChange' return false unless webhook_valid? handle_webhook else false...
23.657895
109
0.596218
b90ff225b20217143824cb6673a9de32e72594b7
168
require 'test_helper' class StaticPagesControllerTest < ActionController::TestCase test "should get index" do get :index assert_response :success end end
16.8
60
0.761905
e9c9a494f9f88f1695696f8ec5b344caf8b686d1
137
class RemoveFechaInicioFromProyectos < ActiveRecord::Migration def change remove_column :proyectos, :fecha_inicio, :date end end
22.833333
62
0.79562
ff25e99955c877396f9767b18fe37b0e5736aa35
717
require 'spec_helper' require 'net/http' describe Lab2::LiveStreamConnection do it "requests an access token, connects to the live stream endpoint, and streams messages to stdout" do credentials = Lab::Credentials.new token_request = Lab2::TokenRequest.new(credentials.client_id, credentials.client_secret)...
27.576923
104
0.772664
7aef6e808c34448109d33fea7e5dcd69c9b1f18c
2,234
class Virtuoso < Formula desc "High-performance object-relational SQL database" homepage "https://virtuoso.openlinksw.com/wiki/main/" url "https://github.com/openlink/virtuoso-opensource/releases/download/v7.2.6.1/virtuoso-opensource-7.2.6.tar.gz" sha256 "38fd3c037aef62fcc7c28de5c0d6c2577d4bb19809e71421fc42093e...
37.233333
123
0.703223
87ad5deeb71c8b9f6e8b182adbd0f241543dd392
179
require 'gettext_i18n_rails' require 'gettext_i18n_rails_js/engine' require 'gettext_i18n_rails_js/js_and_coffee_parser' if RUBY_PLATFORM != 'java' module GettextI18nRailsJs end
25.571429
79
0.854749
3925ec72547ef6f208fcd4e7dcdc576a71b6efac
2,172
require 'test_helper' class PasswordResetsTest < ActionDispatch::IntegrationTest def setup ActionMailer::Base.deliveries.clear @user = users(:michael) end test "password resets" do get new_password_reset_path assert_template 'password_resets/new' # アドレス無効 post password_resets_path...
35.032258
72
0.655157
26ef4605fff31b9c7fe8d0c12dc0d1835663c86d
8,275
require 'spec_helper' describe EmailValidator do person_class = Class.new do include ActiveModel::Validations attr_accessor :email validates :email, :email => true end person_class_mx = Class.new do include ActiveModel::Validations attr_accessor :email validates :email, :email => {:mx =>...
29.343972
95
0.658489
21eae66299199933c1a8afa25973b558b005f2a4
5,160
# encoding: UTF-8 module Vines class Stanza class Iq class Roster < Query NS = NAMESPACES[:roster] register "/iq[@id and (@type='get' or @type='set')]/ns:query", 'ns' => NS def process validate_to_address get? ? roster_query : update_roster end ...
36.595745
98
0.597287
b92f743dccc3a1ecbff442db39ee96d3861cd810
146
require "test_helper" class CalendlyrTest < Minitest::Test def test_that_it_has_a_version_number refute_nil ::Calendlyr::VERSION end end
18.25
39
0.794521
619ad4cff55cef2d2145b74acce816d42b015d2d
2,243
require 'spec_helper' require 'support/test_model' describe ActiveRecordExtensions::CreateExtensions do describe '.update_or_create' do context 'when no records exists previously' do subject do TestModel.update_or_create({day: Date.today}, {foo: :bar}) end it { should be_an_instance_o...
26.388235
81
0.641106
e86319c8c6a7e7559e8a486439fb8231e9611f72
1,299
class OpenBabel < Formula desc "Chemical toolbox" homepage "https://openbabel.org" url "https://github.com/openbabel/openbabel/archive/openbabel-3-1-1.tar.gz" version "3.1.1" sha256 "c97023ac6300d26176c97d4ef39957f06e68848d64f1a04b0b284ccff2744f02" license "GPL-2.0" revision 1 head "https://github.com/o...
29.522727
94
0.718245
e224766ac9b73ceb5aa94316b84e06263c742fb3
5,431
#! /usr/bin/env ruby -S rspec require 'spec_helper' require 'puppet/util/rdoc' require 'rdoc/rdoc' describe Puppet::Util::RDoc do it "should fail with a clear error without RDoc 1.*" do Puppet.features.stubs(:rdoc1?).returns(false) expect { Puppet::Util::RDoc.rdoc("output", []) }. should raise_error(...
35.496732
123
0.648683
288660f1a6c85798db953be17f3abc251a85ec57
617
require File.dirname(__FILE__) + "/../spec_helper" describe IceCube::StringBuilder do describe :sentence do it "should return empty string when none" do expect(IceCube::StringBuilder.sentence([])).to eq("") end it "should return sole when one" do expect(IceCube::StringBuilder.sentence(["1"])...
28.045455
83
0.640194
4a14741909bc7c79ea445f1803e44f0f9b463636
737
describe 'POST api/v1/time_entries', type: :request do let!(:user) { create(:user) } subject { post api_v1_time_entries_path, params: params, headers: auth_headers, as: :json } context 'with valid params' do let(:params) { attributes_for(:time_entry) } it 'creates the time entry' do expect { subj...
27.296296
93
0.668928
91b98f382be66007c0ae6b125308662099b33946
576
# -*- coding: utf-8 -*- require 'rspec' describe 'JRUBY-6863' do let(:str) do str = "あいうえおかきくけこ" end subject do str.slice!(3..-1) # => "えおかきくけこ" end it 'String#index without args' do # See http://jira.codehaus.org/browse/JRUBY-xxxx expect(subject.index(/[^ ]/)).to eq(0) end it 'Strin...
19.2
52
0.59375
611c6093c21d4aefbecd5604d51a542a239228be
90
require 'baseline/hooks/create_site_data_pages' module Baseline module Hooks end end
12.857143
47
0.811111
abf7b4246e6c5037ee71e0c64054824903c4fe7c
4,301
class ErlangAT21 < Formula desc "Programming language for highly scalable real-time systems" homepage "https://www.erlang.org/" # Download tarball from GitHub; it is served faster than the official tarball. url "https://github.com/erlang/otp/archive/OTP-21.3.8.18.tar.gz" sha256 "3481a47503e1ac0c0296970b460d19...
32.832061
118
0.671239
1a18e4692b6805c68c3916919585218d46134bbd
9,251
require "danger/danger_core/executor" # If you cannot find a method, please check spec/support/ci_helper.rb. RSpec.describe Danger::Executor, use: :ci_helper do describe "#validate!" do context "with CI + is a PR" do it "not raises error on Bamboo" do with_bamboo_setup_and_is_a_pull_request do |sys...
34.011029
108
0.658307
212fd26a4b1578a77fc6e871789a3e497291dfd8
1,186
require File.expand_path("../../Abstract/abstract-php-extension", __FILE__) class Php55Couchbase < AbstractPhp55Extension init homepage "https://pecl.php.net/package/couchbase" desc "Provides fast access to documents stored in a Couchbase Server." url "https://pecl.php.net/get/couchbase-2.0.7.tgz" sha256 "04...
31.210526
95
0.757167
032ef3c7444a9b28061f5fbd8143e1f60b94d3aa
744
require 'spec_helper' @os_facts base_resources = YAML.load_file(File.dirname(__FILE__) + '/../resources/base_resources.yaml') tpinstalls = base_resources['tp__install'] describe 'sensu.lab.psick.io' do on_supported_os.each do |os, facts| context "on #{os}" do let(:facts) do OS_FACTS.merge(facts) ...
25.655172
93
0.596774
33204d3635207f826255fb263cea6be1500ed299
3,307
## # $Id$ ## ## # This file is part of the Metasploit Framework and may be subject to # redistribution and commercial restrictions. Please see the Metasploit # web site for more information on licensing and terms of use. # http://metasploit.com/ ## require 'msf/core' class Metasploit3 < Msf::Exploit::Remote Rank ...
29.526786
98
0.573632
265d972fb2ece75e391d40ce946cf8cc6eab0cf9
1,203
class Ddgr < Formula include Language::Python::Shebang desc "DuckDuckGo from the terminal" homepage "https://github.com/jarun/ddgr" url "https://github.com/jarun/ddgr/archive/v1.8.1.tar.gz" sha256 "d223a3543866e44e4fb05df487bd3eb23d80debc95f116493ed5aad0d091149e" license "GPL-3.0" bottle do cellar :...
36.454545
94
0.773067
7af165b68a72d0b3e47071d3a8892063f2dbce76
711
# frozen_string_literal: true class AbrahamHistoriesController < ApplicationController def create @abraham_history = AbrahamHistory.new(abraham_history_params) @abraham_history.creator_id = current_account.id respond_to do |format| if @abraham_history.save format.json { render json: @abraha...
30.913043
91
0.73699
ff77b29d8960fc5f6158f03592797393a52e5b95
54,928
# -*- coding: utf-8 -*- require 'json' require 'net/imap' require 'optparse' require 'pp'if $DEBUG require 'riser' require 'yaml' OptionParser.accept(JSON) do |json_data, *_| begin JSON.load(json_data) rescue raise OptionParser::InvalidArgument, json_data end end module RIMS module Cmd CMDs = {} ...
32.59822
166
0.517059
01121bd7069372ff3602536aeacd5031da73e87d
816
# frozen_string_literal: true class Instructor < ApplicationRecord has_and_belongs_to_many :positions validates_presence_of :last_name, :first_name, :utorid validates_uniqueness_of :utorid # Returns a formatted string displaying the instructor's contact information def contact_info if ema...
23.314286
80
0.645833
ac5836a588e0a21c3635a9d2085241562096cd4f
1,083
require 'active_support/all' require 'action_controller' module Rails module ConsoleMethods # reference the global "app" instance, created on demand. To recreate the # instance, pass a non-false value as the parameter. def app(create=false) @app_integration_instance = nil if create @app_integ...
28.5
80
0.692521
39b68e7e907c3fd026b3435dc202b4b029a6a4ed
9,108
require 'spec_helper' describe PushRule do using RSpec::Parameterized::TableSyntax let(:global_push_rule) { create(:push_rule_sample) } let(:push_rule) { create(:push_rule) } let(:user) { create(:user) } let(:project) { Projects::CreateService.new(user, { name: 'test', namespace: user.namespace }).execute }...
31.735192
110
0.657115
5d240c76d304e4161b5a7552f8a64bb87b704da1
10,962
# encoding: utf-8 module CarrierWave ## # This module simplifies manipulation with RMagick by providing a set # of convenient helper methods. If you want to use them, you'll need to # require this file: # # require 'carrierwave/processing/rmagick' # # And then include it in your uploader: # # ...
30.792135
208
0.627349
79cba3d3dc3a9e225a17eddd11bcfce2622e8c40
451
class CreateBlogPosts < ActiveRecord::Migration[5.1] def change create_table :blog_posts do |t| t.string :title t.string :post_image t.text :body t.references :user, foreign_key: true t.integer :status t.integer :post_type t.boolean :post_public t.boolean :post_publ...
22.55
52
0.651885
b9ef63243a36504a4502e1a168fc95d91c46e28e
224
unless defined?(APP_PATH) if File.exist?(File.expand_path("test/dummy/config/application.rb", ENGINE_ROOT)) APP_PATH = File.expand_path("test/dummy/config/application", ENGINE_ROOT) end end require "rails/commands"
28
83
0.767857
62e95993d940e3c852f4620c4190e2a611ea81f3
345
cask :v1 => 'itools' do version '2.4.6' sha256 '412dcd5a082ebf88566a4422e4c1d127e063a65ad9d8f3917e0b29e871da6783' # itools.hk is the official download host per the vendor homepage url "http://dl2.itools.hk/dl/iTools_#{version}.dmg" name 'iTools' homepage 'http://pro.itools.cn/mac/english' license :gratis...
26.538462
75
0.73913
bb733b52b3402887501741c5d16fca009d9a49fc
5,287
# # Be sure to run `pod spec lint testPod.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 https://guides.cocoapods.org/syntax/podspec.html # To see working Podspecs in the CocoaPods repo see https://github...
37.496454
117
0.60488
bf1c8ceaed3aede449629dd3ac3a190b585357b7
10,688
module ActionView # = Action View Cache Helper module Helpers module CacheHelper # This helper exposes a method for caching fragments of a view # rather than an entire action or page. This technique is useful # caching pieces like menus, lists of new topics, static HTML # fragments, and ...
41.426357
124
0.628743
4a691a35c3402edb7ab1d478082d6ef0e2ab12d3
336
class Benchmarker def initialize(target, size) end def setup end def generate end def run(args=nil) # Just running help is probably a good proxy of a full startup. # Simply asking for the version might also be good, but it would miss all # of the app searching and loading parts `puppet ...
18.666667
77
0.696429
871d0bc09a7b96b3d5b2c8f80b687ddd8fcd95a5
1,530
require 'spec_helper' module Spree module Stock module Splitter describe ShippingCategory do let(:variant1) { build(:variant) } let(:variant2) { build(:variant) } let(:shipping_category_1) { create(:shipping_category, name: 'A') } let(:shipping_category_2) { create(:shippin...
31.22449
82
0.637255
1880f84ecff209c61d00fe95e31b4b751d5f27b2
1,789
require 'spec_helper' describe 'odoo::repo9' do let(:pre_condition) do [ 'class apt() {}', 'define apt::key($ensure, $id, $source) {}', 'define apt::source($ensure, $location, $comment, $release, $repos, $include) {}', 'class apt::update() {}' ] end let!(:stdlib_stubs) do Mock...
24.175676
88
0.568474
26c064faf3b69c67177df328180556bb533067d5
511
class FakeStarReadingResultGenerator def initialize(student, options = {}, index) @student = student @index = index @start_date = options.fetch(:start_date) @days_between_tests = options.fetch(:days_between_tests) end def next return { date_taken: @start_date + (@index * @days_between_t...
26.894737
64
0.65362
214381b0b45490462eed1ebe1326197b3325fe4d
296
module AppleNews module Component module ScalableImage extend ActiveSupport::Concern included do required_property :url optional_properties :accessibility_caption, :caption, :explicit_content property_inflection :url, 'URL' end end end end
19.733333
79
0.692568
87865b7aa1d5b37ac0d3b6fee05d5a120e3d6388
237
# frozen_string_literal: true FactoryBot.define do factory :review do association :account association :project title { Faker::Lorem.characters(number: 16) } comment { Faker::Lorem.characters(number: 1024) } end end
21.545455
53
0.7173
33c2290759041c90a751a0670cc54795ab58248e
170
class Process class << self def on(event, &callback) `process.on(#{event}, #{callback})` end def platform `process.platform` end end end
14.166667
41
0.582353
d50ffc79af7d680241f755472e6ce1f3509bc501
257
# frozen_string_literal: true module Lokalise module Collections class Translation < Base class << self def endpoint(project_id, *_args) path_from projects: [project_id, 'translations'] end end end end end
18.357143
58
0.642023
4a54ae6ad55f035e10b16a14971fbbdd3e61ea1d
1,437
class <%= controller_name %> < Application # provides :xml, :yaml, :js def index @<%= plural_name %> = <%= class_name %>.all display @<%= plural_name %> end def show(id) @<%= name %> = <%= class_name %>.get(id) raise NotFound unless @<%= name %> display @<%= name %> end def new on...
24.775862
108
0.527488
f71287cec07ecb10437298afdfc40cd9ee5ed180
343
module Amistad module FriendshipModel def self.included(receiver) if receiver.ancestors.map(&:to_s).include?("ActiveRecord::Base") receiver.class_exec do include Amistad::ActiveRecordFriendshipModel end else raise "Amistad only supports ActiveRecord and Mongoid" ...
24.5
70
0.676385
b9a6a312107b7f3b7da006c0869bc6058aa1c433
849
class Web < Sinatra::Base get '/' do erb :web end get '/redirect' do return if Bot&.instance && Bot.instance.client_started? begin log = Log.create log.getting_token web_client = Slack::Web::Client.new rc = web_client.oauth_access( client_id: configatro...
22.342105
60
0.594817
e99ae11a53c27559a3ce61db467ad9a1ce47186c
646
module Nmax ## Storage class for storage sorted numbers class Storage def initialize(size:) @sorted_storage = SortedSet.new @size = size end def add(number) return if @sorted_storage.include?(number) if @sorted_storage.size < @size @sorted_storage.add(number) else...
18.457143
48
0.637771
914ab7e42270b9d177073064e183eb458bb6fd4e
1,315
{ matrix_id: '1776', name: 'stat96v5', group: 'Meszaros', description: 'linear programming problem, C. Meszaros test set', author: '', editor: 'C. Meszaros', date: '2005', kind: 'linear programming problem', problem_2D_or_3D: '0', num_rows: '2307', num_cols: '75779', nonz...
29.222222
106
0.647148
d5aea3201f97fa6f762b225653f8be53d2694fba
146
# Be sure to restart your server when you modify this file. Rails.application.config.session_store :cookie_store, key: '_nineties_slang_session'
36.5
84
0.815068
5d4fc59fb95afecaa69e47bcefa7cda7fd1c96b7
1,071
# frozen_string_literal: true require 'spec_helper' require 'rubocop' require 'rubocop/rspec/support' require_relative '../../../../rubocop/cop/migration/add_column_with_default' describe RuboCop::Cop::Migration::AddColumnWithDefault do include CopHelper let(:cop) { described_class.new } context 'outside of...
25.5
116
0.666667
e9e86c0d22b6803fb6c0fbbf830d05d4662a0a88
326
class CreateRefunds < ActiveRecord::Migration def change create_table :refunds do |t| t.integer :provider_id t.integer :claimant_id t.float :amount_requested t.date :date_received t.float :amount_received t.date :date_posted t.text :reason t.timestamps end en...
20.375
45
0.662577
9131dac5c84073e0f5f704b2a47f00c6410f44b0
652
Rails.application.configure do config.lograge.enabled = true config.lograge.custom_options = lambda do |event| { pid: Process.pid, ip: event.payload[:ip], user: event.payload[:user], time: event.time.utc.strftime("%Y-%m-%dT%H:%M:%SZ"), params: event.payload[:params].except(*%w(cont...
40.75
245
0.633436
ab19b15563a9188d8383a217197f4e556f31d940
677
# Behaviors class Behavior < ApplicationRecord belongs_to :client has_many :behavior_reports validates :description, presence: true attr_encryptor :description, key: Rails.application.secrets.behavior_description_key, algorithm: 'aes-256-cbc', mode: :single_iv...
21.83871
73
0.686854
397eaee068c2d495dc6246ed7fd3d78ac977a6ab
4,777
require 'spec_helper' # Snippet visibility scenarios are included in more details in spec/support/snippet_visibility.rb describe PersonalSnippetPolicy do let(:regular_user) { create(:user) } let(:external_user) { create(:user, :external) } let(:admin_user) { create(:user, :admin) } let(:author_permissions) do...
28.951515
97
0.694369
62f8add0264cc41a6e817da9a3224f4db6cf4c36
906
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "an included module" do module A def foo "foo" end end module B; include A; end module C; include B; end module D; include B; end it "should still be included after reincarnation" do A.reincarnate module A ...
19.276596
65
0.609272
ac5d55d2ab719c83193e3142fbb54d3e78c3707f
3,188
# frozen_string_literal: true class Fisk module Instructions # Instruction VBROADCASTSD forms = [] operands = [] encodings = [] # vbroadcastsd: ymm{k}{z}, xmm operands << OPERAND_TYPES[59] operands << OPERAND_TYPES[24] encodings << Class.new(Fisk::Encoding) { def encode buffer, ...
27.016949
57
0.576851
f8bf4124443145cf885ddb5900d98cdad320acce
240
module GymcloudAPI::V2 module Entities class UserAuthentication < Grape::Entity expose :id expose :email expose :provider do |auth| auth.authentication_provider.name end expose :created_at expose :updated_at end end end
13.333333
40
0.754167
4a5a668cff394beafb5fe9c301be421001447160
908
require 'test_helper' class StaticPagesControllerTest < ActionDispatch::IntegrationTest # test "the truth" do # assert true # end test "should get home" do get '#home' assert_response :success assert_select "title", "Ruby on Rails Tutorial Sample App" end test "should get help" do get hel...
26.705882
72
0.711454
ff78f8b12059bd2ccddae61dc95e565309dc9df8
2,720
description "Toolkit Kickstart" # Stylesheets file '../shared/style.scss', :like => :stylesheet, :media => 'screen, projection', :to => 'style.scss' file '_base.scss', :like => :stylesheet, :to => 'partials/global/_base.scss' file '../shared/_variables.scss', :like => :stylesheet, :to => 'partials/global/_variables...
46.896552
216
0.689338
5d1e6d0028ef43df63ef3b2b096eec6755f26f31
183
# frozen_string_literal: true class CreateJmxes < ActiveRecord::Migration[5.2] def change create_table :jmxes do |t| t.string :name t.timestamps end end end
15.25
48
0.677596
3881179f74f3f6bbe78933137b5f7a18ac018270
1,181
# encoding: utf-8 $:.push File.expand_path("../lib", __FILE__) require "audited/version" Gem::Specification.new do |gem| gem.name = 'audited' gem.version = Audited::VERSION gem.authors = ['Brandon Keepers', 'Kenneth Kalmer', 'Daniel Morrison', 'Brian Ryckbost', 'Steve Richert', 'Ryan Glover'] gem.email...
39.366667
126
0.684166
62152c327ab240aacc893942099611d6a86d3511
554
# frozen_string_literal: true FactoryBot.define do factory :naive_mooc_provider_user, class: 'MoocProviderUser' do association :user_id, factory: :user association :mooc_provider_id, factory: :mooc_provider sequence(:access_token) {|n| "token#{n}" } end factory :oauth_mooc_provider_user, class: 'Moo...
32.588235
65
0.738267
6aad2d1c0cb7ec09b365d6de0e5c2f70cf79b684
508
require 'net/http' require 'uri' module Api::V1::UserHelper TOKEN = '' def transaction_result?(amount:, destination:) url = 'http://api.goldbank.ru/transfer' query = { amount: amount, currency: 'USD', destination: destination, token: TO...
18.142857
68
0.535433
21f8c2708024df6dffecb77844cfc6f75526679b
677
class SessionsController < ApplicationController def new end def create user = User.find_by(email: params[:session][:email].downcase) if user && user.authenticate(params[:session][:password]) if user.activated? log_in user params[:session][:remember_me] == '1' ? remember(user) : fo...
23.344828
91
0.648449
5d9a45b9a77c0a8482faa3eab3f4f52e4271310d
843
# frozen_string_literal: true module SolidusShipstation module Api class ThresholdVerifier class << self def call(shipment) return false unless shipment.order.completed? !!(shipment_requires_creation?(shipment) || shipment_requires_update?(shipment)) end privat...
29.068966
100
0.680902
5dbb6004209eba0688892000165e4220d13d5c03
283
def intersection(nums1, nums2) lookup_table = Array.new(1001, nil) nums1.each { |num| lookup_table[num] = true } intersection = [] nums2.each do |num| if lookup_table[num] == true intersection << num lookup_table[num] = false end end intersection end
21.769231
47
0.657244
e810529af1822082131b080e579f7760c4339717
2,171
class Libphonenumber < Formula desc "C++ Phone Number library by Google" homepage "https://github.com/google/libphonenumber" url "https://github.com/google/libphonenumber/archive/v8.12.20.tar.gz" sha256 "a318a40272587305c2e2d6f0663c06f6d7bdb0d0be0877bfd67518a3cdfffe33" license "Apache-2.0" livecheck do ...
35.016129
122
0.676647
918262a1fd6bd7cb3497d8208dea281efcffc45b
2,018
############################################################################### # Copyright 2012-2013 inBloom, Inc. and its affiliates. # # 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 # # htt...
38.075472
124
0.650644
9193d2ee3dd6b83db94e3c485c2668642e2671c7
1,860
require 'shopify_cli' module ShopifyCli module Commands class Connect < ShopifyCli::Command class << self def call(args, command_name) ProjectType.load_type(args[0]) unless args.empty? super end def help ShopifyCli::Context.message('core.connect.help',...
28.615385
90
0.615591
bb9128639614a6b95e5facf9fda45a0d2e8c64a6
693
require './config/environment' class ApplicationController < Sinatra::Base configure do set :public_folder, 'public' set :views, 'app/views' enable :sessions set :session_secret, "my_app_secret" register Sinatra::Flash end get "/" do erb :'welcome' end helpers do def l...
16.5
98
0.676768
1836618c064200bd1604bc0a0f6d9fcb4fbf67fe
1,558
=begin #Topological Inventory Ingress API #Topological Inventory Ingress API The version of the OpenAPI document: 0.0.2 Contact: support@redhat.com Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.2.0 =end require 'spec_helper' require 'json' require 'date' # Unit tests for TopologicalInve...
28.851852
115
0.766367
613efd9de9777b955193d79da33c2d5efee4a18e
5,789
require 'spec_helper' # This spec was generated by rspec-rails when you ran the scaffold generator. # It demonstrates how one might use RSpec to specify the controller code that # was generated by Rails when you ran the scaffold generator. # # It assumes that the implementation code is generated by the rails scaffold ...
33.853801
169
0.658836
79abba78c0737f6f445549e68feead65c7582931
155
class BadgeGroupingSerializer < ApplicationSerializer attributes :id, :name, :description, :position, :system def system object.system? end end
19.375
57
0.754839
4a8683d925805c13359dbc0d3d3114e3940522c7
2,828
Sequel.migration do up do # The denormalised pact publication details for each publication create_view(:all_pact_publications, Sequel::Model.db[:pact_publications].select( Sequel[:pact_publications][:id], Sequel[:c][:id].as(:consumer_id), Sequel[:c][:name].as(:consumer_name), Sequel[:c...
49.614035
173
0.732673
010d9d865082bc0cd6f6e92b541a937c017cd8ec
285
require 'rails_helper' describe 'JustDatetimePickerInput', type: :feature do context 'Form' do before do add_user_resource end it 'shows input' do visit new_admin_user_path expect(page).to have_css('.just_datetime_picker', count: 1) end end end
19
65
0.691228
876025a5dbac62ef834e782a5bbf256697dfe977
88
$LOAD_PATH << "#{File.dirname(__FILE__)}/../lib" require 'compiler' Compiler.make_all
14.666667
48
0.704545
26def9261d5d920d0b917842c9e747b7136f8001
589
module Recurr module Events class Base attr_reader :options, :starts attr_accessor :start_year, :start_month, :start_day DAY_REPRESENTATION = 24 * 3600 def initialize(options) @options = options @starts = options[:starts]&.to_time ...
19.633333
59
0.573854
d54a3282b7d6070c1e58efefbd69682b17a2a9c0
2,491
Addressbookserver::Application.configure do # Settings specified here will take precedence over those in config/application.rb # Code is not reloaded between requests config.cache_classes = true # Full error reports are disabled and caching is turned on config.consider_all_requests_local = false con...
36.632353
104
0.760739
38987a2025c4e81161ae70e6712dadff4a9a7cef
700
# # This code handles the creation of the github client with or without an auth token # # This class smells of :reek:UtilityFunction class GithubListerCore class << self # # Everything from here is private # private # # Initialise the client and set auto_paginate to...
25
83
0.522857
79dd5bb69f11006d650eb9ba120b2dbca6dc658f
488
module SS::Model::MailSetting extend ActiveSupport::Concern extend SS::Translation included do field :sender_name, type: String field :sender_email, type: String field :mail_signature, type: String permit_params :sender_name, :sender_email, :mail_signature validates :sender_email, email: tr...
25.684211
64
0.727459
bbc71a03f51264e34572a6239a9e8188ab40bd1d
16,998
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ # # Copyright (c) 2016, Electric Power Research Institute (EPRI) # All rights reserved. # # OpenADR ("this software") is licensed under BSD 3-Clause license. # # Redistribution and use in source and binary forms, with or without m...
57.425676
206
0.62678
e28554f08c0a2b6b57fab7fb86ebd1ff8304543f
434
# These are Class level methods. module Effective module EffectiveDatatable module Dsl def datatable(&block) define_method('initialize_datatable') { instance_exec(&block) } end def scopes(&block) define_method('initialize_scopes') { instance_exec(&block) } end def...
19.727273
71
0.652074
bb3feafa692471af6e42091e97a3c5efc8ecaad4
6,030
# All Devise controllers are inherited from here. class DeviseController < Devise.parent_controller.constantize include Devise::Controllers::ScopedViews helper DeviseHelper helpers = %w(resource scope_name resource_name signed_in_resource resource_class resource_params devise_mapping) helper_me...
30.15
113
0.729187
62709633d2e891e5b625cd24b6841d5e671f9005
2,605
module Enumerable # see: http://stackoverflow.com/a/7139631/83386 def value_at_keypath(keypath) keypath = keypath.to_s if keypath.is_a?(KeyPath::Path) parts = keypath.split '.', 2 # if it's an array, call the index if self[parts[0].to_i] match = self[parts[0].to_i] else match = sel...
27.712766
123
0.663724
4af4b66dd87ada6c4485c8b0c02739f2d644accf
1,432
class VersionDiffer def print_latest(io = $stdout) io.puts diff(last_version, ".") end def update(path) old = File.read(path) File.open(path, "w") do |file| show_latest(file) file << old end end def generate(path) versions = released_versions versions.unshift "." ve...
24.271186
131
0.630587
4aafcb9fd3caafddeb5004628d9ed655a99808e3
1,261
require 'uri' require 'puppet/file_serving' require 'puppet/util' # This module is used to pick the appropriate terminus # in file-serving indirections. This is necessary because # the terminus varies based on the URI asked for. module Puppet::FileServing::IndirectionHooks PROTOCOL_MAP = {"puppet" => :rest, "file" ...
39.40625
125
0.720856
7a1ffde093756057f0f811c5128f1a678cee457a
41
Thepivotstudy::Engine.routes.draw do end
13.666667
36
0.829268
bba57dc94644d24ced57ce82f0f4cb9f22e9dc4f
2,269
#! /usr/bin/env ruby -S rspec require 'spec_helper' describe Puppet::Parser::Functions.function(:private) do let(:scope) { PuppetlabsSpec::PuppetInternals.scope } subject do function_name = Puppet::Parser::Functions.function(:private) scope.method(function_name) end it 'should issue a warn...
37.196721
240
0.669899
f8ebefb6067eee2e0fbf6c2eaf6b5406453e7ca7
71
# frozen_string_literal: true module ApiGuard VERSION = '0.4.2' end
11.833333
29
0.732394
1a4f56420520e6f8d4c5514172bcd0d10ce8d027
124
class Tag < ApplicationRecord has_many :tag_relates, dependent: :destroy has_many :data_sets, through: :tag_relates end
24.8
44
0.790323
bf5745e6ca3016f4205b3cbb97b45e2bad7b0f0c
32
require "rps" require "stringio"
16
18
0.78125
26e21adfc385607076321c8f0828bbbbb9e592b7
1,856
require 'spec_helper' EMAILS = { welcome_email: "successfully registered", rejected_email: "is rejected", verified_email: "successfully verified" } EMAILS.each do |key, value| RSpec.shared_examples key do it "has #{key} specific text in body" do expect(body).to include(value) end it "has use...
26.514286
89
0.696659