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 |
|---|---|---|---|---|---|
61b9fa6bf49b232e366aa8aa44172b44c0d144ed | 2,172 | require 'xmlscan/scanner'
require 'stringio'
module RSS
class XMLScanParser < BaseParser
class << self
def listener
XMLScanListener
end
end
private
def _parse
begin
if @rss.is_a?(String)
input = StringIO.new(@rss)
else
input =... | 17.803279 | 59 | 0.574586 |
bb24bca041b61987670ff8369c74a4e8878198c2 | 1,185 | # encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative sou... | 35.909091 | 86 | 0.760338 |
ac4473e58d4e95dc6f3ba52f238bf541cd9a141e | 1,444 | require "spec_helper"
describe Toolsmith::ViewHelpers::BootstrapHelpers do
subject { AbstractActionView.new }
let(:content_block) do
Proc.new { "content" }
end
context "#form_actions" do
let(:element) { to_element subject.form_actions(&content_block), "div" }
it "renders a container with a cl... | 25.333333 | 80 | 0.641274 |
ab1497cc65930a1c82f73257fcf59c90cb48df00 | 1,274 | # 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::Logic::Mgmt::V2016_06_01
module Models
#
# Model object.
#
#
class AccessKeyRegenerateActionDefinition
include Ms... | 25.48 | 74 | 0.565934 |
abb7bc3febd67132b925fef3e8fc8d80aa80f023 | 11,084 | # frozen_string_literal: true
describe 'users update end-point', :transaction do
before(:each) do
creation = create_user build(:user, :with_credentials)
expect(creation).to be_success
@current_user = creation.value!
encoding = tokenize @current_user
expect(encoding).to be_success
@token = enc... | 40.452555 | 95 | 0.657705 |
87b5d7ceb18e7b861d43821364a5c6f3601bb66a | 4,744 | class Rust < Formula
desc "Safe, concurrent, practical language"
homepage "https://www.rust-lang.org/"
stable do
url "https://static.rust-lang.org/dist/rustc-1.30.0-src.tar.gz"
sha256 "cd0ba83fcca55b64c0c9f23130fe731dfc1882b73ae21bef96be8f2362c108ee"
resource "cargo" do
url "https://github.com... | 33.885714 | 96 | 0.666315 |
ac901d12503fdf84bdba6a2507e4b76754eca9bd | 1,338 | #-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
#
# 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 ChiliProject, which is a fork of ... | 39.352941 | 91 | 0.765321 |
6a0e578d214961ff07efde2912670e265b311785 | 9,930 | class Certbot < Formula
include Language::Python::Virtualenv
desc "Tool to obtain certs from Let's Encrypt and autoenable HTTPS"
homepage "https://certbot.eff.org/"
url "https://github.com/certbot/certbot/archive/v1.11.0.tar.gz"
sha256 "a5b170f81bc5aab507a480006218bd4d256e0ae7cb43c37ba46018c00299af91"
lice... | 45.972222 | 149 | 0.80574 |
2840435348bb352012582ddb630c2824a4f4b36d | 185 | def login_as(user)
visit '/users/sign_in'
within("#new_account") do
fill_in 'Email', with: user.email
fill_in 'Password', with: 'password'
end
click_button 'Log in'
end
| 20.555556 | 40 | 0.681081 |
6a8a18dfd6c1f187865fa96acc78bc8d1afb4530 | 611 | module HomePageSteps
step 'ми відкрили початкову сторінку' do
visit '/'
end
step 'в навігаційному меню я хочу бачити посилання на розділи:' do |categories|
categories.each do |category|
within('.main-menu') do
find_link(category[0]) != nil
end
end
end
step 'ми маємо бачити к... | 21.821429 | 81 | 0.653028 |
b9d6948359d9d2ff7075de2370b194ca9da671e2 | 617 | class ResultGroup < AactRecord
include BelongsToStudy
has_many :reported_events, dependent: :restrict_with_exception
has_many :milestones, dependent: :restrict_with_exception
has_many :drop_withdrawals, dependent: :restrict_with_exception
has_many :baseline_measures, dependent: :restrict_with_exception
has... | 47.461538 | 99 | 0.844408 |
aba68d6db2ff543fa52c5f44fda0e537934d58d0 | 15,609 | require "fileutils"
require "digest/md5"
require "active_support/core_ext/string/strip"
require "rails/version" unless defined?(Rails::VERSION)
require "open-uri"
require "uri"
require "rails/generators"
require "active_support/core_ext/array/extract_options"
module Rails
module Generators
class AppBase < Base #... | 35.965438 | 124 | 0.568518 |
6a545d73b9cb53f2f896cc7f415caa2e6ebfcce0 | 496 | # frozen_string_literal: true
module ResourceRegistry
module Operations
module Features
# Enable a Feature
# @param [Symbol] name Name of feature to enable
# @param [Hash] options Options passed through to feature enable call
# @return result of the feature instance enable call
clas... | 23.619048 | 75 | 0.641129 |
bfeaeb1c441da0a7fdb85530f77bb39b1f45b036 | 2,082 | module Textpow
class ScoreManager
POINT_DEPTH = 4
NESTING_DEPTH = 40
START_VALUE = 2 ** ( POINT_DEPTH * NESTING_DEPTH )
BASE = 2 ** POINT_DEPTH
def initialize
@scores = {}
end
def score search_scope, reference_scope
max = 0
search_scope.split( ',' ).eac... | 31.545455 | 140 | 0.588377 |
6ab229c49c30fe9284a03547a1c462292dcc5e8c | 1,835 | #
# Copyright 2021- Kentaro Hayashi
#
# 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 wr... | 29.126984 | 96 | 0.622888 |
ffb646f56f45534f0af744e4695b7580ec0a8c85 | 2,414 | require 'rails_helper'
RSpec.describe Event, type: :model do
describe 'Relations' do
it { is_expected.to belong_to(:item) }
it { is_expected.to embed_many(:dispatches) }
end
describe 'Fields' do
it { is_expected.to have_timestamps }
it { is_expected.to have_field(:item_id).of_type(Object) }
... | 31.350649 | 98 | 0.673571 |
3355600b921da0c41df7796c8d3352da54cdb733 | 3,032 | # 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::Network::Mgmt::V2020_03_01
module Models
#
# An array of private link service id that can be linked to a private end
# point wit... | 29.72549 | 83 | 0.550462 |
38209ad2d3e765341c5cd8efebc180684345d789 | 951 | require 'zoho_invoice/base'
module ZohoInvoice
class Contact < Base
READ_ATTRIBUTES = [
:contact_id,
:contact_name,
:company_name,
:website,
:currency_id,
:first_name,
:last_name,
:address,
:email,
:phone,
:mobile,
... | 19.408163 | 62 | 0.574132 |
b9836258b5f3caf02b4bb0b2b3f4245d1e1ca84e | 1,444 | require 'mini_magick'
module SliceRename
class Slicer
def self.slice_image(config)
extension = File.extname config.path
name = File.basename config.path, extension
path = File.dirname config.path
i = 0
for y in 0..(config.rows - 1)
for x in 0..(config.columns - 1)
... | 25.333333 | 91 | 0.546399 |
61d039c4be5e1a36abf1c534068fcb41e865c226 | 1,390 | class Libmicrohttpd < Formula
desc "Light HTTP/1.1 server library"
homepage "https://www.gnu.org/software/libmicrohttpd/"
url "https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.62.tar.gz"
mirror "https://ftpmirror.gnu.org/libmicrohttpd/libmicrohttpd-0.9.62.tar.gz"
sha256 "bd3e097d703f5091a6a01b56c0464a9... | 37.567568 | 94 | 0.705036 |
333850b6d09af61a26c715ae0d8176cac9483ef8 | 169 | class CreateInterests < ActiveRecord::Migration[6.0]
def change
create_table :interests do |t|
t.string :interest_name
t.timestamps
end
end
end
| 16.9 | 52 | 0.686391 |
794625dd870afa9ad10c6cb023232da33bff43b2 | 3,256 | class Gnupg < Formula
desc "GNU Pretty Good Privacy (PGP) package"
homepage "https://gnupg.org/"
url "https://gnupg.org/ftp/gcrypt/gnupg/gnupg-2.2.10.tar.bz2"
sha256 "799dd37a86a1448732e339bd20440f4f5ee6e69755f6fd7a73ee8af30840c915"
bottle do
sha256 "7190eeef3372dec0d663f29f59fdc192b4f2b684b00b684405a3fd... | 32.888889 | 93 | 0.687961 |
bf425a2617c7065339894513510d0911877b7b03 | 7,131 | require 'rails_helper'
describe Clusters::Applications::Knative do
include KubernetesHelpers
include ReactiveCachingHelpers
let(:knative) { create(:clusters_applications_knative) }
include_examples 'cluster application core specs', :clusters_applications_knative
include_examples 'cluster application status... | 33.167442 | 122 | 0.726406 |
38c7582d5917ffdc28f1b25766dcebb0577e2593 | 51 | module Cobregratis
class Service < Base
end
end | 12.75 | 22 | 0.764706 |
214b3d3ee446fe2be58044437ef73edc9721e253 | 279 | class UberArray
def initialize(array)
@array = array
end
def each
i = 0
while i < @array.length
yield @array[i]
i += 1
end
end
end
UberArray.new([1, 2, 3, 4, 5, 6]).each do |x|
puts "element #{x}"
end
| 15.5 | 45 | 0.476703 |
081bd48891f3686df555ce30c3f4042b99a8eca2 | 178 | json.extract! possible_answer, :id, :question_id, :order, :answer_text, :is_text, :boolean, :created_at, :updated_at
json.url possible_answer_url(possible_answer, format: :json)
| 59.333333 | 116 | 0.786517 |
5dcc40a4cccd4cd627f918090700641c429f0956 | 1,035 | require 'cheer_up/version'
require 'Thor'
module CheerUp
class Cli < Thor
desc 'up "name"', 'cheers you up with a name if you provide one'
long_desc <<-MEH
A sarcastic phrase spoken by the Terminal, which probably
won't cheer whoever it's directed at up.
MEH
def up(name = nil)
phra... | 26.538462 | 91 | 0.588406 |
e203aa0f7977f025e7723a55acf0542568dba2ed | 116 | class AdminController < ApplicationController
def index
# puts "in the controller"
# binding.pry
end
end | 19.333333 | 45 | 0.724138 |
9172862411af8bbc609268f31b659ae5bc0ec4fb | 306 | # == Schema Information
#
# Table name: carts
#
# id :integer not null, primary key
# user_id :integer
# status :integer
# metadata :jsonb
# created_at :datetime not null
# updated_at :datetime not null
#
FactoryGirl.define do
factory :cart do
end
end
| 17 | 53 | 0.604575 |
08304014de74d48ffef6a0c296913eaae9cb0bae | 312 | class CreatePosts < ActiveRecord::Migration[6.1]
def change
create_table :posts do |t|
t.string :header
t.string :color
t.string :title
t.string :design
t.string :body
t.integer :user_id
t.timestamps
end
add_index :posts, :user_id, unique: true
end
end
| 19.5 | 48 | 0.625 |
2699c97552c691b3e67cea0ad1e79aab5e496da8 | 8,125 | # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic... | 41.454082 | 245 | 0.688985 |
01d29f6ec845fb28105871fd86528a5d2401079a | 266 | require "rubocop"
require "standard/rubocop/ext"
require "standard/version"
require "standard/cli"
require "standard/railtie" if defined?(Rails) && defined?(Rails::Railtie)
require "standard/formatter"
require "standard/cop/block_delimiters"
module Standard
end
| 19 | 73 | 0.785714 |
3991db085748504e105dad0700703b8229e0e3d9 | 143 | class Lion
attr_accessor :name, :sound
def initialize(attributes)
@name = attributes[:name]
@sound = attributes[:sound]
end
end
| 15.888889 | 31 | 0.685315 |
6a0a92bafd8909c0b9fedc10820924da9182aa0a | 2,741 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe SidekiqHelper do
describe 'parse_sidekiq_ps' do
it 'parses line with time' do
line = '55137 10,0 2,1 S+ 2:30pm sidekiq 4.1.4 gitlab [0 of 25 busy] '
parts = helper.parse_sidekiq_ps(line)
expect(parts).to eq(['55137', '10,0',... | 37.040541 | 124 | 0.587377 |
1abcaf2fa8b0b0effbee145aadd24b094ea4f0ed | 6,798 | # 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 applicable law or agreed to in writing, ... | 28.683544 | 80 | 0.53604 |
61f24fa4f31f3e5f8f9b2328aff7a0dafd04a1a1 | 566 | module RailsAdmin
module Extensions
module PaperTrail
class VersionProxy
def message
@message = @version.event
end
def version_id
@version.id
end
def remark
@remark = @version.remark
end
end
class AuditingAdapter
... | 18.258065 | 35 | 0.519435 |
397deaa3d752cb93832464ca985f2f7b1c628dde | 1,482 | class Hive < Formula
desc "Hadoop-based data summarization, query, and analysis"
homepage "https://hive.apache.org"
url "https://www.apache.org/dyn/closer.lua?path=hive/hive-3.1.2/apache-hive-3.1.2-bin.tar.gz"
mirror "https://archive.apache.org/dist/hive/hive-3.1.2/apache-hive-3.1.2-bin.tar.gz"
sha256 "d75dcf... | 32.217391 | 95 | 0.686235 |
7a017beac9832ef3cd8d754027e60c2fc0af5049 | 8,381 | =begin
#Aspose.Diagram Cloud API Reference
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 3.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.3.0-SNAPSHOT
=end
require 'date'
module AsposeDiag... | 32.111111 | 248 | 0.647536 |
bb2d49957c7a8ba5bca8f99229255b2864321635 | 3,080 | # frozen_string_literal: true
require File.dirname(__FILE__) + '/../../test_helper.rb'
class Drip::Client::EventsTest < Drip::TestCase
def setup
@client = Drip::Client.new { |c| c.account_id = "12345" }
end
context "#track_event" do
setup do
@email = "derrick@getdrip.com"
@action = "Signed ... | 28 | 90 | 0.583766 |
e9a3adb3d733ba711b1b8c7e87093317fd7a4c05 | 3,176 | require 'dry/core/class_attributes'
require 'dry-types'
RSpec.describe 'Class Macros' do
before do
module Test
class MyClass
extend Dry::Core::ClassAttributes
defines :one, :two, :three
one 1
two 2
three 3
end
class OtherClass < Test::MyClass
t... | 21.459459 | 74 | 0.61272 |
629db25ebf4bd9eb49475c052418425184b3ad28 | 567 | working_directory '/var/www/myappda/current'
pid '/var/www/myappda/current/tmp/pids/unicorn.pid'
stderr_path '/var/www/myappda/log/unicorn.log'
stdout_path '/var/www/myappda/log/unicorn.log'
listen '/tmp/unicorn.myappda.sock'
worker_processes 12
timeout 30
before_fork do |server, worker|
old_pid = "/var/www/myappda/... | 29.842105 | 68 | 0.730159 |
4adfe37a2501c5aee7e2052ecc0fb428c12a3247 | 551 | module Cnab240::V80
class AgenciaItau < BinData::Record
include Cnab240::DefaultMixin
include Cnab240::SegmentoMixin
lstring :zeros_1, :length => 1, :pad_byte => '0'
lstring :favorecido_agencia, :length => 4, :pad_byte => '0'
string :brancos_1, :length => 1, :pad_byte => ' '
lstring :zeros_2... | 36.733333 | 72 | 0.642468 |
d55826981900b2d0565f8ac227d297dc34f50827 | 3,959 | # frozen_string_literal: true
require_relative './configuration_validator'
module Reek
module Configuration
# Responsible for converting marked strings coming from the outside world
# into proper regexes.
class ConfigurationConverter
REGEXABLE_ATTRIBUTES = %w(accept reject exclude).freeze
in... | 35.666667 | 119 | 0.63021 |
e88f1ec3d25dba8ba4ad3126e52fd2ae7851948e | 514 | cask :v1 => 'meerkat' do
version '1.5.3'
sha256 'bf5a5e492463a7ec1c3e959a55227dd6fcec5bb902124f9bde819bf4f5933982'
url "http://codesorcery.net/downloads/Meerkat_#{version}.dmg"
appcast 'http://codesorcery.net/appcasts/Meerkat.xml',
:sha256 => 'ef91167a375342e078f147e20477056552bef06ea9e306a93ffb8a17a... | 39.538462 | 115 | 0.764591 |
d519b829c511163a522f2c6aafe13e053bf8287d | 1,898 | #-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2021 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 ChiliProject, which is a fork ... | 30.612903 | 91 | 0.722866 |
ff5e4ca82e5dfb34b22baa60289cfe330a53eeb1 | 438 | # frozen_string_literal: true
module Resolvers
class UserStarredProjectsResolver < BaseResolver
type Types::ProjectType.connection_type, null: true
argument :search, GraphQL::STRING_TYPE,
required: false,
description: 'Search query.'
alias_method :user, :object
def reso... | 24.333333 | 87 | 0.703196 |
bf03bf52c2b3637748cb359e9947d00142bbd5b2 | 3,998 | 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.216495 | 102 | 0.758379 |
38ce93051ea0345a932a7ff37f5ea8512290a5f5 | 388 | sensu_check "valid_standalone_check" do
interval 20
command 'true'
standalone true
end
sensu_check "valid_pubsub_check" do
interval 20
command 'true'
subscribers ['all']
end
sensu_check "removed_check" do
action :delete
end
# proxy client
sensu_check "valid_proxy_client_check" do
interval 20
comman... | 16.166667 | 41 | 0.765464 |
263df0c8e4aa5837e647693afae3c5d3101b10b5 | 199 | class CreateSearchSubscriptions < ActiveRecord::Migration
def change
create_table :search_subscriptions do |t|
t.string :query
t.string :email
t.timestamps
end
end
end
| 18.090909 | 57 | 0.698492 |
ac6278ff56cd78b9a74ee48fc875a9b9af9a8ddc | 4,460 | require 'pg_adaptor'
RSpec.describe 'adapting structs into pg' do
let(:db) { Sequel.postgres 'pg_adaptor_test' }
before do
PGAdaptor.db = db
db.extension :pg_array
db.extension :pg_json
db.create_table :test_table do
primary_key :id
String :name
String :other
column :membe... | 29.342105 | 156 | 0.577354 |
f879536183b999a95167ff55e562c98ac4ef34c2 | 2,382 | 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... | 36.646154 | 87 | 0.764064 |
fffdc88b53811d431368c42af3cde2a3c8cd623b | 117 | class Donation < ActiveRecord::Base
belongs_to :user
validates :date, :presence => true, :valid_date => true
end
| 23.4 | 57 | 0.726496 |
382d8e8cdcb765233239f128b6b4f8ed15a63499 | 2,369 | class Flow < Sequel::Model
require 'mustermann'
many_to_one :site
many_to_one :store
many_to_one :media_store, class: :Store
def name
if post_kind
return post_kind.capitalize
else
return "Files"
end
end
def url_pattern
return Mustermann.new(url_template) # type: :sinatra
... | 26.617978 | 101 | 0.704095 |
61bc5b499afae7a71d035297373723b93839c39c | 1,915 | module PaginationHelper
def self.get_self_link(collection, query)
self_query = query.clone
self_query = query.except(:page).clone
self_query['page[number]'] = collection.current_page
self_query['page[size]'] = collection.per_page
"#{ENV['APIGATEWAY_URL']}/v1/dashboard?#{self_query.to_query}"
end... | 36.826923 | 90 | 0.703394 |
916ded239915b14c9fc1f94961a2b904be188010 | 2,597 | # default[:apache_tomcat][:java_url]='http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz'
default[:apache_tomcat][:java_url]='http://192.168.79.1/sources/jdk-7u79-linux-x64.tar.gz'
default[:apache_tomcat][:java_src]='jdk-7u79-linux-x64.tar.gz'
default[:apache_tomcat][:java_unfold]='jdk1.7.0_... | 54.104167 | 127 | 0.648826 |
5d5c8bdb071ac255c5a2a7bbd88d66607b9534e4 | 802 | # frozen_string_literal: true
module GraphQL
class UnauthorizedFieldError < GraphQL::UnauthorizedError
# @return [Field] the field that failed the authorization check
attr_accessor :field
def initialize(message = nil, object: nil, type: nil, context: nil, field: nil)
if message.nil? && [field, type... | 33.416667 | 107 | 0.65212 |
5d0480a2d48f92de9eb37f45b1a2f3c2b60ad2a3 | 660 | namespace :migration do
desc "Usage: RAILS_ENV=production bundle exec rake migration:fill_dao_transactions_count_to_address"
task fill_dao_transactions_count_to_address: :environment do
progress_bar = ProgressBar.create({
total: Address.count,
format: "%e %B %p%% %c/%C"
})
values =
Ad... | 30 | 130 | 0.730303 |
ed26559326cfbda1db84e665df8f2ddd76ababdf | 3,610 | #
# Cookbook:: postgresql
# Resource:: postgresql_table
#
# Copyright:: 2013, OpenStreetMap Foundation
#
# 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/LICE... | 37.604167 | 148 | 0.684488 |
01b0e460961c7017e01ec2f755a8d2e70f628e91 | 3,897 | #-- encoding: UTF-8
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2021 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... | 33.886957 | 91 | 0.579933 |
f7a94b359b20ca7fb3a958e23e4e7bedaf764c5b | 7,859 | # encoding: utf-8
require 'pathspec/regexspec'
class GitIgnoreSpec < RegexSpec
attr_reader :regex
def initialize(pattern)
pattern = pattern.strip unless pattern.nil?
# A pattern starting with a hash ('#') serves as a comment
# (neither includes nor excludes files). Escape the hash with a
# back-... | 28.474638 | 73 | 0.550833 |
f75ff6fbede2d282ab5f06196c6b984195b037d2 | 815 | # frozen_string_literal: true
module Yabber
# Base Message validation
module Validation
include Constants
def validate_topic(topic)
raise ArgumentError, "Invalid Topic: #{topic}. (#{TOPICS})" unless valid_topic?(topic)
end
def validate_type(type)
raise ArgumentError, "Invalid Type: #{... | 22.027027 | 92 | 0.655215 |
01a1e1dfc2255ce05e3d822b671a692b52222f7b | 16,919 | #!/usr/bin/env ruby
# -------------------------------------------------------------------------- #
# Copyright 2002-2020, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License... | 28.531197 | 84 | 0.48874 |
28ea171973614cf18f9d9362e43c0cabba3cd86f | 2,732 | module Cubits
class Callback
#
# Processes callback request parsed into separate params
# and instantiates a resource object on success.
#
# @param params [Hash]
# @param params[:cubits_callback_id] [String] Value of the CUBITS_CALLBACK_ID header
# @param params[:cubits_key] [String] Value... | 39.594203 | 113 | 0.691801 |
bf2018fa7644a9cdef044491c4404e838a678c40 | 993 | lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "simple_dsl_parser/version"
Gem::Specification.new do |spec|
spec.name = "simple_dsl_parser"
spec.version = SimpleDslParser::VERSION
spec.authors = ["xiongzenghui"]
spec.email = [... | 36.777778 | 85 | 0.64854 |
87cdf0483636aac72fb9794c2df1c3814d3e7349 | 556 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe ProductStock, type: :model do
let(:product_stock) { build(:product_stock) }
it 'should have a product id' do
product_stock.product_id = nil
expect(product_stock).to_not be_valid
end
it 'should have current_stock' do
product_stoc... | 24.173913 | 65 | 0.75 |
28cb7ffa22077e118a0bf61c9bcf8ab83594a175 | 886 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require(*Rails.groups)
require "address_book"
module Dummy
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in conf... | 36.916667 | 99 | 0.72009 |
e948b7f2de16eb216c14ffb5e1eaff3407607372 | 905 | module DeclarativePolicy
# The DSL evaluation context inside rule { ... } blocks.
# Responsible for creating and combining Rule objects.
#
# See Base.rule
class RuleDsl
def initialize(context_class)
@context_class = context_class
end
def can?(ability)
Rule::Ability.new(ability)
en... | 19.673913 | 60 | 0.626519 |
01cd4aaf5bf54f2854fc1b105a352a5c52fe4655 | 1,127 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# dat... | 41.740741 | 86 | 0.755102 |
1d2d14fc0ff1375cfc9dd6237d31ebb53b379947 | 82 | Rails.application.routes.draw do
mount Fundraiser::Engine => "/fundraiser"
end
| 16.4 | 43 | 0.756098 |
038b31d2b2e8d0c225ba473f4676aecc1532dcd1 | 203 | Eson::Search::BaseQuery.new do
query do
term :tag => "something"
end
filter do |f|
range :post_date, {:from => "2010-03-01", :to => "2010-04-01"}
prefix "name.second" => "ba"
end
end
| 20.3 | 66 | 0.586207 |
e89ef3d917c18527082ad0f2bcad7fbacb4873e5 | 123 | require 'test_helper'
class TimeEventTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 15.375 | 45 | 0.707317 |
08b5a3383fbf33ac8a8e8f3fb45ed78ba76ddd98 | 1,558 | # frozen_string_literal: true
require_relative 'test_reporter'
class TestReporterPublicStartStop < TestReporter
# This class extends TestReporter so it includes all of the tests from
# TestReporter plus any additional test_* cases below and it
# overrides create_report to use the start/stop methods
# This sp... | 33.148936 | 79 | 0.771502 |
21e0c970d688399c4cbb969612db4f44fe41be1c | 1,350 | module Grammar
class Ngram
include Grammar::LanguageHelper
attr_accessor :contents
def initialize(grams=[])
self.contents = grams
end
def omnigrams
self.contents.map{|gram| gram.is_a?(Array) && gram.flatten || nil}.compact
end
def with_leading(matches, args={})
phras... | 30 | 146 | 0.651111 |
1c283e85f6219ade83d753b514a07c1254050fbb | 10,721 | require_relative '../SMatrix'
require 'test/unit'
require_relative '../storage/yale'
require_relative '../storage/dok'
require_relative '../storage/lil'
require 'complex'
require 'matrix'
class TestConditionals<Test::Unit::TestCase
# this is to test all conditionals when comparing differnet sMatrices
# NOTE: may nee... | 20.076779 | 95 | 0.642384 |
38364a0b151289a753e1a7a3d610f228fc91f4c4 | 1,246 | module Gitlab
class SnippetSearchResults < SearchResults
include SnippetsHelper
attr_reader :limit_snippet_ids
def initialize(limit_snippet_ids, query)
@limit_snippet_ids = limit_snippet_ids
@query = query
end
def objects(scope, page = nil)
case scope
when 'snippet_title... | 23.074074 | 81 | 0.679775 |
e82c74b3875948d5e573e9fdef54acadeb5b3df3 | 1,545 | require_relative "../canvas_base_mutation"
require_relative "../../types/canvas/group_category"
module LMSGraphQL
module Mutations
module Canvas
class CreateGroupCategoryAccount < BaseMutation
argument :account_id, ID, required: true
argument :name, String, required: true
argument :s... | 39.615385 | 170 | 0.638835 |
1c1206c1cbb0000c4a0caa66b5325b0e2a7fed25 | 5,002 | Ледяные дороги в местах, но в основном временными.
В нескольких местах в Чешской Республике, главной дороги ледяные и снежные.
Однако, большинство дорог являются временными, с дополнительной помощи, необходимой в таких местах.
Carlsbad региона
В своём регионе, дороги были использованы сегодня утром, хотя в некоторых ме... | 94.377358 | 218 | 0.828669 |
bb84635b45ccdc87448d3f7eb41231444f52de2a | 148 | # Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_blog-api-example_session'
| 37 | 86 | 0.804054 |
332a9d532d9831d5fb2f7e2a400c25faebd96965 | 3,619 | require 'rails_helper'
include DmKnowledge::SkmlHelper
describe DmKnowledge::SkmlHelper do
#------------------------------------------------------------------------------
describe "skml_to_html" do
let(:skml) do
<<-SKML
<!--: data-who="someone" data-srcid="1.x" -->
Some text to convert
<!--: data-who="someo... | 28.722222 | 108 | 0.604034 |
01de010eda1108a2b26dfd352afee69ecaaedd32 | 2,117 | class NewsReleasesController < ApplicationController
before_action :authenticate, except: [:index, :show]
before_action :set_news_release, only: [:show, :edit, :update, :destroy]
# GET /news_releases
# GET /news_releases.json
def index
@news_releases = NewsRelease.all
end
# GET /news_releases/1
# ... | 27.493506 | 99 | 0.685876 |
5df0561276657c6cc9aade16744469c5dc2fe6d7 | 2,684 | #
# Author:: Adam Jacob (<adam@chef.io>)
# Author:: Seth Falcon (<seth@chef.io>)
# Copyright:: Copyright 2009-2016, Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may... | 38.342857 | 125 | 0.585693 |
18008c191280180e313e727c3fdef29c2468ae51 | 292 | # frozen_string_literal: true
module ExceptionTrack
class Engine < ::Rails::Engine
isolate_namespace ExceptionTrack
initializer "exception-track.assets.precompile", group: :all do |app|
app.config.assets.precompile += %w( exception-track/application.css )
end
end
end
| 24.333333 | 75 | 0.736301 |
1d193d6e7cdee4a05762aa437d2f6e486ae7dcf6 | 931 | # encoding: utf-8
class Admin::RewardsController < Admin::BaseController
before_filter :find_parent_user, :except => [:index]
def index
@rewards = Reward.order('created_at DESC').page(params[:page])
@title = '奖励记录'
end
def new
respond_to do |f|
f.js {
@reward_type = params[:reward_ty... | 26.6 | 130 | 0.628357 |
1de4272ed01df32eea16c47c37422464c343186e | 123 | module Sofa
module Version
MAJOR = 0
MINOR = 1
PATCH = 4
STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
end
end
| 13.666667 | 41 | 0.552846 |
0170171cd9505312ca9d39201fbfd82d6241d79d | 271 | module Typhoeus
class Response
module Cacheable
# Set the cache status, if we got response from cache
# it will have cached? == true
attr_writer :cached
def cached?
defined?(@cached) ? !!@cached : false
end
end
end
end
| 18.066667 | 59 | 0.608856 |
337cb30fbabc24577e507da8827eda1ac3c54195 | 844 | #
# Copyright (c) 2015 Nordstrom, Inc.
#
require 'spec_helper'
software = OHAI['software']
describe 'software plugin' do
it 'should add software to the plugin directory'do
expect(file '/etc/chef/ohai_plugins/software.rb').to be_file
end
it 'vas should not be installed'do
expect(software['vas']['instal... | 22.210526 | 64 | 0.683649 |
ac622049c124ba55bc61f4d94a9c4040229f4318 | 1,122 | class ArchiveTransactionsService
attr_reader :user, :period_started_at, :period_ended_at
def initialize(user, archive_date)
@user = user
@period_started_at = archive_date.beginning_of_month
@period_ended_at = archive_date.end_of_month
end
def archive
AggregatedTransaction.transaction do
... | 28.05 | 75 | 0.737077 |
79bd643142ec8c4f57000fe238e2b5bd56abe734 | 27,799 | # Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 38.609722 | 103 | 0.617396 |
7acebb6455e9d4d9efbec621373d289498675ce1 | 662 | class PokemonsController < ApplicationController
layout "main"
def index
if params[:searching_for]
p = params[:searching_for]
if p == "types"
@pokemons = Pokemon.type_search(params[:query])
elsif p == "name"
@pokemons = Pokemon.name_sea... | 25.461538 | 65 | 0.539275 |
21502271ac4c77f04862e6db2d4f149066924b47 | 3,307 | # == Schema Information
#
# Table name: stops
#
# id :integer not null, primary key
# name :string
#
# Table name: routes
#
# num :string not null, primary key
# company :string not null, primary key
# pos :integer not null, primary key
# stop_id :inte... | 22.806897 | 79 | 0.655277 |
286daca44b03407c4785b94db71f0d5e15ffab76 | 3,891 | class Rust < Formula
desc "Safe, concurrent, practical language"
homepage "https://www.rust-lang.org/"
# license ["Apache-2.0", "MIT"] - pending https://github.com/Homebrew/brew/pull/7953
license "Apache-2.0"
stable do
url "https://static.rust-lang.org/dist/rustc-1.45.1-src.tar.gz"
sha256 "ea53e6424e... | 33.25641 | 94 | 0.668209 |
1a67543d5207fe52ec22ebcf17bd82a23b706f17 | 302 | cask :v1 => 'node' do
version '0.10.36'
sha256 'f6702b77c7b2f269834acab2210fc5bf43bc20467652ddefb55ccec61c58193a'
url "http://nodejs.org/dist/v#{version}/node-v#{version}.pkg"
homepage 'http://nodejs.org'
license :mit
pkg "node-v#{version}.pkg"
uninstall :pkgutil => 'org.nodejs'
end
| 23.230769 | 75 | 0.708609 |
263dc99b96f00c24e06a364a003b406cbb04250a | 1,825 |
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "flu_vaccination/version"
Gem::Specification.new do |spec|
spec.name = "flu_vaccination"
spec.version = ::VERSION
spec.authors = ["TODO: Write your name"]
spec.email = ["TODO... | 43.452381 | 96 | 0.675616 |
f7bf7397d89687d465e05f37540bdb352349d3f9 | 592 | Pod::Spec.new do |s|
s.name = "HYPWebView"
s.summary = "WebView++"
s.version = "0.1.0"
s.homepage = "https://github.com/hyperoslo/HYPWebView"
s.license = 'MIT'
s.author = { "Hyper Interaktiv AS" => "ios@hyper.no" }
s.source = { :git => "ht... | 37 | 104 | 0.567568 |
6ac62f831bb6cd5c1364579e01c3165cabde92b9 | 9,231 | # Copyright (C) 2013-2016 VMware, Inc.
provider_path = Pathname.new(__FILE__).parent.parent
require File.join(provider_path, 'vcd')
Puppet::Type.type(:vcd_system).provide(:vcd_system, :parent => Puppet::Provider::Vcd) do
@doc = 'Manage vcd system settings'
include PuppetX::VMware::Util
def general_settings
... | 36.2 | 170 | 0.649767 |
917575db6151d0d395a8b4455cfdb6dcae778bf8 | 177 | Rails40::Application.config.secret_key_base = '62c740bbc79cd7fa4dfabc7365c0f7ec98204cfae45a41d2e1423d6084bb762e9310acf46fc7e4cc6215a90c7aeef4107b9f1c7e3b68623fd11af43b716ccf5e'
| 88.5 | 176 | 0.943503 |
e2de8259f86b0ea730fc38c79fe0d82c514b7c46 | 174 | # Example class with Elasticsearch persistence
class PersistentArticle
include Tire::Model::Persistence
property :title
property :published_on
property :tags
end
| 14.5 | 46 | 0.787356 |
bba499898243e712b418338bc08d61189fc329d8 | 301 | class AdminUser < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
def to_s
email
end
end
| 27.363636 | 62 | 0.740864 |
33121902a2a4147d63960cd98922db7890bf1171 | 3,801 | # Generated via
# `rails generate curation_concerns:work GenericWork`
module CurationConcerns
class GenericWorksController < ApplicationController
include CurationConcerns::CurationConcernController
# Adds Sufia behaviors to the controller.
include Sufia::WorksControllerBehavior
self.curation_conce... | 38.01 | 157 | 0.71639 |
117d721e7900e5fe1f63622849f6b2c9c31b4e95 | 134 | class String #:nodoc:
def indent(n)
if n >= 0
gsub(/^/, ' ' * n)
else
gsub(/^ {0,#{-n}}/, "")
end
end
end
| 13.4 | 29 | 0.402985 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.