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 |
|---|---|---|---|---|---|
1c27640c3b3832192686665a5f5385e151b7f38a | 4,113 | require 'spec_helper'
RSpec.describe MXNet::Optimizer do
describe '.create' do
it 'does not accept a class' do
expect {
MXNet::Optimizer.create(MXNet::Optimizer::SGD)
}.to raise_error(ArgumentError)
end
it 'accepts an instance' do
opt = MXNet::Optimizer.create(MXNet::Optimizer::... | 32.132813 | 145 | 0.653781 |
bf87d5f1d455f3e8ec3c3327b462db7eaae880a4 | 1,874 | # encoding: utf-8
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# /spec/fixtures/responses/whois.co.ug/status_registered.expected
#
# and regenerate the tests with the following rake task
#
# $ rake genspec:parsers
#
require 'spec_helper'
require 'who... | 26.771429 | 74 | 0.667556 |
5d8d666ae26ca1a83c599f430ee935bde41eebb8 | 456 | class AircraftsController < ApplicationController
def index
aircrafts = Aircraft.all
if aircrafts
render json: AircraftSerializer.new(aircrafts)
else
render json: {message: 'No aircrafts found'}
end
end
def show
aircraft = Aircraft.find_by(id: params[:id])
if aircraft
r... | 22.8 | 62 | 0.682018 |
bf0ee566117b0e8f9fcb8ab0d48972aac5eed682 | 1,253 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads/v3/enums/search_engine_results_page_type.proto
require 'google/protobuf'
require 'google/api/annotations_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_file("google/ads/googleads/v3/enums/search_engine_result... | 37.969697 | 233 | 0.769354 |
f7edac462ef3caa451dde5b90c0c32592abcc9fb | 439 | ENV['RAILS_ENV'] ||= 'test'
require_relative "../config/environment"
require "rails/test_help"
require "minitest/reporters"
Minitest::Reporters.use!
class ActiveSupport::TestCase
# Run tests in parallel with specified workers
parallelize(workers: :number_of_processors)
# Setup all fixtures in test/fixtures/*.yml... | 29.266667 | 82 | 0.763098 |
ed35f13162e33318e910f379353d24c067893e2b | 46 | module MethodFallback
VERSION = '0.1.2'
end
| 11.5 | 21 | 0.717391 |
261531041be37c56e007c4be31d7f9c037858742 | 1,198 |
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'gbeacon/version'
Gem::Specification.new do |spec|
spec.name = 'gbeacon'
spec.version = Gbeacon::VERSION
spec.authors = ['Marlon Henry Schweigert']
spec.email = ['fleyhe0@gma... | 36.30303 | 87 | 0.653589 |
91b230311343c0b682d61439f0275cd33e092979 | 420 | require "rails_helper"
feature "Handling Forbidden responses from the backend", type: :feature do
let(:forbidden_page) { PageObjects::Page::Forbidden.new }
before do
signed_in_user
stub_api_v2_request("/recruitment_cycles/#{Settings.current_cycle}", "", :get, 403)
end
it "Renders the forbidden page" ... | 26.25 | 87 | 0.740476 |
e2860ac7b07c8e6a8b91a87e37605dbcf2c569fa | 1,293 | cask 'amethyst' do
if MacOS.version <= :mavericks
version '0.9.10'
sha256 '82adf42ce6031ab59a3072e607788e73f594ad5f21c7118aabc6c5dafe3d0b47'
url "https://ianyh.com/amethyst/versions/Amethyst-#{version}.zip"
elsif MacOS.version <= :el_capitan
version '0.10.1'
sha256 '9fd1ac2cfb8159b2945a4482046ee... | 38.029412 | 153 | 0.723898 |
61a604b954f773ae85d8287e7dee54f51df14a9a | 7,556 | require 'sidekiq/web'
Gitlab::Application.routes.draw do
#
# Search
#
get 'search' => "search#show"
# API
require 'api'
Gitlab::API.logger Rails.logger
mount Gitlab::API => '/api'
constraint = lambda { |request| request.env["warden"].authenticate? and request.env['warden'].user.admin? }
constrain... | 24.77377 | 132 | 0.560349 |
1c2444e839beaf7865c3e4fad27fcc27aff7a511 | 2,515 | Rails.application.routes.draw do
resource :profile, only: [:show, :edit, :update]
resources :donations, only: [:edit, :update] do
resource :confirmation, only: [:create, :destroy, :update]
end
resource :location, only: [:update]
resources :pre_registrations, only: [:create]
resources :zones, only: [] ... | 29.940476 | 80 | 0.638569 |
030efd6cfd21e4efee8438a783d5b2ff6bc07fce | 2,584 | Pod::Spec.new do |s|
s.name = "MatrixSDK"
s.version = "0.22.5"
s.summary = "The iOS SDK to build apps compatible with Matrix (https://www.matrix.org)"
s.description = <<-DESC
Matrix is a new open standard for interoperable Instant Messaging and VoIP, providing pragmatic HTTP APIs and... | 36.394366 | 228 | 0.642028 |
5db05865ea57ec93f706e129309f5098e9421034 | 1,040 | # frozen_string_literal: true
require 'test_helper'
class UsersControllerTest < ActionDispatch::IntegrationTest
setup do
@user = users(:one)
end
test 'should get index' do
get users_url
assert_response :success
end
test 'should get new' do
get new_user_url
assert_response :success
en... | 20.392157 | 85 | 0.688462 |
bb1929c00c1e655d4a70e3c227f62594d0b9a526 | 1,441 | # typed: false
require 'spec_helper'
require 'ddtrace/transport/io'
RSpec.describe Datadog::Transport::IO do
describe '.new' do
subject(:new_io) { described_class.new(out, encoder) }
let(:out) { instance_double(IO) }
let(:encoder) { instance_double(Datadog::Core::Encoding::Encoder) }
let(:client) {... | 26.2 | 73 | 0.634976 |
bbb8a6d195e04caaf36ca47036435f40195d29bf | 6,696 | # Klue-Less DDD generator
module KDsl
module TemplateRendering
# https://api.rubyonrails.org/classes/ActiveSupport/Inflector.html#method-i-humanize
class HandlebarsFormatter
# ----------------------------------------------------------------------
# format symbols
# -----------------------... | 25.172932 | 88 | 0.497909 |
2878752636aa0d1b9f131c2dc8fd94dbe0d9fd5b | 2,412 | #
# Author:: Bryan McLellan (btm@loftninjas.org)
# Copyright:: Copyright (c) 2009 Bryan McLellan
# 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
#
# ... | 40.2 | 77 | 0.644693 |
383201ce6513a08d3ef3b5730bb6828d9480e01f | 4,606 | #########################################
# This class provide methods to install, index, or update internal databases
#########################################
class DatabasesSupportInternal < DatabasesSupport
#INIT
def initialize(dir,info)
#First SET provided databases constant
load_repository_info(dir)
#L... | 39.367521 | 307 | 0.681068 |
ab0512e905f5c323c0f2e8583a5ef9bbb65e959d | 3,098 | module Luban
module Deployment
module Packages
class Monit
class Controller < Luban::Deployment::Service::Controller
module Commands
module Public
def monitor_control_file_name
@monitor_control_file_name ||= 'monitrc'
end
... | 30.98 | 147 | 0.581988 |
1af8f12979c9b601bda60beb10668f8e539ec18b | 91 | require "camome_gc_watcher/version"
module CamomeGcWatcher
# Your code goes here...
end
| 15.166667 | 35 | 0.78022 |
acece9791142015984703dcbb07edacd40fa2f9b | 11,684 | # frozen_string_literal: true
begin
require "openssl"
# Disable FIPS mode for tests for installations
# where FIPS mode would be enabled by default.
# Has no effect on all other installations.
OpenSSL.fips_mode=false
rescue LoadError
end
# Compile OpenSSL with crypto-mdebug and run this test suite with OSSL... | 29.356784 | 100 | 0.623331 |
b9947b9144484694ac304807025332f0bde22e08 | 1,396 | # table_catalog | postgres_to_redshift
# table_schema | public
# table_name | acquisition_pages
# table_type | BASE TABLE
# self_referencing_column_name |
# reference_generation |
# user_defined_type_catalog |
# user_defined_type_schema |... | 25.381818 | 147 | 0.603868 |
38bf41dc89360ca35d7eb7d50b304040471c9146 | 971 | require 'spec_helper'
describe Wombat do
it 'should provide syntactic sugar method Wombat.crawl' do
Wombat.should respond_to(:crawl)
end
it 'should provide syntactic sugar method Wombat.scrape' do
Wombat.should respond_to(:scrape)
end
it 'should redirect .scrape to .crawl' do
fake_class = double :fake
f... | 23.682927 | 64 | 0.709578 |
18d8122474df8042e0cc0a0bd6d8b4b18e8cabb5 | 199 | # Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
module Diaspora
autoload :Parser
end
| 24.875 | 77 | 0.733668 |
e834fa9b640a76ab619fec4fc8dcfcb9d6cbbf2b | 1,695 | require 'spec_helper'
describe TeamMembersController do
before do
@team = Factory(:team)
@user = Factory(:user)
@admin = Factory(:team_member, :user => @user, :team => @team, :admin => true)
sign_in @user
end
describe 'update' do
it 'should promote if user was not admin on success' do
... | 36.847826 | 110 | 0.641298 |
bbebf3cd68dc65406e95744c5b60e12a5de84a29 | 3,198 | class Goolabs < Formula
desc "Command-line tool for morphologically analyzing Japanese language"
homepage "https://pypi.python.org/pypi/goolabs"
url "https://files.pythonhosted.org/packages/ce/86/2d3b5bd85311ee3a7ae7a661b3619095431503cd0cae03048c646b700cad/goolabs-0.4.0.tar.gz"
sha256 "4f768a5b98960c507f5ba4e1c... | 43.216216 | 141 | 0.799875 |
f7704e61b4e00b79674d343bc482d6bf187d2a66 | 3,374 | # 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::MediaServices::Mgmt::V2018_03_30_preview
module Models
#
# Describes all the settings to be used when encoding the input video with
... | 30.396396 | 78 | 0.474215 |
1ab474dcc593da0e9eae9ce543d3256b0fbce284 | 623 | require 'tok'
require 'rails'
module Tok
class Engine < Rails::Engine
isolate_namespace Tok
initializer :append_migrations do |app|
if model_exist?
config.paths["db/migrate"].expanded.each do |expanded_path|
app.config.paths["db/migrate"] << expanded_path
end
end
e... | 23.074074 | 101 | 0.664526 |
91487a72bc58875f1926ad7caeadf20465a8412a | 10,959 | # 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 applicable law or agreed to in writing, ... | 44.730612 | 85 | 0.598777 |
18baf9b50f98897aea092e7d3e3a0f8ee1ff9639 | 484 | name 'generated_cookbook'
maintainer 'Copyright Holder'
maintainer_email 'email@domain.com'
license 'Apache-2.0'
description 'Installs / configures generated_cookbook'
long_description ::File.read(File.expand_path('../README.md', __FILE__))
version '0.1.0'
chef_version '>= 1... | 44 | 83 | 0.698347 |
616676080a6a24fecbbe98998865be12b300e3bb | 303 | require 'euchre'
# choose trump
puts %w{Diamonds Clubs Spades Hearts}[rand(4)]
ed = EuchreDeck.new
ed.shuffle
5.times{ puts ed.deal }
And the sort program as:
require 'euchre'
eh = EuchreHand.new
eh.trump = gets.strip
while card = gets
eh.add_card( card.strip )
end
puts eh.trump
puts eh.hand
| 12.625 | 46 | 0.719472 |
011f25115462bc48608b3e0a028d1543879316a8 | 372 | # -*- encoding: ascii-8bit -*-
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/cover_and_include', __FILE__)
require File.expand_path('../shared/cover', __FILE__)
ruby_version_is "1.8.8" do
describe "Range#cover?" do
it_behaves_like :range_cover_and_include, :cover?... | 33.818182 | 65 | 0.731183 |
4a5556ab0b4f240e4d4bb4fe0473172cba0723f0 | 2,161 | # frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don... | 34.301587 | 85 | 0.761222 |
7993e31d4c42a3ab2a5e7502f7f2f1eeb71d58ff | 1,867 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = AverageRanking
include Msf::Exploit::Remote::Ftp
def initialize(info = {})
super(update_i... | 27.455882 | 101 | 0.534012 |
bb58ebea673f7fb0b97a021f55758b59cc4c2a96 | 3,815 | RSpec.describe EventSourcery::EventProcessing::ErrorHandlers::ExponentialBackoffRetry do
subject(:error_handler) do
described_class.new(
processor_name: processor_name,
)
end
let(:processor_name) { 'processor_name' }
let(:on_event_processor_error) { spy }
let(:logger) { spy(Logger) }
before d... | 35.990566 | 129 | 0.683617 |
08569a130778ad94c2eb25c0db9c0f8c34411c9c | 619 | require "serverspec"
require "docker"
describe "Dockerfile" do
before(:all) do
image = Docker::Image.build_from_dir('/docker-file/.')
set :os, family: :debian
set :backend, :docker
set :docker_image, image.id
end
describe file('/usr/share/jenkins/ref/') do
it { should be_directory }
end
... | 19.967742 | 59 | 0.678514 |
5dcf86028dbeefef55b483ea20e8819df168cbc9 | 780 | Pod::Spec.new do |s|
s.name = "ReYunTracking"
s.version = "1.3.3"
s.summary = "ReYun Tracking SDK"
s.homepage = "https://github.com/ReYunTracking/Tracking"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "feiyang" => "3196817369@qq.com" }
s.pl... | 26.896552 | 98 | 0.598718 |
e8afc7fa386442e44261860c069b327f0493e60d | 23,426 | # frozen_string_literal: true
require_relative '../test_helper'
SingleCov.covered! uncovered: 4
describe Stage do
subject { stages(:test_staging) }
let(:stage) { subject }
it "#unique_name" do
assert_equal "Foo / Staging", stage.unique_name
end
describe "validations" do
it "is valid" do
asse... | 30.149292 | 120 | 0.670964 |
9101002bc2cc1bd24b07d7193f9c3d1dbb7aa6dd | 382 | require 'httparty'
class LoginHistoriesController < ApplicationController
before_action :auth_member!
layout "landing"
def index
if current_user.present?
@login_histories = LoginHistory.where(member_id: current_user.id)
.order('created_at DESC').paginate(:page => par... | 23.875 | 103 | 0.65445 |
874b7df6e5fc0a15577f4bf39f9252fe09e43af3 | 5,098 | #
# Be sure to run `pod spec lint hehe.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github.com/Co... | 35.901408 | 93 | 0.58827 |
abbde0abedf3a8e89f98a8c01c5510a1ae7d07ef | 1,005 | class Libosip < Formula
desc "Implementation of the eXosip2 stack"
homepage "https://www.gnu.org/software/osip/"
url "https://ftpmirror.gnu.org/osip/libosip2-4.1.0.tar.gz"
mirror "https://ftp.gnu.org/gnu/osip/libosip2-4.1.0.tar.gz"
sha256 "996aa0363316a871915b6f12562af53853a9962bb93f6abe1ae69f8de7008504"
b... | 41.875 | 95 | 0.761194 |
ab56f118c4ac6a8337d6ca619017f9c98164b113 | 74 | FactoryBot.define do
factory :task, class: "Lakatan::Task" do
end
end
| 14.8 | 42 | 0.716216 |
e2711f29cb69766fa6a783c8690a625896e4533c | 34,058 | # frozen_string_literal: true
# Copyright 2021 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... | 52.396923 | 146 | 0.541694 |
e89679f057a2b19056eafc020dfa433f17748167 | 1,329 | # frozen_string_literal: true
require 'spec_helper'
describe 'GeoCalc' do
describe 'Spherical distance between' do
let(:point_one) { Location.new(0.0, 0.0) }
let(:point_two) { Location.new(0.0, 1.0) }
it 'should be equal to 110951' do
expect(GeoCalc.distance_between(point_one, point_two).value.ro... | 33.225 | 87 | 0.696764 |
bf916580c031697f3da85c922afd56763b70be22 | 117 | #if Rails.env.staging? || Rails.env.production?
# SMTP_SETTINGS = {
# api_key: ENV['POSTMARK_API_KEY']
# }
#end
| 19.5 | 47 | 0.65812 |
21072f829ef84b40591df386196ac1c5fa8a5331 | 306 | # encoding utf-8
# Copyright (c) Universidade Federal Fluminense (UFF).
# This file is part of SAPOS. Please, consult the license terms in the LICENSE file.
class AddExtendOnHoldToPhases < ActiveRecord::Migration
def change
add_column :phases, :extend_on_hold, :boolean, :default => false
end
end
| 30.6 | 84 | 0.75817 |
f84851de9e5102193a4dc6d5723aa4fb878cfdf5 | 1,294 | require 'test_helper'
class TestBase2Csv < Test::Unit::TestCase
def test_load_strings
expected_output = {}
output = Babelish::Base2Csv.new.send :load_strings, nil
assert_equal expected_output, output
end
def test_create_csv_file
keys = ["ERROR_HANDLER_WARNING_DISMISS", "ANOTHER_STRING"]
file... | 29.409091 | 99 | 0.710974 |
f85822d4ac322746e2f1ca86f2eb191b87b3e536 | 2,012 | class Earthly < Formula
desc "Build automation tool for the container era"
homepage "https://earthly.dev/"
url "https://github.com/earthly/earthly/archive/v0.5.8.tar.gz"
sha256 "6ef27bea990737c9ed76dfd05699c0b992ee0ca72c939b53c036748afee97385"
license "BUSL-1.1"
head "https://github.com/earthly/earthly.git"... | 39.45098 | 122 | 0.73161 |
180040f4bd3d8b597c931372c646a532d6039e3d | 2,128 | # coding: utf-8
require "danger/request_sources/vsts"
RSpec.describe Danger::RequestSources::VSTS, host: :vsts do
let(:env) { stub_env }
let(:subject) { Danger::RequestSources::VSTS.new(stub_ci, env) }
describe "#new" do
it "should not raise uninitialized constant error" do
expect { described_class.n... | 28.756757 | 130 | 0.68938 |
2111320c7b14c244119b95eed6657f0cde96f0b5 | 6,549 | # encoding: UTF-8
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe 'ApiAuth' do
describe 'generating secret keys' do
it 'should generate secret keys' do
ApiAuth.generate_secret_key
end
it 'should generate secret keys that are 88 characters' do
expect(ApiAuth.generat... | 35.209677 | 125 | 0.614598 |
ac1f1df338609e6491750768710b3e57dc0deca7 | 66,985 | # frozen_string_literal: true
require 'spec_helper'
describe Grape::Validations do
subject { Class.new(Grape::API) }
def app
subject
end
def declared_params
subject.namespace_stackable(:declared_params).flatten
end
describe 'params' do
context 'optional' do
before do
subject.p... | 33.847903 | 213 | 0.565336 |
79837a40ff50dd982ebdc0c9defc8bcb54ccfe03 | 872 | require "json"
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
Pod::Spec.new do |s|
s.name = "react-native-cidscan"
s.version = package["version"]
s.summary = package["description"]
s.homepage = package["homepage"]
s.license = package["license"]
s.authors ... | 34.88 | 190 | 0.619266 |
33dea25289a319d77894d49df0f63ecb2e353d67 | 3,806 | # frozen_string_literal: true
module API
class ProtectedBranches < Grape::API
include PaginationParams
BRANCH_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(name: API::NO_SLASH_URL_PART_REGEX)
before { authorize_admin_project }
helpers Helpers::ProtectedBranchesHelpers
p... | 40.063158 | 118 | 0.686548 |
1d05fa2b7f863f87399f44ac2d9fcc8362955d71 | 43 | module RubyExample
VERSION = "0.1.0"
end
| 10.75 | 19 | 0.697674 |
e85c09525926d1578a0f8b491ce5895c9b5564be | 1,169 | module Carto
class AccessToken < OauthToken
# Compatibility with ActiveRecord inheritance. When migrating to ActiveRecord,
# the class name changed from ::AccessToken to ::Carto::AccessToken
# Source: https://yiming.dev/blog/2017/12/07/add-sti-to-a-legacy-activerecord-model/
self.store_full_sti_class... | 30.763158 | 88 | 0.747648 |
e9933e7acd363f480db729cd2a62796a894e24cb | 845 | # frozen_string_literal: true
require 'rspec'
RSpec.shared_context 'WidgetsCommon' do
before(:all) do
LibyuiClient.timeout = 0
LibyuiClient.interval = 0
@app = LibyuiClient::App.new(host: 'www.example.com', port: '9999')
end
# Common Request/Response parts
let(:widgets_url) { 'http://www.example.... | 29.137931 | 71 | 0.671006 |
d596b3f566f61b94096aae5f9b14444c54ca8e1d | 1,008 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core/handler/bind_tcp'
require 'msf/core/payload/windows/bind_tcp'
module MetasploitModule
CachedSize = 318
include Msf::Payload::Stager
include Msf::Payload::... | 23.44186 | 87 | 0.628968 |
edd016097ed63fe89516aae41cd4a4a7a94b2d87 | 916 | require 'spec_helper'
require 'hiera-puppet-helper'
describe 'rjil::trust_selfsigned_cert' do
let :params do
{
:cert => '/etc/ssl/certs/jiocloud.com.crt',
:ssl_cert_package => 'jiocloud-ssl-certificate',
}
end
let :facts do
{
:operatingsystem => 'Ubuntu',
:o... | 23.487179 | 78 | 0.611354 |
38ed3531c02042ed59c05c945aa5cf33d8eb1b63 | 999 | # 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 `rails
#... | 41.625 | 86 | 0.762763 |
f8b4b187312a358a017a335ce81804784921d914 | 159 | # This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Locations::Application
| 31.8 | 67 | 0.773585 |
79ff442fb6afac978ee8871dfe5deb11309e79f2 | 4,624 | class Menu
class Node
attr_accessor :parent, :parent_id, :children
attr_accessor :site_controller_id, :controller_action_id, :content_page_id
attr_accessor :id, :name, :label, :url
def initialize
@parent = nil
end
def setup(item)
@parent_id = item.parent_id
@name = item.nam... | 26.574713 | 92 | 0.600562 |
4ad6e19dd0bb1d2d0597c11d4bd434d87d713cbd | 891 | cask 'switchresx' do
version '4.5.2'
sha256 :no_check # required as upstream package is updated in-place
url "http://www.madrau.com/data/switchresx/SwitchResX#{version.to_i}.zip"
name 'SwitchResX'
homepage 'http://www.madrau.com'
license :freemium
prefpane 'SwitchResX.prefPane'
uninstall :quit => [... | 35.64 | 93 | 0.521886 |
f73e2c43a3019f0823a7646d58ea6b3a3c303ed2 | 439 | class PdfValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
return unless value.present? && File.exist?(value.path)
PDF::Reader.new(value.path)
unless value.path.downcase.match?(/\.pdf$/)
record.errors[attribute] << "is a PDF, but has the extension '#{File.extname(v... | 31.357143 | 97 | 0.699317 |
019e881dea79a9c098fae9b0c8b8f3a63c4e55ff | 820 | require 'rubygems'
require 'json'
require 'net/http'
require 'net/https'
require 'uri'
load 'blueprints.rb'
load 'config-oauth.rb'
load 'tls.rb'
class Message
def direct_message(user_id, screen_name, text)
instructions = Blueprints.new
api_url = instructions.getAPI_URL
command_url = in... | 25.625 | 94 | 0.696341 |
b96d0c08323b67414872086eff88bfddaca9382a | 2,593 | require 'rails_helper'
require 'fileutils'
# rubocop:disable Metrics/BlockLength
RSpec.feature 'DatasetQueuing', type: :feature do
HOLD_SUBMISSIONS_PATH = File.expand_path(File.join(Rails.root, '..', 'hold-submissions.txt')).freeze
# include MerrittHelper
include DatasetHelper
include Mocks::Datacite
# inc... | 30.869048 | 116 | 0.699961 |
1cc0d1536ae3c5351fd2f3d48858d7d64b81a479 | 3,467 | # frozen_string_literal: true
require 'simplecov'
require 'simplecov-json'
SimpleCov.formatters = [
SimpleCov::Formatter::HTMLFormatter
]
MINIMUM_COVERAGE = 27
SimpleCov.at_exit do
if SimpleCov.result.covered_percent < MINIMUM_COVERAGE
abort "Too low coverage. Expected #{MINIMUM_COVERAGE} was #{SimpleCov.res... | 36.882979 | 98 | 0.75512 |
1ab4f413fa2b76c2a6926001336bd6525a8320a4 | 127 | covers 'facets/file/null'
test_case File do
class_method :null do
test do
assert File.null
end
end
end
| 8.466667 | 25 | 0.645669 |
61201cb724fe5250869151c66c213b9db4252287 | 880 | module Dashing
module Generators
class InstallGenerator < ::Rails::Generators::Base
source_root File.expand_path('../../templates', __FILE__)
desc 'Creates a Dashing initializer for your application.'
def install
route 'mount Dashing::Engine, at: Dashing.config.engine_path'
end
... | 26.666667 | 93 | 0.675 |
f87660d7a21d296efca7258519ebe668882427ba | 2,861 | CurationConcerns.configure do |config|
# Injected via `rails g geo_concerns:install`
config.register_curation_concern :vector_work
config.register_curation_concern :raster_work
config.register_curation_concern :image_work
config.minter_statefile = "log/minter-state"
# Should schema.org microdata be display... | 44.015385 | 103 | 0.761622 |
4ae94c028bd0ee647e0cc3f8420c758a46a73c04 | 159 | dir = File.dirname(__FILE__)
Dir[File.expand_path("#{dir}/*.rb")].uniq.each do |file|
if file =~ /\/test_\w+\.rb$/
puts file
require file
end
end | 22.714286 | 56 | 0.616352 |
4aa56a65a679a192fd7c566e0e7976f7d8cbb043 | 1,047 | # encoding: utf-8
require "logstash/filters/base"
require "logstash/namespace"
# Execute ruby code.
#
# For example, to cancel 90% of events, you can do this:
# [source,ruby]
# filter {
# ruby {
# # Cancel 90% of events
# code => "event.cancel if rand <= 0.90"
# }
# }
#
class LogS... | 24.928571 | 83 | 0.647564 |
b9d85a235d075bb5df36b081b24b570099e2538d | 1,194 | # frozen_string_literal: true
require_relative 'helper'
class TestFakerFoodPL < Test::Unit::TestCase
include DeterministicHelper
assert_methods_are_deterministic(
FFaker::FoodPL,
:food, :processed, :unprocessed, :vegetable, :fruit,
:meat, :herb, :spice, :fermented, :diary, :preserves
)
def setup... | 19.258065 | 58 | 0.710218 |
267e7bbc249e303efcd3238f76b3b60caccb2fc7 | 2,098 | module QA
module Page
module Project
class Show < Page::Base
include Page::Component::ClonePanel
view 'app/views/projects/_last_push.html.haml' do
element :create_merge_request
end
view 'app/views/projects/_home_panel.html.haml' do
element :project_name
... | 24.682353 | 93 | 0.595329 |
1c616507234829f0c5e971aeb54fb188dfc7864f | 1,981 | # 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... | 32.47541 | 78 | 0.61686 |
d5d401e45fa90d3cc5e7a11f6eef1d463ab08326 | 147 | append_file '.gitignore', <<-ignores
.ackrc
.rvmrc
config/database.yml
.bundle
db/*.sqlite3
log/*.log
tmp/
.sass-cache/
.rvmrc
*.DS_Store
ignores
| 10.5 | 36 | 0.727891 |
ac647725cb6feef7aaf578c44aba4292f7baee28 | 1,521 | # encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
require 'utils/simpleconfig'
module Inspec::Resources
class NtpConf < Inspec.resource(1)
name 'ntp_conf'
supports platform: 'unix'
desc 'Use the ntp_conf InSpec audit resource to test the synchronization settings defined in the ntp.conf file. Th... | 25.779661 | 165 | 0.617357 |
3832eb315f84f8fff8c50e8fe0d7a668ad580152 | 575 | FactoryBot.define do
factory :staff_member do
email { Faker::Internet.email }
family_name { Faker::Japanese::Name.last_name }
given_name { Faker::Japanese::Name.first_name }
family_name_kana { family_name ? family_name.yomi : Faker::Japanese::Name.last_name.yomi }
given_name_... | 41.071429 | 94 | 0.657391 |
267161d96de20a0a6e531aaccd6559cffba6e697 | 2,007 | module Fog
module AWS
class IAM
class Real
require 'fog/aws/parsers/iam/list_server_certificates'
# List server certificates
#
# ==== Parameters
# * options<~Hash>:
# * 'Marker'<~String> - The marker from the previous result (for pagination)
# * ... | 35.210526 | 150 | 0.55705 |
873d8e1f0e338e9282346a73db0c93bda0b10716 | 2,930 | require 'helper'
##
# Test class
class TestLoadFile < Test::Unit::TestCase
# Path to test files
TMP_STRING_PATH = 'test/files/tmp.strings.dat'
STRING_PATH = 'test/files/strings.dat'
# Called before every test method runs. Can be used
# to set up fixture information.
def setup
@stor... | 25.478261 | 168 | 0.652218 |
3311a6bbfc18fc6346b4138abd082058ca34e3aa | 6,629 | require "cases/helper"
class Dog
include ActiveModel::Validations
include ActiveModel::Validations::Callbacks
attr_accessor :name, :history
def initialize
@history = []
end
end
class DogWithMethodCallbacks < Dog
before_validation :set_before_validation_marker
after_validation :set_after_validation... | 35.449198 | 109 | 0.802383 |
4abf94b479aa062330bfd759593506676fcdde6f | 3,659 | require File.expand_path('../spec_helper', __FILE__)
module Danger
describe Danger::DangerCodeStyleValidation do
it 'should be a plugin' do
expect(Danger::DangerCodeStyleValidation.new(nil)).to be_a Danger::Plugin
end
describe 'with Dangerfile' do
before do
@dangerfile = testing_dang... | 35.524272 | 110 | 0.657557 |
1cce5380bd0c918959b5f46c4a42df246c400d4f | 224 | require './config/environment'
if ActiveRecord::Migrator.needs_migration?
raise 'Migrations are pending. Run `rake db:migrate` to resolve the issue.'
end
run ApplicationController
use ItemsController
use UsersController
| 22.4 | 77 | 0.8125 |
ffb50896ef050ee14f2a398ff76219b8ade4fc77 | 165 | module Groupby
module Model
class CustomUrlParam < Serializable
# string @key
# string @value
attr_accessor :key, :value
end
end
end | 13.75 | 39 | 0.636364 |
bb926ce0bbc7e787de8aa783955f3556bc5ffc3e | 1,784 | class MesonInternal < Formula
include Language::Python::Virtualenv
desc "Fast and user friendly build system"
homepage "https://mesonbuild.com/"
url "https://github.com/mesonbuild/meson/releases/download/0.46.1/meson-0.46.1.tar.gz"
sha256 "19497a03e7e5b303d8d11f98789a79aba59b5ad4a81bd00f4d099be0212cee78"
l... | 32.436364 | 153 | 0.740471 |
91b3e6059f0b7d22932cd4580f1fde37b92565ea | 206 | class PreferredView < ActiveRecord::Migration
def self.up
add_column :users, :preferred_view, :string, :default => :expanded
end
def self.down
remove_column :users, :preferred_view
end
end
| 20.6 | 70 | 0.728155 |
ac758a6c762f74e92d22fee2314701379166531f | 491 | # 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::Compute::Mgmt::V2020_06_01
module Models
#
# Defines values for ResourceIdentityType
#
module ResourceIdentityType
Sys... | 25.842105 | 70 | 0.718941 |
6a4edf82cbe246288d3f936d568a0ff6f3f2fe97 | 851 | module Liquid
module Rails
class Railtie < ::Rails::Railtie
config.app_generators.template_engine :liquid
initializer 'liquid-rails.register_template_handler' do |app|
ActiveSupport.on_load(:action_view) do
ActionView::Template.register_template_handler(:liquid, Liquid::Rails::Templ... | 27.451613 | 97 | 0.649824 |
6268321ccde5655d5209b73b30e974ea75950b7f | 91 | require 'rspec'
require 'simplecov'
SimpleCov.start
require 'nikto/version'
include Nikto
| 13 | 23 | 0.802198 |
6a6aeb897bc752a6e9ebf7e933cbd7466814c485 | 640 | class SessionsController < ApplicationController
before_action :require_no_user!, only: [:new, :create]
def new
@user = User.new
render :new
end
def create
@user = User.find_by_credentials(params[:user][:user_name], params[:user][:password])
if @user.nil?
@user = User.new(user_params)
... | 20.645161 | 89 | 0.682813 |
916438a2827f07e43c888aa08dc66002c3fb9f43 | 281 | module Frontend
mattr_accessor :organisations_search_client
mattr_accessor :search_client
mattr_accessor :mapit_api
mattr_accessor :imminence_api
mattr_accessor :local_links_manager_api
mattr_accessor :govuk_website_root
mattr_accessor :local_transactions_config
end
| 28.1 | 45 | 0.864769 |
d5ae37bff524380c3a2428b107d0ed67aa3baa2f | 130 | require 'spree_core'
require 'spree_extension'
require 'spree_coinbase_commerce/engine'
require 'spree_coinbase_commerce/version'
| 26 | 41 | 0.861538 |
bbd69b732e5e6c4d147801afed875692659c1e98 | 468 | # Takes the pcgw_games_list.json file and outputs a tab-delimited file for mix'n'match.
require 'open-uri'
require 'json'
require 'cgi'
games_list = JSON.parse(File.read('pcgw_games_list.json'))
games_list.uniq! { |game| game['pcgw_id'].downcase }
game_array = []
games_list.each do |game|
game_array << "#{CGI.une... | 24.631579 | 87 | 0.702991 |
62734e5415539734714130d810842b5851c9fc40 | 65 | module Ruboty
module Ponpetter
VERSION = "0.0.1"
end
end
| 10.833333 | 21 | 0.661538 |
ffbb1cf94bcb6dd70376975e4d8001770c147f66 | 869 | # More info please refer to: https://www.inspec.io/docs/
# Get path to terraform state file from attribute of kitchen-terraform.
terraform_state = attribute "terraform_state", {}
# Define how critical this control is.
control "state_file" do
# Define how critical this control is.
impact 0.6
# The actua... | 37.782609 | 96 | 0.726122 |
6a2eb159467da3b77243f2c07821e3f88b85df5e | 2,352 | # frozen_string_literal: true
require 'database_cleaner'
require 'cucumber/rails/database/strategy'
require 'cucumber/rails/database/deletion_strategy'
require 'cucumber/rails/database/null_strategy'
require 'cucumber/rails/database/shared_connection_strategy'
require 'cucumber/rails/database/truncation_strategy'
requ... | 29.037037 | 79 | 0.720238 |
4abad6b214ecd31c13366a091af20980757756e9 | 1,685 | # frozen_string_literal: true
# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0
module OpenTelemetry
module Instrumentation
module Sidekiq
module Middlewares
module Client
# TracerMiddleware propagates context and instruments Sidekiq client
# by way ... | 32.403846 | 95 | 0.549555 |
d54e5af42055049767e40f76840948c9d0fb984d | 223 | class CreateArtists < ActiveRecord::Migration[4.2]
def change
create_table :artists do |t|
t.string :name
t.timestamps
end
change_table :events do |t|
t.integer :artist_id
end
end
end
| 17.153846 | 50 | 0.64574 |
e9d6f7613e1cc08675d04cde1ca1112c9c3e43ca | 281 | # frozen_string_literal: true
module SpreeMailchimpEcommerce
class UpdateProductJob < ApplicationJob
def perform(mailchimp_product)
return unless mailchimp_product
gibbon_store.products(mailchimp_product["id"]).update(body: mailchimp_product)
end
end
end
| 23.416667 | 84 | 0.782918 |
4a1023f911b2e77887adfbf0223e9e87c75358b4 | 116 | class AddStripeIdToUser < ActiveRecord::Migration
def change
add_column :users, :stripe_id, :string
end
end
| 19.333333 | 49 | 0.758621 |
034d6316a188c7d6721ee2494e98123d9ef95499 | 676 | module SlackArena
class Server < SlackRubyBotServer::Server
on :channel_joined do |client, data|
message = 'Welcome to Are.na! Please `/arena connect [channel]` to publish a channel here.'
logger.info "#{client.owner.name}: joined ##{data.channel['name']}."
client.say(channel: data.channel['id']... | 37.555556 | 97 | 0.668639 |
6a651b382edc73134c27ed854319fb2b91e168d8 | 1,054 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads/v9/enums/interaction_type.proto
require 'google/api/annotations_pb'
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_file("google/ads/googleads/v9/enums/interaction_type.proto", :syntax =>... | 34 | 185 | 0.746679 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.