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 |
|---|---|---|---|---|---|
1802de945f3f99052607d2438ec6cdd993483365 | 129 | class FormtasticsController < ApplicationController
autocomplete :brand, :name
def new
@product = Product.new
end
end
| 16.125 | 51 | 0.751938 |
28cbb65faf6821a3a9ac3776fa369a29b1a07326 | 416 | class CreateAccounts < ActiveRecord::Migration[4.2]
def change
create_table :accounts do |t|
t.belongs_to :user, index: true
t.belongs_to :source, index: true
t.string :url
if ApplicationRecord.connection.class.name === 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter'
t.json :... | 26 | 106 | 0.65625 |
33773fc3f94a87bbea9c6683ed9d397b6328ab4c | 42 | module TextOpener
VERSION = "0.0.1"
end
| 10.5 | 19 | 0.690476 |
1c13f417b915a0b1f0ea12df2df0a1ff38cd2ac5 | 2,246 | module DataMapper; module Ext
module Object
# Returns the value of the specified constant.
#
# @overload full_const_get(obj, name)
# Returns the value of the specified constant in +obj+.
# @param [Object] obj The root object used as origin.
# @param [String] name The name of the constant... | 38.724138 | 92 | 0.635797 |
9163a97e6ca5a5f4f00f76a01c51e5d590785396 | 697 | # frozen_string_literal: true
module DistributionPoints
class CostsCalculationController < ApplicationController
def show
result = result_for(CalculateShippingCost.new)
if result.success?
render status: :ok, plain: String(result.success)
else
render status: result.failure == :n... | 26.807692 | 80 | 0.69297 |
bf443e8b518e28b70d33281a378fc157e6edec60 | 2,028 | # -------------------------------------------------------------------------
# Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
# -------------------------------------------------------------------------
class Wso2am310 < Formula
desc "WSO2 API Manager 3.1.0"
homepage "https://wso2.com/a... | 38.264151 | 181 | 0.584813 |
f87b3e228f7fb9f20f37b1df63f3b152d2958c92 | 3,638 | require 'rails_helper'
RSpec.describe NfgUi::UI::Utilities::Initializer do
let(:test_class_with_initializer) { Class.new { include NfgUi::UI::Utilities::Initializer } }
let(:view_context) { ActionController::Base.new.view_context }
let(:tested_component_name) { :alert }
let(:traits) { [] }
let(:options) { { ... | 37.505155 | 253 | 0.658329 |
5d0c93d44fe915828507a7bc2048fa66ec3d49ee | 1,552 | # Encoding: utf-8
require 'spec_helper'
JMX_CONFIG = File.join(@agent_config_dir, 'conf.d/jmx.yaml')
describe service(@agent_service_name) do
it { should be_running }
end
describe file(JMX_CONFIG) do
it { should be_a_file }
it 'is valid yaml matching input values' do
generated = YAML.load_file(JMX_CONFIG... | 26.758621 | 98 | 0.453608 |
28e21a06e6cb887e923e056207fd4e0e483bc79b | 798 | class Ecm::Staff::Organisation < Ecm::Staff::Base
# associations
has_many :business_units
# callbacks
after_initialize :set_defaults, if: :new_record?
translates :description, :name, :slug if ActiveRecord::Base.connection.table_exists?(:ecm_staff_organisation_translations)
# friendly id support
extend ... | 24.181818 | 124 | 0.720551 |
01fbb68039548030f8d6185713b47d91e8db3ac8 | 2,579 | # frozen_string_literal: true
require 'cli'
# Handle actions related to the cli file crypter interface.
module CliFileCrypter
# Starter point of the cli file crypter.
# Run CliFileCrypter.run, it use the ARGV arguments to find and execute an action.
# Catch all PasswordManager::PasswordManagerError to stop the ... | 35.819444 | 97 | 0.738271 |
6a73c053fea9e3ae159b2e5a07d51b110a71a2d5 | 220 | Rails.application.routes.draw do
devise_for :views
devise_for :users
resources :posts
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root 'posts#index'
end
| 24.444444 | 101 | 0.763636 |
ed8ed7c3edcd282cd51e5a159a54a032d0c92a38 | 29,938 | # frozen_string_literal: true
require_relative 'spec_helper'
describe Asciidoctor::PDF::FormattedText::Formatter do
context 'HTML markup' do
it 'should format strong text' do
output = subject.format '<strong>strong</strong>'
(expect output).to have_size 1
(expect output[0][:text]).to eql 'stro... | 40.293405 | 177 | 0.640323 |
1c2bce63d65bc6a0a2ceb24019872bd311dffd3f | 158 | RSpec.describe Array do
it 'initial length is 0' do
expect(subject.length).to eq(0)
subject.push(10)
expect(subject.length).to eq(1)
end
end | 17.555556 | 35 | 0.677215 |
6abdac05df9eb2ef8cff298245a0cdeec8a620dc | 605 | module Parsers
module Edi
class ImportCache
def initialize
@plan_cache = Hash.new
Plan.all.each do |p|
@plan_cache[p.year] ||= {}
@plan_cache[p.year][p.hios_plan_id] = p
end
@carrier_fein_cache = Carrier.all.inject({}) do |acc, c|
c.carrier_prof... | 21.607143 | 64 | 0.547107 |
ed2c0b07664f088e99898ca6ed8a08c5970b6fcd | 457 | cask 'vv' do
version '2.0.0'
sha256 '584399df3cb0e96e7d2436036ecb6ff02885b9e82005b2acff174b9dcb5c7d61'
url "https://github.com/vv-vim/vv/releases/download/v#{version}/VV-#{version}.dmg"
appcast 'https://github.com/vv-vim/vv/releases.atom'
name 'VV'
homepage 'https://github.com/vv-vim/vv'
depends_on form... | 26.882353 | 84 | 0.724289 |
79308806623d0d7ad19634ba498841a80dc53996 | 165 | class Project < ActiveRecord::Base
belongs_to :category
has_many :assets, dependent: :destroy
accepts_nested_attributes_for :assets, allow_destroy: true
end
| 20.625 | 60 | 0.793939 |
bf4a5b0467472a889d14cbba987d73e9352926bb | 832 | # coding: utf-8
require 'helper'
describe JavaProperties::Encoding::Unicode do
subject{ JavaProperties::Encoding::Unicode }
let(:encoded) { 'this is some \u0024 text \U05D4 with unicode' }
let(:encoded_normalized) { 'this is some $ text \u05d4 with unicode' }
let(:decoded) { 'this is some $ text ה with unicod... | 28.689655 | 72 | 0.707933 |
1d09f64f82f8d1e4e0e5bbc27df3f09819a69f89 | 167 | class AddColumnsToUserRoles < ActiveRecord::Migration[5.0]
def change
add_column :user_roles, :desc, :text
add_column :user_roles, :cover, :string
end
end
| 23.857143 | 58 | 0.736527 |
e851b06e15ef674536aaa774f5b2b456e4698823 | 4,560 | # frozen_string_literal: true
require 'yaml'
module UserAgentParser
class Parser
FAMILY_REPLACEMENT_KEYS = %w[
family_replacement
v1_replacement
v2_replacement
v3_replacement
v4_replacement
].freeze
OS_REPLACEMENT_KEYS = %w[
os_replacement
os_v1_replacement
... | 26.982249 | 86 | 0.641447 |
1895b09069695f582737b86918d8b39a5f3d5714 | 25,445 | require 'bigdecimal'
require 'date'
require 'arel/visitors/reduce'
module Arel
module Visitors
class UnsupportedVisitError < StandardError
def initialize(object)
super "Unsupported argument type: #{object.class.name}. Construct an Arel node instead."
end
end
class ToSql < Arel::Visit... | 29.382217 | 377 | 0.585695 |
bf5cb9bf18aac215e85016fffe5f6b7f0537d4f5 | 1,660 | class RubricCriteriaController < ApplicationController
before_filter :authorize_only_for_admin
def download_csv
@assignment = Assignment.find(params[:assignment_id])
file_out = MarkusCSV.generate(@assignment.get_criteria(:all, :rubric)) do |criterion|
criterion_array = [criterion.name, criterion.max... | 36.086957 | 89 | 0.672289 |
872422e93c9a026dafee38ea7f28f4599f9b8b0a | 1,820 | require 'search_object/plugin/graphql'
require 'graphql/query_resolver'
class Resolvers::LinksSearch
include SearchObject.module(:graphql)
scope { Link.all }
type types[Types::LinkType]
class LinkFilter < ::Types::BaseInputObject
argument :OR, [self], required: false
argument :description_contains, ... | 26.376812 | 100 | 0.717033 |
61dd8e65df9f73e230d36e82efd61c923ed1870a | 347 | #This is the solution to problem 3-5(c), giving the median of a set of three numbers, as solved by Alex TW.
include(Math)
def median(x,y,z)
if x == y
return y
elsif y == z
return y
elsif x == z
return x
elsif x > y && y > z
return y
elsif x > y && y < z
return x
elsif y > x && y > z
return z
else y > x ... | 16.52381 | 107 | 0.608069 |
e98421014e3f9d43f6cea3abb6335c89efed4f2d | 667 | Pod::Spec.new do |s|
s.platform = :ios
s.ios.deployment_target = '14.0'
s.name = "Core"
s.summary = "Dicoding Core.framework for modularization chapter"
s.requires_arc = true
s.version = "1.0.0"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "Aria Pratomo" => "ariapratomo@gmail.com" }
s.homepage = "... | 25.653846 | 105 | 0.667166 |
e203c8d23460da660a506ae806e383df7232b1ce | 164 | class AddTokenToActivist < ActiveRecord::Migration
def change
add_column :activists, :token, :string
add_index :activists, :token, unique: true
end
end
| 23.428571 | 50 | 0.743902 |
6a7b0ec154565a884c6b406a8150d90e9f804897 | 646 | require 'csv'
namespace :seed_data do
desc "Import calentadores"
task urusec_from_csv: :environment do
import_csv('ursea-calentadores-agua.csv') do |row|
p = Product.new(
brand: row[0].split(' ').map{ |a| a.capitalize }.join(' '),
model: row[1],
description: row[2],
kwatts... | 23.925926 | 73 | 0.595975 |
62a71d128aa5ab20848ead00ea5c0b32e394ee78 | 313 | test_cask 'invalid-depends-on-x11-value' do
version '1.2.3'
sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
url TestHelper.local_binary_url('caffeine.zip')
homepage 'http://example.com/invalid-depends-on-x11-value'
depends_on :x11 => :no_such_value
app 'Caffeine.app'
end
| 26.083333 | 75 | 0.779553 |
f806072972dee95ec8cfd04911ef5ee1613c3e89 | 146 | require 'test_helper'
class Api::V1::DecksControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
end
| 18.25 | 68 | 0.726027 |
e9b56a4a4ae4f37adfeae5ac7b8b6afe44d1794e | 93 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'objectify_config'))
| 46.5 | 92 | 0.731183 |
7a8e135547e0d6fe57cd872d525fccdbdb951b34 | 1,300 | class Vegeta < Formula
desc "HTTP load testing tool and library"
homepage "https://github.com/tsenart/vegeta"
url "https://github.com/tsenart/vegeta.git",
:tag => "cli/v8.1.1",
:revision => "6f0659435229e0adcbddf1cbbdf9c0adf95f9081"
bottle do
cellar :any_skip_relocation
sha256 "52401d4882d9... | 35.135135 | 94 | 0.724615 |
9138a02fbc7afffffdbc6b96b4468aa15083e940 | 1,110 | require 'morpheus/api/api_client'
class Morpheus::LicenseInterface < Morpheus::APIClient
def get()
url = "#{@base_url}/api/license"
headers = { params: {}, authorization: "Bearer #{@access_token}" }
execute(method: :get, url: url, headers: headers)
end
def install(key)
url = "#{@base_url}/api/l... | 33.636364 | 118 | 0.64955 |
08b17b7b9ef66bdb8bd1bebbeed7607d5b16e154 | 1,033 | # -*- coding: utf-8 -*-
#
#--
# Copyright (C) 2009-2010 Thomas Leitner <t_leitner@gmx.at>
#
# This file is part of kramdown.
#
# kramdown is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the... | 27.918919 | 91 | 0.728945 |
116827ac683eadc7b5f864986f0a9536d8ee7643 | 4,787 | require 'spec_helper'
describe "User", js: true do
scenario "sign in and sign out" do
user = create(:user, email: 'user@example.com', password: '123456', password_confirmation: '123456')
visit sprangular_engine.root_path
wait_for_loading
within 'header' do
page.find('a', text: 'Sign in').clic... | 25.328042 | 104 | 0.636307 |
f8d4a359f920cfca74818bb20c935b69deaf8af6 | 898 | # == Schema Information
#
# Table name: relation_members
#
# relation_id :bigint(8) default(0), not null, primary key
# member_type :enum not null
# member_id :bigint(8) not null
# member_role :string not null
# version :bigint(8) default(0), not null, primary key
#... | 30.965517 | 88 | 0.691537 |
4aa709c3b930d0c13e1f2d511ae852ca487a5754 | 14,256 | =begin
#NSX-T Data Center Policy API
#VMware NSX-T Data Center Policy REST API
OpenAPI spec version: 3.1.0.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.17
=end
require 'date'
module NSXTPolicy
# Child wrapper for PolicyLbVirtualServer, used in hierarchical AP... | 35.287129 | 508 | 0.647727 |
1d9b472e69654e80a8262f15ec6433724104f356 | 1,039 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'git/status_all/version'
Gem::Specification.new do |spec|
spec.name = "git-status-all"
spec.version = Git::StatusAll::VERSION
spec.authors = ["Nathan Reed"]
spec.email... | 35.827586 | 104 | 0.641963 |
1c87fccd4caaf8a466ab1095712c89e88f11b9a7 | 2,312 | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'rubygems'
require 'mocha'
require 'spec'
require 'spec/autorun'
Spec::Runner.configure do |config|
config.mock_with :mocha
end
require 'aspect4r'
# ======================= Class to be tested =================================
class Klass
... | 20.642857 | 78 | 0.612457 |
ed34cf81a4272eeccab764ede13140acde95660b | 143 | class RemoveVersionsTables < ActiveRecord::Migration[5.1]
def change
drop_table :version_associations
drop_table :versions
end
end
| 20.428571 | 57 | 0.776224 |
bf5b61a846f84eeed681f7ace5c097d92555fc08 | 3,411 | class Admin::ProductsController < Admin::BaseController
resource_controller
before_filter :load_data
after_filter :set_image, :only => [:create, :update]
# set the default tax_category if applicable
new_action.before do
next unless Spree::Config[:default_tax_category]
@product.tax_category = TaxCateg... | 37.9 | 212 | 0.646731 |
eddb46e86c28a805f6a1143099104df4c934aaf5 | 831 | # You'll get a string and a boolean.
# When the boolean is true, return a new string containing all the odd characters.
# When the boolean is false, return a new string containing all the even characters.
#
# If you have no idea where to begin, remember to check out the cheatsheets for string and logic/control
#
# od... | 28.655172 | 104 | 0.696751 |
bf720984f2de746dab07ea26c70a6b1a287fe413 | 423 | module Overcommit::Hook::CommitMsg
# Ensures commit message subject lines start with a capital letter.
class CapitalizedSubject < Base
def run
return :pass if empty_message?
first_letter = commit_message_lines[0].to_s.match(/^[[:punct:]]*(.)/)[1]
unless first_letter.match(/[[:upper:]]/)
... | 26.4375 | 78 | 0.661939 |
e9b8e3c9eb0d68525ff718eb6fce5f8eb81fd0ef | 3,701 | module Jets
class Preheat
extend Memoist
# Examples:
#
# Jets::Preheat.warm("posts_controller-index")
# Jets::Preheat.warm("jets-preheat_job-warm")
#
def self.warm(function_name, options={})
Preheat.new(options).warm(function_name)
end
def self.warm_all(options={})
... | 31.632479 | 139 | 0.642529 |
d53beae8aec422a8fe413ed6028bc3f7fc920d35 | 1,223 | devise_for :users, controllers: { registrations: "users/registrations" }
resources :archives, only: [:index]
resources :projects, only: [:index, :edit, :new, :update, :create, :show] do
resources :audits, only: [:index]
end
resources :categories, only: [:index, :create, :edit, :update]
resources :assignments, only: [... | 38.21875 | 91 | 0.693377 |
874e732eec725a785d83c6138083f757c4af2928 | 146 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Backend::LeaveApplicationsController, type: :controller do
render_views
end
| 24.333333 | 73 | 0.835616 |
26dbe0b41c0b3b628c7e3340299ed239b67d985d | 2,698 | # Manage indirections to termini. They are organized in terms of indirections -
# - e.g., configuration, node, file, certificate -- and each indirection has one
# or more terminus types defined. The indirection is configured via the
# +indirects+ method, which will be called by the class extending itself
# with this ... | 43.516129 | 170 | 0.717569 |
abd719f81b7d94196314fa9ac4328eb642da25cb | 149 | FactoryBot.define do
factory :paper do
title { "AAAAA" }
venue { "aaa" }
year { 2021 }
authors { build_list :author, 1 }
end
end
| 16.555556 | 37 | 0.590604 |
62e6602ac18fe6f73b701a7a777708d4466a5a7c | 226 | require File.expand_path('../../../spec_helper', __FILE__)
describe "String#upcase" do
it "needs to be reviewed for spec completeness"
end
describe "String#upcase!" do
it "needs to be reviewed for spec completeness"
end
| 22.6 | 58 | 0.738938 |
87472547e2c284b1915587e37c84388f0ccc07a9 | 1,915 | # -*- encoding: utf-8 -*-
# stub: rails-controller-testing 1.0.2 ruby lib
Gem::Specification.new do |s|
s.name = "rails-controller-testing".freeze
s.version = "1.0.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]... | 43.522727 | 112 | 0.641775 |
4a29d2be2eb5084227a0029a5df185c021ab8f3b | 74 | $LOAD_PATH << File.expand_path('../../../lib', __FILE__)
require 'fencer'
| 24.666667 | 56 | 0.648649 |
018fb26098685b4abc6df3a2c284e700d7b01d13 | 1,596 | # frozen_string_literal: true
module Gitlab
module Ci
module Pipeline
module Seed
class Stage < Seed::Base
include Gitlab::Utils::StrongMemoize
delegate :size, to: :seeds
delegate :dig, to: :seeds
def initialize(context, attributes, previous_stages)
... | 24.553846 | 73 | 0.510025 |
acc5220187e3231dc162d3383449aadf6a6fe4e6 | 686 | # `pod spec create bbb` 建 NSDictionaryArray_utf8Description.podspec 文件。
# Be sure to run `pod spec lint bbb.podspec' to ensure this is a
Pod::Spec.new do |s|
s.name = "bbb"
s.version = "0.0.1"
s.summary = "NSDictionary, NSArray UTF8中文 log 输出."
s.description = <<-DESC
NSDictionary, NSArray UTF8中文 l... | 36.105263 | 93 | 0.629738 |
e2974a8603afc62c9abc896209901d06d2aa76cf | 2,117 | Capistrano::Configuration.instance(:must_exist).load do
namespace :ssh do
desc 'Generate ssh keys and upload to server'
task :setup do
ssh.create_keys
ssh.upload_keys
end
desc "Creates an rsa ssh key pair in your ~/.ssh folder"
task :create_keys do
question = [
"T... | 33.078125 | 108 | 0.555975 |
0857bd71a0ad0b6eda9883b40ead96526e333849 | 3,763 | # encoding: utf-8
require 'spec_helper'
describe Github::PageIterator, 'when number' do
let(:header) { {"Link" => "<https://api.github.com/users/wycats/repos?page=4&per_page=20>; rel=\"next\", <https://api.github.com/users/wycats/repos?page=6&per_page=20>; rel=\"last\", <https://api.github.com/users/wycats/repos?pa... | 31.621849 | 342 | 0.660643 |
39404efcb5749a968fe0bc67ce053b23fba375df | 1,114 | # frozen_string_literal: true
class PropertyDeSer < De::Ser::Ializer
property :string_prop, type: :type_that_doest_exist_but_will_evaluate_to_string
property :symbol_prop, type: Symbol
property :integer_prop, type: Integer
property :decimal_prop, type: BigDecimal
property :bool_p... | 34.8125 | 111 | 0.701077 |
38f382bd6c0c65c5f8bd2df4d505fbc54ad1a16f | 620 | require 'test_helper'
require 'ipaddr'
require 'ip'
class IPTest < Minitest::Test
include IP
def test_that_prefix_is_correct
[
[IP.new('192.168.1.0/24'), 24],
[IP.new('10.9.8.240/28'), 28],
[IP.new('192.168.1.0/32'), 32]
].each do |ip, subnet|
assert_equal(subnet, ip.subnet)
en... | 22.142857 | 64 | 0.608065 |
38ca30cf303bc2ceef89a8c0c56895992af57f13 | 86 | FactoryBot.define do
factory :hand do
hand_id { 1 }
user_id { 1 }
end
end
| 12.285714 | 20 | 0.616279 |
d57c893e1d54e42bc13249112d7f8887957af7f4 | 5,292 | require 'spec_helper'
require 'acceptance/webmock_shared'
require 'ostruct'
require 'acceptance/httpclient/httpclient_spec_helper'
describe "HTTPClient" do
include HTTPClientSpecHelper
before(:each) do
WebMock.reset_callbacks
HTTPClientSpecHelper.async_mode = false
end
include_examples "with WebMock... | 32.268293 | 121 | 0.650983 |
080d945c99659d8d7e8e01a0d1fb8bab24c98f2b | 11,497 | require 'puppet/util/autoload'
require 'puppet/parser/scope'
require 'puppet/pops/adaptable'
# A module for managing parser functions. Each specified function
# is added to a central module that then gets included into the Scope
# class.
#
# @api public
module Puppet::Parser::Functions
Environment = Puppet::Node::E... | 36.731629 | 235 | 0.66887 |
18454c1cd708352259f14de1aaefe8419ac18216 | 515 | module SpreeVariantsPromotionRule
class Engine < Rails::Engine
require 'spree/core'
isolate_namespace Spree
engine_name 'spree_variants_promotion_rule'
# use rspec for tests
config.generators do |g|
g.test_framework :rspec
end
def self.activate
Dir.glob(File.join(File.dirname... | 24.52381 | 88 | 0.679612 |
f86ccc3647aa389f8da976a7d407d23a7b5b3084 | 5,264 | =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... | 23.189427 | 177 | 0.576938 |
e9b197aee701eb873e104f81fb8c00e383d95d04 | 953 | require_relative '../test_helper'
class SubscopeTest < Test::Unit::TestCase
setup do
# Fake entries that should NOT be returned
5.times { Album.create title: lorem, body: '' }
@items = {
:a => Album.create(title: "Secher glite"),
:b => Album.create(title: "Shebboleth mordor"),
:c => Al... | 21.177778 | 53 | 0.539349 |
1a7a6cb9fc8c21ddc1b19043856bbcd85a86bca1 | 196 | class CreateNicknames < ActiveRecord::Migration
def change
create_table :nicknames do |t|
t.string :name
t.integer :building_id
t.timestamps null: false
end
end
end
| 17.818182 | 47 | 0.678571 |
01adda3fcd36c8017b841e7f35aadf7c5b61ecc4 | 1,028 | require 'spec_helper'
describe 'nagios::default' do
let(:chef_run) do
runner = ChefSpec::Runner.new(platform: 'ubuntu', version: '12.04')
runner.converge 'nagios::default'
end
subject { chef_run }
before do
ChefSpec::Server.create_data_bag('users',
'tsmith' =>... | 28.555556 | 71 | 0.533074 |
4abc2860bf5e4291cdbc82988bf0859a6027bdc6 | 1,843 | class Capybara::Selenium::Node < Capybara::Driver::Node
def text
native.text
end
def [](name)
native.attribute(name.to_s)
rescue Selenium::WebDriver::Error::WebDriverError
nil
end
def value
if tag_name == "select" and self[:multiple] and not self[:multiple] == "false"
native.find_ele... | 21.940476 | 106 | 0.658166 |
384bc2ba510d16ed985e1457ef8e34a148fca87d | 2,750 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Hanaonazure::Mgmt::V2017_11_03_preview
module Models
#
# The response from the List SAP monitors operation.
#
class SapMonitorListResult
... | 28.061224 | 80 | 0.523636 |
28003a0d469ad27083f031aedf0090ae0df3dd34 | 1,362 | module Celluloid
# An abstraction around threads from the InternalPool which ensures we don't
# accidentally do things to threads which have been returned to the pool,
# such as, say, killing them
class ThreadHandle
def initialize(actor_system, role = nil)
@mutex = Mutex.new
@join = ConditionVa... | 26.705882 | 96 | 0.635095 |
f78ab7e13b4072851686b4525e3700630f6f9fcf | 197,195 | module MonstersManualContent
MONSTERS_MANUAL_CONTENT =
{:monsters=>
[{:key=>:aarakocra,
:challenge=>0.25,
:name=>"Aarakocra",
:type=>"Humanoid",
:source=>"Monster Manual",
:xp_value=>50,
:boss=>nil,
:groups=>nil},
{:key=>:abjurer,
:challenge=>9,
:name=>"Abjurer",
:type=>"... | 21.971588 | 77 | 0.556404 |
f735342dc640c5e4bb5a7ce3b9aca8c830bfd541 | 131 | Rails.application.routes.draw do
get "home/index"
get "home/about"
mount Contenteditable::Engine => "/contenteditable"
end
| 16.375 | 53 | 0.732824 |
08b73850014d9c079ccbacc12638edc9fc6c5862 | 1,424 | require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Phrase::JobTemplateLocalesCreateParameters
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe 'JobTemplateLocalesCreateParameters' do
before do
# run before each test
... | 29.666667 | 102 | 0.739466 |
f7a99efcfbbc94c9f13fe5cd8d2b8ae933b04b8b | 13,046 | # -*- coding: binary -*-
#
# An NTLM Authentication Library for Ruby
#
# This code is a derivative of "dbf2.rb" written by yrock
# and Minero Aoki. You can find original code here:
# http://jp.rubyist.net/magazine/?0013-CodeReview
# -------------------------------------------------------------
# Copyright (c) 2005,2006... | 31.285372 | 103 | 0.683964 |
5d632f619681c36bdf975ff0f3075f9f16fe1929 | 638 | require 'spec_helper'
RSpec.describe 'User seeding' do
context 'when db/seeds/alchemy/users.yml file is present' do
let(:seeds_file) do
'spec/fixtures/users.yml'
end
before do
FileUtils.mkdir_p(Rails.root.join('db/seeds/alchemy'))
FileUtils.cp(seeds_file, Rails.root.join('db/seeds/alch... | 25.52 | 77 | 0.678683 |
bb05ff4281e96b6224253d636a7ade7123519c28 | 126 | class Comment
include Mongoid::Document
field :name
field :content
embedded_in :article, :inverse_of => :comments
end
| 18 | 48 | 0.746032 |
bfe585ef4f9b1bc356a0b74098e9df1f44bf2a99 | 226 | class CreateTrips < ActiveRecord::Migration[5.0]
def change
create_table :trips do |t|
t.string :user_email
t.text :place_ids
t.string :mode
t.text :feedback
t.timestamps
end
end
end
| 17.384615 | 48 | 0.632743 |
f8be79092b18faae8ad3e239a2ad40991e97d903 | 34,702 | RSpec.describe AuthenticationMixin do
include Spec::Support::ArelHelper
let(:host) { FactoryBot.create(:host) }
let(:invalid_auth) { FactoryBot.create(:authentication, :resource => host, :status => "Invalid") }
let(:valid_auth) { FactoryBot.create(:authentication, :resource => host, :status ... | 41.860072 | 199 | 0.658002 |
333dcd33ae77cb9b7115145f48357e671b492e58 | 7,131 | require 'httprecognizer/constants'
require 'httprecognizer/version'
require 'deque'
# Parent expected to provide following API:
#
# default_name
# known_name?
# keepalive?
# now
# logger
# add_client
# remove_client
#
# This module implements the HTTP handling code. I call it a recognizer,
# and not a parser because i... | 33.478873 | 180 | 0.575235 |
ed74a628a9eec7a274d2a8e3de3a03464f212d7c | 2,325 | 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't have to restart the web serv... | 35.769231 | 86 | 0.76086 |
91a621d2c7600a3483c574401e93eea5cfd97d91 | 1,051 | module Morpho
class ActivationsController < ApplicationController
skip_before_action :require_login, only: [ :new, :create, :show ]
helper_method :user
def create
if user && !user.active?
user.resend_activation_needed_email!
flash.now[:notice] = I18n.t('morpho.messages.activations.c... | 23.355556 | 81 | 0.627022 |
bbaea38ad4a168e837ce8ba1f8e8e65e07037651 | 403 | class CreateBalances < ActiveRecord::Migration[5.1]
def change
create_table :balances do |t|
t.references :user, null: false, foreign_key: true
t.float :amount, null: false
t.float :price_per_item, null: false
t.float :profit_percent, null: false
t.column :strategy, :smallint, null... | 25.1875 | 73 | 0.669975 |
01db74a66b51d04a2f1d4c03bfc75760a8c73e0c | 532 | class CreateJointMembershipApplications < ActiveRecord::Migration[5.2]
def change
create_table :joint_membership_applications do |t|
t.string :first_name
t.string :last_name
t.string :email
t.string :phone_number
t.string :street_line_one
t.string :street_line_two
t.stri... | 21.28 | 70 | 0.657895 |
1db01e843e1b490f3b81c1a37a725fb77a500c47 | 530 | #AtCoder Beginner 13 B
def red a , b
count = 0
while true
a += 1
count += 1
if a == 10 then
a = 0
end
if a == b then
break
end
end
return count
end
def blue a , b
count = 0
while true
a -= 1
count += 1
if a == -1 then
a = 9
end
if a == b ... | 10.392157 | 25 | 0.539623 |
7a1473b19a51e6ad820416ee7cbe952b2855fd99 | 263 | # frozen_string_literal: true
module PafsCore
class ProgramUploadFailure < ApplicationRecord
belongs_to :program_upload_item, inverse_of: :program_upload_failures
validates :field_name, presence: true
validates :messages, presence: true
end
end
| 23.909091 | 73 | 0.794677 |
4ab7b0e81e12ab802067fcb0a22c6781f8fb4c8e | 9,144 | # frozen_string_literal: true
# see app/controllers/name_controller.rb
class NameController
before_action :disable_link_prefetching, except: [
:create_name,
:edit_name
]
def create_name
store_location
pass_query_params
init_create_name_form
if request.method == "POST"
@parse = pars... | 30.891892 | 80 | 0.69007 |
bb515b6e1281735aa8aaaba111d0457d0dcbad19 | 195 | class Field::EmailPresenter < FieldPresenter
def input(form, method, options={})
form.email_field(
method,
input_defaults(options).merge(:autocomplete => "off")
)
end
end
| 21.666667 | 59 | 0.671795 |
7a507de8e452cff8b07d0753799aa1d9539c19d7 | 9,345 | =begin
#NSX-T Manager API
#VMware NSX-T Manager REST API
OpenAPI spec version: 2.5.1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.19
=end
require 'date'
module NSXT
class ServiceDeploymentStatus
# List of issue and detailed description of the issue in cas... | 34.356618 | 327 | 0.662386 |
33071a417468644c10b42191d5003dd45c38539d | 1,386 | ActionController::Routing::Routes.draw do |map|
map.resources :groups, :accounts
# Load Blacklight's routes and add edit_catalog named route
Blacklight::Routes.build map
map.edit_catalog 'catalog/:id/edit', :controller=>:catalog, :action=>:edit
#map.root :controller => 'collections', :action=>'index'
... | 53.307692 | 172 | 0.639971 |
1a4aef57f548baf57c3485d9000307f2d15e2698 | 508 | require 'spec_helper'
RSpec.describe NormalizerJp::Normalizers::HiraganaNormalizer do
describe '.call' do
subject { NormalizerJp::Normalizers::HiraganaNormalizer.call(value) }
context 'when value is katakana' do
let(:value) { 'キタムラ' }
it 'converts to hiragana' do
expect(subject).to eq '... | 22.086957 | 73 | 0.637795 |
61cb716783fce6f5e3bbbad770a266965d800df5 | 357 | # coding: utf-8
# The exception raised when an enabled EOI is detected in a readline operation.
class MiniReadlineEOI < StandardError; end
# The exception raised when the prompt is too long to fit.
class MiniReadlinePLE < RuntimeError; end
# The exception raised when the secret entry mask is invalid.
class ... | 32.454545 | 80 | 0.767507 |
ac1a3d94b7c99f8038a3b68ed010bf8263f89c80 | 321 | # frozen_string_literal: true
require "rails_helper"
RSpec.describe CartItem, type: :model do
it { should validate_numericality_of(:quantity).is_greater_than_or_equal_to(1) }
it { is_expected.to belong_to(:cart) }
it { is_expected.to belong_to(:product) }
it { is_expected.to belong_to(:product_variant) }
end... | 26.75 | 82 | 0.76324 |
1dcd169d2866e929fa81023de49046827527789c | 714 | Pod::Spec.new do |s|
s.name = "FVEasyShowCase"
s.version = "1.0"
s.summary = "Highlight parts of your app iShowcase."
s.homepage = "https://github.com/tato469/FVEasyShowCase"
s.screenshots = "https://github.com/tato469/FVEasyShowCase/raw/master/screenshots/screenshot... | 39.666667 | 106 | 0.609244 |
ed4b20825ca7f2e46dc3d3ac226d87549f400705 | 566 | #!/usr/bin/env ruby
require 'fileutils'
require 'json'
system("make out/8cc.c.eir.js out/elc.c.eir.js out/eli.c.eir.js")
headers = {}
Dir.glob('libc/*.h').each do |hf|
h = File.read(hf)
hn = File.basename(hf)
headers[hn] = h
end
FileUtils.mkdir_p('web')
FileUtils.ln_sf('../tools/8cc.js.html', 'web')
FileUtils... | 22.64 | 65 | 0.641343 |
08f581bcc7c083cb2ebc68d428aa041361a77a93 | 315 | module CliDetection
extend ActiveSupport::Concern
included do
before_action :cli_detected
end
private
def cli_detected
@cli_detected = ua_parse(request.user_agent)
end
def ua_parse(user_agent)
user_agent =~ /\A(curl|Wget|HTTPie|httpie-go|Go-http-client|Faraday)/
end
end
| 17.5 | 75 | 0.707937 |
f7856039abbbead8f5910caefa74f2ba33460b78 | 227,710 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
module Aws::S3Control
module Types
# The container for abort incomplete... | 35.408179 | 230 | 0.608577 |
3305280b2c5bf821ce138acf8cdc89889503307d | 1,517 | # -*- encoding: utf-8 -*-
# stub: jekyll-theme-midnight 0.1.1 ruby lib
Gem::Specification.new do |s|
s.name = "jekyll-theme-midnight".freeze
s.version = "0.1.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.a... | 39.921053 | 112 | 0.678312 |
391edb395923ebe96ed79f1db8d650a2e88f1e6e | 1,512 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
require 'aws-sdk-core'
require 'aws-sigv4'
require_relative 'aws-sdk-ec2inst... | 28 | 92 | 0.76455 |
08440851497ce80f0ca5699f21d3be8d6558837a | 236 | class CreateTaggings < ActiveRecord::Migration
def change
create_table :taggings do |t|
t.references :proposal, index: true
t.string :tag
t.boolean :internal, default: false
t.timestamps
end
end
end
| 19.666667 | 46 | 0.669492 |
1a77aa1bc1e47dfbd1bc81a5771c3e72bb936f08 | 408 | include_attribute "deployment"
default[:erlang][:version] = "R14B01"
default[:erlang][:id] = "eyJzaWciOiJhYmhYc0hsTERyNVpJc2Q5Y3pibTdMZy9kTUk9Iiwib2lkIjoi%0ANGU0ZTc4YmNhMzFlMTIyMjA0ZTRlOTg2M2IxYjc0MDUwMThlZDMzZDNlMDIi%0AfQ==%0A"
default[:erlang][:path] = File.join(node[:deployment][:home], "deploy", "erlang")
default[:... | 68 | 159 | 0.823529 |
61f3d2373b0996d94a466318ea97d1d3f0622924 | 2,053 | Pod::Spec.new do |s|
s.name = 'MKNetworkKit'
s.version = '0.87'
s.summary = 'ARC ready Networking Framework with built in authentication and HTTP 1.1 caching standards support for iOS 5+ devices.'
s.homepage = 'https://github.com/MugunthKumar/MKNetworkKit'
s.author ... | 46.659091 | 144 | 0.712616 |
bbd0dff90aceb7fca677891150f09a17450324d9 | 1,726 | #
# Be sure to run `pod lib lint DatePickerDialogSwift.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name =... | 40.139535 | 125 | 0.662804 |
79c501d950555c85ae2f9c96d1277d4293350671 | 825 | # -*- encoding: utf-8 -*-
require 'spec_helper'
describe "メモリ使用量を取得できていることを確認する" do
it "collector名がmemoryであること" do
mem = Bounscale::Collector::Memory.new
mem.name.should == "memory"
end
it "メモリ使用量が取得できること(モック)" do
dummy_ps = " RSZ\n2036 \n780"
mem = Bounscale::Collector::Memory.new
... | 22.916667 | 46 | 0.633939 |
260e7631afeb8815229ae76f10ec6af603413c85 | 1,452 | module Cash
class Fake < HashWithIndifferentAccess
attr_accessor :servers
def get_multi(*keys)
slice(*keys).collect { |k,v| [k, Marshal.load(v)] }.to_hash
end
def set(key, value, ttl = 0, raw = false)
self[key] = marshal(value, raw)
end
def get(key, raw = false)
if raw
... | 17.285714 | 65 | 0.542011 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.