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 |
|---|---|---|---|---|---|
266d40fc69e3915ee8129b431271753fa0474d50 | 2,054 | # frozen_string_literal: true
module ZohoHub
class Response
def initialize(params)
@params = params || {}
end
def invalid_data?
error_code?('INVALID_DATA')
end
def invalid_token?
error_code?('INVALID_TOKEN')
end
def internal_error?
error_code?('INTERNAL_ERROR')
... | 21.395833 | 98 | 0.623174 |
6243dc92b457d6597e34077be3c7b7017b37be42 | 1,681 | # frozen_string_literal: true
module QA
module Page
module Project
module Job
class Show < QA::Page::Base
include Component::CiBadgeLink
view 'app/assets/javascripts/jobs/components/log/log.vue' do
element :job_log_content
end
view 'app/assets/j... | 27.557377 | 118 | 0.566924 |
e8ac4419211f4b27f6ee642e6e9ce0e89e5ec6dc | 5,905 | #!/usr/bin/env ruby
# frozen_string_literal: true
TEMPLATE = <<~MAIN_TEMPLATE
load(
"{workspace_name}//ruby:defs.bzl",
"rb_library",
)
package(default_visibility = ["//visibility:public"])
rb_library(
name = "bundler_setup",
srcs = ["lib/bundler/setup.rb"],
visibility = ["//visibility:pri... | 30.91623 | 101 | 0.633362 |
ed5a0ddd3e74c6ea235cc7b3dd0c844dd7c4cd72 | 79 | # frozen_string_literal: true
class ValidationsReflex < ApplicationReflex
end
| 15.8 | 43 | 0.848101 |
f88bfc8f19c480331f69c320819e5e669ecec589 | 86 | module FormHelpers
def submit_form
find('input[type="submit"]').click
end
end
| 14.333333 | 38 | 0.709302 |
1c96b3c7912b7f23ef613e86f39bfc70c444808b | 1,801 | #
# Description: This method sets the retirement_state to retiring
#
module ManageIQ
module Automate
module Cloud
module VM
module Retirement
module StateMachines
module Methods
class StartRetirement
def initialize(handle = $evm)
... | 28.587302 | 98 | 0.44975 |
e919ca02690cd2f277c8ff6e84ccc233f4c22422 | 1,354 | cask 'vlc' do
version '2.2.8'
sha256 '4406e025c566c5703ab11e53070d3e399680ddfb8994b60cb753079dffd2a027'
url "https://get.videolan.org/vlc/#{version}/macosx/vlc-#{version}.dmg"
appcast 'http://update.videolan.org/vlc/sparkle/vlc-intel64.xml',
checkpoint: '2e8debe5851a85536ff4ef24cff5bbff2cbce7c17bc390... | 37.611111 | 148 | 0.676514 |
f7a420623cfbdca894ca3eda3ecc94272733bcd8 | 1,773 | require "spec_helper"
require "shared/configured"
describe MetricFu::Configuration, "for templates" do
it_behaves_like "configured" do
describe "when there is no CC_BUILD_ARTIFACTS environment variable" do
before(:each) do
ENV["CC_BUILD_ARTIFACTS"] = nil
get_new_config
end
it "... | 34.096154 | 116 | 0.672307 |
f7005a81b0b696205728803dd570954c111019c9 | 1,582 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'tdameritrade/version'
Gem::Specification.new do |spec|
spec.name = "tdameritrade-api-ruby"
spec.version = TDAmeritrade::VERSION
spec.authors = ["Winston Kotzan"]
spec... | 43.944444 | 118 | 0.675727 |
87f31da4f875577919147496ecb187967857bba6 | 194 | require 'rest-client'
response = RestClient.get 'https://careapi.coronasafe.in/api/v1/state/'
states = JSON.parse(response)['results']
states.each { |state| State.create!(name: state['name']) }
| 38.8 | 71 | 0.726804 |
d5ecb2bef297e68891e487c914f6c92d919829ba | 880 | # frozen_string_literal: true
require 'active_support/core_ext/class'
require 'active_support/core_ext/module/delegation'
module ERBLint
class Reporter
def self.create_reporter(format, *args)
reporter_klass = "#{ERBLint::Reporters}::#{format.to_s.camelize}Reporter".constantize
reporter_klass.new(*arg... | 22 | 91 | 0.665909 |
87b4495e54cf480a607609d75d5b28a18c00a1f7 | 1,268 | require 'date'
WEEKS, DAYS = 6, 7
# 读入假日数据文件
@holiday = IO.readlines("q62-holiday.txt").map{|h|
h.split('/').map(&:to_i)
}
# 读入调休工作日数据文件
@extra_workday = IO.readlines("q62-extra-workday.txt").map{|h|
h.split('/').map(&:to_i)
}
# 计算符合条件的最大长方形的面积
def max_rectangle(cal)
rect = 0
WEEKS.times{|sr| ... | 24.862745 | 111 | 0.495268 |
ed7c90f58401c1128d902c1cb08fec0a13458dbd | 270 | class OnyxMountainlion < Cask
url 'http://joel.barriere.pagesperso-orange.fr/dl/108/OnyX.dmg'
homepage 'http://www.titanium.free.fr/downloadonyx.php'
version '2.7.4'
sha256 'e025125b06fc78322347f8549871c67e570131af83e8bb18b62ed43b65d7369d'
link 'OnyX.app'
end
| 33.75 | 75 | 0.785185 |
b938756aec8a30505a7963d0e7d94958744c3866 | 844 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 38.363636 | 86 | 0.763033 |
3399e6ad486748941106d874383bff31a54014e4 | 516 | require 'formula'
class Libresample < Formula
homepage 'https://ccrma.stanford.edu/~jos/resample/Available_Software.html'
url 'http://ftp.de.debian.org/debian/pool/main/libr/libresample/libresample_0.1.3.orig.tar.gz'
sha1 '85339a6114627e27010856f42a3948a545ca72de'
def install
system "./configure", "--disa... | 32.25 | 96 | 0.70155 |
188051f5c2568869834127903528e684574909e6 | 5,586 | # frozen_string_literal: true
require_relative '../../helper'
require 'fluent/plugin/filter_throttle'
SingleCov.covered!
describe Fluent::Plugin::ThrottleFilter do
include Fluent::Test::Helpers
before do
Fluent::Test.setup
end
after do
if instance_variable_defined?(:@driver)
assert @driver.err... | 30.52459 | 111 | 0.617078 |
91a48c2da573be63b80aca30787b95c7b7514b3a | 514 | class HomeController < ApplicationController
def index
end
def menu
@sections = Section.all
if params[:section_id].present?
@current_section = Section.find(params[:section_id])
@items = @current_section.food_items
else
@items = FoodItem.all
end
if params[:search]
@ite... | 19.769231 | 76 | 0.651751 |
ab2bc2366156661d06f69dc71d5dbbd36293b04b | 318 | cask :v1 => 'nocturne' do
version '2.0.0'
sha256 '062ae6b4619ab518650b2f502aaeb7a864bf69e45ce08dec8b5a3f34a027a347'
url "https://blacktree-nocturne.googlecode.com/files/Nocturne.#{version}.zip"
name 'Nocturne'
homepage 'http://code.google.com/p/blacktree-nocturne/'
license :oss
app 'Nocturne.app'
end
| 26.5 | 79 | 0.751572 |
7a110db2484dc1fa46de92f49d05ab88139383f2 | 515 | require "find"
version = ARGV.shift
def insert_url_after_html_tag(html, url)
comment = "<!-- Online page at #{url} -->"
html.gsub(/(<html[^>]*>)/i){ $1 + comment }
end
Dir.chdir("html/#{version}") {
Find.find(".") {|file|
next unless File.extname(file) == ".html"
path = file[1..-1] # remove first .
... | 27.105263 | 69 | 0.584466 |
d504bf85459371366db1882eaeec51f21326cf59 | 2,600 | # encoding: utf-8
require 'spec_helper'
describe "Unacknowledged messages" do
#
# Environment
#
include EventedSpec::AMQPSpec
default_timeout 5
amqp_before do
@connection1 = AMQP.connect
@connection2 = AMQP.connect
@connection3 = AMQP.connect
@channel1 = AMQP::Channel.new(@connecti... | 26.804124 | 101 | 0.667308 |
38b6def881807172a5938ba1960ad0986806677a | 4,123 | #-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2017 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 ... | 33.795082 | 108 | 0.724715 |
33cfb80818cdd7f48caea6ee38174d33a85641a6 | 1,438 | module Effective
class Region < ActiveRecord::Base
include RegionOverride
self.table_name = EffectiveRegions.regions_table_name.to_s
belongs_to :regionable, :polymorphic => true
# structure do
# title :string
# content :text
# snippets :text
# t... | 29.346939 | 167 | 0.650904 |
01eeec766c110c7179ce2846c0f24bcc5f653a1d | 252 | class CreateAppointment < ActiveRecord::Migration[7.0]
def change
create_table :appointments do |t|
t.string :location
t.date :dateOfAppointment
t.integer :user_id
t.integer :doctor_id
t.timestamps
end
end
end
| 21 | 54 | 0.674603 |
ff310ecb374b563100744a2a0eaa73fcf3576eba | 170 | class Profile < ApplicationRecord
attr_accessor :height_unit, :weight_unit
belongs_to :user
validates :height, :starting_weight, :name, :age, presence: true
end
| 18.888889 | 66 | 0.764706 |
bb00ee13cd2fc3d30473b4c9d71dae91df19b595 | 401 | # frozen_string_literal: true
namespace :db do
namespace :seed do
Dir[Rails.root.join('db', 'seeds', '*.rb')].each do |filename|
task_name = File.basename(filename, '.rb')
desc 'Seed ' + task_name + ', based on the file with the same name in `db/seeds/*.rb`'
task task_name.to_sym => :environmen... | 28.642857 | 92 | 0.63591 |
6a55ab54834fbcf0cd6dbaa92132e837dcd5a0b8 | 1,872 | # frozen_string_literal: true
Rails.application.configure do
# 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 server when you make code changes.
config.cache_classes = f... | 33.428571 | 80 | 0.760684 |
391129d2e5e9dd8e93fc13d7189c2297749fbda5 | 544 | module Papapi
require_relative 'response'
class GridResponse < Response
include Enumerable
def attributes
parsed['rows'].first
end
def count
parsed['count']
end
def rows
parsed['rows'].slice(1, parsed['rows'].count-1)
end
def [] (key)
if rows[key.to_i]
... | 16 | 60 | 0.582721 |
28148b2dfee24dce38c9f22a243101bd5c145c98 | 3,144 | require 'rails_helper'
RSpec.describe 'Candidate can carry over unsuccessful application to a new recruitment cycle' do
include CycleTimetableHelper
around do |example|
Timecop.freeze(mid_cycle) do
example.run
end
end
scenario 'when an unsuccessful candidate returns in the next recruitment cycl... | 30.524272 | 167 | 0.800891 |
bfa99e6eb9f2fd3d0b0c043b414dd939a8f71c0d | 1,244 | App::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite ... | 35.542857 | 84 | 0.77492 |
5d7f0ffba504885fb1dce5736335d40baf3b4c6d | 1,523 | # frozen_string_literal: true
require 'spec_helper'
require Rails.root.join('db', 'migrate', '20191004081520_fill_productivity_analytics_start_date.rb')
RSpec.describe FillProductivityAnalyticsStartDate do
let(:settings_table) { table('application_settings') }
let(:metrics_table) { table('merge_request_metrics') ... | 38.075 | 107 | 0.734077 |
1848db752e006062983400174bc11cf8db399435 | 7,559 | # frozen_string_literal: true
require "test_helper"
class RespLegalTest < ActiveSupport::TestCase
def test_a_un_fabricant_valid
assert Fabricate.build(:resp_legal).valid?
end
def test_detection_adresses_identiques_cas_degenere
assert RespLegal.new.adresse_inchangee?
end
def test_detection_adresse... | 37.795 | 137 | 0.679984 |
33133438f8939de64c8a5e11f0e302461e071b41 | 967 | module Fog
module AWS
class SQS
class Real
require 'fog/aws/parsers/sqs/send_message'
# Add a message to a queue
#
# ==== Parameters
# * queue_url<~String> - Url of queue to add message to
# * message<~String> - Message to add to queue
#
# ==... | 24.794872 | 113 | 0.552223 |
abb5493d5776c66e181e5f9ce5931b71d46caf4f | 937 | require File.dirname(__FILE__) + '/../lib/em/spec'
require 'bacon'
require File.dirname(__FILE__) + '/../lib/em/spec/bacon'
EM.spec_backend = EventMachine::Spec::Bacon
describe 'Bacon' do
should 'work as normal outside EM.describe' do
1.should == 1
end
end
EM.describe EventMachine do
should 'work' do
d... | 18.019231 | 56 | 0.610459 |
b9abdf99244973aa4f658b1ae2491c5735969e78 | 147 | class RenameOrderItemsToLineItems < ActiveRecord::Migration
def change
rename_table :glysellin_order_items, :glysellin_line_items
end
end
| 21 | 62 | 0.823129 |
21079a54fc19bbffb516722e86eacfcbee3e41a8 | 4,387 | #
# MessagePack-RPC for Ruby
#
# Copyright (C) 2010-2011 FURUHASHI Sadayuki
#
# 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
#
# ... | 20.404651 | 77 | 0.652154 |
03aff983aa06c6e928c5663eb58ab64cd251d7a3 | 163 | Before("@lambdapreview") do
@service = Aws::LambdaPreview::Resource.new
@client = @service.client
end
After("@lambdapreview") do
# shared cleanup logic
end
| 18.111111 | 45 | 0.723926 |
9114ced8be4960b3807d978972b1be44f1f4baa1 | 1,466 | # Copyright 2011-2013 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... | 23.269841 | 78 | 0.626194 |
08d0ccc942277ba6626fe8b27c3b7f6d2737ba64 | 305 | # frozen_string_literal: true
# encoding: utf-8
require 'spec_helper'
require 'runners/unified'
base = "#{CURRENT_PATH}/spec_tests/data/crud_unified"
CRUD_UNIFIED_TESTS = Dir.glob("#{base}/**/*.yml").sort
describe 'CRUD unified spec tests' do
define_unified_spec_tests(base, CRUD_UNIFIED_TESTS)
end
| 21.785714 | 54 | 0.767213 |
21c07a1ffbc08dd10cc5908a8f85d0aaf2852616 | 405 | # frozen_string_literal: true
module Eve
class UpdateCorporationJob < ActiveJob::Base
queue_as :default
retry_on EveOnline::Exceptions::Timeout,
EveOnline::Exceptions::ServiceUnavailable,
EveOnline::Exceptions::BadGateway,
EveOnline::Exceptions::InternalServerError
def perform(corpora... | 23.823529 | 57 | 0.748148 |
e9fc82055501ea4c9b01532eda9eabe10f86a2c3 | 8,787 | # frozen_string_literal: true
module Id3Taginator
module Frames
class Id3v2Frame
include Extensions::Encodable
include Extensions::ArgumentCheck
HEADER_SIZE_V_3_4 = 10
HEADER_SIZE_V_2 = 6
attr_accessor :options
attr_reader :frame_id
# builds an id3v2.2 frame of the gi... | 35.148 | 116 | 0.65631 |
1a244b1a579ea007326ea509dfb2db5932cdb87a | 2,983 | require_relative '../../utils'
require_relative './inflection/term'
require_relative './inflection/part_of_speech'
require_relative './inflection/declension'
require_relative './inflection/case'
require_relative './inflection/gender'
require_relative './inflection/degree'
require_relative './inflection/mood'
require_r... | 30.131313 | 84 | 0.560845 |
79b50df2fd0647ffcb0c6ca62d22987262bd0480 | 987 | require 'sinatra'
require 'json'
typeToConversionType = {
"scale" => method(:Integer),
"bool" => ->(c) { (c.downcase == "true" || c.downcase == "yes") },
"string" => method(:String),
"int" => method(:Integer),
"float" => method(:String),
"date" => method(:String)
}
post '/' do
payload = JSON.parse(requ... | 22.431818 | 77 | 0.669706 |
f7f982384d09f50984d2f14ce934eff8fe2b28d8 | 81,125 | #------------------------------------------------------------------------
# (The MIT License)
#
# Copyright (c) 2008-2011 Rhomobile, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software wit... | 35.737885 | 183 | 0.60922 |
e904cb6c6fcceccf68dc249b7ff25c77c42d8fc0 | 502 | module Search
class GlobalService
attr_accessor :current_user, :params
def initialize(user, params)
@current_user, @params = user, params.dup
end
def execute
group = Group.find_by(id: params[:group_id]) if params[:group_id].present?
projects = ProjectsFinder.new.execute(current_use... | 26.421053 | 80 | 0.697211 |
013cb8006d4f6e2812e7d9a54eb560ff5855779f | 306 | cask "patchwork" do
version "3.18.1"
sha256 "2436dc487afb45264e81c5b1d65cb4acc7ec8d772ce2af2132122f86ca6d887c"
url "https://github.com/ssbc/patchwork/releases/download/v#{version}/Patchwork-#{version}.dmg"
name "Patchwork"
homepage "https://github.com/ssbc/patchwork"
app "Patchwork.app"
end
| 27.818182 | 96 | 0.767974 |
d525e2dfdc437b07ca93c3c05bd058d30225fd2d | 2,601 | # Redmine - project management software
# Copyright (C) 2006-2014 Jean-Philippe Lang
#
# This program 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 2
# of the License, or (at your option) any... | 37.695652 | 155 | 0.682045 |
b97df99bb38e1336bd05d974ce9f323c49f14916 | 1,127 | # Copyright 2015 Nordstrom, 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 writi... | 34.151515 | 74 | 0.748891 |
1cd4ecb303734735f9bb8688ef07211357b0a3b7 | 3,031 | # frozen_string_literal: true
require "bcdice/dice_table/table"
require "bcdice/dice_table/d66_grid_table"
require "bcdice/arithmetic"
module BCDice
module GameSystem
class AngelGear < Base
# ゲームシステムの識別子
ID = 'AngelGear'
# ゲームシステム名
NAME = 'エンゼルギア 天使大戦TRPG The 2nd Editon'
# ゲームシステ... | 23.496124 | 122 | 0.428571 |
5d2e5e05717d4d662f6fc32091adbf814750aa04 | 467 | # frozen_string_literal: true
begin
require "pry-byebug"
rescue LoadError
end
ENV["RAILS_ENV"] = "test"
require "rubanok"
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f }
RSpec.configure do |config|
config.mock_with :rspec
config.example_status_persistence_file_path = "tmp/rspec_... | 19.458333 | 76 | 0.749465 |
2876000b938086b88b946f9b6594b67e16bd8148 | 521 | #---
# Excerpted from "Rails 4 Test Prescriptions",
# published by The Pragmatic Bookshelf.
# Copyrights apply to this code. It may not be used to create training material,
# courses, books, articles, and the like. Contact us if you are in doubt.
# We make no guarantees that this code is fit for any purpose.
# Visit ... | 37.214286 | 84 | 0.754319 |
03d8a43fce771badb0ec6ad00bc848e9189e6e23 | 324 | class DummyAuctionable < ActiveRecord::Base
include AlleApi::Auctionable
attr_accessible :category_id, :title, :weight
def title_for_auction
"#{title} for auction"
end
def category_id_for_auction
666
end
def image_1_contents
File.read(Rails.root.join 'spec/support/fixtures/1x1.jpg')
end
... | 18 | 62 | 0.740741 |
6a21b5b27550d66ff112606646dfe6309baeca46 | 1,819 | def get_coordinates(token)
return token.split(',').map(&:to_i)
end
def get_instruction(line)
tokens = line.split
instruction = nil
coordinates = [nil,nil],[nil,nil]
if line =~ /^turn/
instruction = tokens[1]
coordinates[0] = get_coordinates tokens[2]
coordinates[1] = get_coo... | 26.362319 | 91 | 0.623419 |
4adabc1e5c10ef23fb1e8c6097b7c477281eb3fc | 553 | class Tasks::Mutations::Create < Lib::Mutations::WithUserAuthentication
graphql_name 'createTask'
description 'Create new task'
argument :project_id, ID, required: true
argument :name, String, required: true
field :task, Lib::Objects::Task, null: true
field :errors, [Lib::Objects::Error], null: false
d... | 26.333333 | 80 | 0.679928 |
7a09b3cb97e431bd972868aad3b39d15b60f4d55 | 7,309 | require 'test_helper'
class CruddlerIntegrationTest < ActionDispatch::IntegrationTest
test "Basic CRUD" do
# INDEX
visit '/houses'
assert page.has_content?('No Houses')
# CREATE
click_link 'Create'
assert_equal '/houses/new', current_path
fill_in 'house_name', with: "First House"
fi... | 28.775591 | 85 | 0.65563 |
879dc90e1d082ceb86f41c3bbc05cc8195540041 | 241 | class Religion < ActiveRecord::Base
extend FriendlyId
friendly_id :name, use: :slugged
has_many :events
# Validations
#
validates :name,
presence: true,
uniqueness: true
def to_s
name
end
end
| 14.176471 | 35 | 0.626556 |
f7c0c7812009714ac1cb71b40aeeb8ee1a8e8705 | 466 | module Versus
class Region < Model
attr_accessor :adjective, :natural_feature, :associated_historical_figure_name
has_many :towns
has_many :people, through: :towns
belongs_to :continent
def name
if adjective && associated_historical_figure_name
"the #{adjective.capitalize} #{natura... | 25.888889 | 107 | 0.714592 |
18165ec7106f7a68c344d36898b90b9833836e79 | 2,254 | class DurationsController < ApplicationController
# before_action :set_duration, only: [:show, :update, :destroy]
# GET /durations
# GET /durations.json
def index
get_user
if !@user
render_not_found
elsif !has_access?
forbidden
else
render_duration
end
end
def render... | 20.678899 | 101 | 0.611358 |
39de1d8a70c9ab8180f06432d766837afde88610 | 1,079 | #
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint flutter_branch_sdk.podspec' to validate before publishing.
#
Pod::Spec.new do |s|
s.name = 'flutter_branch_sdk'
s.version = '1.3.2'
s.summary = 'Flutter Plugin for Brach Metrics... | 43.16 | 104 | 0.622799 |
1aee2ca5c64ada52d32e652fb0f60c323a0e51e1 | 3,493 | # frozen_string_literal: true
ActionView::Helpers::FormBuilder.class_eval do
def error_message(method, tag: :div, ref_method: nil, escape: true, **options, &block)
return if object.errors.empty?
error = object.errors[method]&.first
error ||= object.errors[ref_method]&.first if ref_method
return unle... | 45.960526 | 180 | 0.749785 |
61d6ff19e58e88cdda94bf538743fdffd15ccde4 | 534 | require 'yaml'
require 'ostruct'
module PHPBB3_BB2MD
# Parse yaml config
class Config
attr_reader :hash
def initialize(conf)
path = File.expand_path(File.dirname(__FILE__)) + '/../../config/'
file = path + conf + '.yml'
raise 'no such config' unless File.exist?(file)
@hash = to_stru... | 19.071429 | 72 | 0.606742 |
e85fbd29854a7b461913b3589517d1722bf6b45b | 546 | # frozen_string_literal: true
require 'rails_helper'
RSpec.configure do |config|
config.swagger_root = Rails.root.join('swagger').to_s
config.swagger_docs = {
'v1/swagger.yaml' => {
openapi: '3.0.1',
info: {
title: 'API V1',
version: 'v1'
},
paths: {},
servers: [... | 17.612903 | 55 | 0.485348 |
61fcd889abb03082eaa89c8b8130426ff8294c80 | 479 | # frozen_string_literal: true
require 'forwardable'
require 'r2-oas/schema/v3/generator'
module R2OAS
module Schema
class Generator
extend Forwardable
def_delegators :@generator, :generate_docs
def initialize(options = {})
case ::R2OAS.version
when :v3
@generator = ... | 19.958333 | 78 | 0.636743 |
1c3f8f3f3131862b00ddd26c5f039f91982d954d | 870 | # == Schema Information
#
# Table name: base_items
#
# id :bigint(8) not null, primary key
# name :string
# category :string
# barcode_count :integer
# created_at :datetime not null
# updated_at :datetime not null
# size :string
# item_count :int... | 29 | 116 | 0.670115 |
e99dbe77f147ac5c7e4da3c7130e1d1fbd0ddae8 | 12,822 | class AnnotationCategoriesController < ApplicationController
include AnnotationCategoriesHelper
respond_to :js
before_action { authorize! }
layout 'assignment_content'
responders :flash
content_security_policy only: :index do |p|
# required because MathJax dynamically changes
# style. # TODO: r... | 37.823009 | 118 | 0.623304 |
6afbd8a588615f1693f92cf95e88baad5d2abeef | 943 | Pod::Spec.new do |s|
s.name = "SwiftPing"
s.summary = "SwiftPing:ICMP Ping in swift - Forked from https://github.com/ankitthakur/SwiftPing"
s.version = "1.1.3"
s.homepage = "https://github.com/toandk/SwiftPing"
s.license = 'MIT'
s.author = { "Ankit Th... | 33.678571 | 108 | 0.603393 |
1c51c11ab05c4382662b3c79630f8495219c0b2f | 1,304 | # 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,... | 33.435897 | 80 | 0.730061 |
7a8459813b11abf5b836b1b596a4e213371b004b | 128 | require 'admin_materialize/version'
module AdminMaterialize
module Rails
class Engine < ::Rails::Engine
end
end
end | 16 | 35 | 0.742188 |
62b46594c50c8a4b7071a006f8aa9ffe650a2495 | 359 | # == Schema Information
#
# Table name: ingress_communities
#
# id :integer not null, primary key
# name :string
# created_at :datetime not null
# updated_at :datetime not null
#
require 'rails_helper'
RSpec.describe Ingress::Community, type: :model do
pending "add some ex... | 22.4375 | 56 | 0.649025 |
6a9b281fb4c7d40a6e255dbef4dd600285220f3f | 3,730 | require 'spec_helper'
describe 'Users > User browses projects on user page', :js do
let!(:user) { create :user }
let!(:private_project) do
create :project, :private, name: 'private', namespace: user.namespace do |project|
project.add_maintainer(user)
end
end
let!(:internal_project) do
create... | 27.835821 | 103 | 0.678016 |
61a0d97b2d98f3355ef3b9de5e42868fd25c3b92 | 41 | module KegbotApi
VERSION = "0.0.1"
end
| 10.25 | 19 | 0.682927 |
1c46ccb19b37b7ac12d388785255693aaafde81b | 605 | class Verdict::Group
include Verdict::Metadata
attr_reader :experiment, :handle
def initialize(experiment, handle)
@experiment, @handle = experiment, handle.to_s
end
def to_s
handle
end
def to_sym
handle.to_sym
end
def ===(other)
case other
when Verdict::Group; experiment ==... | 16.351351 | 83 | 0.639669 |
f7e46c66c1d27fdf49af962a0ea6053d087cd1b3 | 22,831 | require 'pathname'
Puppet::Type.newtype(:dsc_xsqlserversetup) do
require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc'
require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers'
@doc = %q{
The DSC xSQLServerSetup resource type.
Automatically generated fro... | 29.270513 | 138 | 0.640182 |
eddd433578a6248b4778c626f4efd59fa10e2f79 | 16,922 | require File.expand_path '../helper', __FILE__
class NoticeTest < Test::Unit::TestCase
include DefinesConstants
def configure
Airbrake::Configuration.new.tap do |config|
config.api_key = 'abc123def456'
end
end
def build_notice(args = {})
configuration = args.delete(:configuration) || conf... | 35.55042 | 133 | 0.660206 |
e8a58760382ebf00b462b2be0e08a16c90ae8c24 | 13,460 | # Functional tests related to plugin facility
require 'functional/helper'
#=========================================================================================#
# Loader Errors
#=========================================================================================#
describe 'plu... | 47.561837 | 170 | 0.639376 |
5d256a3b7559720cafe0cb622a00c0b19c8b1033 | 599 | class BoshInit < Formula
desc "creates and updates the Director VM"
homepage "https://github.com/cloudfoundry/bosh-init"
version "0.0.99"
url "https://s3.amazonaws.com/bosh-init-artifacts/bosh-init-#{version}-darwin-amd64"
sha256 "3a2f63493ecede7b9d99d46ffd0c99d5c40edd44db6ddd97ffcc52c56b4ebb89"
depends_on... | 29.95 | 120 | 0.734558 |
b9bf013f5f79bc09f8021fc70284279d287afae7 | 4,034 | require 'fileutils'
module CkeditorFileUtils
CKEDITOR_INSTALL_DIRECTORY = File.join(::Rails.root.to_s, '/public/javascripts/ckeditor/')
PLUGIN_INSTALL_DIRECTORY = File.join(::Rails.root.to_s, '/vendor/plugins/easy-ckeditor/')
def CkeditorFileUtils.recursive_copy(options)
source = options[:source]
... | 36.672727 | 111 | 0.660635 |
e94b44eba89fe6b9387dacd15d0a85a399fe72ab | 494 | require 'rails_helper'
RSpec.shared_examples_for "work_metadata" do
describe "metadata" do
let(:fields) do
[:unit, :staff_notes, :abstract, :collection_identifier, :sub_collection,
:spatial, :alternative, :temporal, :format, :provenance, :work_type,
:preservation_level, :preservation_level_ra... | 29.058824 | 79 | 0.710526 |
38e8b4ac4fcfb12579899bb57e4fbf7f35db9c37 | 328 | def Threes(number)
while number > 1
if number%3 == 0
p number.to_s + " 0"
number = number/3
else
if (number+1)%3 == 0
p number.to_s + " 1"
number = (number+1)/3
elsif (number-1)%3 == 0
p number.to_s + " -1"
number = (number-1)/3
end
end
end
p number.to_s
end
Threes(100)
Threes(3... | 16.4 | 26 | 0.57622 |
79504d378d945c9411a265ef3889aef23673aa94 | 1,388 | class Rinetd < Formula
desc "Internet TCP redirection server"
homepage "https://www.boutell.com/rinetd/"
url "https://www.boutell.com/rinetd/http/rinetd.tar.gz"
version "0.62"
sha256 "0c68d27c5bd4b16ce4f58a6db514dd6ff37b2604a88b02c1dfcdc00fc1059898"
bottle do
rebuild 1
# sha256 "fe8636ee77c709a3a2df... | 28.326531 | 93 | 0.688761 |
5df571dcdf58d8df32a626c9bc4565981f171b02 | 1,182 | module TwilioExtensions
module AccountContext
def available_phone_numbers(country_code=:unset)
client = @version.instance_variable_get(:@domain).client
TwilioMock::Mocker.new(username: client.account_sid, token: client.auth_token).available_number if TwilioMock::Testing.enabled?
super(country_co... | 34.764706 | 155 | 0.738579 |
38a123c3c1de7f8345a822e85ab4b03f95068a0e | 220 | class CreateQuestions < ActiveRecord::Migration[6.0]
def change
create_table :questions do |t|
t.string :title
t.belongs_to :section, null: false, foreign_key: true
t.timestamps
end
end
end
| 22 | 59 | 0.681818 |
4a62ef7fb9b88c99522a0ce5bc4f674d8af61abe | 1,868 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
config.hosts.clear
# 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 ... | 34.592593 | 87 | 0.759101 |
873142b1ccc608d8255dac3e59d06a99c6d0f4b4 | 214 | class SageAvatarGroup < SageComponent
set_attribute_schema({
items: [[
color: [:optional, NilClass, SageSchemas::COLORS],
css_classes: [:optional, String],
initials: String,
]]
})
end
| 21.4 | 56 | 0.64486 |
bfbf8c6ded97bf92f3e439579271b7948c2eae6c | 1,436 | # Copyright:: Copyright 2010-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 obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | 38.810811 | 80 | 0.649721 |
f86d8d4b29e67da813503189211a18a21ec7fc22 | 565 | # frozen_string_literal: true
module SigepWeb
class WebServiceReverseLogisticApi
def initialize
@client = Savon.client(
wsdl: url,
ssl_verify_mode: :none
)
end
def process(method, message)
@client.call(method, soap_action: "", message: message)
end
private
... | 20.925926 | 86 | 0.647788 |
627d3bb42c76040caeefa903e43aae2705406fbe | 3,542 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe ::Gitlab::SubscriptionPortal do
using RSpec::Parameterized::TableSyntax
let(:env_value) { nil }
before do
stub_env('CUSTOMER_PORTAL_URL', env_value)
end
describe '.default_subscriptions_url' do
where(:test, :development, :result) ... | 34.72549 | 122 | 0.704122 |
1cd7b56826f7be7cd5a9f6c3525720a5fb566683 | 1,500 | require 'carrierwave'
require "tencent_cos_sdk"
module CarrierWave
module Storage
class TencentCos < Abstract
# Create and save a file instance to your engine.
def store!(file)
f = CarrierWave::Storage::TencentCos::File.new(uploader.store_path)
f.stor... | 30 | 91 | 0.502667 |
875df5bbdf2b69576f7b4c1321f7c04fb2581a4b | 2,517 | require 'hyperclient'
module Payshares
class Client
include Contracts
def self.default(options={})
new options.merge({
horizon: "https://horizon.payshares.org"
})
end
def self.default_testnet(options={})
new options.merge({
horizon: "https://horizon-testnet.pay... | 26.494737 | 87 | 0.614621 |
872b9bfb5e4f69b31e93e38e5d984a4adc189f50 | 346 | require "test_helper"
class SongsheetTest < ActiveSupport::TestCase
test "all_media returns tracks and songsheet" do
songsheet = create :songsheet, :with_track
media = [
create(:medium, record: songsheet),
create(:medium, record: songsheet.track)
]
assert_equal media.to_set, songsheet.a... | 23.066667 | 57 | 0.716763 |
d5f54ff2dafe46e9facad5cc748d8cb31fb62d2c | 77 | json.partial! "courseofstudies/courseofstudy", courseofstudy: @courseofstudy
| 38.5 | 76 | 0.844156 |
e29479c3d571bdb86623cbdba501087d54864add | 3,831 | ##
# $Id$
##
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
# http://metasploit.com/
##
require 'msf/core/exploit/pdf'
require 'msf/core'
require 'zlib'
c... | 29.469231 | 90 | 0.593579 |
91276215588327f420ed957922f8f6249f948f76 | 157 | class User < ActiveRecord::Base
has_secure_password
has_many :movies
validates :name, :email, presence: true
validates :email, uniqueness: true
end
| 19.625 | 41 | 0.757962 |
1cec7094f82dc9874e124c0006d0559a088849e6 | 612 | require 'devise_feature_flags/version'
require 'devise_feature_flags/models/devise_feature_flag'
require 'active_record'
require 'devise'
module DeviseFeatureFlags
class Feature < ::ActiveRecord::Base
self.table_name = 'feature_flags_features'
has_many :feature_users, primary_key: :key, foreign_key: :feature... | 32.210526 | 101 | 0.795752 |
1145531e9967ef60bcb8ce39904d2d7e23178aee | 210 | class Registration < ApplicationRecord
belongs_to :user, inverse_of: :registrations
belongs_to :course, inverse_of: :registrations
validates :user, presence: true
validates :course, presence: true
end
| 26.25 | 48 | 0.785714 |
879cecee1f3193e80d2621d2ff80a4804cbdcb50 | 803 | # Automatic Image alt tags from image names extension
class Middleman::Extensions::AutomaticAltTags < ::Middleman::Extension
def initialize(app, options_hash={}, &block)
super
end
helpers do
# Override default image_tag helper to automatically insert alt tag
# containing image name.
def image_ta... | 25.09375 | 86 | 0.617684 |
21ed49b5488a090e4fa62e44a03ac7eda5a87604 | 1,247 | # frozen_string_literal: true
# Fetches the self monitoring metrics dashboard and formats the output.
# Use Gitlab::Metrics::Dashboard::Finder to retrieve dashboards.
module Metrics
module Dashboard
class SelfMonitoringDashboardService < ::Metrics::Dashboard::PredefinedDashboardService
DASHBOARD_PATH = 'co... | 30.414634 | 91 | 0.663994 |
b9c2cb074a80cb410c6a87a25e3de0ec8aff5154 | 1,482 | describe GraylogAPI::System::Cluster, vcr: true do
include_context 'graylogapi'
context 'node' do
subject(:response) do
graylogapi.system.cluster.node
end
it 'code 200' do
expect(response.code).to eq 200
end
it 'contain cluster_id' do
expect(response.keys).to include 'cluste... | 20.583333 | 66 | 0.645749 |
e95ebd9050bed0a813472308b180ce37510a00ba | 1,671 | require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')
LoadedYaml = ['en', 'en-BORK'].inject({}) do |h, locale|
h[locale] = YAML.load_file(File.expand_path(File.dirname(__FILE__) + "/../lib/locales/#{locale}.yml"))[locale]['faker']
h
end
class TestLocale < Test::Unit::TestCase
def teardown
Fak... | 34.8125 | 123 | 0.679234 |
ac04389f79a7693703ae0955724bcbc5e8171db2 | 5,540 | # 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... | 34.409938 | 86 | 0.594404 |
6a445e13eff68d7e74b25bcc49de4fb1a271e104 | 1,141 | require 'spec_helper_system'
describe 'apt::source' do
context 'reset' do
it 'clean up puppetlabs repo' do
shell('apt-key del 4BD6EC30')
shell('rm /etc/apt/sources.list.d/puppetlabs.list')
end
end
context 'apt::source' do
it 'should work with no errors' do
pp = <<-EOS
includ... | 21.942308 | 65 | 0.574934 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.