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 |
|---|---|---|---|---|---|
182bf4fce59427c3144711e3b5953dd746337c0c | 12,523 | require 'spec_helper'
describe VCR::Configuration do
describe '#cassette_library_dir=' do
let(:tmp_dir) { VCR::SPEC_ROOT + '/../tmp/cassette_library_dir/new_dir' }
after(:each) { FileUtils.rm_rf tmp_dir }
it 'creates the directory if it does not exist' do
expect { subject.cassette_library_dir = t... | 38.296636 | 133 | 0.69025 |
870d8b4673f829833ef61b05029d94735ce7f447 | 6,853 | #
# Helper - S3
#
require 'kumogata/template/helper'
def _s3_to_deletion_policy(value)
return "Retain" if value.nil?
case "value"
when "delete"
"Delete"
when "retain"
"Retain"
when "shapshot"
"Snapshot"
else
_valid_values(value, %w( Delete Retain Snapshot ), "Retain")
end
end
def _s3_to... | 24.215548 | 136 | 0.684226 |
912c54e6c4f589bd18ccec01fcd2ce6bb8f90fe4 | 1,840 | # frozen_string_literal: true
class CommentsController < BaseController
before_action :set_article, only: [:create, :preview]
def create
options = new_comment_defaults.merge comment_params.to_h
@comment = @article.add_comment(options)
unless current_user.nil? || session[:user_id].nil?
# maybe u... | 27.878788 | 102 | 0.709783 |
1df0ea73a49d95b89fa5bbf76307f390220da887 | 1,552 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Post
include Msf::Post::Windows::Priv
include Msf::Post::Windows::ShadowCopy
def initialize(info={})
super(update_info(info,
'Name' ... | 28.740741 | 128 | 0.591495 |
b907eb93dacd7d1d2ac8df02b3ca24de9f4dec5f | 276 | class ApplicationHelper::Button::TemplateProvision < ApplicationHelper::Button::Basic
def calculate_properties
super
self[:title] = _("Selected item is not eligible for Provisioning") if disabled?
end
def disabled?
!@record.supports_provisioning?
end
end
| 25.090909 | 85 | 0.753623 |
ffcaeb3c8f513b7b6f8ca64ca92f2d31ec6b6f4d | 206 | class CreateJoinTableGameTeam < ActiveRecord::Migration[6.0]
def change
create_join_table :games, :teams do |t|
t.index [:team_id, :game_id]
t.index [:game_id, :team_id]
end
end
end
| 22.888889 | 60 | 0.674757 |
f8314612960d081de707af8a9f4e3160d4f9856e | 974 | require File.dirname(__FILE__) + '/../spec_helper'
describe VimSdk::VmomiSupport do
describe :qualified_wsdl_name do
it "should provide qualified WSDL names for builtin types"
it "should provide qualified WSDL names for array types"
it "should provide qualified WSDL names for object types"
end
descr... | 28.647059 | 88 | 0.74538 |
79326699c05db48cbc6d340646e7f9bcff688a04 | 975 | require 'json'
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
Pod::Spec.new do |s|
s.name = 'EXCamera'
s.version = package['version']
s.summary = package['description']
s.description = package['description']
s.license = package['license']
s.auth... | 34.821429 | 188 | 0.612308 |
1139ce9d672e25bbb70d670cfe13fc9630f032e4 | 615 | # frozen_string_literal: true
module Stupidedi
module Versions
module FortyTen
module SegmentDefs
s = Schema
e = ElementDefs
r = ElementReqs
TDS = s::SegmentDef.build(:TDS, "Total Monetary Value Summary",
"Total Monetary Value Summary",
e::E610.simple_use... | 30.75 | 71 | 0.611382 |
abaf6b0a7a9bf3400ade81a21900a43bad39b85e | 2,009 | #-- encoding: UTF-8
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2020 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProj... | 28.295775 | 91 | 0.735689 |
616fa3f2e586a4f0c6f1bc965fd939508f7e8ac4 | 4,579 | # Copyright 2011, Dell
#
# 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 writing, software
... | 24.88587 | 88 | 0.666521 |
037b8f78752669f0e0d65a7db0fec68e0121a1d1 | 1,626 | ##
# This code was generated by
# \ / _ _ _| _ _
# | (_)\/(_)(_|\/| |(/_ v1.0.0
# / /
#
# frozen_string_literal: true
module Twilio
module REST
class Authy
class V1 < Version
##
# Initialize the V1 version of Authy
def initialize(domain)
super
... | 27.559322 | 90 | 0.52706 |
619392c159bee3615a1cb008bd973467b35d7387 | 196 | # -*- encoding: utf-8 -*-
module BrBoleto
module Retorno
module Cnab240
class Cecred < BrBoleto::Retorno::Cnab240::Base
# O Banco Cecred segue o padrão da FEBRABAN.
end
end
end
end | 19.6 | 50 | 0.688776 |
111e5486706433ebe4fe82ecb38e87881f1fdf1e | 306 | # frozen_string_literal: true
# Copyright (c) 2019 Danil Pismenny <danil@brandymint.ru>
# Be sure to restart your server when you modify this file.
# ActiveSupport::Reloader.to_prepare do
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )
# end
| 23.538462 | 59 | 0.72549 |
ff7cd58d88a38c0d2714b31b3f837c6090847a86 | 962 | require File.expand_path('../boot', __FILE__)
require 'rack/cors'
require 'rails/all'
Bundler.require(*Rails.groups)
require "devise_token_auth"
module Dummy
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration sho... | 38.48 | 99 | 0.721414 |
210ce1c4f1d6cefafc2e6ae5c588a1387ff8d05e | 791 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads/v4/resources/topic_view.proto
require 'google/protobuf'
require 'google/api/field_behavior_pb'
require 'google/api/resource_pb'
require 'google/api/annotations_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_f... | 28.25 | 134 | 0.740834 |
4a060b6671f410aa4e75e875f9b42f514242a639 | 394 | module Kernel
def calling_method
caller[1][/`([^']*)'/, 1].to_sym
end
# Returns the object's singleton class (exists in Ruby 1.9.2)
def singleton_class; class << self; self; end; end unless method_defined?(:singleton_class)
# class_eval on an object acts like singleton_class.class_eval.
def class_eva... | 24.625 | 93 | 0.708122 |
26352e64aacfa56245bf42df91a6d51e17d2c487 | 52,728 | require "securerandom"
require_relative '../client'
require_relative '../du/du_client'
require_relative '../du/upload_file'
require_relative 'app_version_common'
require_relative 'app_version_ref'
require_relative 'availability'
require_relative 'errors'
require_relative 'iap_subscription_pricing_tier'
require_relativ... | 37.743737 | 261 | 0.608178 |
ed7193b97776613839d6864cf9114eaebb53d243 | 4,897 | require 'spec_helper'
feature 'Merge When Pipeline Succeeds', :feature, :js do
let(:user) { create(:user) }
let(:project) { create(:project, :public) }
let(:merge_request) do
create(:merge_request_with_diffs, source_project: project,
author: user,
... | 32.217105 | 117 | 0.633653 |
030f443cb7546423c7f6c28ef99cb7528b702bd2 | 366 | # frozen_string_literal: true
module Resolvers
module FiltersBySchemaName
extend ActiveSupport::Concern
included do
option :schema, type: [String, { null: false }], description: "Filter by a namespace.name schema identifier" do |scope, value|
value.present? ? scope.filtered_by_schema_version(v... | 26.142857 | 132 | 0.713115 |
f8b843f9f4cab4d2dad4d3aaeb9491390dc42ab8 | 608 | cask "koodo-reader" do
arch = Hardware::CPU.intel? ? "" : "-arm64"
version "1.4.3"
if Hardware::CPU.intel?
sha256 "fc5b491c5f800de6855288dfa3ef796970ced5c082dcf324f4ace84fc3d3a0cb"
else
sha256 "8e11951614d196971f8c7e3cad37531464c40b11f32860d5ec295eacd77f14c0"
end
url "https://github.com/troyeguo/... | 30.4 | 114 | 0.741776 |
e256a7890094dfcd27db9ddca2d7116f82a44e07 | 197 | # frozen_string_literal: true
module Fields::Validations
class MultipleNestedFormField < FieldOptions
prepend Fields::Validations::Presence
prepend Fields::Validations::Length
end
end
| 21.888889 | 46 | 0.791878 |
399948da78ae2b38ed32e05ebedf94dc854e2a72 | 501 | Rails.application.routes.draw do
get 'sessions/new'
get 'users/new'
root 'static_pages#home'
get '/help', to: 'static_pages#help'
get '/about', to: 'static_pages#about'
get '/contact', to: 'static_pages#contact'
get '/signup', to: 'users#new'
get '/login', to: 'sessions#new'
post '/login', to: 'sessio... | 31.3125 | 102 | 0.692615 |
1d917bb646e2734ce97658cac2f7360181462e1e | 685 | module ShipStation
class InternationalOptions
attr_accessor :contents,
:customsItems,
:nonDelivery
def initialize
self.nonDelivery = "return_to_sender"
self.contents = "merchandise"
end
def add_item(description, quantity, value, country)
self.customsItems ||= []
... | 20.147059 | 121 | 0.646715 |
d56cbadc3d5d47debc09684b030d391666f9fbba | 690 | cask "singularity" do
version "1.8.9.8709"
sha256 "ef40901d39389588be972b6f72ec58d1a4f0d982dbb87f0ea1eeeab1d388763b"
url "https://bitbucket.org/router_gray/singularityviewer/downloads/Singularity_Alpha_#{version.dots_to_underscores}_x86_64.dmg",
verified: "bitbucket.org/router_gray/singularityviewer/"
na... | 32.857143 | 130 | 0.718841 |
1a706e353d6c14f3cde5e03ad42a8a49b2e7768f | 158 | class DropCloudProvider < ActiveRecord::Migration[4.2]
def change
remove_column :projects, :cloud_provider_id
drop_table :cloud_providers
end
end
| 22.571429 | 54 | 0.778481 |
03bb13c013b93dd7c01ca62b362be69ce748ba34 | 1,796 | class SourcesController < ApplicationController
before_filter :authenticate, except: [:index, :show, :up, :down]
def index
if params[:query]
@sources = Source.text_search(params[:query])
elsif params[:tag]
@sources = Source.tagged_with(params[:tag]).order('rating DESC').page(params[:page]).per_... | 23.946667 | 129 | 0.641425 |
0871c92841b7e028743f01707faf8539a634d32a | 688 | require 'serverspec'
require 'docker'
require 'spec_helper'
describe "Dockerfile" do
before(:all) do
@image = Docker::Image.build_from_dir('.', { 'dockerfile' => ENV['DOCKERFILE'] })
set :docker_image, @image.id
end
include_examples 'collection::bootstrap'
include_examples 'collection:... | 31.272727 | 89 | 0.72093 |
b9989de77560f7e6611a457580142c2eeb122f17 | 192 | $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')))
require 'moss_ruby'
require 'webmock/rspec'
| 32 | 84 | 0.760417 |
0888e5f9cc6adad433286040b5dd3c3440c40edc | 688 | # frozen_string_literal: true
require 'test_helper'
class ConnectionTest < Minitest::Test
def wrap_dbname_configuration
initial_dbname = Pgsnap.configuration.dbname
yield
Pgsnap.set_configuration { |config| config.dbname = initial_dbname }
end
def test_that_initial_dbname_is_nil
wrap_dbname_con... | 23.724138 | 72 | 0.761628 |
08ceef3f894af6f5be7c27fef0d660b12518e03a | 2,779 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe HCA::SubmissionFailureEmailAnalyticsJob, type: :job do
subject do
described_class.new
end
before do
Settings.reports.token = 'asdf'
Settings.reports.server = 'stage-tms.govdelivery.com'
Settings.google_analytics_tracking_id = '... | 34.7375 | 95 | 0.698813 |
263b0e9a4ab29a61fd1d14f96812992a3627a4b7 | 502 | class UsersController < ApplicationController
def show
@user = User.find(params[:id])
end
def new
@user = User.new
end
def create
@user = User.new(user_params) # Not the final implementation!
if @user.save
flash[:success] = "Welcome to the Sample App!"
redirect_to @user
els... | 19.307692 | 68 | 0.60757 |
4a7a517ef26f68bfaf3466024147c0cd6d3c81dd | 381 | name 'base-template'
maintainer 'Steven Gonzales'
maintainer_email 'steven.gonzales@rackspace.com'
license 'Apache 2.0'
description 'Installs/Configures base-template'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.2'
depends 'authorized_k... | 29.307692 | 72 | 0.711286 |
e2061a17fa6c9d37d94f5137a87dab0cfd1cfd56 | 71 | module GovUKFrontendToolkit
class Engine < ::Rails::Engine
end
end
| 14.2 | 32 | 0.760563 |
bf61c0b07cf35cca99294876e0a9ae78470074ba | 1,374 | require 'test_helper'
class UsersLoginTest < ActionDispatch::IntegrationTest
test "login with invalid information" do
get login_path
assert_template 'sessions/new'
post login_path, params: { session: { email: "", password: "" } }
assert_template 'sessions/new'
assert_not flash.empty?
get root... | 28.040816 | 86 | 0.697234 |
e9a917fa1b3f4920a56738eae46a2316617cab70 | 303 | if Rails.env.development? || ENV['FORCE_DB_SEED'].present?
admin = Administrator.create(
name: 'Dev Admin',
email: 'admin@figment.network',
one_time_setup_token: SecureRandom.hex
)
puts "Admin created:\nhttp://localhost:3000/admin/sessions/new?token=#{admin.one_time_setup_token}"
end
| 33.666667 | 101 | 0.732673 |
ab0228b347ebc06b2c58182e5b02195761b16bc0 | 133,161 | # +----------------------------------------------------------------------+
# | Licensed Materials - Property of IBM |
# | |
# | (C) Copyright IBM Corporation 2006- 2018 |
# +-----------------------------... | 37.050918 | 175 | 0.597915 |
1db572f041c0bb2eecc17f978212f04da08d8a1d | 84 | # typed: true
def dead_code
x = nil
return if !x
x # error: unreachable
end
| 9.333333 | 24 | 0.642857 |
7a065757d079906a6857878b1f11d8d5f9915242 | 3,940 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... | 41.473684 | 102 | 0.758376 |
d555d03ecb9d736db625e1a716a86e6117b68bfb | 2,266 | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with this
# work for additional information regarding copyright ownership. The ASF
# licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use... | 35.40625 | 129 | 0.707414 |
334cc23b3fc815e5dc0fcdfada2a3c88a0f656a3 | 2,222 | require './spec/support/sidekiq_middleware'
require './spec/support/helpers/test_env'
class Gitlab::Seeder::Burndown
def initialize(project, perf: false)
@project = project
end
def seed!
Timecop.travel 10.days.ago
Sidekiq::Worker.skipping_transaction_check do
Sidekiq::Testing.inline! do
... | 22.907216 | 110 | 0.646715 |
7a6d93f22f0fd6fca3674af6630a2722c46dc2af | 144 | class AddPersonToBraintreeAccount < ActiveRecord::Migration[5.2]
def change
add_column :braintree_accounts, :person_id, :string
end
end
| 24 | 64 | 0.784722 |
62edd348ad6537ebdba2220a9d250af114f4d9b7 | 671 | # require 'sidekiq'
if Sidekiq::VERSION.to_f >= 3
Sidekiq.configure_server do |config|
handler = ->(ex, content){
BetterExceptionNotifier.notify_exception(ex, data: { sidekiq: context })
}
config.error_handlers << handler
end
else
### Sidekiq < v3
module BetterExceptionNotifier
class ... | 19.735294 | 78 | 0.66468 |
e8c65b4f4e02bf27f83c958049ba3e4ce63ae563 | 7,713 | =begin
PureCloud Platform API
With the PureCloud Platform API, you can control all aspects of your PureCloud environment. With the APIs you can access the system configuration, manage conversations and more.
OpenAPI spec version: v2
Contact: DeveloperEvangelists@genesys.com
Generated by: https://github.com/swagger-ap... | 22.356522 | 177 | 0.562686 |
6ab7930627300963502d589cb0ec5882ade5431c | 936 | module Centurion
class Pool
include Enumerable
attr_accessor :vms
def initialize
@vms = []
end
def each(&block)
@vms.each { |vm| block.call(vm) }
end
FORWARDED_COLLECTION_METHODS = [:name, :path, :ips, :status, :destroy]
FORWARDED_COLLECTION_METHODS.each do |method|
... | 22.285714 | 74 | 0.621795 |
91f79e31d3496e98341d2e1d27fb4ceb36dd054f | 2,013 | WORKSPACE_DIR = File.expand_path(File.dirname(__FILE__) + '/..')
def in_dir(dir)
current = Dir.pwd
begin
Dir.chdir(dir)
yield
ensure
Dir.chdir(current)
end
end
SITE_DIR = "#{WORKSPACE_DIR}/reports/site"
desc 'Build the part of the website for this branch'
task 'site:build' do
project = Buildr.p... | 28.352113 | 124 | 0.68157 |
08c690fb84b37265bef680414e6999bb630f3f59 | 2,815 | # frozen_string_literal: true
require 'rails_helper'
RSpec.feature 'Course: Experience Points: Disbursement' do
let(:instance) { Instance.default }
with_tenant(:instance) do
let(:course) { create(:course) }
let(:course_students) { create_list(:course_student, 4, course: course) }
let(:course_teaching_... | 39.097222 | 98 | 0.722558 |
6137f043b3c312f99d2e62e48ff33928e4190c18 | 13,471 | # frozen_string_literal: true
require 'optparse'
require 'fileutils'
require_relative 'core_ext/regexp'
module Rack
class Server
using ::Rack::RegexpExtensions
class Options
def parse!(args)
options = {}
opt_parser = OptionParser.new("", 24, ' ') do |opts|
opts.banner = "... | 28.907725 | 192 | 0.554821 |
abd1644141f1e3c75e64cc28a02c6ed5c34eab15 | 287 | FactoryGirl.define do
# Define your Spree extensions Factories within this file to enable applications, and other extensions to use and override them.
#
# Example adding this to your spec_helper will load these Factories for use:
# require 'spree_travel_adventure/factories'
end
| 41 | 130 | 0.794425 |
182ef224113dd993a07c8b77ea9c46a740a6a302 | 2,736 | require "rails_helper"
require "spec_helper"
require "test_data_helper"
describe Player do
let(:train_car_type) { TrainCarType.find_by(name: "Locomotive") }
let(:name) { "Player 1" }
let(:name_alt) { "Player 2" }
let(:colour) { "Green" }
let(:players) { test_players }
let(:game) { Game.new(current_player: ... | 25.811321 | 116 | 0.649854 |
1a747a16cceb1e6f692d3cb1e2777cbc6ff3b5a3 | 5,282 | module CTA
class CustomerAlerts
@cache_responses = true
# Returns the connection object we use to talk to the CustomerAlerts API
def self.connection
@connection ||= Faraday.new do |faraday|
faraday.url_prefix = 'http://www.transitchicago.com/api/1.0/'
faraday.use CTA::CustomerAlerts... | 39.41791 | 133 | 0.665468 |
6114f42a4ff039cdd3680b779052b09e252d4947 | 2,755 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Security::Mgmt::V2018_06_01
module Models
#
# Pricing tier will be applied for the scope based on the resource ID
#
class Pricing < Resource
... | 30.611111 | 78 | 0.505263 |
18154a27e9d0b8f298e2d64086b5762bc54658df | 674 | describe "Convert Background Color" do
before do
@object = Object.new
@object.extend Stalactoast::Conversions
end
it "sets the appropriate CRToast key" do
d = {}
@object.convert_background_color({}, d)
d[KCRToastBackgroundColorKey].should != nil
end
it "has red as default" do
@objec... | 23.241379 | 75 | 0.68546 |
ab2190a6f78d71ea76a7265566a59567ba6e51e5 | 6,110 | require "autoscaling/models/AlarmDiff"
module Cumulus
module AutoScaling
# Public: A class that encapsulates data about configuration for an autoscaling
# Cloudwatch alarm.
#
# The action to be taken is inferred to be activating the policy that contains
# the alarm. As such, we don't keep arrays ... | 36.807229 | 112 | 0.60982 |
e887b9d2ed096aafb100d66651d208ab4212fafc | 181 | listen '/home/docd/docd/shared/tmp/sockets/unicorn.sock'
pid '/home/docd/docd/shared/tmp/pids/unicorn.pid'
timeout 60
worker_processes 4
working_directory '/home/docd/docd/current'
| 30.166667 | 56 | 0.801105 |
d5021a1fd10c5222cd352daf6d1f64cdd89abc5a | 7,834 | # Copyright (c) 2012-2019 Snowplow Analytics Ltd. All rights reserved.
#
# This program is licensed to you under the Apache License Version 2.0,
# and you may not use this file except in compliance with the Apache License Version 2.0.
# You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/li... | 37.304762 | 113 | 0.57761 |
ff8f07b16ae5a55c94bf4dbf11d958eb3bd1a4cd | 157 | # Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
ProviderStore::Application.initialize!
| 26.166667 | 52 | 0.808917 |
ff7a871c0eb94bab7ae2769f13ccd34f55179083 | 1,716 | require 'pry'
class BookBytes::Scraper
attr_accessor :genre
def self.genre
@genre
end
def self.get_genre_page(genre_name)
@genre = BookBytes::Genre.find_genre(genre_name)
genre_html = Nokogiri::HTML(open("http://www.bookdaily.com/browse")).css("section.genre-categories li > h3").detect do |gen... | 29.084746 | 136 | 0.668998 |
bf484197c48edac920150c002752ad0e7fae356a | 841 | class StartScanWorker
include Sidekiq::Worker
include Sidekiq::Status::Worker
include Base
sidekiq_options({ :queue => :default,:retry => true })
def perform
scans = Scaner.where("team_id is not null and (status='Queued' or status='Scanning')").order("created_at DESC")
unless scans.present?
scans = Scaner.... | 31.148148 | 114 | 0.705113 |
38c65c480dc858e2c02a83c01acf9e0efd59bce3 | 352 | # frozen_string_literal: true
module Api
module V3
class SubdomainsController < Api::V1::ApiApplicationController
include Syncable
respond_to :json
def index
project = Project.find params[:project_id]
@subdomains = to_sync(project.subdomains, 'subdomains', params[:last_sync_tim... | 22 | 88 | 0.690341 |
33131297482ce0201416c9f01e23fad4a4bc2054 | 8,486 | require "test_helper"
require "gds_api/test_helpers/publishing_api"
class PublishingApi::DetailedGuidePresenterTest < ActiveSupport::TestCase
include GdsApi::TestHelpers::PublishingApi
def present(edition)
PublishingApi::DetailedGuidePresenter.new(edition)
end
test "DetailedGuide presenter passes schema ... | 33.808765 | 150 | 0.70363 |
114f508878aa7b327e16d1708a9134294e41e2b9 | 1,711 | require File.expand_path(File.dirname(__FILE__) + '/../test_helper' )
module IntegrationTests
class BlogCategoriesTest < ActionController::IntegrationTest
def setup
super
@section = Blog.first
@site = @section.site
use_site! @site
@special_characters_category = @section.categories.f... | 31.109091 | 77 | 0.678551 |
87e1c54fe2db8f57c120f8e39a006d0109a2213d | 558 | # frozen_string_literal: true
module Vedeu
module Interfaces
# Provides a non-existent model to swallow messages.
#
# @api private
#
class Null < Vedeu::Null::Generic
include Vedeu::Presentation
include Vedeu::Presentation::Colour
include Vedeu::Presentation::Position
i... | 17.4375 | 56 | 0.625448 |
1c238ea71ae2d4a399c4103cb2e22d32ac8d6f75 | 600 | class CreatePromptReports < ActiveRecord::Migration[5.2]
def change
create_table :prompt_reports do |t|
t.integer :user_id, null: false
t.datetime :read_at, null: true, default: nil
t.bigint :removed_uid, null: true, default: nil
t.text :changes_json, null: false
... | 30 | 58 | 0.601667 |
269f283f5325c2f6f2a29760b18c3bddc9c5c299 | 369 | # frozen_string_literal: true
Deposit::Engine.routes.draw do
root to: 'collection#index'
resources :collection, only: [:index]
scope '/collection' do
match '/record' => 'collection#record_payments', :via => :post, :as => 'do_record_payments'
match '/account_invoices' => 'collection#account_invoices', :... | 28.384615 | 103 | 0.693767 |
e20015b72019c8bf991e4f341f693c8b0c2de08c | 38 | module Dacker
VERSION = "0.0.1"
end
| 9.5 | 19 | 0.657895 |
21e921aa9a576434a67bbfe81922621ac6951107 | 3,668 | FactoryBot.define do
factory :ems_folder do
sequence(:name) { |n| "Test Folder #{seq_padded_for_sorting(n)}" }
end
factory :datacenter, :parent => :ems_folder, :class => "Datacenter"
factory :storage_cluster, :parent => :ems_folder, :class => "StorageCluster"
factory :inventory_group,
:class ... | 35.269231 | 107 | 0.624591 |
6123e81ba0a955fb13367f954738e8022befbbbd | 4,561 | class Vim < Formula
desc "Vi \"workalike\" with many additional features"
homepage "http://www.vim.org/"
# *** Vim should be updated no more than once every 7 days ***
url "https://github.com/vim/vim/archive/v7.4.979.tar.gz"
sha256 "b91bd610a07d6d72cb113fe06f2db722a130f8218568e0958a84c266758bd75b"
head "htt... | 38.008333 | 100 | 0.654681 |
01dacac666cee80493b033d9bfe52a54ffc78c92 | 13,219 | # Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmat... | 49.141264 | 154 | 0.75104 |
1c04921bbda93307f5ba26ffe2047141e5b8e068 | 1,376 | # frozen_string_literal: true
# Copyright 2015 Australian National Botanic Gardens
#
# This file is part of the NSL Editor.
#
# 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
#
# ht... | 33.560976 | 76 | 0.742006 |
d52217869a3e826b9e6ecb32da26cf2a4e565e84 | 456 | class User < ApplicationRecord
before_save { email.downcase! }
validates :name, presence: true, length: { maximum:50 }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i
validates :email, presence: true, length: { maximum:255},
format: { with: VALID_EMAIL_REGEX},
... | 41.454545 | 72 | 0.618421 |
6201bda125ad9693beb6e0564a095eadca5257f2 | 4,610 | # helper class from https://gist.github.com/defunkt/278994
module RequiredTime
class << self
def hook
Kernel.class_eval do
alias_method :__require_benchmarking_old_require, :require
def require(path, *args)
RequiredTime.benchmark_require(path, caller) { __require_benchmarking_old_... | 30.130719 | 127 | 0.570933 |
b9136fe5fd9f719a227bfdff11ad792aee475771 | 607 | class PagesController < ApplicationController
skip_before_action :require_login
def index
@random_feedbacks = Feedback.published.random
render template: "pages/home"
end
def show
if valid_page?
@random_feedbacks = Feedback.published.random
@collaborators = Collaborator.all
@categ... | 23.346154 | 88 | 0.691928 |
bf654cc7a7d2fed344a2052e467cfff0fcecdf5e | 1,704 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# Source: google/ads/google_ads/v1/services/campaign_label_service.proto for package 'Google::Ads::GoogleAds::V1::Services'
# Original file comments:
# Copyright 2019 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not ... | 37.043478 | 123 | 0.759977 |
3869582f5445ba2649806201d75e94da1d7a46ce | 509 | require 'spec_helper'
describe Ashbe::Compression do
it "knows how many algorithms there are" do
Ashbe::Compression.algorithms.size.must_equal 3
end
it "can lookup up an algorithm by symbol" do
Ashbe::Compression.algorithm_for( :lzo ).name.must_equal "LZO"
Ashbe::Compression.algorithm_for( :lzo ).m... | 28.277778 | 116 | 0.750491 |
7a51059a0d781957e214d2a5f883c451c221288f | 4,342 | # frozen_string_literal: true
module Rails # :nodoc:
module GraphQL # :nodoc:
class Type # :nodoc:
# = GraphQL InputType
#
# Input defines a set of input fields; the input fields are either
# scalars, enums, or other input objects.
# See http://spec.graphql.org/June2018/#InputObject... | 32.162963 | 92 | 0.573468 |
1a559c4596479fb911123e8114cb1482296daff6 | 6,615 | #! /usr/bin/env ruby
require 'spec_helper'
require 'puppet_spec/compiler'
describe "when using a hiera data provider" do
include PuppetSpec::Compiler
# There is a fully configured 'sample' environment in fixtures at this location
let(:environmentpath) { parent_fixture('environments') }
let(:facts) { Puppet::... | 45 | 174 | 0.728496 |
61b8c75eb61d89ee306851bd2321423df44e443c | 2,634 | #!/usr/bin/env ruby
# frozen_string_literal: true
module Enumerable
def my_each
return to_enum unless block_given?
to_a.length.times { |i| yield(to_a[i]) }
self
end
def my_each_with_index
return to_enum unless block_given?
to_a.length.times { |i| yield(to_a[i], i) }
self
end
def m... | 21.241935 | 71 | 0.60858 |
080993f02d3ee1110741c890261108136c99dd58 | 1,908 | class LibpqxxAT6 < Formula
desc "C++ connector for PostgreSQL"
homepage "http://pqxx.org/development/libpqxx/"
url "https://github.com/jtv/libpqxx/archive/6.4.7.tar.gz"
sha256 "3fe9f38df1f0f9b72c8fe1b4bc0185cf14b4ed801a9c783189b735404361ce7f"
license "BSD-3-Clause"
revision 1
bottle do
sha256 cellar:... | 38.938776 | 122 | 0.683962 |
33532526f032871fee1ea908de259d23eb01c97c | 572 | # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fil... | 38.133333 | 78 | 0.75 |
ffc86864d2af3c3a44e1ea93bd078fddef60b1e8 | 971 | # frozen_string_literal: true
# Copyright 2018 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... | 23.682927 | 74 | 0.69104 |
269e1195d6124bb5b7548327f9dfd65260efa4ff | 724 | module NZMPsPopolo
module Serializers
class BaseSerializer
attr_reader :record
def initialize(record)
@record = record
end
class << self
attr_reader :defined_popolo_type
def popolo_type(type)
raise ArgumentError, 'Can only be :person, :organization, :me... | 24.965517 | 84 | 0.563536 |
795ea8b4de9e36b76c1e079da0f996560b3ddd20 | 2,734 | # -*- encoding: utf-8 -*-
# stub: jekyll 3.6.2 ruby lib
Gem::Specification.new do |s|
s.name = "jekyll"
s.version = "3.6.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"]
s.authors = ["Tom Preston-Werner"]
s.bindir = "exe"
... | 41.424242 | 105 | 0.607169 |
edadf4b5dc6d6fc221b10f96c6bdd4a5dc560d3e | 2,123 | require 'spec_helper'
resource 'JobTask' do
before do
log_in users(:owner)
end
post "/workspaces/:workspace_id/jobs/:job_id/job_tasks" do
parameter :job_id, "Job ID"
parameter :workspace_id, "Workspace ID"
parameter :action, "Task Type"
parameter :source_id, "Source Table ID"
parameter :... | 29.901408 | 95 | 0.667923 |
79a936c3c3aa597f8986b100b1283b70e709a156 | 1,031 |
Pod::Spec.new do |s|
s.name = "KCUserKit"
s.version = "0.1.85"
s.summary = "A short description of KCUserKit."
s.license = 'MIT'
s.author = { "Emil Wojtaszek" => "emil@appunite.com" }
s.source = { :git => "git@git.appunite.com:newmedia/kingschat-us... | 29.457143 | 113 | 0.600388 |
1d38c53b94c69bffa17093ae5ce95cd802617df4 | 606 | module Fog
module ContainerInfra
class Telefonica
class Real
def create_cluster(params)
request(
:expects => [202, 201, 200],
:method => 'POST',
:path => "clusters",
:body => Fog::JSON.encode(params)
)
end
end
... | 21.642857 | 60 | 0.486799 |
182f9096e17f038f0d283af4b34a3753e7b89429 | 140 | require 'test_helper'
class UserlistControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
end
| 17.5 | 62 | 0.742857 |
91c5d880e87d60623d95e73b2f161f66da6e64f6 | 443 | # InSpec test for recipe linux_patching::default
# The InSpec reference, with examples and extensive documentation, can be
# found at https://docs.chef.io/inspec/resources/
unless os.windows?
# This is an example test, replace with your own test.
describe user('root'), :skip do
it { should exist }
end
end
... | 26.058824 | 73 | 0.731377 |
e8cb5b63053ccc55350e1a505f4fdb6a48611259 | 1,910 | require 'spec_helper'
require 'vigilem/x11/display'
describe Vigilem::X11::Display do
after(:each) do
[described_class].each do |klass|
(klass.instance_variables - [:@layout]).each do |ivar|
klass.send(:remove_instance_variable, ivar)
end
end
end
it 'is a subclass of Xlib::Disp... | 26.164384 | 108 | 0.653927 |
e8841ed4a95e036d44b133c93666ef7f56fea47d | 1,360 | require 'rails_helper'
RSpec.describe AssetPolicy, type: :policy do
let(:school_user) { create(:school_user) }
let(:rb_user) { create(:local_authority_user) }
let(:support_user) { create(:support_user) }
let(:cc_user) { create(:computacenter_user) }
subject(:policy) { described_class }
describe 'Scope' d... | 41.212121 | 94 | 0.708088 |
216052b8894d696776cafd7a314a354943dfe5a5 | 1,054 | class EmailPreference < ActiveRecord::Base
belongs_to :user
belongs_to :category, class_name: :EmailCategory, foreign_key: :email_category_id
validates :user_id, :email_category_id, presence: true
validates :subscribed, inclusion: { in: [true, false] }
include CustomTimestampAttributesForUpdate
before_sav... | 31.939394 | 83 | 0.805503 |
3898dc0c7e388339ec77962dc1f390c038ebcb1a | 1,242 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads/v8/enums/search_term_targeting_status.proto
require 'google/api/annotations_pb'
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_file("google/ads/googleads/v8/enums/search_term_targeting_s... | 36.529412 | 225 | 0.758454 |
d5bdd94f543520ce55d454fea230555674f32eb8 | 1,251 | #
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'amap_map_fluttify'
s.version = '0.0.1'
s.summary = 'An `Amap` map component, based on `fluttify` engine.'
s.description = <<-DESC
A new flutter plugin project... | 30.512195 | 137 | 0.603517 |
f83c9b8f5b224ed501ed3b3acaedf8359c38fede | 1,646 | module Dapp
module Deployment
module Config
module Directive
class Expose < Base
attr_reader :_port
attr_reader :_type
def initialize(dapp:)
@_port = []
@_type = 'ClusterIP'
super
end
def cluster_ip
s... | 23.855072 | 109 | 0.482989 |
e83d54890a342cca824c013165d203c4e6eed50f | 5,171 | #
# Tests, setup, and teardown common to the application and plugin generator suites.
#
module SharedGeneratorTests
def setup
Rails.application = TestApp::Application
super
Rails::Generators::AppGenerator.instance_variable_set('@desc', nil)
Kernel::silence_warnings do
Thor::Base.shell.send(:att... | 32.522013 | 178 | 0.704893 |
edda5e951421e86338682970559b721799f5c9d0 | 2,409 | module Enjoy::News
module Controllers
module Categories
extend ActiveSupport::Concern
def index
@categories = category_class.enabled.sorted.to_a
@root_catalog = category_class.enabled.roots.sorted.all.to_a
after_initialize
end
def show
@category = categor... | 30.1125 | 124 | 0.599419 |
61dbcc92a1b6d1598d0efc8299f8af6d4eef46d0 | 4,120 | module Geokit
module Geocoders
# Open Street Map geocoder implementation.
class OSMGeocoder < Geocoder
private
# Template method which does the geocode lookup.
def self.do_geocode(address, options = {})
options_str = generate_bool_param_for_option(:polygon, options)
options... | 37.454545 | 159 | 0.654369 |
bb49e162918921e0b757efba54a03bb90824f3cf | 1,987 | #!/usr/bin/env ruby
require 'open-uri'
require 'tracker_api'
require 'pry'
require 'yaml'
class CategorizeSecurityNotices
attr_reader :stories
def initialize(tracker_client, stories_file, stack_receipt, stack)
ref = JSON.parse(File.read(stories_file))
@tracker_client = tracker_client
@stories = JSON.... | 25.805195 | 96 | 0.650226 |
f7680daa65ebc6c0a8093f66aaf988ffb7a36e1b | 776 | require 'fog/core/model'
module Fog
module Compute
class XenServer
class PBD < Fog::Model
# API Reference here:
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=PBD
identity :reference
attribute :uuid
attribute :__host, :aliases => :host
... | 18.926829 | 73 | 0.554124 |
33daa07dd8018a59cffd79b5ec2ba7d97009ac45 | 1,353 | #snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.]
#snippet-sourceauthor:[Doug-AWS]
#snippet-sourcedescription:[Encrypts a string.]
#snippet-keyword:[AWS Key Management Service]
#snippet-keyword:[encrypt method]
#snippet-keyword:[Ruby]
#snippet-service:[kms]
#snippet-sourcety... | 33 | 88 | 0.724316 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.