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 |
|---|---|---|---|---|---|
112598eec22e2f05fa39e43ecaac4da94cc720e6 | 20,354 | ######################################################################
# Copyright (c) 2008-2015, Alliance for Sustainable Energy.
# All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published b... | 49.765281 | 152 | 0.707183 |
e20ea0329262243c945799d5ef5a1cd711bf30d5 | 488 | cask "freeplane" do
version "1.8.6"
sha256 "72cbc35735f8e67023a254696b59b32ecd56b18a199d170fe66a00b422bc24b5"
# downloads.sourceforge.net/freeplane/ was verified as official when first introduced to the cask
url "https://downloads.sourceforge.net/freeplane/freeplane%20stable/Freeplane-#{version}.dmg"
appcast... | 37.538462 | 99 | 0.788934 |
38fca4b920d2bdb9ad77b3b9961645d3d6a2eca0 | 2,049 | # Encoding: utf-8
# Cloud Foundry Java Buildpack
# Copyright 2013-2017 the original author or authors.
#
# 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/... | 32.52381 | 88 | 0.704734 |
7adfc980eede7f85bbf6a91c1f82c1dd166666c5 | 2,948 | =begin
#SendinBlue API
#SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/or... | 37.794872 | 839 | 0.699796 |
e2e5023f38e049041fc29f1a8820834681eee101 | 3,111 | # frozen_string_literal: true
require "active_support/core_ext/hash/indifferent_access"
module ActionDispatch
class Request
class Utils # :nodoc:
mattr_accessor :perform_deep_munge, default: true
def self.each_param_value(params, &block)
case params
when Array
params.each ... | 30.203883 | 107 | 0.621665 |
ff22f1900f3a02cbe601905a604de209674661bf | 814 | require 'flipper/ui/action'
require 'flipper/ui/decorators/feature'
module Flipper
module UI
module Actions
class PercentageOfActorsGate < UI::Action
route %r{features/[^/]*/percentage_of_actors/?\Z}
def post
feature_name = Rack::Utils.unescape(request.path.split("/")[-2])
... | 29.071429 | 98 | 0.624079 |
219ec87a02a5b944c0988fa5f4d3771df703e060 | 430 | require 'formula'
class Rhash < Formula
homepage 'http://rhash.anz.ru/'
url 'http://downloads.sourceforge.net/project/rhash/rhash/1.3.0/rhash-1.3.0-src.tar.gz'
sha1 'f51a7f3eea051ebef5c16db5c4a53ff3c2ef90c2'
def install
# install target isn't parallel-safe
ENV.j1
system 'make', 'install', "PREFIX... | 25.294118 | 89 | 0.595349 |
5d2aaa174b329074b445b7816902020352f41964 | 769 | #---
# Excerpted from "The RSpec Book",
# published by The Pragmatic Bookshelf.
# Copyrights apply to this code. It may not be used to create training material,
# courses, books, articles, and the like. Contact us if you are in doubt.
# We make no guarantees that this code is fit for any purpose.
# Visit http://www.p... | 34.954545 | 82 | 0.736021 |
d53594eb5afe5726a1aa08f85b6b6a811b2917c1 | 7,920 | # frozen_string_literal: true
module Timebox
extend ActiveSupport::Concern
include AtomicInternalId
include CacheMarkdownField
include Gitlab::SQL::Pattern
include IidRoutes
include Referable
include StripAttribute
include FromUnion
TimeboxStruct = Struct.new(:title, :name, :id, :class_name) do
... | 30.114068 | 124 | 0.629798 |
bfab4387688d87f770ad69173f2c1a41e221e60b | 7,080 | # frozen_string_literal: true
require 'spec_helper'
describe 'Project fork' do
include ProjectForksHelper
let(:user) { create(:user) }
let(:project) { create(:project, :public, :repository) }
before do
sign_in user
end
it 'allows user to fork project' do
visit project_path(project)
expect(... | 25.934066 | 117 | 0.668785 |
d5d3e3cdadc6ae02358dcf3b706b0ea53232954a | 164 | class AddAncestryToLocation < ActiveRecord::Migration[5.0]
def change
add_column :locations, :ancestry, :string
add_index :locations, :ancestry
end
end
| 23.428571 | 58 | 0.75 |
1c73d674ea58a44adf7ab0dff99468cd098c1aac | 1,007 | class MyValidator < ActiveModel::Validator
def validate(record)
# Add an error if the name chosen is not unique to the user
if user_already_has_item_with_name?(record) && user_item_is_not_current_item(record)
record.errors[:base] << "You already have a #{record.class.name.downcase} named '#{record.name}... | 35.964286 | 143 | 0.738828 |
01ef61eb9959bb01006ce0c2b3cb8dd9fa9d1059 | 3,552 | # frozen_string_literal: true
describe RuboCop::Cop::Util do
class TestUtil
include RuboCop::Cop::Util
end
describe '#line_range' do
let(:source) do
<<-END
foo = 1
bar = 2
class Test
def some_method
do_something
end
end
baz = ... | 26.117647 | 78 | 0.594313 |
38a0ef6ecd793c8826e91e09ad74a4204099d7af | 6,462 | # FUNCTIONS
CFDP_CLASS_HASH = {"CFDP::PDUMetadata"=>0, "CFDP::PDUFileData"=>1, "CFDP::PDUFinished"=>2,
"CFDP::PDUNAK"=>3, "CFDP::PDUEOF"=>4, "CFDP::PDUACK"=>5}
def miss_pdus(*args)
miss_sent_hash = args[0][:miss_sent_pdus]
unless miss_sent_hash.nil?
miss_sent_hash.each do |key, value|
cmd("CFDP_TEST MISS_SEN... | 32.969388 | 186 | 0.728412 |
f77ab3bd77e08b35057d71ddc0d52b2171a59e66 | 738 | class Task::Filter::ContactInfoAddr < Task::Filter::Base
def execute_query(tasks, filters)
# We are plucking ids here because the contact filter already generates an sql statement with several nested subqueries
# and sending too many of those to postgres can cause unexpected errors and is often slower than br... | 43.411765 | 123 | 0.711382 |
911e01af2eb2306bda9afdfeea843a51c60653ff | 67,135 | # -*- coding: utf-8 -*-
require 'spec_helper'
describe API::Projects do
include Gitlab::CurrentSettings
let(:user) { create(:user) }
let(:user2) { create(:user) }
let(:user3) { create(:user) }
let(:admin) { create(:admin) }
let(:project) { create(:project, namespace: user.namespace) }
let(:project2) { c... | 35.90107 | 145 | 0.656334 |
0181811db077244a82a78c7abdec70cc6444c399 | 1,611 | require "spec_helper"
RSpec.describe Bootpay do
it 'remote form' do
bootpay = Bootpay::ServerApi.new(
'5b9f51264457636ab9a07cde',
'sfilSOSVakw+PZA+PRux4Iuwm7a//9CXXudCq9TMDHk=',
:development
)
result = bootpay.remote_form(
{
pg: 'dana... | 40.275 | 105 | 0.387958 |
1c0b9f562e344a61b1126d35e384b6526bdb3bca | 16,607 | #
# Author:: Daniel DeLeo (<dan@kallistec.com>)
# Copyright:: Copyright (c) Chef Software Inc.
# License:: Apache License, Version 2.0
#
# 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
#
# ... | 39.167453 | 160 | 0.622569 |
38b77568a3905c30d672b5afc80c85043035887b | 5,317 | # Copyright (C) 2014-2015 MongoDB Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | 30.039548 | 98 | 0.621215 |
4ae5418391b2e8e2021a487b898e24ce57894d43 | 8,552 | # coding: UTF-8
require "steno"
require "steno/core_ext"
require "sys/filesystem"
require "thread"
require "dea/loggregator"
require "dea/registry_enumeration"
module Dea
class InstanceRegistry
DEFAULT_CRASH_LIFETIME_SECS = 60 * 60
CRASHES_REAPER_INTERVAL_SECS = 10
DEFAULT_STOPPING_LIFETIME_SECS = 60
... | 27.235669 | 109 | 0.643592 |
287cf0c166f0255fe2880e02b7b449d2672a4065 | 8,101 | #--
# Author:: Daniel DeLeo (<dan@kallistec.com>)
# Author:: Tim Hinderliter (<tim@opscode.com>)
# Copyright:: Copyright (c) 2009 Daniel DeLeo
# Copyright:: Copyright (c) 2011 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this... | 27.093645 | 147 | 0.673621 |
21465d9e98ecba607ae9058f6f0c1025bf264d97 | 377 | #
# File : B.rb
# Author : Kazune Takahashi
# Created : 2018-11-4 16:38:39
# Powered by Visual Studio Code
#
x = gets.to_i
ok = Array.new(1010){false}
ok[0] = ok[1] = true
for i in 2...1010 do
for j in 2...1010 do
if i ** j < 1010
ok[i ** j] = true;
else
break
end
end
end
for i in 0..... | 13.962963 | 31 | 0.546419 |
d5b4e95b0b46ed272e8c07cb8327717a833430a5 | 3,511 | require 'rails_helper'
describe "upload UntaggedAnimalAssessment category", type: :feature do
let(:user) { create(:user) }
let(:valid_file) { "#{Rails.root}/db/sample_data_files/untagged_animal_assessment/Untagged_assessment_03122018.csv" }
let(:invalid_file) { "#{Rails.root}/spec/support/csv/invalid_headers.csv... | 43.345679 | 198 | 0.698946 |
1a9f6aefa3b12a635270b0649415bafdcf7c87ad | 1,074 | # frozen_string_literal: true
module Clowne
module Adapters # :nodoc: all
class ActiveRecord
module Resolvers
class UnknownAssociation < StandardError; end
class Association
class << self
# rubocop: disable Metrics/ParameterLists
def call(source, record, d... | 27.538462 | 93 | 0.623836 |
629b21c786819d750fae641df1fa0da6b73ab1e3 | 275 | class Category < ApplicationRecord
resourcify
acts_as_tree counter_cache: :children_count
extend FriendlyId
friendly_id :name, use: :slugged, routes: :default
has_and_belongs_to_many :sections, join_table: :section_categories
def to_s
self.name
end
end
| 18.333333 | 68 | 0.774545 |
bbfe01df29e3ff0e22b8ab999c408333037657a2 | 1,855 | # 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::DataShare::Mgmt::V2018_11_01_preview
module Models
#
# log specifications for operation api
#
class OperationMetaLogSpecific... | 26.884058 | 70 | 0.525606 |
2141cb7274f487f15ee9331a4a78da42aaa914ae | 36 | module Abra
VERSION = "1.0.2"
end
| 9 | 19 | 0.638889 |
7ae2bae5e10b9b515d7d602f80ed6864d00348f6 | 963 | require 'formula'
class Dart < Formula
homepage 'https://www.dartlang.org/'
if MacOS.prefer_64_bit?
url 'https://storage.googleapis.com/dart-archive/channels/stable/release/38663/sdk/dartsdk-macos-x64-release.zip'
sha1 'fc214070863861e444b0a9619dd92a93c0932bc9'
else
url 'https://storage.googleapis.c... | 25.342105 | 118 | 0.69055 |
798538a3445d2d430353f28bf4633936fab0168f | 1,704 | require 'fileutils'
require 'tempfile'
require_relative 'spec_helper'
module Aws
module EventStream
describe Encoder do
describe "#encode" do
Dir.glob(File.expand_path('../fixtures/decoded/positive/*', __FILE__)).each do |path|
suit_name = File.basename(path)
ex... | 27.047619 | 104 | 0.579812 |
ac0ea7b67e52ffd91e2bcf83cb931b6ff7282f64 | 1,760 | require "application_system_test_case"
class CommandActionsTest < ApplicationSystemTestCase
setup do
@command_action = command_actions(:one)
end
test "visiting the index" do
visit command_actions_url
assert_selector "h1", text: "Command Actions"
end
test "creating a Command action" do
visit... | 30.344828 | 60 | 0.725568 |
ab1d3f079b49b4c6563c809d3258292e80481569 | 2,205 | module OpenConferenceWare
module ProposalsHelper
# Return link with a +label+ for sorting records by +field+. The optional
# +kind+ (e.g., :sessions or :proposals) determines what URLs to generate, if
# one isn't specified, then the @kind instance variable will be used.
def sort_link_for(label, field,... | 37.372881 | 97 | 0.666667 |
910ed16320817989153e7fa234d08182129f1b43 | 1,774 | RSpec.describe WorldpayCnp::XML do
describe ".parse" do
it "parses XML (string) to a hash" do
hash = described_class.parse(fixture_file("sale_sample.xml").read)
expect(hash).to eq(
'cnpOnlineRequest' => {
'version' => '12.8',
'merchantId' => '1',
'authentication... | 27.292308 | 88 | 0.429538 |
7a3ab65e0aef98e0dbea036c9ca260ff605cf50e | 5,614 | require "testing_env"
require "formula"
require "formula_installer"
require "utils/bottles"
class FormularyTest < Homebrew::TestCase
def test_class_naming
assert_equal "ShellFm", Formulary.class_s("shell.fm")
assert_equal "Fooxx", Formulary.class_s("foo++")
assert_equal "SLang", Formulary.class_s("s-lang... | 27.385366 | 109 | 0.708942 |
1acb5846fcf9028026ddb5104637bfb58fc791e7 | 3,687 | require 'spec_helper'
describe Ability, lib: true do
describe '.users_that_can_read_project' do
context 'using a public project' do
it 'returns all the users' do
project = create(:project, :public)
user = build(:user)
expect(described_class.users_that_can_read_project([user], proje... | 31.245763 | 83 | 0.628967 |
ac262aec00b69ff8dbc44f2ee2d852ebdcf54e7d | 28,970 | # frozen_string_literal: true
# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0
require 'test_helper'
describe OpenTelemetry::Exporter::OTLP::Exporter do
SUCCESS = OpenTelemetry::SDK::Trace::Export::SUCCESS
FAILURE = OpenTelemetry::SDK::Trace::Export::FAILURE
TIMEOUT = OpenTelemetry:... | 46.650564 | 223 | 0.613807 |
21ce1a64c735fd798de4519a1165ee1c7957f8db | 230 | #!/usr/bin/env ruby
#---
# Excerpted from "Everyday Scripting in Ruby"
# We make no guarantees that this code is fit for any purpose.
# Visit http://www.pragmaticprogrammer.com/titles/bmsft for more book information.
#---
ONE=1
| 25.555556 | 82 | 0.730435 |
6a25ac2f60dae274eae0d627dbc5c369ec86c038 | 10,469 | =begin
#The Plaid API
#The Plaid REST API. Please see https://plaid.com/docs/api for more details.
The version of the OpenAPI document: 2020-09-14_1.20.6
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.1.0
=end
require 'date'
require 'time'
module Plaid
# AssetReportCreateRequest defin... | 32.311728 | 227 | 0.643232 |
ab99be994853aafae335dfb3562943038d053d78 | 95 | require 'cla_signature_authorizer'
class IclaSignatureAuthorizer < ClaSignatureAuthorizer
end
| 19 | 54 | 0.884211 |
38585af060a27bb316c01c7a880cb5874e5492b5 | 3,255 | require_relative "../test_helper"
class ExamplesConcurrentWorkersTest < Minitest::Test
class ConcurrentWorkers < Eventbox
async_call def init
@tasks = []
@waiting = {}
@working = {}
end
async_call def add_worker(workerid)
worker(workerid)
end
action def worker(workerid)
... | 23.25 | 94 | 0.626114 |
f84598f8ccf018df3d53e53df7272ff4bd5b68bd | 195 | module Eugeneral
module Comparisons
class GreaterThan < Comparitor
def resolve(args=[])
value_for(subject, args) > value_for(object, args)
end
end
end
end
| 16.25 | 58 | 0.630769 |
1c012e45e0372804ef6830ec0339ed986e5eb4b3 | 1,746 | class Jose < Formula
desc "C-language implementation of Javascript Object Signing and Encryption"
homepage "https://github.com/latchset/jose"
url "https://github.com/latchset/jose/releases/download/v10/jose-10.tar.bz2"
sha256 "5c9cdcfb535c4d9f781393d7530521c72b1dd81caa9934cab6dd752cc7efcd72"
revision 1
bot... | 40.604651 | 94 | 0.683849 |
0859b4239de2dedb4d27b23a4bf998b34cc58721 | 810 | # encoding: utf-8
#--
# Copyright 2013-2014 DataStax, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 36.818182 | 74 | 0.783951 |
7adf4c05b25ad239ec8947be36c185cc2786aca5 | 6,291 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::EXE
def initialize(... | 30.687805 | 142 | 0.595772 |
21210560dfb0fc14c97296e7a4b2ef983c29d1a6 | 237 | class StaffMemberFormPresenter < UserFormPresenter
def suspended_check_box
markup(:div, class: "check-boxes") do |m|
m << check_box(:suspended)
m << label(:suspended, "アカウント停止")
end
end
end | 29.625 | 50 | 0.611814 |
5d3ab603e0a0ee4b2db921c3bf486b0f4b623077 | 1,690 | # frozen_string_literal: true
module ReleaseTools
module Tasks
module AutoDeploy
class Prepare
include ::SemanticLogger::Loggable
def execute
check_version
prepare_monthly_release
results = create_branches
notify_results(results)
end
... | 26 | 78 | 0.619527 |
3970fa39c0c1a018e340a4699fbd190c0041ff6f | 17,061 | # -------------------------------------------------------------------------- #
# Copyright 2002-2019, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# no... | 35.767296 | 80 | 0.529805 |
e8d45ca55f49abdd4fffb1ea8f7d67607fea7815 | 15,190 | # frozen_string_literal: true
# Assuming you have not yet modified this file, each configuration option below
# is set to its default value. Note that some are commented out while others
# are not: uncommented lines are intended to protect your configuration from
# breaking changes in upgrades (i.e., in the event that... | 48.685897 | 154 | 0.752535 |
bb7931c8a7af0857bbb96cad036c7190b847a7c3 | 4,798 | require 'coveralls'
Coveralls.wear!
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, ... | 47.98 | 92 | 0.74406 |
e2993351310aefe0403105112b83fa5c625dd6fc | 2,740 | module StripeService::Store::StripePayment
StripePaymentModel = ::StripePayment
InitialPaymentData = EntityUtils.define_builder(
[:community_id, :mandatory, :fixnum],
[:transaction_id, :mandatory, :fixnum],
[:payer_id, :mandatory, :string],
[:receiver_id, :mandatory, :string],
[:status, const_... | 27.959184 | 117 | 0.666423 |
e83654c9197baa0b456b76d83b5cec26d5b13cc2 | 352 | class LoginPage < SitePrism::Page
set_url '/mercurysignon.php'
element :campo_login, 'input[name*="userName"]'
element :campo_senha, 'input[name*="password"]'
element :botao_entrar, 'input[name*="login"]'
def logar(usuario, senha)
campo_login.set usuario
campo_senha.set senha
... | 29.333333 | 51 | 0.670455 |
4ad2c6eca2169ec0adb1f7a951ad0dbca877764a | 55 | json.partial! "api/v2/imports/import", import: @import
| 27.5 | 54 | 0.745455 |
21abc012f8ed9bff5e9eb7d39b9be6a0431657a6 | 1,989 | require "chef/chef_fs/file_system/base_fs_object"
require "chef/chef_fs/file_system/nonexistent_fs_object"
class Chef
module ChefFS
module FileSystem
class MultiplexedDir < BaseFSDir
def initialize(*multiplexed_dirs)
@multiplexed_dirs = multiplexed_dirs.flatten
super(@multiplexe... | 30.6 | 236 | 0.571644 |
1a2360a5d3fffcfd328fff7edcd2f357d7866463 | 2,382 | # Configure Rails Environment
ENV["RAILS_ENV"] = "test"
# Disable warnings locally
$VERBOSE = ENV["CI"]
require File.expand_path("dummy/config/environment.rb", __dir__)
ActiveRecord::Migrator.migrations_paths = [File.expand_path("dummy/db/migrate", __dir__), File.expand_path("../db/migrate", __dir__)]
require "rails/... | 28.023529 | 133 | 0.7733 |
1c5e83581833d03176db1931b108d154ceeae74d | 3,131 | require 'test_helper'
class UserTest < ActiveSupport::TestCase
def setup
@user = User.new(
name: "Example User",
email: "user@example.com",
password: "foobar",
password_confirmation: "foobar")
end
test "should be valid" do
assert @user.valid?
end
test "name should be pr... | 27.707965 | 78 | 0.667838 |
b9170140b4405fc5842ce300ee93e42aca3a8b85 | 1,419 | class Hugo < Formula
desc "Configurable static site generator"
homepage "https://gohugo.io/"
url "https://github.com/gohugoio/hugo/archive/v0.60.0.tar.gz"
sha256 "cc6b72d2bb56f57bf4a51afcaddfec37bd895b163b47a595dc64e3063c733a4a"
head "https://github.com/gohugoio/hugo.git"
bottle do
cellar :any_skip_rel... | 33 | 93 | 0.704722 |
1c2660b5c7faf42995b62682d792c40524bc6323 | 3,220 | #!/usr/bin/env ruby
# Encoding: utf-8
#
# Copyright:: Copyright 2012, Google Inc. All Rights Reserved.
#
# License:: 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
#
# ... | 31.881188 | 79 | 0.690373 |
ab8b6342ca98d00181aedf3dfda8d640435d6270 | 121 | class AddCookieSaltToUsers < ActiveRecord::Migration
def change
add_column :users, :cookie_salt, :string
end
end
| 20.166667 | 52 | 0.768595 |
ac2d36d9e8d2f7a51de574987d81770d7951b5e8 | 437 | require 'redis'
module Humperdink
class ForkSavvyRedis
def initialize(redis)
@redis = redis
@pid = Process.pid
end
def method_missing(meth_id, *args, &block)
reconnect_on_fork
@redis.send(meth_id, *args, &block)
end
def reconnect_on_fork
if Process.pid != @pid
... | 19 | 46 | 0.622426 |
39a865a2691f940e4f5ea6bca01167760b426a44 | 391 | module Twostroke::AST
class Try < Base
attr_accessor :try_statements, :catch_variable, :catch_statements, :finally_statements
def walk(&bk)
if yield self
try_statements.each { |s| s.walk &bk }
catch_statements.each { |s| s.walk &bk } if catch_statements
finally_statements.ea... | 30.076923 | 90 | 0.662404 |
ff8394b947592cca90444f8d6957ebcef73107b8 | 2,447 | # frozen_string_literal: true
require 'spec_helper'
describe ClustersHelper do
describe '#has_rbac_enabled?' do
context 'when kubernetes platform has been created' do
let(:platform_kubernetes) { build_stubbed(:cluster_platform_kubernetes) }
let(:cluster) { build_stubbed(:cluster, :provided_by_gcp, p... | 27.188889 | 107 | 0.665713 |
2611af99151001e9175bf683a097499547d7c85e | 3,363 | # frozen_string_literal: true
require 'aws-sdk'
require 'trollop'
require 'opzworks'
SSH_PREFIX = '# --- OpzWorks ---'
SSH_POSTFIX = '# --- End of OpzWorks ---'
module OpzWorks
class Commands
class SSH
def self.banner
'Generate and update SSH configuration files'
end
def self.run
... | 30.297297 | 98 | 0.521558 |
03929c24bd93c8092f09bc3974aba2e176d2d37c | 738 | class RubyBotJob < ApplicationJob
queue_as :default
def perform(data,room_id,to_ignore=nil)
search_keywords = %w{scouring rummage foraging forage hunting seeking hunt looking quest exploration frisking frisk activity manhunt shakedown ransacking searching help}
if (data["body"].split(' ').collect(&:downcas... | 36.9 | 172 | 0.680217 |
e29364f3f8433fe8debcc43d36bf2cc493403746 | 2,602 | class Minio < Formula
desc "High Performance, Kubernetes Native Object Storage"
homepage "https://min.io"
url "https://github.com/minio/minio.git",
tag: "RELEASE.2022-03-17T06-34-49Z",
revision: "ffcadcd99e012af6005145fb265ea88a0c3750ed"
version "20220317063449"
license "AGPL-3.0-or-later"
... | 36.647887 | 123 | 0.691007 |
abaf0c0cf1db266740e8a1f29f879fc665fd47ef | 2,295 | # encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative sou... | 31.438356 | 86 | 0.697168 |
5dd0a53fa71aa2513efb4bbfb7ee2a00f59f2ed4 | 1,210 | require 'spec_helper'
describe Puppet::Type.type(:firewalld_service) do
before do
Puppet::Provider::Firewalld.any_instance.stubs(:state).returns(:true) # rubocop:disable RSpec/AnyInstance
end
context 'with no params' do
describe 'when validating attributes' do
[:name, :service, :zone].each do |par... | 29.512195 | 109 | 0.681818 |
7afc35eabe60d3008f0c0d49bc46f2198345eee5 | 155 | module AuthHelper
def auth_headers(user)
token = JsonWebToken.encode({user_id: user.id})
{'Authorization': "Bearer #{token[:token]}"}
end
end | 19.375 | 51 | 0.683871 |
875f17282f9804c6c662556dc1b3873c98ef4135 | 830 | # frozen_string_literal: true
class PagesWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
sidekiq_options retry: 3
feature_category :pages
def perform(action, *arg)
send(action, *arg) # rubocop:disable GitlabSecurity/PublicSend
end
# rubocop: disable CodeReuse/ActiveRe... | 27.666667 | 83 | 0.755422 |
e27c68bf1197c098266f3d7ee5a6846d3106e2ea | 4,243 | require 'spec_helper'
describe ProjectRequestPresenter do
let(:project_request_presenter) { FactoryGirl.build(:project_request_presenter) }
describe "#project_request" do
let(:project_request) { project_request_presenter.project_request }
it "should instantiate a project request based on the params" do
... | 36.895652 | 161 | 0.757483 |
5dc753443be8c050693ded0d011cd1674b5d134b | 156 | class AddDecimalPlaceToExpenses < ActiveRecord::Migration[4.2]
def change
change_column :expenses, :value, :decimal, precision: 7, scale: 2
end
end
| 26 | 69 | 0.75 |
1d404915617e1bbf9723f078f35b4903f37f0ac6 | 1,914 | # frozen_string_literal: true
require 'spec_helper'
describe Gitlab::ContentSecurityPolicy::ConfigLoader do
let(:policy) { ActionDispatch::ContentSecurityPolicy.new }
let(:csp_config) do
{
enabled: true,
report_only: false,
directives: {
base_uri: 'http://example.com',
child_... | 30.870968 | 87 | 0.675026 |
edc621da4d34e64dda3a7d45e3d5fd8e2334defd | 3,175 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Api::V1::RolesController, type: :request do
let!(:super_admin) { create(:user, :super_admin) }
let!(:organization) { create(:organization) }
let!(:with_read_permission) { organization.user }
let!(:cant_modify) do
[
create(:user, :ad... | 32.731959 | 99 | 0.700787 |
edb765ee1a6ecb64eb483a8bdd73d1bb933adac6 | 481 | require 'formula'
class Dex2jar < Formula
homepage 'https://code.google.com/p/dex2jar/'
url 'https://dex2jar.googlecode.com/files/dex2jar-0.0.9.15.zip'
sha1 'cc9366836d576ce22a18de8f214368636db9fcba'
def install
# Remove Windows scripts
rm_rf Dir['*.bat']
# Install files
prefix.install_metafi... | 22.904762 | 65 | 0.683992 |
1db32ed4e01dcdd85a7e6b40bf8a128cc3214f8b | 1,343 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
Gem::Specification.new do |spec|
spec.name = 'aws-sdk-apigatewayma... | 40.69697 | 127 | 0.685778 |
2181af2e7eff49f4ff99db5fbebed1b44d77d2c6 | 1,058 | # frozen_string_literal: true
require 'aws_backend'
class AWSMQConfiguration < AwsResourceBase
name 'aws_mq_configuration'
desc 'Describes a Amazon MQ configuration.'
example "
describe aws_mq_configuration(configuration_id: 'test1') do
it { should exist }
end
"
def initialize(opts = {})
... | 26.45 | 149 | 0.725898 |
4a699fe32130a046f51c672fa8f0608c6a976963 | 7,056 | # frozen_string_literal: true
module Auth
class ContainerRegistryAuthenticationService < BaseService
AUDIENCE = 'container_registry'
REGISTRY_LOGIN_ABILITIES = [
:read_container_image,
:create_container_image,
:destroy_container_image,
:update_container_image,
:admin_container_i... | 31.0837 | 124 | 0.692035 |
acc6231dd291d6f7baf91699191c82c72b4b5362 | 213 | class <%= redemption_class_name %> < ActiveRecord::Base
belongs_to :<%= singular_name %>, :counter_cache => 'redemptions_count'
belongs_to :user
validates_presence_of :user_id, :<%= singular_name %>_id
end
| 30.428571 | 73 | 0.732394 |
6aa54b0be1d4ff9b69fa8974648bd6636d4d481c | 2,929 | RSpec.describe Harvest::Api::Resources::TimeEntries do
subject do
described_class.new(access_token: ENV['HARVEST_ACCESS_TOKEN'],
account_id: ENV['HARVEST_ACCOUNT_ID'])
end
let(:time_entry_attributes) do
%w(id spent_date hours notes is_locked locked_reason is_closed is_billed
timer_started_at ... | 29.887755 | 76 | 0.656197 |
219865cbb54f7f0142e33a8bb7c0ece28d7314a8 | 326 | FactoryGirl.define do
factory :application_token do
sequence :application do |i|
"application #{i}"
end
# the plain token is application
token_salt { BCrypt::Engine.generate_salt }
token_hash { BCrypt::Engine.hash_secret(application, token_salt) }
association :user, factory: :user
en... | 23.285714 | 70 | 0.702454 |
18ebb13414eaf6c664dad60013b9e71ce624c625 | 934 | # frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'cross_table/version'
Gem::Specification.new do |spec|
spec.name = 'cross_table'
spec.version = CrossTable::VERSION
spec.authors = ['masa.kunikata']
spec.em... | 32.206897 | 74 | 0.648822 |
014d9750ec33ba72a54d0fc6940976e0f609876b | 7,934 | # encoding: utf-8
#
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "Li... | 40.896907 | 135 | 0.738593 |
08e3f9500dcfdcab9e9fb767fe205338f24dd6e1 | 79 | class TWEnv::Error < RuntimeError
ArchiveNotFoundError = Class.new(self)
end
| 19.75 | 40 | 0.78481 |
28dd3f97c959f14e6734484cdb4e8e4abff45a70 | 1,052 | Puppet::Type.newtype(:neutron_vpnaas_service_config) do
ensurable
newparam(:name, :namevar => true) do
desc 'Section/setting name to manage from neutron_vpnaas.conf'
newvalues(/\S+\/\S+/)
end
newproperty(:value, :array_matching => :all) do
desc 'The value of the setting to be defined.'
def in... | 25.658537 | 107 | 0.642586 |
0333dd2f3c0ab707753df0a52a7e4ecc8be1a05c | 236 | require 'habitat'
require 'jungle_organism_factory'
require 'pond_organism_factory'
jungle = Habitat.new(1, 4, JungleOrganismFactory.new)
jungle.simulate_one_day
pond = Habitat.new(3, 2, PondOrganismFactory.new)
pond.simulate_one_day
| 23.6 | 53 | 0.822034 |
e2d6123ac990df5e23eca894eb3611f81c22a861 | 164 | require 'rails_helper'
module Cmor::Galleries
RSpec.describe PictureDetail, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
end
| 20.5 | 58 | 0.737805 |
38dadb38d80dde47746bc2220514c385995eb841 | 22,633 | # frozen_string_literal: true
require "yaml"
require "active_support/core_ext/hash/keys"
require "active_support/core_ext/object/blank"
require "active_support/key_generator"
require "active_support/message_verifier"
require "active_support/encrypted_configuration"
require "active_support/deprecation"
require "rails/e... | 36.563813 | 157 | 0.682278 |
260af9be0fdfeb778529bee0d402617347ada583 | 4,906 | # frozen_string_literal: true
module Unparser
class Emitter
# Arg expr (pattern args) emitter
class ArgExpr < self
handle :arg_expr
children :body
private
# Perform dispatch
#
# @return [undefined]
#
# @api private
#
def dispatch
visit_pa... | 16.630508 | 86 | 0.53832 |
01736ef09d5eb1706514c174ca6b2e0c349dc3ef | 1,653 | Pod::Spec.new do |spec|
spec.name = "UnityMediationSdk"
spec.version = '0.2.1'
spec.summary = "Unity Mediation SDK"
spec.description = "UnityMediationSdk Framework containing protobuf objc files for communicating with the instantiation service."
spec.homepage = "https://gith... | 71.869565 | 320 | 0.722928 |
1df50ef2b52f515c301031c3e1c3ba6d0d4da9c2 | 878 | require 'rails_helper'
RSpec.describe "books/show", type: :view do
before(:each) do
@book = assign(:book, Book.create!(
title: "Title",
description: "MyText",
edition: 2,
pages: 3,
format: "Format",
price: 4,
quantity: 5,
available: false,
author: nil,
... | 23.72973 | 43 | 0.59795 |
e28a8abc3da8b25eb0919e55aceb94817460ffff | 389 | class Invitation < ApplicationRecord
include Invitations::Core
# 🚅 add concerns above.
# 🚅 add belongs_to associations above.
# 🚅 add has_many associations above.
# 🚅 add oauth providers above.
# 🚅 add has_one associations above.
# 🚅 add scopes above.
# 🚅 add validations above.
# 🚅 add ... | 16.913043 | 40 | 0.678663 |
28d7f806a27e70a03e85a0fac630813724d96df9 | 3,526 | class Swift < Formula
desc "High-performance system programming language"
homepage "https://github.com/apple/swift"
url "https://github.com/apple/swift/archive/swift-2.2-SNAPSHOT-2015-12-18-a.tar.gz"
version "2.2-SNAPSHOT-2015-12-18-a"
sha256 "2ff6c780f1768e410e444915d6830048025a7f353c9a4bc30456bbd40ad33951"
... | 32.348624 | 92 | 0.632728 |
e9a6ab006abb8d3efd8cc583cba933bc27615440 | 270 | class ParticipantSerializer < ActiveModel::Serializer
attributes :id, :email, :first_name, :last_name, :status
has_many :case_notes
has_many :paperworks
has_many :studio_assessments
has_one :personal_questionnaire
has_one :professional_questionnaire
end
| 20.769231 | 58 | 0.8 |
f7ee39a17555e896ddaba6b8a9eed215507acb23 | 214 | class AddDefaultValueToIsActive < ActiveRecord::Migration
def up
change_column :users, :is_active, :boolean, :default => true
end
def down
change_column :users, :is_active, :boolean, :default => nil
end
end
| 21.4 | 62 | 0.752336 |
6a20fdb441a02c7306fee306542e96c0443a4592 | 2,665 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... | 40.378788 | 239 | 0.654784 |
b94a22bf81edceb9ebec27da8454e25570fb84ac | 5,805 | RSpec.describe ContaAzulApi::Sale do
before do
stub_request(:post, %r{https://api.contaazul.com/oauth2/token}).
to_return(status: 200, body: File.read('spec/fixtures/refresh_oauth_token.json'))
stub_const('CaAuthHistory', FakeCaAuthHistory)
logger = double(:logger, info: '')
allow(Rails).to re... | 35.833333 | 106 | 0.671662 |
ab73699a44cacf4efb50b31685cb6943d517bb1f | 162 | # frozen_string_literal: true
require "workbook/cell"
module Workbook
module Types
class Numeric < Numeric
include Workbook::Cell
end
end
end
| 13.5 | 29 | 0.716049 |
0353ae9db7927ece1418bfc10117127828554d14 | 245 | working_directory "/home/root/furtively/current"
pid "/home/root/furtively/shared/pids/unicorn.pid"
stderr_path "/home/root/furtively/shared/log/unicorn.log"
stdout_path "/home/root/furtively/shared/log/unicorn.log"
worker_processes 2
timeout 30 | 40.833333 | 57 | 0.820408 |
4a749293a2114644222e554e7581bdbed394b841 | 497 | cask 'iexplorer' do
version '3.9.8.0'
sha256 '93a9a6e9ba083dcffc22c8f02aa17576d456a6cccce2a423f6c41497bdd9135f'
url "https://www.macroplant.com/release/iExplorer-#{version}.dmg"
appcast 'https://www.macroplant.com/iexplorer/ie3-appcast.xml',
checkpoint: '5681a4d7b14edacfc86a43ad3929b4b798e6ecc30db80f... | 31.0625 | 88 | 0.7666 |
26f557057ad524d7af98c918029603379d1a6ec9 | 2,360 | require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)
describe "Array#hash" do
it "returns the same fixnum for arrays with the same content" do
[].respond_to?(:hash).should == true
[[], [1, 2, 3]].each do |ary|
ary.hash.should == ary.dup.h... | 27.44186 | 73 | 0.609322 |
0392832b5eadd3d0c92c9c2c8983ea357e64ae7a | 788 | class ProgressBar
module Format
class String < ::String
MOLECULE_PATTERN = /%[a-zA-Z]/
ANSI_SGR_PATTERN = /\e\[[\d;]+m/
def displayable_length
gsub(ANSI_SGR_PATTERN, '').length
end
def bar_molecule_placeholder_length
@bar_molecule_placeholder_length ||= bar_molecules.size * 2
end
def non_b... | 21.297297 | 64 | 0.591371 |
acbb1b5f9244c0dd4a7eef848c2bf5db18b31b64 | 164 | class AddIndexUniqueToUsageLimitsAgain < ActiveRecord::Migration
def change
add_index(:usage_limits, [:metric_id, :plan_id, :period], unique: true)
end
end
| 27.333333 | 75 | 0.768293 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.