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 |
|---|---|---|---|---|---|
797bf9dfd62f720d7e31dbc5cb0726cf34a06721 | 1,209 | ##
# This file is part of WhatWeb and may be subject to
# redistribution and commercial restrictions. Please see the WhatWeb
# web site for more information on licensing and terms of use.
# http://www.morningstarsecurity.com/research/whatweb
##
# Version 0.2 # 2011-02-25 #
# Updated version detection
##
Plugin.define "... | 31 | 211 | 0.719603 |
61eafd7dc50d92b9b8e574ff0d4f5e54980d67c6 | 1,215 | require_relative "../lib/cmake"
class Libalkimia < Formula
desc "Library used by KDE Finance applications"
homepage "https://kmymoney.org"
head "https://invent.kde.org/office/alkimia.git", branch: "master"
stable do
url "https://download.kde.org/stable/alkimia/8.1.0/alkimia-8.1.0.tar.xz"
sha256 "91680... | 30.375 | 105 | 0.702881 |
b9888bec37b04ff4a03a02a2ac15429d80c00788 | 3,218 | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# Check that a copyright notice was given in each source file.
#
# The default regexp for an acceptable copyright notice can be found in
# config/default.yml. The default can be changed as follows:
#
# Style... | 32.18 | 82 | 0.610938 |
1afaeac783bbc1ff8201b3c456450f111fb52168 | 370 | require 'rails_helper'
RSpec.describe PostsController, type: :controller do
describe '#render_404' do
before do
def controller.index
raise ActiveRecord::RecordNotFound
end
end
it 'renders the 404 page with' do
get :index
expect(response.code).to eq "404"
expect(resp... | 20.555556 | 52 | 0.667568 |
6a2d116fc2a59ebaee7ed273c3030d823e2649c6 | 149 | class AddSpaceNameToSpaceTemplateSpaces < ActiveRecord::Migration
def change
add_column :space_template_spaces, :space_name, :string
end
end
| 24.833333 | 65 | 0.812081 |
01901382f31d4f892c6ddafb27098fa2841d892c | 2,622 | # Copyright 2017 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, ... | 36.929577 | 112 | 0.7254 |
622a66e9d0556ef606f41b880b44e2cd5d717b10 | 683 | #
# Cookbook Name:: apache2
# Recipe:: autoindex
#
# Copyright 2008-2009, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | 29.695652 | 74 | 0.749634 |
bf9c56151b940643535f311c70474a4144348c56 | 11,108 | module Devise
module LDAP
class Connection
attr_reader :ldap, :login
def initialize(params = {})
if ::Devise.ldap_config.is_a?(Proc)
ldap_config = ::Devise.ldap_config.call
else
ldap_config = YAML.load(ERB.new(File.read(::Devise.ldap_config || "#{Rails.root}/config... | 37.026667 | 215 | 0.640889 |
ff1d961abf7bbccb7677d6c45e05a1e9bd2a4317 | 502 | def dfs(i, total)
return if total >= @min || @hash[i] && total >= @hash[i]
@hash[i] = total
return @min = total if i >= @days.size
@costs.each do |cost, day|
tmp = @days[i] + day
j = @days.bsearch_index { |ele| ele >= tmp } || @days.size
dfs(j, total+cost)
end
end
# @param {Integer[]} days
# @par... | 23.904762 | 62 | 0.579681 |
1dd22d7a3ae0f25fa0b8590b6085de7a9bddbabc | 1,755 | # frozen_string_literal: true
module Groups
class CreateService < Groups::BaseService
def initialize(user, params = {})
@current_user, @params = user, params.dup
@chat_team = @params.delete(:create_chat_team)
end
def execute
remove_unallowed_params
@group = Group.new(params)
... | 24.041096 | 120 | 0.645014 |
38a2e48e77e4097660081b9b5830065dc96fd3e4 | 181 | class AddStripePaymentMethodIdToAccount < ActiveRecord::Migration[6.0]
def change
add_column :accounts, :stripe_payment_method_id, :string, null: false, default: ""
end
end
| 30.166667 | 86 | 0.773481 |
1cc2c4573598c71ad7a0125051e398a9796c84e0 | 412 | class CreatePaymentCards < ActiveRecord::Migration[5.1]
def change
create_table :payment_cards do |t|
t.belongs_to :organization, null: false, index: true, foreign_key: true
t.string :stripe_id, null: false
t.string :brand, null: false
t.integer :exp_month, null: false
t.integer :exp... | 29.428571 | 77 | 0.674757 |
6abfcfab8a0d4a317ccb1f1dbb8264e0688c0b4a | 1,997 | # Inspired by:
# https://github.com/ruby-debug/ruby-debug-ide/blob/master/ext/mkrf_conf.rb
# This file needs to be named mkrf_conf.rb
# so that rubygems will recognize it as a ruby extension
# file and not think it is a C extension file
require 'rubygems/specification'
require 'rubygems/dependency'
require 'rubygems/... | 31.203125 | 75 | 0.651477 |
08d3bd6f804104c6eb7a5dcfd7778179f46808df | 517 | module Shoulda
module Matchers
# @private
class Error < StandardError
def self.create(attributes)
allocate.tap do |error|
attributes.each do |name, value|
error.__send__("#{name}=", value)
end
error.__send__(:initialize)
end
end
def... | 17.233333 | 45 | 0.516441 |
d5272bad409ade6eb5d2b5417ad48145b3135416 | 162 | class AddDeactivatedAtToInstitutions < ActiveRecord::Migration[5.2]
def change
add_column :institutions, :deactivated_at, :datetime, default: nil
end
end
| 27 | 70 | 0.783951 |
117511bcca192410ef288af4df8dc8a33b5265df | 9,366 | # Copyright (c) 2018-2019 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: MIT
# DO NOT MODIFY. THIS CODE IS GENERATED. CHANGES WILL BE OVERWRITTEN.
# vcenter - VMware vCenter Server provides a centralized platform for managing your VMware vSphere environments
require 'date'
module VSphereAutomation
... | 38.073171 | 446 | 0.657698 |
335cb1cf2bc40e0460bcbbe0b2773ccf89a01f64 | 4,210 | Rails.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
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... | 40.873786 | 102 | 0.738242 |
ed27dbfbadf21e793609a469fc4686187a2dae8c | 1,102 | module ApiLocationEventsConcern
extend ActiveSupport::Concern
included do
private
def create_json(resource)
resource.as_json(only: [:id, :event_id, :problem_id, :active, :length, :active_at, :created_at])
end
def update_json(resource)
resource.as_json(only: [:id, :event_id, :problem_id... | 36.733333 | 149 | 0.583485 |
4a5fb169c936b98c0ca846046ce9cc9aba00bba9 | 275 | require 'spec_helper'
module TestFactories
module Fact
describe ID do
let(:fixed_id) { described_class.fixed_id }
it 'fixed_id is exactly this fixed id' do
expect(fixed_id).to eq '825e44d5-af33-4858-8047-549bd813daa8'
end
end
end
end
| 18.333333 | 69 | 0.68 |
331efa5259a9d8e24f74754a86b990cbed1dba17 | 708 | require "resqued/config"
require "resqued/runtime_info"
module Resqued
module TestCase
module LoadConfig
# Test your resqued config.
#
# If you do this to start resqued:
#
# $ resqued config/resqued-environment.rb config/resqued-workers.rb
#
# Then you'll want to do ... | 24.413793 | 87 | 0.639831 |
01749ff6d1dd2332fb2369febf2522df2468df92 | 52 | puts gets.match(/[$T].*G.*[$T]/) ? 'quiet': 'ALARM'
| 26 | 51 | 0.5 |
281737d9759f47643483179ad539dba97a216ff2 | 210 | require 'test_helper'
class <%= class_name %>PolicyTest < ActiveSupport::TestCase
def test_scope
end
def test_create
end
def test_show
end
def test_update
end
def test_destroy
end
end
| 10.5 | 59 | 0.714286 |
1cab0bd63214dbb3ba59bf4b9246901f5e6c8612 | 467 | module Jargon
class Localizations < Jargon::Resource
include Jargon::Helpers
include Jargon::Locales
def query(params = {})
rejects_id
client.get('/localizations', params)
end
def get
expects_id
client.get("/localizations/#{id}")
end
def save(localization)
... | 17.961538 | 49 | 0.62955 |
f8127789616cc5f2c9ad837c9346d7f74f486b96 | 1,131 | # frozen_string_literal: true
require './lib/version'
Gem::Specification.new do |spec|
spec.name = 'danger-shiphawk-plugin'
spec.version = Danger::ShipHawkPlugin::VERSION
spec.summary = 'A Danger plugin for running Ruby files through Rubocop.'
spec.description ... | 36.483871 | 88 | 0.640141 |
03083b0d4f74148fa2de14b5a47312eea6debb21 | 10,578 | #-- copyright
# ReportingEngine
#
# Copyright (C) 2010 - 2014 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.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT AN... | 31.20354 | 125 | 0.670259 |
6267703e5dc45d2a9bcc9daaf8ef06e3c6782ffb | 447 | class Candybar < Cask
version '3.3.4'
sha256 'f305596f195445016b35c9d99a40789c6671195e9cbad0b6e92e808b6c633ad6'
url "https://panic.com/candybar/d/CandyBar%20#{version}.zip"
homepage 'http://www.panic.com/blog/candybar-mountain-lion-and-beyond'
app 'CandyBar.app'
caveats <<-EOS.undent
Candybar is free ... | 31.928571 | 75 | 0.749441 |
791d66166eedd7c39966d26ebe36ec9d499a5b8f | 572 | class Catalog::Property < ActiveRecord::Base
validates :name, presence: true, uniqueness: true
has_many :product_properties, class_name: Catalog::ProductProperty,
foreign_key: :catalog_property_id,
dependent: :delete_all
has_many :category_properties... | 40.857143 | 71 | 0.608392 |
1a7243a7111c821e30d127762fe0491582dc83a9 | 551 | #
# RSMP base class
#
module RSMP
module Logging
attr_reader :archive, :logger
def initialize_logging options
@archive = options[:archive] || RSMP::Archive.new
@logger = options[:logger] || RSMP::Logger.new(options[:log_settings])
end
def author
end
def log str, options={}
... | 21.192308 | 78 | 0.638838 |
5df1d4c5ca2ded3a44043281b551944c7266e909 | 167 | class AddHstore < ActiveRecord::Migration
def up
execute 'CREATE EXTENSION IF NOT EXISTS hstore'
end
def down
execute 'DROP EXTENSION hstore'
end
end
| 16.7 | 51 | 0.724551 |
7a1d8a808edb4b8e7bd821fb81534413d9d0b27a | 389 | cask 'whatpulse' do
version '2.6'
sha256 '90fecfd945d78b2b38900765a16f0a6d1114badd636629b45cf0f59d585b130b'
url "http://amcdn.whatpulse.org/files/whatpulse-mac-#{version}.dmg"
name 'WhatPulse'
homepage 'http://www.whatpulse.org/'
license :gratis
pkg "WhatPulse #{version}.mpkg"
uninstall pkgutil: 'com... | 25.933333 | 75 | 0.722365 |
ac4c80a35568a85bff6302aca7de9f1b3794d8d4 | 6,201 | # encoding: utf-8
# author: Dominik Richter
# author: Christoph Hartmann
require 'helper'
describe Inspec::MockProvider do
let(:subject) { Inspec::MockProvider.new(target) }
describe 'without data' do
let(:target) {{ mock: {}}}
it 'has no files on empty' do
subject.files.must_equal []
end
end... | 30.101942 | 82 | 0.601838 |
0378a1869143cda6113cef486754f3e6f717596e | 1,732 | #
# Be sure to run `pod lib lint SEETools.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'SEETools'
... | 25.850746 | 109 | 0.62067 |
61cbda2e0aaeda1e6740b9a6f2e35ed49df2e3c7 | 471 | #
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
describe "FFI.errno" do
module LibTest
extend FFI::Library
ffi_lib TestLibrary::PATH
attach_function :setLastError, [ :int ], :void
end
it "FFI.errno co... | 22.428571 | 74 | 0.721868 |
1d3c9ba2c061da7deef8696441cfd3d954bdd25c | 1,143 | module CanBeConstrained
def constraint
#Don't bother storing it, and most importantly, don't reuse it because things like multipler and constant must always be reset
PurplishLayout::ConstraintProxy.new(self)
end
def constrained_views(*views, &block)
block.call(*(views.map {|e| e.constraint}))
end
... | 22.411765 | 130 | 0.651794 |
bf69f8405a9e672f634afb59beb2f324d1ee7edb | 2,658 | module MiqReport::Notification
def notify_user_of_report(run_on, result, options)
userid = options[:userid]
url = options[:email_url_prefix]
user = User.lookup_by_userid(userid)
from = options[:email] && !options[:email][:from].blank? ? options[:email][:from] : ::Settings.smtp.from
to = options... | 37.43662 | 135 | 0.62453 |
bf69c5dd4fba794d1fd6bdf0366d7a530d7c1ca1 | 1,128 | module Beekeeper
class Logger
def self.fatal(error, logger: nil)
message = if error.respond_to? :backtrace
message_with_backtrace(error)
else
error
end
internal_logger(logger).fatal message
end
def self.error(error, logger: n... | 26.857143 | 106 | 0.590426 |
3816edfc1f9a901a0fcdfabdc2619bf11fc38c33 | 1,281 | class Passwdqc < Formula
desc "Password/passphrase strength checking and enforcement toolset"
homepage "https://www.openwall.com/passwdqc/"
url "https://www.openwall.com/passwdqc/passwdqc-1.3.1.tar.gz"
sha256 "d1fedeaf759e8a0f32d28b5811ef11b5a5365154849190f4b7fab670a70ffb14"
bottle do
cellar :any
sha... | 33.710526 | 93 | 0.740047 |
d56ae9f266e3dfcd704da0a5e8972d4bdd104b25 | 4,049 | #
# Invokers are responsible for
#
# 1. grabbing work off a job broker (such as a starling or rabbitmq server).
# 2. routing (mapping) that work onto the correct worker method.
# 3.invoking the worker method, passing any arguments that came off the broker.
#
# Invokers should implement their own co... | 32.918699 | 127 | 0.544332 |
f8f0a69622f42f5304cde52eb9d925f5450eaa2f | 1,660 | # frozen_string_literal: true
# ActiveRecord custom data type for storing datetimes with timezone information.
# See https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/11229
require 'active_record/connection_adapters/postgresql_adapter'
module ActiveRecord::ConnectionAdapters::PostgreSQL::OID
# Add the class... | 30.740741 | 84 | 0.775301 |
91e63f931c48cdaacec3c9ef7626bf2a06051249 | 1,499 | module ElectricWindowsOperable
def open_windows
'Windows opening...'
end
def close_windows
'Windows closing...'
end
end
class Vehicule
@@number_of_object = 0
attr_accessor :speed, :color
attr_reader :year, :model
def initialize(y, c, m)
@year = y
@color = c
@model = m
@speed ... | 16.11828 | 76 | 0.663109 |
d5886984908c03578f8aa8a5b2505e7d9e496f1c | 2,389 | # frozen_string_literal: true
require 'forwardable'
module Faraday
# Response represents an HTTP response from making an HTTP request.
class Response
# Used for simple response middleware.
class Middleware < Faraday::Middleware
# Override this to modify the environment after the response has finishe... | 22.971154 | 80 | 0.62118 |
916f0c88df0e75550f1de45fd179548f21bde735 | 2,194 | # encoding: utf-8
require "logstash/util/loggable"
require "logstash/util"
require "concurrent"
module LogStash module Instrument module PeriodicPoller
class Base
include LogStash::Util::Loggable
DEFAULT_OPTIONS = {
:polling_interval => 5,
:polling_timeout => 120
}
public
def initia... | 29.648649 | 89 | 0.61258 |
ac7b046b94689a1da5c983626f59c4cb959c1cf4 | 1,562 | module PlinkAdmin
class UserUpdateWithActiveStateManager
attr_accessor :user_record
def initialize(user_record)
raise ArgumentError unless user_record.is_a?(Plink::UserRecord)
@user_record = user_record
end
def update_attributes(params)
user_params = params.to_h.symbolize_keys
... | 28.4 | 86 | 0.706146 |
91f3d1ccc23d0ee06b42947cffd4858809813db1 | 3,388 | FactoryGirl.define do
factory :employer_profile_no_attestation, class: EmployerProfile do
organization { FactoryGirl.build(:organization) }
entity_kind "c_corporation"
sic_code "1111"
transient do
employee_roles []
end
before :create do |employer_profile, evaluat... | 38.5 | 310 | 0.739669 |
ac185b9c13bade5a924d202c80710efc14618eb5 | 1,727 | require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
require 'linode'
describe Linode::Linode::Job do
before :each do
@api_key = 'foo'
@linode = Linode::Linode::Job.new(:api_key => @api_key)
end
it 'should be a Linode instance' do
@linode.class.should < Linode
end
%w(l... | 35.244898 | 148 | 0.63231 |
bfd5266dbb47f7e6eb35df7c227c3ff57e0df1fe | 1,848 | # frozen_string_literal: true
Rails.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 "s... | 38.5 | 85 | 0.771645 |
f7b3e1d8e049317bd73cb7a1d8d46d00d6556c61 | 144 | class AddDeletedAtToTransferItems < ActiveRecord::Migration
def change
add_column :spree_transfer_items, :deleted_at, :datetime
end
end
| 24 | 60 | 0.805556 |
b9ef25e686153ba4b9546e86349bc0f285491cce | 443 | class CheckinsEvent
def self.properties(action, checkin)
{
action: action,
user_id: checkin.user_id,
work_id: checkin.episode.work_id,
episode_id: checkin.episode_id,
has_comment: checkin.comment.present?,
shared_sns: checkin.shared_sns?,
keen: { timestamp: checkin.create... | 24.611111 | 56 | 0.683973 |
79e3dc237a3984c421007f7404f836b5c1965468 | 482 | 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 HrTil
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specifi... | 30.125 | 82 | 0.761411 |
332ddf4bbc78e3b0675660a81b7f8deb9b480f69 | 202 | class Array
alias :__old_plus :+
def +(val)
result = __old_plus(val.cur)
if val.reactive? && !result.reactive?
result = ReactiveValue.new(result)
end
return result
end
end
| 15.538462 | 41 | 0.638614 |
d52f3d07fd0dbd4c43f52dbb93127d4f02bf7a3a | 3,981 | require "language/go"
class GitlabRunner < Formula
desc "The official GitLab CI runner written in Go"
homepage "https://gitlab.com/gitlab-org/gitlab-runner"
url "https://gitlab.com/gitlab-org/gitlab-runner.git",
:tag => "v10.1.0",
:revision => "c1ecf97f92aaeee1b8dafe8f58d38d8c7d8aa1ff"
head "https:... | 35.864865 | 106 | 0.635016 |
bf0ae18ff4fb4b34184ac29d35ea147f10887ab4 | 1,997 | class ResponseProcessingController < ApplicationController
before_action { @hide_available_languages = true }
def index
@rp_name = current_transaction.rp_name
outcome = POLICY_PROXY.matching_outcome(session[:verify_session_id])
case outcome
when MatchingOutcomeResponse::GOTO_HUB_LANDING_PAGE
... | 44.377778 | 92 | 0.7997 |
1d4dcfdd56b833aaa0e1c035e7b0accdc6f7eb3b | 583 | require_relative '../automated_init'
context "Activation" do
context "Optional Factory Method Parameter" do
receiver = OpenStruct.new
factory_method = Controls::FactoryMethod.name
cls = Class.new do
Configure.activate(self, factory_method: factory_method)
configure :some_attr
extend... | 21.592593 | 62 | 0.703259 |
1d87bd1d0502216ed07bf283add4e65aaed6bf14 | 1,296 | # frozen_string_literal: true
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 31.609756 | 88 | 0.709877 |
183f8716d454c57061caf71867a6db4b553d4090 | 2,001 | class InviteRequest < ActiveRecord::Base
acts_as_list
validates :email, :presence => true, :email_veracity => true
validates_uniqueness_of :email, :message => "is already part of our queue."
before_validation :compare_with_users, :on => :create
# Realign positions if they're incorrect
def self.reset_or... | 39.235294 | 134 | 0.716142 |
1d32b5e7bb1ed4d49dafecc80649f6fce96e41e2 | 1,171 | module HealthDataStandards
module Import
module C32
class ImmunizationImporter < CDA::SectionImporter
def initialize(entry_finder=CDA::EntryFinder.new("//cda:section[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.117']/cda:entry/cda:substanceAdministration"))
super(entry_finder)
... | 40.37931 | 169 | 0.701964 |
398ab7279bfdc8d987b666c9989855f3235db7ad | 24,140 | # frozen_string_literal: true
require 'time'
require 'test/unit'
class TestTimeExtension < Test::Unit::TestCase # :nodoc:
def test_rfc822
t = Time.rfc2822("26 Aug 76 14:30 EDT")
assert_equal(Time.utc(1976, 8, 26, 14, 30) + 4 * 3600, t)
assert_equal(-4 * 3600, t.utc_offset)
t = Time.rfc2822("27 Aug 7... | 47.519685 | 134 | 0.647349 |
033c45c8fab90407d792fa260edead735b56ee3f | 1,671 | require File.expand_path('../helper', __FILE__)
begin
require 'nokogiri'
class NokogiriTest < Test::Unit::TestCase
def nokogiri_app(&block)
mock_app do
set :views, File.dirname(__FILE__) + '/views'
get('/', &block)
end
get '/'
end
it 'renders inline Nokogiri strings' do
nokogiri_app... | 24.573529 | 87 | 0.605625 |
e811ae9594c237c332d81ff5123f295d10d80093 | 4,540 | # == Schema Information
#
# Table name: expense_items
#
# id :integer not null, primary key
# position :integer
# created_at :datetime
# updated_at :datetime
# expense_group_id :integer
# has_details :boolean default(FALS... | 26.549708 | 160 | 0.712996 |
e22c070c467db34b7b13e64e674c6b0fcdd37483 | 1,121 | module Vagrant
module Serial
module Middleware
class StopForwardingPorts
def initialize(app, env)
@app = app
end
def call(env)
if env[:vm].config.serial.set?
FileUtils.mkdir_p(env[:vm].config.serial.sockets_path) if env[:vm].config.serial.set? && !Fil... | 37.366667 | 234 | 0.599465 |
621d52c88dbddbdd9e7599229e6e55a9dfa14285 | 12,342 | # Copyright (c) 2010 - 2011, Ruby Science Foundation
# All rights reserved.
#
# Please see LICENSE.txt for additional copyright notices.
#
# By contributing source code to SciRuby, you agree to be bound by our Contributor
# Agreement:
#
# * https://github.com/SciRuby/sciruby/wiki/Contributor-Agreement
#
# === validatio... | 32.308901 | 139 | 0.575433 |
1c6e2cef3555d7fed038bef124d39d0e85678f58 | 8,564 | module Rya
# Contains extensions to core Ruby classes and modules.
module CoreExtensions
module Array
# Scales with respect to the min and max of the data actually in the Array.
def scale new_min, new_max
old_min = self.min
old_max = self.max
self.scale_fixed old_min, old_m... | 32.195489 | 149 | 0.563755 |
26515dd591c8946733fe0df06badb1a1eaf04242 | 1,142 | class ChainHeadResponse < Dry::Struct
attribute :chainhead, Types::String
attribute :chaininprocesslist, Types::Bool
def self.from_dynamic!(d)
jsonData = d
d = Types::Hash[d]
if(jsonData.has_key? 'result')
d = d.fetch("result")
else
d = d.fetch("error")
end
new(
chain... | 26.55814 | 102 | 0.66725 |
bb81fcca5e7eb041388fd04be97649008406fd8d | 2,134 | #
# tkextlib/iwidgets/selectionbox.rb
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
#
require 'tk'
require 'tkextlib/iwidgets.rb'
module Tk
module Iwidgets
class Selectionbox < Tk::Itk::Widget
end
end
end
class Tk::Iwidgets::Selectionbox
TkCommandNames = ['::iwidgets::sel... | 20.718447 | 75 | 0.672446 |
bf3a1cac616da688079238ef870a1258380a75bb | 297 | class OperaNext < Cask
version '24.0.1558.25'
sha256 '43e312a807baf3f8ad3a89a27bfaf7baefbe02a8a0dc92c6bb01e27a16569d72'
url "http://get.geo.opera.com/pub/opera-next/#{version}/mac/Opera_Next_#{version}_Setup.dmg"
homepage 'http://www.opera.com/computer/next'
link 'Opera Next.app'
end
| 29.7 | 94 | 0.767677 |
edd0248f704108a4052bb178d4ee8b2c3fe6022b | 5,463 | class GccAT6 < Formula
desc "GNU compiler collection"
homepage "https://gcc.gnu.org"
url "https://ftp.gnu.org/gnu/gcc/gcc-6.5.0/gcc-6.5.0.tar.xz"
mirror "https://ftpmirror.gnu.org/gcc/gcc-6.5.0/gcc-6.5.0.tar.xz"
sha256 "7ef1796ce497e89479183702635b14bb7a46b53249209a5e0f999bebf4740945"
revision 6
livechec... | 32.325444 | 140 | 0.647446 |
f7430f7958037705a596b9b3ba0b6c7036ea92f9 | 27,188 | #!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../test_helper'
class EngineTest < Test::Unit::TestCase
# A map of erroneous Sass documents to the error messages they should produce.
# The error messages may be arrays;
# if so, the second element should be the line number that should be reported for the e... | 41.699387 | 171 | 0.60295 |
d5f49ac4579aa2a193bea5af5f5c016f0fc686d3 | 258 | require 'optparse'
require 'bundler'
require 'typhoeus'
require 'json'
require 'ruby-progressbar'
require 'csv'
require 'date'
require 'yaml'
require 'active_support/all'
require 'byebug'
Dir[File.dirname(__FILE__) + "/lib/*.rb"].each{ |file| require file } | 21.5 | 69 | 0.744186 |
39e29f8dc3dc7f1e136e15cecc943e8a56f5eb93 | 3,433 | module ApiSchema
class ResourceDefinition
include ::Swagger::Blocks::ClassMethods
def initialize(method, api_version, base_path, extra_path = nil)
@base_path = base_path
@extra_path = extra_path
@method = method
@api_version = api_version
@header_params = []
@path_params =... | 25.81203 | 81 | 0.593067 |
6294ab9313f95d170280a94ac81d1776feaedf45 | 47 | module BootstrapHelper
VERSION = "0.0.1"
end
| 11.75 | 22 | 0.723404 |
f75e5eb56382822e28723a67ad2e9f1e8e70d034 | 4,903 | # frozen_string_literal: true
require 'cucumber/core/test/action'
require 'cucumber/core/test/duration_matcher'
module Cucumber
module Core
module Test
describe Action do
context "constructed without a block" do
it "raises an error" do
expect { Action.new }.to raise_error(Ar... | 31.632258 | 121 | 0.562513 |
399d13c819846bd21ad6e5a03ed1144890857ec3 | 12,526 | # frozen_string_literal: true
require "rails/generators/rails/app/app_generator"
require "date"
module Rails
# The plugin builder allows you to override elements of the plugin
# generator without being forced to reverse the operations of the default
# generator.
#
# This allows you to override entire operat... | 28.663616 | 150 | 0.613684 |
39cdda0790391d9d15f6be3d4d193489d821b8a4 | 702 | class SessionsController < ApplicationController
def new
# @srs = .new
end
def create
# sessions[:email]
user = User.find_by(email: params[:session][:email].downcase)
if user && user.authenticate(params[:session][:password])
session[:user_id] = user.id
... | 30.521739 | 81 | 0.595442 |
b9a4ef9570fb9e3da883289efc8a4ff9bb0ac1ef | 8,694 | # frozen_string_literal: true
RSpec.describe Faraday::RackBuilder do
# mock handler classes
(Handler = Struct.new(:app)).class_eval do
def call(env)
env[:request_headers]['X-Middleware'] ||= ''
env[:request_headers]['X-Middleware'] += ":#{self.class.name.split('::').last}"
app.call(env)
e... | 28.227273 | 101 | 0.643087 |
1ca307534a136e39039215c181d25b152a325c17 | 156,540 | #------------------------------------------------------------------------
# (The MIT License)
#
# Copyright (c) 2008-2011 Rhomobile, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software wit... | 35.577273 | 313 | 0.610042 |
bbcad634880a8d82fc82acc2ae3bd7884fb64f7e | 1,112 | module Pione
module Location
class HTTPSLocation < HTTPLocation
set_scheme "https"
define(:need_caching, true)
define(:real_appendable, false)
define(:writable, false)
# Send a request HTTPS Get and evaluate the block with the response.
def http_get(&b)
http = Net::HT... | 27.8 | 75 | 0.588129 |
6aba5a4c7dd95f50094f12f1d6b177cfac4c93f6 | 1,679 | module LogsHelper
def of_name
return if params[:name].blank? || params[:searching].blank?
thing = params[:searching].classify.constantize.find_by(name: params[:name])
' for '.html_safe <<
link_to(params[:name], controller: params[:searching], action: :show, id: thing.id)
end
def severity_class(... | 34.979167 | 182 | 0.659917 |
61d09f4b2692b96cca3ef88af1aa5369e61d04f9 | 1,016 | module DataMapper
class Property
class Decimal < Numeric
load_as BigDecimal
dump_as BigDecimal
coercion_method :to_decimal
DEFAULT_PRECISION = 10
DEFAULT_SCALE = 0
precision(DEFAULT_PRECISION)
scale(DEFAULT_SCALE)
protected
def initialize... | 27.459459 | 144 | 0.608268 |
0894f1cee64fc55273bf04c8875f013773cb5d94 | 1,193 | # frozen_string_literal: true
require File.join(File.expand_path('../../../../test', __dir__), 'test_helper')
module MasterfilesApp
class TestTreatmentTypePermission < Minitest::Test
include Crossbeams::Responses
def entity(attrs = {})
base_attrs = {
id: 1,
treatment_type_code: Faker:... | 32.243243 | 88 | 0.706622 |
39af561b7c0bac6c9d64754f30a5d6fb83a78b20 | 44 | module Heroku; end
require 'heroku/client'
| 11 | 23 | 0.772727 |
6142bfe56a968180e3d028f7c6d30143b76720a5 | 8,483 | # Copyright (c) 2016, 2022, 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... | 37.20614 | 245 | 0.677001 |
91d40978007bb77647c809f9dae7d4e53847ab4c | 2,920 | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe CouchRest::WillPaginate do
class SomeModel < CouchRest::Model::Base
use_database SPEC_COUCH
property :name
paginated_view_by :name
end
[SomeModel].each do |klass|
describe klass do
before(:all) do
reset_te... | 29.494949 | 105 | 0.618493 |
f746ebd8d4ab89f8902b34b0c8a08d39d3452647 | 614 | ENV['RAILS_ENV'] ||= 'test'
require File.expand_path("../dummy/config/environment.rb", __FILE__)
require 'rspec/rails'
require 'factory_girl_rails'
require 'database_cleaner'
require 'pry'
Rails.backtrace_cleaner.remove_silencers!
# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| requi... | 22.740741 | 71 | 0.742671 |
d5006575894aba74a1cdb9b04ff226d693b1ca5e | 11,602 | require_relative './miq_ae_service_model_legacy'
require_relative './miq_ae_service_vmdb'
require_relative './miq_ae_service_rbac'
module MiqAeMethodService
class MiqAeService
include Vmdb::Logging
include DRbUndumped
include MiqAeMethodService::MiqAeServiceModelLegacy
include MiqAeMethodService::MiqA... | 28.09201 | 163 | 0.650577 |
386721a33ee35da8a07668ac9166c8ee5f3f7c88 | 144 | name 'build_cookbook'
maintainer 'eternaltyro'
maintainer_email 'eternaltyro@gmail.com'
license 'mit'
version '0.1.0'
depends 'delivery-truck'
| 18 | 40 | 0.791667 |
ac6498ec7aec43831aa46f8b5b96257c3a211588 | 1,522 | # frozen_string_literal: true
# Cookbook:: travis_build_environment
# Recipe:: ramfs
# Copyright:: 2017 Travis CI GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, ... | 36.238095 | 79 | 0.760841 |
f7cc7b839de0bd24d7f403d74cd9bbd9739ec0f2 | 363 | describe SectionPolicy do
let(:context) { { role: role, real_user: role.end_user } }
describe_rule :manage? do
succeed 'role is an instructor' do
let(:role) { create(:instructor) }
end
failed 'role is a ta' do
let(:role) { create(:ta) }
end
failed 'role is a student' do
let(:ro... | 24.2 | 60 | 0.61157 |
ffbeac1a6248bd9d5fdd3828d398cf957892b424 | 331 | cask 'understand' do
version '5.0.972'
sha256 '19141b85f34cac4d0c2bc008b2bc44edea496a70320d6966e04f3402f5560ba0'
url "http://builds.scitools.com/all_builds/b#{version.patch}/Understand/Understand-#{version}-MacOSX-x86.dmg"
name 'SciTools Understand'
homepage 'https://scitools.com/features/'
app 'Understan... | 30.090909 | 111 | 0.776435 |
187004c128b0b572192a151c90d281f72f285f75 | 2,830 | # Copyright 2011-2012 Rice University. Licensed under the Affero General Public
# License version 3 or later. See the COPYRIGHT file for details.
class QuestionPart < ActiveRecord::Base
belongs_to :multipart_question
belongs_to :child_question, :class_name => 'Question'
validates_presence_of :multipart_ques... | 31.797753 | 92 | 0.640989 |
ff490c611355742ee514f9256e9f2b44f2c7d37b | 693 | require "spec_checkr/version"
class SpecCheckr
def initialize(target, spec_folder)
@target = target
@spec_folder = spec_folder
end
def check
@files_in_target = get_files(@target)
@files_in_spec = get_files(@spec_folder)
print(@files_in_spec)
compare_arrays
end
def get_files(director... | 21 | 62 | 0.670996 |
263b767784ccd65c6306073f0f2fe7e305a3cc9a | 1,958 | Pod::Spec.new do |spec|
spec.name = 'module'
spec.version = '1.0'
spec.homepage = 'Link to the Shared Module homepage'
spec.source = { :git => "Not Published", :tag => "Cocoapods/#{spec.name}/#{spec.version}" }
spec.authors ... | 42.565217 | 113 | 0.539326 |
18aa3a23800e16473d63fd89a4f3bfced9a08f36 | 6,692 | # frozen_string_literal: true
module Alchemy
class Page < BaseRecord
module PageElements
extend ActiveSupport::Concern
included do
attr_accessor :autogenerate_elements
with_options(
class_name: "Alchemy::Element",
through: :public_version,
inverse_of: :... | 32.485437 | 101 | 0.625224 |
6acf96f62a4d112ec32a888c2ead44edb97c852a | 1,084 | require 'spec_without_rails_helper'
require 'models/single_events_by_day'
describe SingleEventsByDay do
let(:date_one) { Date.new(2013, 12, 25) }
let(:date_two) { Date.new(2013, 12, 26) }
let(:event_on_date_one) { double('SingleEvent', date: date_one) }
let(:event_on_date_two) { double('SingleEvent', date: da... | 32.848485 | 88 | 0.695572 |
33dc49a6f8aee6037d1ae0e755e78275e0cd1b3e | 2,389 | module Mongoid
module Association
module Referenced
module AutoSave
extend ActiveSupport::Concern
# Used to prevent infinite loops in associated autosaves.
#
# @example Is the document autosaved?
# document.autosaved?
#
# @return [ true, false ] Ha... | 29.8625 | 93 | 0.541231 |
3883dffe294b7721a3d4e4ddfd3d9c91b46f9209 | 994 | ENV['DATABASE_ADAPTER'] = 'docker_postgres'
ENV['RACK_ENV'] = 'development'
require 'db'
require 'tasks/database'
require 'pact_broker/db'
PactBroker::DB.connection = PactBroker::Database.database = DB::PACT_BROKER_DB
Approvals.configure do |c|
c.approvals_path = 'regression/fixtures/approvals/'
end
RSpec.configur... | 26.157895 | 100 | 0.774648 |
4af72a157dcb301b2257c14f28d3c2c359a0fa71 | 2,908 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::SQL::Mgmt::V2017_03_01_preview
module Models
#
# Scheduling properties of a job.
#
class JobSchedule
include MsRestAz... | 29.373737 | 75 | 0.500688 |
6a4917b2cc52acf5877cb1a19084202c7a6f4b88 | 684 | # Typographical attribute
#
# Indicates that this entity is used to render text.
#
define_attribute :typographical do
# The text to display
property :text
# Acts as a short-circuit for rendering
property :visible, default: true
# Property to store the `Ruby2D::Text` used to render the text
property :text_... | 22.8 | 64 | 0.719298 |
21a1d477a2bdd597d419fa4151a9585a33598c1b | 4,135 | require 'base64'
include_recipe 'bcpc-hadoop::hadoop_config'
::Chef::Recipe.send(:include, Bcpc_Hadoop::Helper)
::Chef::Resource::Bash.send(:include, Bcpc_Hadoop::Helper)
hdprel=node[:bcpc][:hadoop][:distribution][:active_release]
hdppath="/usr/hdp/#{hdprel}"
%w{hadoop-hdfs-namenode hadoop-hdfs-journalnode}.each do |... | 28.715278 | 78 | 0.702539 |
d5a1caaaeeb85984be901bdf5d7de692c09060ad | 36 | module Eth
VERSION = "0.4.17"
end
| 9 | 20 | 0.638889 |
26e2402a18da9d3b2e9dc0666008276c6abfd3f7 | 2,644 | # Implementation class for Cancan gem. Instead of overriding this class, consider adding new permissions
# using the special +register_ability+ method which allows extensions to add their own abilities.
#
# See http://github.com/ryanb/cancan for more details on cancan.
require 'cancan'
module Spree
class Ability
... | 35.72973 | 107 | 0.645234 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.