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 |
|---|---|---|---|---|---|
33176dd5eff11fcf05d4ac60260d4dcfc77159b9 | 4,760 | require "pathname"
require "vagrant/action/builder"
module VagrantPlugins
module ManagedServers
module Action
# Include the built-in modules so we can use them as top-level things.
include Vagrant::Action::Builtin
# This action is called to establish linkage between vagrant and the managed se... | 28 | 89 | 0.55042 |
614085ceea94bdce7c8b4f5939a77125b5d1b56e | 669 | ## TODO
# Attributes
# attendance
# Leaders
class SportsApi::Model::Event
SCORE_STATES = [
PREGAME = 'pregame',
INPROGRESS = 'in-progress',
FINAL = 'final'
]
attr_accessor :date,
:league,
:gameid,
:line,
:competitors,
:s... | 18.583333 | 58 | 0.437967 |
ffd4492d0a3146a840070e7040a4834614c68afa | 173 | # frozen_string_literal: true
class AddResourceIdToAnnouncement < ActiveRecord::Migration[5.0]
def change
add_column :announcements, :resource_id, :integer
end
end
| 21.625 | 64 | 0.786127 |
384380e4bf0a2e2d1dee2bc0da85c2004cd085ca | 527 | require 'zenprofile'
##
# A ProfiledProcessor that uses Ryan Davis' ZenProfiler.
#
# The ZenProfiler profiler requires Ruby 1.8.3 or better and RubyInline.
# ZenProfiler can be found at http://rubyforge.org/frs/?group_id=712
class ActionProfiler::ZenProfilerProcessor < ActionProfiler::ProfiledProcessor
def start_p... | 21.08 | 78 | 0.757116 |
61d485d03f59287ea945fbe729f6f7ab312aa241 | 128 | CelluloidBenchmark::Session.define do
benchmark :home_page, 1
get "https://github.com/scottwillson/celluloid-benchmark"
end
| 25.6 | 59 | 0.796875 |
03f6cd1a96f94f199f077dcc6dab9f7f96b2fcd8 | 39 | require 'honeybadger'
raise 'badgers!'
| 13 | 21 | 0.769231 |
e2e5c061b70def035d80392badacae3d3f3429bc | 7,512 | module Capybara
module Node
module Finders
##
#
# Find an {Capybara::Node::Element} based on the given arguments. +find+ will raise an error if the element
# is not found.
#
# If the driver is capable of executing JavaScript, +find+ will wait for a set amount of time
# a... | 41.502762 | 131 | 0.567226 |
3909d725f7e6c7e27effcbddb2ec4b414bd1af6b | 2,446 | require "jekyll"
require "uri"
module Jekyll
module GitHubMetadata
class SiteGitHubMunger
extend Forwardable
def_delegators :"Jekyll::GitHubMetadata", :site
private def_delegator :"Jekyll::GitHubMetadata", :repository
def initialize(site)
Jekyll::GitHubMetadata.site = site
... | 29.829268 | 91 | 0.624693 |
266ca47f5ce735bd6af7425f6534391111087a47 | 3,443 | # frozen_string_literal: true
require "action_policy/testing"
module ActionPolicy
# Provides assertions for policies usage
module TestHelper
class WithScopeTarget
attr_reader :scopes
def initialize(scopes)
@scopes = scopes
end
def with_target
if scopes.size > 1
... | 30.741071 | 90 | 0.623003 |
f8972dab66749d41d83c686454269e2a93676715 | 2,166 | require 'yaml'
require 'pathname'
require File.expand_path '../paths', __FILE__
module Libv8
class Location
def install!
File.open(Pathname(__FILE__).dirname.join('.location.yml'), "w") do |f|
f.write self.to_yaml
end
return 0
end
def self.load!
File.open(Pathname(__FILE_... | 26.096386 | 120 | 0.633887 |
089ed22b0cb0e30a70c32218cffcb25632871037 | 996 | require "geoip_redis/store"
require "geoip_redis/csv_reader"
require "geoip_redis/blocks_parser"
require "geoip_redis/locations_parser"
module GeoipRedis
class CountryLoader
def initialize(redis)
@store = Store.new(redis)
@csv_reader = CSVReader.new
@blocks_parser = BlocksParser.new
@loca... | 26.210526 | 69 | 0.682731 |
b93a34cb54eb52f248e74bdf60d7661a171d2af4 | 7,934 | class Ffmpeg < Formula
desc "Play, record, convert, and stream audio and video"
homepage "https://ffmpeg.org/"
url "https://ffmpeg.org/releases/ffmpeg-2.8.tar.bz2"
sha256 "9565236404d3515aab754283c687c0a001019003148bf7f708e643608c0690b8"
head "https://github.com/FFmpeg/FFmpeg.git"
bottle do
sha256 "845... | 40.070707 | 116 | 0.665994 |
ac1d68216a65058b4fede73bb2a9f5cdcaf45284 | 4,067 | require "set"
require "formula"
require "formula_versions"
class Descriptions
CACHE_FILE = HOMEBREW_CACHE + "desc_cache.json"
def self.cache
@cache || load_cache
end
# If the cache file exists, load it into, and return, a hash; otherwise,
# return nil.
def self.load_cache
@cache = JSON.parse(CACH... | 28.843972 | 91 | 0.678387 |
912e0d838dd04637ffe3ba11f578ea36908e4205 | 87 | # gems require UPPER case ENV variables so translate
Idv::UpcaseVendorEnvVars.new.call
| 29 | 52 | 0.827586 |
91bf3fada7b0c96a80e17c14a2086c30afa657a5 | 73 | Dummy::Application.routes.draw do
get ':action', :to => 'sessions'
end
| 18.25 | 34 | 0.684932 |
e8cb5f1688b0f9821a5f892158b190889dcd136e | 8,633 | require 'jwt'
RSpec.describe OAuth2::Strategy::Assertion do
subject { client.assertion }
let(:client) do
cli = OAuth2::Client.new('abc', 'def', :site => 'http://api.example.com', :auth_scheme => auth_scheme)
cli.connection.build do |b|
b.adapter :test do |stub|
stub.post('/oauth/token') do |... | 34.951417 | 132 | 0.598633 |
d5c52c464763bfaade7d812728d93d621a06d744 | 2,242 | # This test verifies that a previouslt cached fact is being resolved correctly after it is not cached anymore
test_name "ttls configured cached fact is resolved after ttls is removed" do
tag 'risk:high'
require 'facter/acceptance/user_fact_utils'
extend Facter::Acceptance::UserFactUtils
# This fact must be re... | 32.492754 | 121 | 0.693131 |
398fe80ccf84d1f971acaa66af94346b36dc676e | 571 | module Kontena::Cli::Vault
class WriteCommand < Clamp::Command
include Kontena::Cli::Common
include Kontena::Cli::GridOptions
parameter 'NAME', 'Secret name'
parameter '[VALUE]', 'Secret value'
def execute
require_api_url
token = require_token
secret = value
if secret.to_... | 22.84 | 63 | 0.595447 |
6207fb476cfbc9ed32de88036143395216889329 | 126 | module Nlocal
module Directory
class Document < Attachment
include Nlocal::Directory::StiChild
end
end
end
| 14 | 41 | 0.706349 |
4abeb407879d4a3c38f55defd2c8db13c96b2fdd | 814 | #
# Cookbook Name:: oneview_test
# Recipe:: power_device_set_uid_state_off
#
# (c) Copyright 2017 Hewlett Packard Enterprise Development LP
#
# 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... | 37 | 84 | 0.777641 |
18a866283f7b08cc27f1220ad5eb28fab749a13b | 218 | # -*- encoding : utf-8 -*-
class Cuenta::Faccion::CategoriasController < Admin::CategoriasController
public
def categorias_skip_path
'../../../'
end
def cats_path
'cuenta/faccion/categorias'
end
end
| 18.166667 | 73 | 0.678899 |
b936a7f38f6a87510fd47a0857e36a42bec00b0c | 713 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'User views services', :js do
include_context 'project service activation'
it 'shows the list of available services' do
visit_project_integrations
expect(page).to have_content('Integrations')
expect(page).to have_content('Campfire')
... | 31 | 55 | 0.734923 |
01fe723edda4d7af5a909df776a1078b3c96dc58 | 401 | module ActsAsCommentableWithReplies
module Extenders
module Commenter
def commenter?
false
end
def acts_as_commenter(*args)
require 'acts_as_commentable_with_replies/commenter'
include ActsAsCommentableWithReplies::Commenter
class_eval do
def self.co... | 16.708333 | 60 | 0.623441 |
8749e72f6bc12968503fbbfc8791c421c64b8a01 | 1,338 | module Withdraws
module Withdrawable
extend ActiveSupport::Concern
included do
before_filter :fetch
end
def create
@withdraw = model_kls.new(withdraw_params)
if two_factor_auth_verified?
if @withdraw.save
@withdraw.submit!
render nothing: true
e... | 26.235294 | 120 | 0.657698 |
39bd77e8c53200128538e5c0d0b196fd97489e85 | 38 | module Prct07
VERSION = "0.1.0"
end
| 9.5 | 19 | 0.657895 |
1d78778c75784da092cd18d8194893ed2207f080 | 34,200 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe ProjectsHelper do
include ProjectForksHelper
include AfterNextHelpers
let_it_be_with_reload(:project) { create(:project) }
let_it_be_with_refind(:project_with_repo) { create(:project, :repository) }
let_it_be(:user) { create(:user) }
bef... | 33.203883 | 589 | 0.681813 |
91aa64e46f8947f73fb5780121106850b29a9427 | 2,669 | # mundi_api
#
# This file was automatically generated by APIMATIC v2.0
# ( https://apimatic.io ).
module MundiApi
# UpdateSellerRequest Model.
class UpdateSellerRequest < BaseModel
# Seller name
# @return [String]
attr_accessor :name
# Seller code
# @return [String]
attr_acce... | 26.69 | 67 | 0.520045 |
ff6799f3544c07ecd1fcb7d079ab7ecc7a4d732b | 6,265 | # encoding: utf-8
require File.expand_path('../../../spec_helper.rb', __FILE__)
describe 'Backup::Syncer::Cloud::CloudFiles' do
let(:syncer) do
Backup::Syncer::Cloud::CloudFiles.new do |cf|
cf.api_key = 'my_api_key'
cf.username = 'my_username'
cf.container = 'my_container'
cf.... | 34.423077 | 78 | 0.631125 |
267909435efee0c5572d5ca6926bc2125bef3699 | 6,733 | describe Fastlane::Actions::StampChangelogAction do
describe 'Stamp CHANGELOG.md with placeholder line action' do
let (:changelog_mock_path) { './../spec/fixtures/CHANGELOG_MOCK_PLACEHOLDER_SUPPORT.md' }
let (:changelog_mock_path_hook) { './spec/fixtures/CHANGELOG_MOCK_PLACEHOLDER_SUPPORT.md' } # Path to mock... | 48.092857 | 229 | 0.650527 |
4a8d3dc11c8a6c86a6f5bc8e3f1166211cbbd70e | 688 | require 'oj' unless defined?(::Oj)
require 'multi_json/adapter'
module MultiJson
module Adapters
# Use the Oj library to dump/load.
class Oj < Adapter
defaults :load, :mode => :strict
defaults :dump, :mode => :compat, :time_format => :ruby
ParseError = if defined?(::Oj::ParseError)
... | 23.724138 | 71 | 0.601744 |
21617d2e6092af17e5e66434d338cea95d224418 | 3,793 | providers = Puppet::Util::Reference.newreference :providers, :title => "Provider Suitability Report", :depth => 1, :dynamic => true, :doc => "Which providers are valid for this machine" do
types = []
Puppet::Type.loadall
Puppet::Type.eachtype do |klass|
next unless klass.providers.length > 0
types << klas... | 31.87395 | 188 | 0.601898 |
bff02796bff7810ca78f5310e54dfff2fca008ee | 26,026 | require File.join(File.dirname(__FILE__), 'base')
require File.join(File.dirname(__FILE__), 'redis')
require File.join(File.dirname(__FILE__), 'socket')
require File.join(File.dirname(__FILE__), 'sandbox')
module Sensu
class Server
include Utilities
attr_reader :is_master
def self.run(options={})
... | 31.432367 | 107 | 0.531853 |
1c02b736f21622b06c4a87045f62ee15f6c9e4da | 5,282 | =begin
#Hydrogen Integration API
#The Hydrogen Integration API
OpenAPI spec version: 1.3.1
Contact: info@hydrogenplatform.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.21
=end
require 'date'
module IntegrationApi
class UpdateBaasClientCO
attr_accessor :nucl... | 28.706522 | 107 | 0.62571 |
6a54054badc8b05a3059edc49d09880f9c21111a | 10,874 | # frozen_string_literal: true
class ProjectPresenter < Gitlab::View::Presenter::Delegated
include ActionView::Helpers::NumberHelper
include ActionView::Helpers::UrlHelper
include GitlabRoutingHelper
include StorageHelper
include TreeHelper
include ChecksCollaboration
include Gitlab::Utils::StrongMemoize
... | 29.309973 | 172 | 0.656428 |
1d4732387cf7bec6694067ff4846d9f9848cc511 | 1,515 | module ApplicationHelper
def current_func_selector(current_func, target_func)
if [*target_func].include? current_func
'class="nowMenu"'.html_safe
else
''
end
end
# meta-tag を出力する
def output_meta_tags
if display_meta_tags.blank?
assign_meta_tags
end
display_meta_tags
... | 24.836066 | 85 | 0.607921 |
33f82cefc0ec6fb2e0b10d700420b75127005255 | 5,339 | # 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.
#
# This file is the source Rails uses to define your schema when running `bin/rai... | 42.03937 | 121 | 0.716239 |
7a5bf4f69a0cb92afd8eb3418ae86013284e3218 | 2,439 | # frozen_string_literal: true
require_relative 'test_helper'
class TestPlLocale < Test::Unit::TestCase
def setup
@phone_prefixes = %w[12 13 14 15 16 17 18 22 23 24 25 29 32 33 34 41 42 43 44 46 48 52 54 55 56 58 59 61 62 63 65 67 68 71 74 75 76 77 81 82 83 84 85 86 87 89 91 94 95].sort
@cell_prefixes = %w[5... | 33.875 | 177 | 0.731037 |
f72cb54e822ed644067c5384c3cca0c28c90726c | 9,111 | class Hash
# ISO does not define Hash#each_pair, so each_pair is defined in gem.
alias each_pair each
##
# call-seq:
# Hash[ key, value, ... ] -> new_hash
# Hash[ [ [key, value], ... ] ] -> new_hash
# Hash[ object ] -> new_hash
#
# Creates a new hash populated with the given objects.
... | 26.031429 | 107 | 0.509275 |
5d893cb4cab66d04d4ebaaaaaa6c7cf6bdafb86f | 14,880 | #--
# ===============================================================================
# Copyright (c) 2005,2006,2007,2008 Christopher Kleckner
# All rights reserved
#
# This file is part of the Rio library for ruby.
#
# Rio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General... | 39.157895 | 111 | 0.578024 |
ff723bd3422b4b77302d3a657635f4b0f55af3ef | 56 | FROM golang:1.17-alpine
RUN apk --no-cache add make git
| 18.666667 | 31 | 0.75 |
916e9046ee93bc2ee3d55cdfa5b4b0fbd13a8ee0 | 566 | require "mustache"
Mustache.template_path = __dir__
require "active_support"
require "active_support/core_ext"
require "salesforce_test_data_factory/version"
require "salesforce_test_data_factory/generator"
require "salesforce_test_data_factory/salesforce/client"
require "salesforce_test_data_factory/salesforce/sobjec... | 33.294118 | 57 | 0.879859 |
abe4e3bbe5e9e0b4715b38f24331a38cc9eda77f | 3,360 | include Niche::Aws::Ec2
# Support whyrun
def whyrun_supported?
true
end
action :associate do
ip = new_resource.ip || node['aws']['elastic_ip'][new_resource.name]['ip']
addr = address(ip)
if addr.nil?
raise "Elastic IP #{ip} does not exist"
elsif addr[:instance_id] == instance_id
Chef::Log.debug("El... | 29.473684 | 122 | 0.66131 |
ac8d191491ec81fd362af9d10acf41699f6241a0 | 1,293 | =begin
#Ory APIs
#Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers.
The version of the OpenAPI document: v0.0.1-alpha.71
Contact: support@ory.sh
Generated by: https://openapi-generator.tech
O... | 29.386364 | 177 | 0.769528 |
26890969a85e7ac2603de6ad402cd8fa88c32a0f | 2,732 | require '<%= gem_name %>/version'
AUTHOR = '<%= author %>' # can also be an array of Authors
EMAIL = "<%= email %>"
DESCRIPTION = "description of gem"
GEM_NAME = '<%= gem_name %>' # what ppl will type to install your gem
RUBYFORGE_PROJECT = '<%= gem_name %>' # The unix name for your project
HOMEPATH = "http://#{RUBYF... | 35.025641 | 116 | 0.659956 |
8764f94d7263ea846a3cb3cb9a37c33cd2ec7351 | 317 | all
rule 'MD002', :level => 1
rule 'MD007', :indent => 4
rule 'MD013', :line_length => 160, :code_blocks => false, :tables => false
rule 'MD026', :punctuation => ".,;:!"
exclude_rule 'MD013'
exclude_rule 'MD014'
exclude_rule 'MD030'
exclude_rule 'MD032'
exclude_rule 'MD033'
exclude_rule 'MD041'
exclude_rule 'MD046'
| 24.384615 | 74 | 0.70347 |
b97b8174dfdcacec98769638eacb76a0893daa46 | 2,712 | # frozen_string_literal: true
RSpec.describe Sports::Butler::SoccerApi::ApiFootballCom::HeadToHead do
let(:sport) { :soccer }
let(:api_name) { :api_football_com }
let(:endpoint) { :head_to_head }
let(:response_type) { Hash }
before do
ConfigHelpers.set_api_football_com
stubs_head_to_head_api_... | 27.673469 | 114 | 0.547935 |
1ce1029b4e6b5678360a8a813305ca6e142acc6d | 11,318 | # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic... | 43.034221 | 245 | 0.684838 |
4aabd1ca79921d1dc40a4fa7477ca92ae1be65ea | 2,998 | # frozen_string_literal: true
module MergeRequests
# Performs the merge between source SHA and the target branch or the specified first parent ref. Instead
# of writing the result to the MR target branch, it targets the `target_ref`.
#
# Ideally this should leave the `target_ref` state with the same state the
... | 31.229167 | 114 | 0.70547 |
6134109cf332fcb2ab15dd69cec7afcc44687cba | 1,203 | #
# Cookbook Name:: oracle
# Recipe:: ora_os_setup
#
# 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 ... | 35.382353 | 91 | 0.760599 |
1a13c25aec541ff2056136e4d86d436163871d7b | 1,123 | #
# Cookbook Name:: god
# Definition:: god_monitor
#
# Copyright 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
#
# Unl... | 28.794872 | 84 | 0.676759 |
6ada47c91f428c271d34daf2fb0d577f16837571 | 329 | # frozen_string_literal: true
# Migration adding github email attribute to user model so that github oauth is possible and separate
# from a database perspective than auth through a user given email.
class AddGithubEmailToUsers < ActiveRecord::Migration[6.0]
def change
add_column :users, :github_email, :string
... | 32.9 | 101 | 0.790274 |
39d9b8cbf53436c14545eabf0188b6b51ff830a1 | 2,160 | class OrdersController < ApplicationController
include CurrentCart
before_action :set_cart, only: [:new, :create]
before_action :set_order, only: [:show, :edit, :update, :destroy]
# GET /orders
# GET /orders.json
def index
@orders = Order.all
end
# GET /orders/1
# GET /orders/1.json
def show
... | 24.545455 | 88 | 0.625 |
1cd313ec819690703e101ccee2bb42bd08dacad9 | 754 | require 'active_support'
require 'test/unit'
class FlashCacheOnPrivateMemoizationTest < Test::Unit::TestCase
extend ActiveSupport::Memoizable
def test_public
assert_method_unmemoizable :pub
end
def test_protected
assert_method_unmemoizable :prot
end
def test_private
assert_method_unmemoizabl... | 17.136364 | 74 | 0.698939 |
ac4bbaab928f93800a63f92c6e061299139633cf | 859 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'digimon/version'
Gem::Specification.new do |spec|
spec.name = "digimon"
spec.version = Digimon::VERSION
spec.authors = ["Xiaoting"]
spec.email = ["yext4011@gm... | 34.36 | 74 | 0.643772 |
1accf3c8f55008bd8393403731a7b20295e5f8a8 | 2,154 | class MatchesController < ApplicationController
layout "modal", only: [ :edit_match_stats ]
include Select, StatusEnum
before_action :authorize_administrator, only: [:pend, :activate, :finish, :update, :postpone, :edit_match_stats, :update_match_stats]
def update
@match = Match.find(params[:id])
date... | 29.506849 | 156 | 0.669452 |
4a45b0a0c00771b062cc998ac972469eb39955da | 314 | class CreateContacts < ActiveRecord::Migration[5.1]
def change
create_table :contacts do |t|
t.string :name
t.string :email
t.string :mobile
t.string :project
t.string :role
t.text :address
t.references :user, foreign_key: true
t.timestamps
end
end
end
| 19.625 | 51 | 0.627389 |
b97154132e1619abb6e00835bbd95a54ceed2293 | 1,372 | require 'rails_helper'
describe 'Layouts (Design)' do
fixtures :users
before(:each) do
@admin = users(:captain_janeway)
log_in_as @admin.login
click_link 'Design'
end
context 'without any layouts' do
it 'says it has no layouts' do
expect(page).to have_content 'No Layouts'
end
i... | 27.44 | 102 | 0.662536 |
2196c3e0ebda7eacd281a6b8e273962997586f87 | 2,792 | require 'tempfile'
module Puppet::Parser::Functions
newfunction(:validate_augeas, :doc => <<-'ENDHEREDOC') do |args|
Perform validation of a string using an Augeas lens
The first argument of this function should be a string to
test, and the second argument should be the name of the Augeas lens to use.
... | 33.238095 | 186 | 0.65043 |
03368beb9c7172201d8222436541151e73d44456 | 1,011 | #
# Copyright (C) 2010-2016 dtk contributors
#
# This file is part of the dtk project.
#
# 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
#
# Unles... | 32.612903 | 94 | 0.761622 |
7a02b2a08ef47300703f319f87adf417595e4c71 | 719 | require 'spec_helper'
require 'docker/compose'
describe 'Example3' do
compose = Docker::Compose.new
set :docker_container, 'sinatra'
before(:all) do
compose.up(detached: true)
c = Docker::Container.get('consul')
sleep 3 # wait for consul to start
c.exec(['consul', 'kv', 'put', 'sinatra/message'... | 21.147059 | 61 | 0.653686 |
f8502a48bd99b197ee506e86738b7e9e6b78d645 | 5,994 | describe MiqAeMethod do
let(:user) { FactoryBot.create(:user_with_group) }
it "should return editable as false if the parent namespace/class is not editable" do
n1 = FactoryBot.create(:miq_ae_system_domain, :tenant => user.current_tenant)
c1 = FactoryBot.create(:miq_ae_class, :namespace_id => n1.id, :name =... | 39.96 | 163 | 0.541041 |
38a96b84c8687cc0b2e7d5205e812b889bd10c03 | 2,704 | require 'test_helper'
class ResetsControllerTest < CleanControllerTest
setup do
@user = User.make!(password: 'Password1')
end
test "Can't do anything if logged in" do
log_in(@user)
assert_404([
[:get, :new, nil],
[:get, :show, {params: {id: 'foo'}}],
[:post, :create, {params: {rese... | 31.44186 | 101 | 0.653476 |
33b739c8aee96dd26ec0c41ad9717f83617ca9ff | 81 | class Redis
class Retryable
class RetryError < RuntimeError; end
end
end
| 13.5 | 40 | 0.740741 |
ac2c9d3f9d3eef834fd364c5275d70b2dd992cab | 425 | # 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::ApiManagement::Mgmt::V2016_07_07
module Models
#
# Defines values for NameAvailabilityReason
#
module NameAvailabilityReason... | 23.611111 | 70 | 0.708235 |
21a85e313342382e10c002921de415e48b668248 | 5,845 | # 0: Original
class MountainBike
TIRE_WIDTH_FACTOR = 0.6
FRONT_SUSPENSION_FACTOR = 0.5
REAR_SUSPENSION_FACTOR = 0.4
def initialize(params)
params.each { |key, value| instance_variable_set "@#{key}", value }
@base_price ||= 300
@front_suspension_price ||= 200
@rear_suspension_price ||= 100
... | 25.524017 | 95 | 0.667066 |
1a9e9ea358fdc1bf38585105c8ecce83cbc5b4d2 | 1,035 | require 'spec_helper'
class UsageJsSpec < Bootstrap::Sass::Rails::Spec
describe 'application.js' do
let(:app_js) { dummy_asset('application.js') }
it 'will render main bootstrap.js file and all included modules' do
app_js.must_include 'affix.js'
app_js.must_include 'alert.js'
app_js.must... | 25.243902 | 71 | 0.685024 |
e9ade35d60ef6ba787a542a6f2b99850ebf98bf1 | 926 | require 'rails_helper'
describe 'list src images using the JSON API', type: :request do
it 'lists src images' do
src_image = FactoryGirl.create(:src_image, work_in_progress: false)
src_image.set_derived_image_fields
src_image.save!
src_image.reload
get(
'/api/v3/src_images',
'',
... | 26.457143 | 71 | 0.557235 |
18f07751914d9327114c9436cdbbf7687511ccfb | 1,260 | module BibleReferenceParser
# This module encapsulates shared behavior for classes that keep track of parsing errors.
# For example, a BookReference may encounter a parsing error due to a book that doesn't
# exist. A ChapterReference may have a parsing error because the chapter number isn't valid
# for the... | 27.391304 | 94 | 0.645238 |
ab11e3b4276050959e06b31a3b5aa17b452a0e75 | 1,029 | SwellMedia::Engine.routes.draw do
root to: 'static#home' # set media to HP if null id
#resources :admin, only: :index
resources :articles, path: SwellMedia.article_path
resources :article_admin, path: 'blog_admin' do
get :preview, on: :member
delete :empty_trash, on: :collection
end
resources :asset_manag... | 21 | 63 | 0.718173 |
e88a88d821be12963680d2748b44078c7d06a470 | 254 | # frozen_string_literal: true
class DropParticipationRecord < ActiveRecord::Migration[6.1]
def change
drop_table :participation_records, id: :uuid do |t|
t.timestamps
t.string :state, null: false, default: "assigned"
end
end
end
| 23.090909 | 60 | 0.712598 |
9199555b55341f43520d27494923eda8de5f2588 | 22 | module BandHelper
end
| 7.333333 | 17 | 0.863636 |
e9f534d9e2f956449bfb2cd6916bfa7e13034a05 | 3,601 | module ActionView::Helpers::TagHelper
def william_paginate(total_count = (@count || 0), per_page = @per_page, page = (@page || 1), method = :get)
page = 1 if page < 1
max = (total_count / (per_page*1.0)).ceil rescue 1
page = max if page > max
adjacents = 2
prev_page = page - 1
next_page = p... | 62.086207 | 280 | 0.563455 |
280da1bf3594ce8198b518eb48ca796fe1b14639 | 723 | # TODO - relies on rake to load files for us
class AutoSeed4 < SeedSuper
# TODO - this chunk should be configured in a file somewhere ... yaml?
# TODO - faker gem should go in here
# TODO - wrap in it's own method - in prep for going to file or faker gem
# Preping the attributes
def self.make_... | 32.863636 | 80 | 0.652835 |
d509283273ac097acac02520ab9074998ee8f116 | 5,546 | # frozen_string_literal: true
module RuboCop
module Cop
module Lint
#
# This cop emulates the following Ruby warnings in Ruby 2.6.
#
# % cat example.rb
# ERB.new('hi', nil, '-', '@output_buffer')
# % ruby -rerb example.rb
# example.rb:1: warning: Passing safe_level with ... | 34.02454 | 100 | 0.583664 |
ff195392ca03f82f2f4e31a4e879cf1353bcc454 | 148 | class AddEditorFeedbackToUsers < ActiveRecord::Migration
def change
add_column :users, :editor_feedback, :boolean, :default => false
end
end
| 24.666667 | 67 | 0.77027 |
e277d8751a5ff3b05a9bbd898df4f3a04db704f0 | 1,129 | # frozen_string_literal: true
module TestHelpers
class FakePushPackageRepository
def initialize
@cache = {}
end
def create_push_package(
script_project:,
script_content:,
compiled_type:,
metadata:,
library:
)
id = id(script_project.script_name, compiled_type... | 24.021277 | 78 | 0.64659 |
03fe924de63c8d8c7a39a2f5a2eb170bffe7c8c6 | 2,689 | require 'rollbar'
begin
require 'rack/mock'
rescue LoadError
end
require 'logger'
namespace :rollbar do
desc 'Verify your gem installation by sending a test exception to Rollbar'
task :test => [:environment] do
if defined?(Rails)
Rails.logger = if defined?(ActiveSupport::TaggedLogging)
... | 28.606383 | 180 | 0.633321 |
ff5b9e53d28804a9bcbed66bda7d814fde96ebbb | 2,789 | # 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::ImportExport::Mgmt::V2016_11_01
module Models
#
# A property containing information about the blobs to be exported for an
# expo... | 30.988889 | 79 | 0.499821 |
ff40ea3c140efcbb7bad1d5c0a32af5992cb5cbc | 3,961 | # encoding: utf-8
#--
# Copyright 2013-2015 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... | 40.418367 | 144 | 0.703105 |
4af27add36c07e36144bec40b047e001040a65fe | 369 | class CreateShortenedUrls < ActiveRecord::Migration[5.1]
def change
create_table :shortened_urls do |t|
t.string :long_url, null: false
t.string :short_url, null: false
t.integer :submitter_id, null: false
t.timestamps
end
add_index :shortened_urls, :short_url, unique: true
ad... | 26.357143 | 56 | 0.704607 |
ff84eb9375478c313d2b6a7882a8c367aba7c7cf | 593 | Pod::Spec.new do |s|
s.name = "PokerNowKit"
s.version = "0.0.10"
s.summary = "Shared framework of PokerNow.club log parsing code"
s.homepage = "https://github.com/pj4533/PokerNowKit"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = {
"PJ Gray" => "pj4533@gma... | 31.210526 | 89 | 0.591906 |
380f48fab793dde3886a4468c89d16b2593611b7 | 848 | ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all tests here...
# Returns... | 27.354839 | 82 | 0.639151 |
e8a943789a11f5e615de28f3573bdff467758b23 | 1,054 | require_relative "shared_examples_for_index"
require_relative "shared_examples_for_tags"
RSpec.describe("v3.0 - ContainerGroup") do
include ::Spec::Support::TenantIdentity
let(:headers) { {"CONTENT_TYPE" => "application/json", "x-rh-identity" => identity} }
let(:container_node) { ContainerNode.create!(:tenant =... | 35.133333 | 126 | 0.680266 |
394568a3e30f37940a0c87d504033e9131877a22 | 1,101 | cask 'unity-ios-support-for-editor@2018.1.9f1' do
version '2018.1.9f1,24bbd83e8b9e'
sha256 :no_check
url "https://download.unity3d.com/download_unity/24bbd83e8b9e/MacEditorTargetInstaller/UnitySetup-iOS-Support-for-Editor-2018.1.9f1.pkg"
name 'iOS Build Support'
homepage 'https://unity3d.com/unity/'
pkg '... | 30.583333 | 138 | 0.71208 |
6187d6aa1c5dd378e2cc4b0d1a957079eaa41db0 | 2,658 | class PostsController < ApplicationController
before_action :set_post, only: [:show, :edit, :update, :destroy]
# GET /posts
# GET /posts.json
def index
case params[:sort]
when 'newest'
@posts = Post.paginate(page: params[:page], per_page: 15).order(created_at: :desc)
else
@posts = Post.... | 25.557692 | 113 | 0.634688 |
6281dfe96d686fc5383aa0a972b50bc7c5eb7d6b | 710 | cask 'squirrel' do
version '0.9.26.2'
sha256 '7ba8f934f8d4fe1d42c944ea0771f1a54ed558dd65ea558c4ba4d203505bc130'
# dl.bintray.com/lotem/rime was verified as official when first introduced to the cask
url "https://dl.bintray.com/lotem/rime/Squirrel-#{version}.zip"
name 'Squirrel'
homepage 'http://rime.im/dow... | 32.272727 | 90 | 0.694366 |
f8c9fb14f0d83f8d501560fcbfb222767f05bca4 | 3,478 | # frozen_string_literal: true
module EE
module Registrations
module WelcomeController
extend ActiveSupport::Concern
extend ::Gitlab::Utils::Override
include ::Gitlab::Utils::StrongMemoize
TRIAL_ONBOARDING_BOARD_NAME = 'GitLab onboarding'
prepended do
include OneTrustCSP
... | 31.053571 | 114 | 0.678551 |
87b606313977fc88925a6763a9448f6aacaf06f3 | 1,250 | require 'sinatra'
require_relative 'lib/dumb'
Dumbstore::App.register_all!
# routes
get('/') { erb :index }
get('/apps') { @apps = Dumbstore::Text.apps.merge(Dumbstore::Voice.apps).values.uniq; erb :apps }
get('/about') { erb :about }
get('/documentation') { erb :documentation }
# These cause method not found errors... | 25 | 97 | 0.684 |
26546ff44bb62f26e928007b7ccece46210f32ac | 181 | module Gluttonberg
module Settings
class Main < Gluttonberg::Application
include Gluttonberg::AdminController
def index
render
end
end
end
end | 16.454545 | 42 | 0.668508 |
ffd5e08b75b608db14bff031dde21c666dab5f98 | 3,680 | require_relative 'utilities'
require 'yaml'
def provision_postgres(root_loc, new_containers)
puts colorize_lightblue('Searching for postgres initialisation SQL in the apps')
# Load configuration.yml into a Hash
config = YAML.load_file("#{root_loc}/dev-env-config/configuration.yml")
return unless config['appli... | 44.878049 | 119 | 0.714674 |
ab0ded4356d4009455321afee631f9acbda8594a | 1,989 | # frozen_string_literal: true
# Copyright (c) 2017-2019 Yegor Bugayenko
#
# 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, including without limitation the rights
# to us... | 34.293103 | 80 | 0.683761 |
01689045dfb06b17da78580adc7d207de97ee16f | 116 | require "gemita/version"
require "gemita/menu"
require "gemita/lista"
module Gemita
# Your code goes here...
end
| 14.5 | 26 | 0.741379 |
79716df6b6033d1f3f7d688faab33a26700df48f | 12,775 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Ci::Config::Entry::Root do
let(:root) { described_class.new(hash) }
describe '.nodes' do
it 'returns a hash' do
expect(described_class.nodes).to be_a(Hash)
end
context 'when filtering all the entry/node names' do
... | 31.778607 | 126 | 0.501996 |
91f0a9217b6a8972b7ea7ef81a418b10e19c0d70 | 294 | name 'cdo-users'
maintainer 'Code.org'
maintainer_email 'will@code.org'
license 'All rights reserved'
description 'Creates users for the accounts defined in Chef'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.18'
| 36.75 | 72 | 0.673469 |
9102ab91def3c4e721716a537227639aecb4cc05 | 2,179 | cask "cocktail" do
if MacOS.version <= :yosemite
version "8.9.2"
sha256 "acc7d191313fa0eb4109ae56f62f73e7ed6685f7d7d438d5138b85d68e40edd8"
url "https://www.maintain.se/downloads/sparkle/yosemite/Cocktail_#{version}.zip"
appcast "https://www.maintain.se/downloads/sparkle/yosemite/yosemite.xml"
elsif... | 41.903846 | 86 | 0.765489 |
39b286c320762d8812380db373ae1c925697a7d3 | 783 | module Api
class RequestParser
def self.parse_user(data)
user_name = Hash(data).fetch_path("requester", "user_name")
return if user_name.blank?
user = User.lookup_by_identity(user_name)
raise BadRequestError, "Unknown requester user_name #{user_name} specified" unless user
user
e... | 31.32 | 106 | 0.698595 |
7a82ddd091754714e83c51de7468162ba9e4310d | 510 | # frozen_string_literal: true
module InternshipOfferInfos
class WeeklyFramed < InternshipOfferInfo
validates :weeks, presence: true
has_many :internship_offer_info_weeks, dependent: :destroy,
foreign_key: :internship_offer_info_id,
... | 24.285714 | 82 | 0.62549 |
18b314c642d34183b8ce731d19e47c7d94aa225d | 3,024 | # $Id: udp.rb 14 2008-03-02 05:42:30Z warchild $
#
# Copyright (c) 2008, Jon Hart
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above cop... | 37.8 | 121 | 0.728836 |
e2177c63da18d8f1e4f298870ae808f85a54baaf | 2,112 | module Poniard
# Mixing this module into a Rails controller provides the poniard DSL to that
# controller. To enable poniard on all controllers, mix this in to
# `ApplicationController`.
module Controller
# @private
def self.included(klass)
klass.extend(ClassMethods)
end
# Call the given ... | 30.608696 | 79 | 0.615057 |
4a5a769a42e4b29ce7ebff1cda797c01f6d329d1 | 945 | module CurrencyRate
class ExmoAdapter < Adapter
# No need to use it for fetching, just additional information about supported currencies
SUPPORTED_CURRENCIES = %w(
ADA BCH BTC BTCZ BTG DASH DOGE DXT EOS ETC ETH EUR GAS GNT GUSD HB
HBZ INK KICK LSK LTC MNX NEO OMG PLN QTUM RUB SMART STQ TRX TRY UAH... | 33.75 | 104 | 0.639153 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.