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 |
|---|---|---|---|---|---|
399e6946411110af35028d511c649d405d6bd279 | 1,013 | module DatabaseValidations
module Checkers
class DbPresenceValidator
attr_reader :validator
# @param [DatabaseValidations::DbPresenceValidator]
def self.validate!(validator)
new(validator).validate!
end
# @param [DatabaseValidations::DbPresenceValidator]
def initializ... | 27.378378 | 92 | 0.700888 |
914485193a692e75febb3af94dd2f9e818dde282 | 3,647 | module ActionArgs
#
# Takes:
# - params hash
# - config for those params
#
# Each param can be either a "simple" value,
# or it can be a Hash.
# For each, create an 'arg', whose type depends on
# whether the param is simple or a hash:
# - Hash -> Accessor (optional or regular)
# - simpl... | 26.05 | 70 | 0.555251 |
e91e3f3dd9ad7662c805368b8d81d2da3ba535d2 | 946 | test_name "should create a user"
tag 'audit:medium',
'audit:refactor', # Use block style `test_run`
'audit:acceptance' # Could be done as integration tests, but would
# require changing the system running the test
# in ways that might require special permissions
... | 27.823529 | 71 | 0.660677 |
33df6b0d4d9445d74fabaace02b593d97f11107f | 51 | # Mock out DJ
module Delayed
class Job
end
end
| 8.5 | 14 | 0.705882 |
f8673e6cc82392b85dca529e631956af7859982d | 303 | Rails.application.routes.draw do
root 'dashboard#index'
namespace :api do
resources :events, only: [:index, :create, :update, :destroy] do
get :search, on: :collection
end
end
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
| 27.545455 | 101 | 0.706271 |
285131fbda718efbf69f7ad24cced22c5e6d7175 | 2,242 | require 'spec_helper'
unless ENV['CI']
describe 'GCal', js: true, type: :feature do
it 'errors without GOOGLE_API_CLIENT_ID' do
visit '/gcal?1'
expect(find('#messages')).to have_text('Missing GOOGLE_API_CLIENT_ID.')
end
context 'with GOOGLE_API_CLIENT_ID' do
before do
ENV['GOOGL... | 42.301887 | 136 | 0.619982 |
03d18fba144a287f24395cb8c2660b9a9e4259fd | 1,770 | # ----------------------------------------------------------
# _________ .__ .__
# / _____/ ____ | | ____ ____ |__|__ __ _____
# \_____ \_/ __ \| | _/ __ \ / \| | | \/ \
# / \ ___/| |_\ ___/| | \ | | / Y Y \
#/_______ /\___ >____/\___ >___|... | 25.652174 | 82 | 0.429379 |
260c59e4a3e308b91209f3625fa32f2be46cc476 | 6,659 | module GpArticle::DocHelper
def doc_link_options(doc)
uri = if Core.preview_mode? && !doc.state_public?
"#{doc.public_dir}preview/#{doc.id}/#{doc.filename_for_uri}"
else
doc.public_uri
end
if doc.target.present? && doc.href.present?
if doc.target == 'attached... | 31.861244 | 160 | 0.612104 |
ab96b3dcd4b765b4dabb4de1a6fa6c870bd3dc09 | 294 | class Build
def self.[](*args)
args.collect { |a|
if a.kind_of? Array
Build[*a]
elsif a.respond_to? :_build_
Build[a._build_]
elsif a.respond_to? :_names_
Names[a._names_]
else
a.to_s
end
}.flatten.uniq.compact
end
end
| 17.294118 | 34 | 0.55102 |
87e8a175587d0b42379e5c0ec97efad7094854a6 | 7,271 | require 'collins_client'
require 'highline'
require 'yaml'
module CollinsShell
module ThorHelper
include Collins::Util
COLLINS_OPTIONS = {
:config => {:type => :string, :desc => 'YAML configuration file'},
:debug => {:type => :boolean, :default => false, :desc => 'Debug output'},
:host =>... | 34.62381 | 160 | 0.629487 |
79cf857ee8c29944752b7c026437a6dbba42657f | 94 | # frozen_string_literal: true
require_relative 'parsers/ls'
require_relative 'parsers/which'
| 18.8 | 32 | 0.829787 |
bb38f3688e5d01e6e31c9eee0eef0c0602d1c463 | 452 | #--
# $Id$
#
# Copyright (c) 2006 Mark Daggett & Garry Dolley
#
# This file is part of RAM (Ruby Asset Manager)
#
# Released under the MIT / X11 License. See LICENSE file for details.
#++
class CategoryObserver < ActiveRecord::Observer
def after_save(record)
return if controller.nil?
controller.instance_... | 20.545455 | 70 | 0.714602 |
61b3ef0597930598ae0f1b5bd3fdf462b5bf42af | 552 | require_relative '../resource_property'
module Convection
module Model
class Template
class ResourceProperty
# Represents a {https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-forwardedvalues-cookies.html
# CloudFront ForwardedValues Cookies Embedded Pr... | 32.470588 | 141 | 0.721014 |
792f331acab5986f66f8314540c0074696fd46ac | 441 | # 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::V2017_11_01
module Models
#
# Defines values for ConnectionStatus
#
module ConnectionStatus
Unknown = "... | 23.210526 | 70 | 0.69161 |
e991be8a833af4bf14263c9310a1da8b93bd6f18 | 721 | Pod::Spec.new do |s|
s.name = 'AWSDynamoDB'
s.version = '2.26.6'
s.summary = 'Amazon Web Services SDK for iOS.'
s.description = 'The AWS SDK for iOS provides a library, code samples, and documentation for developers to build connected mobile applications using AWS.'
s.homepage = 'http... | 40.055556 | 157 | 0.615811 |
4a924447e9d52a8e74b431106e9bad6f3b9fc943 | 939 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'Register an Agreement', js: true do
include Dry::Monads[:result]
let(:user) { create(:user) }
let(:conn) { instance_double(SdrClient::Connection) }
let(:blacklight_config) { CatalogController.blacklight_config }
let(:solr_conn) { blackligh... | 32.37931 | 104 | 0.734824 |
f78a0ca460aec7eadb70642205d8435eb5b9a957 | 717 | Pod::Spec.new do |s|
s.name = "JZSwiftWarpper"
s.version = "0.0.1"
s.summary = "Swift Module Warpper"
s.description = "Reactive Extension for daily using"
s.homepage = "https://github.com/uspython/JZSwiftWarpper.git"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author ... | 34.142857 | 103 | 0.606695 |
5daec366854ad507a398ce0896f83bb80b87cf54 | 678 | #
# Cookbook:: ohai
# Library:: matchers
#
# Author:: Tim Smith (<tsmith@chef.io>)
#
# Copyright:: 2016-2017, Chef Software, 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:... | 32.285714 | 74 | 0.738938 |
91f6659326d1095d11ac82bf20040e071cb9a777 | 131 | FactoryBot.define do
factory :user do
sequence(:email) { |n| "user#{n}@test.example" }
password { "p@55word" }
end
end
| 18.714286 | 52 | 0.625954 |
ac93d60bba046954fa553c71861b0e3b1932d053 | 1,501 | require_relative '../../mutations/host_nodes/register'
module V1
class NodesApi < Roda
include RequestHelpers
route do |r|
token = r.env['HTTP_KONTENA_GRID_TOKEN']
grid = Grid.find_by(token: token.to_s)
halt_request(404, {error: 'Not found'}) unless grid
r.post do
r.is do
... | 25.016667 | 64 | 0.52032 |
f8f8c79eba35b0968322507e896bdf2c943416c0 | 1,404 | class QuotesController < ApplicationController
def new
@quote = Quote.new
@lead = Lead.new
@price_per_salt_bag = Quote::PRICE_PER_SALT_BAG
@price_per_sq_ft = Quote::PRICE_PER_SQ_FT
@min_charge = Quote::MIN_CHARGE
@discount = Quote::DISCOUNT
end
def create
@quote = Quote.new quote_par... | 25.071429 | 88 | 0.623219 |
1aa46ce34ceda9504f97e0b5ade2563f8188469e | 3,356 | require 'fog/core/model'
module Fog
module Compute
class Google
class TargetPool < Fog::Model
identity :name
attribute :kind, :aliases => 'kind'
attribute :self_link, :aliases => 'selfLink'
attribute :id, :aliases => 'id'
attribute :creation_timestamp, :aliases =>... | 29.699115 | 88 | 0.592968 |
1d954ec762558966ffc685b73022b838514c8008 | 233 | # A Different Problem
#
# https://open.kattis.com/problems/different
ARGF.each_line do |line|
numbers =
line
.scan(/[[:digit:]]+/)
.map(&:to_i)
difference = numbers[0] - numbers[1]
puts(difference.magnitude)
end
| 15.533333 | 44 | 0.643777 |
e2289697e041444cd4a1b121a61c1d2a899a26db | 4,888 | #!/usr/bin/env ruby
# This script is a sample of MultiTkIp class
require "multi-tk"
###############################
TkLabel.new(:text=>'This is the Default Master Ipnterpreter').pack(:padx=>5, :pady=>3)
TkButton.new(:text=>'QUIT', :command=>proc{exit}).pack(:pady=>3)
TkFrame.new(:borderwidth=>2, :height=>3,
... | 42.137931 | 100 | 0.481588 |
01620420d2220fa5cea7e3d40ecfcd525c496137 | 532 | #!/usr/bin/ruby
Indent = " "
Width = 16
filename = ARGV[0]
basename = File.basename(filename, File.extname(filename))
print <<END
const char #{basename}[] = {
END
def put_chara(chara)
print ", " unless @first
@first = false
if @col == Width
print "\n"
@col = 0
end
print Indent if @col == 0
pr... | 14.378378 | 58 | 0.595865 |
18233b8e217f50cbe35419e02118425e59a50b96 | 270 | class CreateRoleAuthRecordScope < ActiveRecord::Migration[6.0]
def change
create_table :role_auth_record_scopes do |t|
t.references :record, polymorphic: true, null: false
t.references :role_auth_scope, null: false, foreign_key: true
end
end
end
| 30 | 67 | 0.740741 |
38eb62a492b8b5c4274143750920c0f27dd6e5b6 | 304 | module Kernel
# call-seq:
# obj.yield_self {|_obj|...} -> an_object
#
# Yields <i>obj</i> and returns the result.
#
# 'my string'.yield_self {|s|s.upcase} #=> "MY STRING"
#
def yield_self(&block)
return to_enum :yield_self unless block
block.call(self)
end
end
| 21.714286 | 59 | 0.592105 |
acdadf36ade4ccf25c9419c32902810f500a0694 | 1,004 | # frozen_string_literal: true
describe BehaviorTree::Builder do
let(:tree_using_alias) do
described_class.build do
inverter do
seqq do
:empty_block
end
end
end
end
let(:tree) do
described_class.build do
inverter do
sequencee do
:empty_blo... | 27.888889 | 93 | 0.667331 |
e8621089bc5e1ca3a3b392ac4f8cc02a11b05795 | 2,729 | require 'test_helper'
class UsersControllerTest < ActionDispatch::IntegrationTest
def setup
@user = users(:michael)
@other_user = users(:archer)
@non_activated_user = users(:non_activated)
end
test "should redirect index when not logged in" do
get users_path
assert_redirected_to login_url
... | 29.344086 | 88 | 0.66801 |
217abf2d50ca134e4e1632c4b7cf6f32bf3a643f | 370 | require "bundler/setup"
require "jack_view_tool"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.expect_wi... | 24.666667 | 66 | 0.756757 |
2126f31972aef219b1a597bbfcef06ba6cb49b83 | 3,194 | #require 'rexml/functions'
require 'rexml/xpath_parser'
module REXML
# Wrapper class. Use this class to access the XPath functions.
class XPath
#include Functions
EMPTY_HASH = {}
# Finds and returns the first node that matches the supplied xpath.
# element::
# The context element
# path:... | 40.948718 | 126 | 0.645899 |
ede4a49e048abe2008d154978e69a64a12b8eada | 861 | require 'spec_helper'
require 'status_shared_examples'
describe Jobba do
it_behaves_like 'status'
it 'computes `all.count` efficiently' do
2.times { make_status(state: :unqueued) }
1.times { make_status(state: :succeeded) }
3.times { make_status(state: :started) }
expect(Jobba.redis).to receive(... | 27.774194 | 99 | 0.686411 |
030c1e6660c7e4e9f5b14d870f9594fdf6ab8f82 | 587 | require 'fog/core/collection'
require 'fog/google/models/compute/snapshot'
module Fog
module Compute
class Google
class Snapshots < Fog::Collection
model Fog::Compute::Google::Snapshot
def all
data = service.list_snapshots
snapshots = data.body['items'] || []
... | 18.935484 | 50 | 0.586031 |
11272866910b256c1f53840a0791c32c4a88a3c3 | 2,153 | require 'rails_helper'
RSpec.describe GuessLetterValidator do
describe '#validate' do
let(:guess) { instance_double('Guess') }
let(:errors) { instance_double('ActiveModel::Errors') }
it 'accepts a single uppercase letter' do
allow(guess).to receive(:letter).and_return('A')
allow(guess).to re... | 34.174603 | 116 | 0.715745 |
acaa0c393651d291c8d2f35ed15a25368c99d96e | 2,075 | # == Schema Information
#
# Table name: services
#
# id :integer not null, primary key
# type :string
# title :string
# project_id :integer
# created_at :datetime not null
# updated_at :datetime not null
... | 26.948052 | 70 | 0.54506 |
acb978e7b00361a5c89a938475570c35d61c48aa | 2,876 | class MockExpectationError < StandardError; end
##
# A simple and clean mock object framework.
module MiniTest
##
# All mock objects are an instance of Mock
class Mock
alias :__respond_to? :respond_to?
skip_methods = %w(object_id respond_to_missing? inspect === to_s)
instance_methods.each do |m|... | 28.475248 | 80 | 0.614395 |
26a33543cfe7f2255be4355ba33c9006580c2f6d | 10,769 | require 'puppet/util/docs'
require 'puppet/util/profiler'
require 'puppet/util/methodhelper'
require 'puppet/indirector/envelope'
require 'puppet/indirector/request'
require 'puppet/util/instrumentation/instrumentable'
# The class that connects functional classes with their different collection
# back-ends. Each indi... | 31.95549 | 170 | 0.690686 |
f7ed081bf5274f2edc69eab28e866b95aa20ca6e | 1,354 | # meraki
#
# This file was automatically generated by APIMATIC v2.0
# ( https://apimatic.io ).
module Meraki
# DhcpOptionModel Model.
class DhcpOptionModel < BaseModel
# The code for the DHCP option. This should be an integer between 2 and 254.
# @return [String]
attr_accessor :code
# ... | 25.074074 | 81 | 0.549483 |
e2d24df151ea101196ad3665581a82d062be7175 | 701 | Pod::Spec.new do |s|
s.name = 'AWSKMS'
s.version = '2.9.8'
s.summary = 'Amazon Web Services SDK for iOS.'
s.description = 'The AWS SDK for iOS provides a library, code samples, and documentation for developers to build connected mobile applications using AWS.'
s.homepage = 'http://aws... | 38.944444 | 157 | 0.606277 |
61c87b29aa56657936e0659f234ebb9fb79b8a14 | 321 | puts "Please type a number betwen 0 to 100"
number = gets.chomp.to_i
case
when number < 0
puts "your number is less than 0"
when number > 0 && number < 50
puts "Your number is betwen 0 to 50"
when number > 50 && number < 100
puts "Your number is betwen 50 to 100"
else
puts "your number is greater than 100"
end... | 22.928571 | 43 | 0.700935 |
33e1589fe468360909aefb481d076610b152fbf0 | 1,823 | module Fog
module Compute
class Packet
# Real
class Real
def get_project(id)
request(
:expects => [200],
:method => "GET",
:path => "/projects/" + id
)
end
end
# Mock
class Mock
def get_project(id)
... | 26.808824 | 77 | 0.398245 |
bba7c88782c0ee4d9b721eff5027de7c828cc2a8 | 323 | module ViewDefinitionHelpers
def with_view_definition(name, version, schema)
definition = Fx::Definition.new(name, version)
FileUtils.mkdir_p(File.dirname(definition.full_path))
File.open(definition.full_path, "w") { |f| f.write(schema) }
yield
ensure
FileUtils.rm_f(definition.full_path)
end
e... | 29.363636 | 64 | 0.739938 |
910112ab5cccae7591117a214a83f841f7539c6c | 1,268 | module V1
# Version 1 API
class MediaController < APIController
def create_for_item
@item = ItemQuery.new.public_find(params[:item_id])
check_user_edits!(@item.collection)
media = CreateMedia.call(owner: @item, collection: @item.collection, params: create_params)
status = media.valid? ... | 26.978723 | 97 | 0.676656 |
2198121bab6ed19d3a100ec747fca5c006c59ef8 | 782 | module NavbarHelper
# Generate <li><a href=...></a></li> appropriate for the Bootstrap navbar.
# If :active_when hash is provided in the options, a class=active will
# automatically be added to the <li> when appropriate.
#
# Example:
#
# <%= navbar_link_to(
# "Home",
# root_pat... | 26.965517 | 76 | 0.588235 |
edabba01156138c0962e1dbb6a1adc6a509eef6c | 654 | # frozen_string_literal: true
module PgMultisearch
class Railtie < ::Rails::Railtie
rake_tasks do
load 'pg_multisearch/tasks.rb'
end
generators do
require 'pg_multisearch/generators'
end
config.to_prepare do
::PgMultisearch.unaccent_function ||= 'unaccent'.freeze
# [Ind... | 24.222222 | 83 | 0.674312 |
6a95aeb8225beb8ddc1e2be377ebda1c0d25b728 | 950 | cask "gitfiend" do
version "0.30.1"
sha256 "ee81b40c15c62709e750f01ad3e57c7c470c569f121a4b6c38a7a0e2b80ce4bf"
url "https://gitfiend.com/resources/GitFiend-#{version}.dmg"
name "GitFiend"
desc "Git client"
homepage "https://gitfiend.com/"
livecheck do
url "https://gitfiend.com/app-info"
strategy ... | 25.675676 | 76 | 0.7 |
e8391cc7aca045f021c4087bc9047c124e7834ad | 5,035 | require 'spec_helper'
module Gitlab::Markdown
describe CommitRangeReferenceFilter do
include FilterSpecHelper
let(:project) { create(:project) }
let(:commit1) { project.commit }
let(:commit2) { project.commit("HEAD~2") }
let(:range) { CommitRange.new("#{commit1.id}...#{commit2.id}") }
let(... | 33.791946 | 140 | 0.60993 |
e8a86690d7d4eea340c0e5d4c97be5c5ac8af792 | 1,795 | cask 'font-dejavu' do
version '2.37'
sha256 '7576310b219e04159d35ff61dd4a4ec4cdba4f35c00e002a136f00e96a908b0a'
url "https://downloads.sourceforge.net/dejavu/dejavu-fonts-ttf-#{version}.zip"
appcast 'https://sourceforge.net/projects/dejavu/rss'
name 'DejaVu'
homepage 'https://sourceforge.net/projects/dejavu... | 54.393939 | 80 | 0.766017 |
019af4d5f7a2f9c2231bb5cf73e27d18c1beffd9 | 287 | # -*- encoding : utf-8 -*-
class AddCurrentLevelEnteredAtToGamePassingsMigration < ActiveRecord::Migration[5.0]
def self.up
add_column :game_passings, :current_level_entered_at, :datetime
end
def self.down
remove_column :game_passings, :current_level_entered_at
end
end
| 26.090909 | 84 | 0.770035 |
f8799dd73673758edc44ca83de6cbef7c29a1c26 | 809 | #
# An abstract module to be included in models using the p2-physics-engine
#
# https://github.com/schteppe/p2.js
#
# It wraps the p2-objects via therubyracer and provides ruby-objects
#
require "p2_physics_wrapper/version"
require "p2_physics_wrapper/p2"
module P2PhysicsWrapper
# Extends base w/ ClassMethods, when... | 23.794118 | 103 | 0.723115 |
bfa4ee469cc91f9ae96ba1fe383e9052467e1f54 | 2,980 | # 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::V2018_04_01
module Models
#
# Response for ListExpressRouteCrossConnection API service call.
#
class ExpressR... | 29.50495 | 80 | 0.55 |
9132484f7322476df7fcf7ec46e50a09098a9468 | 7,874 | # frozen_string_literal: false
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic ... | 32.00813 | 148 | 0.697485 |
1c37433364b916c35d83092c13b38a2d025fc17c | 675 | default['yum']['ol6_UEK_latest']['repositoryid'] = 'ol6_UEK_latest'
default['yum']['ol6_UEK_latest']['description'] = 'Latest Unbreakable Enterprise Kernel for Oracle Linux $releasever ($basearch)'
default['yum']['ol6_UEK_latest']['baseurl'] = 'http://public-yum.oracle.com/repo/OracleLinux/OL6/UEK/latest/$basearch/'
de... | 67.5 | 129 | 0.717037 |
1caaebf5a1241ec9acf455471a10aeebc0c75211 | 1,208 | class UsersController < ApplicationController
before_action :logged_in_user, only: [:edit, :update]
before_action :correct_user, only: [:edit, :update]
def show
@user = User.find(params[:id])
end
def new
@user = User.new
end
def create
@user = User.new(user_params)
if @user.save
... | 19.483871 | 60 | 0.605132 |
033427fa7994f5b34249025184ea7f8ae9b9a7d3 | 3,679 | # frozen_string_literal: true
databases = ActiveRecord::Tasks::DatabaseTasks.setup_initial_database_yaml
namespace :gitlab do
namespace :background_migrations do
desc 'Synchronously finish executing a batched background migration'
task :finalize, [:job_class_name, :table_name, :column_name, :job_arguments] ... | 32.848214 | 110 | 0.661321 |
ed91e07890e2a170e2b53d9fb5eaffe0bac897de | 4,449 | require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'helper'))
context "search for an account" do
context "by name" do
setup do
run_with_rescue do
SessionHelper.sales_coord.call_api CityGrid::API::Accounts::Account,
:search,
:userName => '25-1'
end
e... | 33.451128 | 101 | 0.591369 |
e2438eb95a9ccd99431d1b1e96fb1b7997c371d0 | 664 | # encoding: UTF-8
#
# Cookbook Name:: openstack-dashboard
# Recipe:: default
#
# Copyright 2012, Rackspace US, 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.o... | 33.2 | 74 | 0.75 |
08563721f2ed925d0795e7d40973fc165e086181 | 612 | require 'rmagick'
require 'tempfile'
module FlickrCollage
class CreateCollage
def call(images, output='/tmp/collage.png')
result_image = Magick::ImageList.new
result_image.push(*images)
largest_image = images.sort_by { |image| image.rows }.last
result_image.montage {
self.tile = ... | 25.5 | 82 | 0.629085 |
4aa06ce6b8689594e9064df0f998c2a0289d091d | 792 | require 'rails_helper'
RSpec.describe "users/index", type: :view do
before(:each) do
assign(:users, [
User.create!(
:email => "Email",
:first_name => "First Name",
:last_name => "Last Name",
:password_digest => "Password Digest"
),
User.create!(
:email =>... | 27.310345 | 71 | 0.559343 |
e8331f64c2b6ab1c992f1357b3da392fa89b2e55 | 83 | # desc "Explaining what the task does"
# task :ebisu do
# # Task goes here
# end
| 16.6 | 38 | 0.662651 |
1c6758dd140a7cc88ea4f5a8de31db58fc27b16b | 575 | require_relative "boot"
require "rails/all"
Bundler.require(*Rails.groups)
module Baukis2
class Application < Rails::Application
config.load_defaults 6.0
config.time_zone = "Tokyo"
config.i18n.load_path +=
Dir[Rails.root.join("config", "locales", "**", "*.{rb,yml}").to_s]
config.i18n... | 22.115385 | 74 | 0.617391 |
ff200c1751c439175e643725f78e476cb73511ef | 116 | class AddUserIdToBlocks < ActiveRecord::Migration
def change
add_column :blocks, :user_id, :integer
end
end
| 19.333333 | 49 | 0.758621 |
62a1f5655af85ac92bfad72d056bdd57f641c1b5 | 1,545 | #
# Be sure to run `pod lib lint PrintChinese.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 https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'PrintC... | 35.930233 | 102 | 0.634304 |
f86ad12ff56b38c1c48d974243658cdd7423d892 | 157 | module TD::Types
# A category containing frequently used chats used to forward messages.
class TopChatCategory::ForwardChats < TopChatCategory
end
end
| 26.166667 | 73 | 0.796178 |
87d22acce73b604d60fcb87932fa0db0af6229c8 | 205 | Shindo.tests("Fog::Compute::HPV2 | addresses collection", ['hp', 'v2', 'compute']) do
service = Fog::Compute.new(:provider => 'HP', :version => :v2)
collection_tests(service.addresses, {}, true)
end | 29.285714 | 85 | 0.658537 |
262e496c135214103ed552049c366ad37931dae3 | 6,483 | require 'sidekiq/web'
Rails.application.routes.draw do
post 'webhooks' => 'webhooks#create'
if AuthProvider.active.providable_type == DatabaseProvider.name
# with local authentification we do not use omniAuth so we must differentiate the config
devise_for :users, controllers: {registrations: 'registration... | 35.42623 | 132 | 0.648928 |
abfe0baa03a40232aff1399e186b5af79b28157a | 1,579 | class Swiftformat < Formula
desc "Formatting tool for reformatting Swift code"
homepage "https://github.com/nicklockwood/SwiftFormat"
url "https://github.com/nicklockwood/SwiftFormat/archive/0.49.7.tar.gz"
sha256 "141e345fd654997bcf501d085be915e2e5386e8d00db08c4d53205c2438ff117"
license "MIT"
head "https://... | 40.487179 | 123 | 0.745408 |
114a883b466551cb670878a543a7e4b7cfa40084 | 125 | require 'test_helper'
class SuperDemandTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 15.625 | 47 | 0.712 |
f709ebd69bc098bfdab86549c05241477d3fe10c | 1,281 | # coding: UTF-8
require_relative 'utils'
class OpenSSL::TestHMAC < Test::Unit::TestCase
def setup
@digest = OpenSSL::Digest::MD5
@key = "KEY"
@data = "DATA"
@h1 = OpenSSL::HMAC.new(@key, @digest.new)
@h2 = OpenSSL::HMAC.new(@key, "MD5")
end
def teardown
end
def test_hmac
@h1.update... | 30.5 | 127 | 0.679157 |
1d14df47ffc11a69025bc9fa3099380e21eb8b49 | 1,435 | #--
# Ruby Whois
#
# An intelligent pure Ruby WHOIS client and parser.
#
# Copyright (c) 2009-2018 Simone Carletti <weppos@weppos.net>
#++
require_relative 'base'
module Whois
class Parsers
# Parser for the whois.aeda.net.ae server.
#
# @note This parser is just a stub and provides only a few basic m... | 22.076923 | 79 | 0.627178 |
01e7246f08605cee6ba9050819b531df7a3d36c5 | 80 | require 'rails'
module DeviseMeteor
class Railtie < Rails::Railtie
end
end | 11.428571 | 32 | 0.75 |
e8f3d2d3235ae9fbdc0d3c32f6733412a189d572 | 1,251 | # 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/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
Gem::Specification.new do |spec|
spec.name = 'aws-sdk-resourcegroupst... | 39.09375 | 125 | 0.681855 |
62e661602c66ac73c998e5ffb48d6c67d5aff041 | 73 | $: << File.expand_path('../', __FILE__)
require 'spec/ruby/spec_helper'
| 18.25 | 39 | 0.671233 |
bb78e6e0d3e46183c46da98ce2d559cf9fb1a406 | 205 | #!/usr/bin/env rspec -cfd
require_relative 'spec_helper'
require 'blockchain'
describe Blockchain do
it "has a logger" do
expect( described_class.logger ).to be_a( Loggability::Logger )
end
end
| 12.8125 | 65 | 0.736585 |
1c23f83d16edd42715fc5611f16143aaac306654 | 654 | # frozen_string_literal: true
FactoryBot.define do
factory :evss_claim do
user_uuid { '1234' }
evss_id { 1 }
data do
fixture_file_name = "#{::Rails.root}/spec/fixtures/evss_claim/claim-detail.json"
File.open(fixture_file_name, 'rb') do |f|
raw_claim = f.read
JSON.parse(... | 28.434783 | 86 | 0.648318 |
62823a1f2482656870d193b8381243b48402ed1e | 2,669 | #!/usr/bin/ruby
#
# Author:: api.sgomes@gmail.com (Sérgio Gomes)
#
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
#
# License:: 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 o... | 31.77381 | 79 | 0.671038 |
1ccc238f5d9084a12d6d11b1a5da7eacba22a4ed | 25 | module SoporteHelper
end
| 8.333333 | 20 | 0.88 |
b92694f8f6bc8f44eaead876316986ecfff9c144 | 2,439 | # encoding: ascii-8bit
require 'openssl'
require 'ffi'
module MoneyTree
module OpenSSLExtensions
extend FFI::Library
if FFI::Platform.windows?
ffi_lib 'libeay32', 'ssleay32'
else
ffi_lib [
'libssl.so.1.1.0', 'libssl.so.1.1',
'libssl.so.1.0.0', 'libssl.so.10',
'libssl1... | 29.743902 | 91 | 0.677327 |
623e677c0d2abca3ef5949212ccb6c5b077f5722 | 4,906 | # -*- coding: utf-8 -*-
###############################################################################
#
# Chartsheet - A class for writing the Excel XLSX Chartsheet files.
#
# Used in conjunction with WriteXLSX
#
# Copyright 2000-2011, John McNamara, jmcnamara@cpan.org
# Convert to ruby by Hideo NAKAMURA, cxn03651@ms... | 23.586538 | 87 | 0.560538 |
ffe0af96779fe5f58f35a2f12760bc003a5ea454 | 108 | Rails.application.config.after_initialize do
# Connector.destroy_all
# initialization code goes here
end | 27 | 44 | 0.824074 |
1a6234037479222203cc95b3d6088c5513462712 | 3,083 | test_name "concurrent catalog requests (PUP-2659)"
# we're only testing the effects of loading a master with concurrent requests
confine :except, :platform => 'windows'
step "setup a manifest"
testdir = master.tmpdir("concurrent")
apply_manifest_on(master, <<-MANIFEST, :catch_failures => true)
File {
ensure =... | 28.284404 | 110 | 0.571846 |
4a013d097974878ab59fc61def00afa736c4718c | 3,806 | module Fastlane
module Actions
class TestSampleCodeAction < Action
def self.run(params)
content = File.read(params[:path])
fill_in_env_variables
# /m says we ignore new line
errors = []
content.scan(/```ruby\n([^`]*)\n```/m).each do |current_match|
current... | 33.385965 | 133 | 0.603783 |
030e9db4a8598f4b9c6e6dfbaee6200914056667 | 1,053 | # frozen_string_literal: true
module ContainerConfig
module Coercer
# Base type coercer
class Base
#
# Returns name of the coercer
#
# @return [String] coercer name
#
def name
raise ContainerConfig::MissingOverride, "Must override name method in derived class #{sel... | 26.325 | 108 | 0.631529 |
abfefe1e1caa682b52f76ef1ddcf17019fe1cec2 | 1,663 | class OpsManager
class DirectorTemplateGenerator
def generate
merge_director_template_products
delete_schema_version
delete_director_ssl
delete_uaa_ssl
delete_guid
delete_ip_assignments
add_merging_strategy_for_networks
installation_settings.to_h
end
def g... | 26.396825 | 87 | 0.700541 |
7a96e11703ab47a12f2dbb7065167e44951433e6 | 13,026 | # Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmat... | 49.154717 | 152 | 0.751036 |
4a337395d46925e2465a243bb2f44aa54e4df31e | 1,120 | module Ticketbai
module Documents
class Annulment < Document
ROOT_NAME = 'T:AnulaTicketBai'.freeze
XMLNS = {
'xmlns:T' => 'urn:ticketbai:anulacion'
}.freeze
ATTRIBUTES = %i[issuer invoice_header software].freeze
attr_accessor(*ATTRIBUTES)
###
# @param [Ticketba... | 24.347826 | 85 | 0.565179 |
4aae2037f85c98f765af2c886618630f3c8191a5 | 1,648 | # -*- encoding: utf-8 -*-
# stub: public_suffix 4.0.3 ruby lib
Gem::Specification.new do |s|
s.name = "public_suffix".freeze
s.version = "4.0.3"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Simon... | 39.238095 | 123 | 0.668689 |
f87e8b6c63c4ff1113e0e2c3b1d63054a160f99c | 1,614 | =begin
#BJR API V1
#API specification for the BJR job server.
The version of the OpenAPI document: v1
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.1.1-SNAPSHOT
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for BJR::OccurrenceMessage
# Automatically generated by... | 27.355932 | 102 | 0.727385 |
aba93a33715485c13868b269e517d327b11c11f1 | 1,751 | #
# Author:: Seth Chisamore (<schisamo@chef.io>)
# Cookbook Name:: windows
# Library:: helper
#
# Copyright:: 2011-2015, Chef Software, 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 Lice... | 32.425926 | 110 | 0.663621 |
616b934604ff8923699fa17cb70007576b4ba89e | 41,841 | module Zajal
# This module contains methods that draw basic geometric primitives.
# Methods either draw directly to the screen (e.g. {#circle},
# {#square}) or affect subsequent drawing (e.g. {#translate}).
#
# {Zajal::Graphics} mostly a wrapper for ofGraphics in openFrameworks.
#
# @see http://www.open... | 28.56041 | 136 | 0.550991 |
08ee85d8144c2add311f1d69cc38edd38294b869 | 3,032 | module Bunto
class EntryFilter
attr_reader :site
SPECIAL_LEADING_CHARACTERS = [
".", "_", "#", "~",
].freeze
def initialize(site, base_directory = nil)
@site = site
@base_directory = derive_base_directory(
@site, base_directory.to_s.dup
)
end
def base_director... | 25.057851 | 78 | 0.572889 |
f8ce905aab0c52309a7f8fbb9f7043ffae5d38ae | 201 | require 'mxx_ru/binary_unittest'
path = 'test/so_5/disp/prio_ot_strictly_ordered/simple_seq1'
Mxx_ru::setup_target(
Mxx_ru::Binary_unittest_target.new(
"#{path}/prj.ut.rb",
"#{path}/prj.rb" )
)
| 20.1 | 60 | 0.736318 |
79e76de411740861232724f9a260486c361bf239 | 1,631 | # -*- encoding: utf-8 -*-
# stub: rb-fsevent 0.11.0 ruby lib
Gem::Specification.new do |s|
s.name = "rb-fsevent".freeze
s.version = "0.11.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "source_code_uri" => "https://github.com/th... | 40.775 | 112 | 0.66217 |
03d5e8ea251eb1dcba22bbfb718aceb472fa0786 | 295 | name "jmxtrans"
maintainer "Brandon Burton"
maintainer_email "brandon@inatree.org"
license "Apache 2.0"
description "Installs/Configures jmxtrans, uses YAMLConfigs"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "1.0.5"
| 36.875 | 72 | 0.684746 |
4a5c3c80aedd3d87620bf154c4efc9dc4677232f | 1,429 | require 'pry'
class Project
attr_reader :title, :id
def initialize(attributes)
@title = attributes[:title]
@id = attributes[:id]
end
def save
result = DB.exec("INSERT INTO projects (name) VALUES ('#{@title}') RETURNING ID")
@id = result.first["id"].to_i
end
def self.all_basic(projects)
... | 21.651515 | 85 | 0.655003 |
8700e29343b24028d0be87b3afadd3535c02927a | 548 | require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/fixtures/classes'
describe "Kernel#to_a" do
it "is defined on Kernel" do
Kernel.should have_instance_method('to_a')
end
end
describe "Kernel#to_a when the receiver is an Array" do
it "returns self" do
array = [1, 2]... | 23.826087 | 59 | 0.70073 |
f7ebb647889d6e6b2940baab49cca51e147bc929 | 780 | class User < ApplicationRecord
has_many :rants
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
validates :email, presence: true
validates :password, uniqueness: true
devise :database_authenticatable, :registerable,
:recoverable,... | 33.913043 | 107 | 0.761538 |
0376b331968ae8c42274086760417956018ae4a2 | 492 | require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module RailsHelloWorld
class Application < Rails::Application
# Settings in config/environments/* take precedence over tho... | 30.75 | 82 | 0.76626 |
1d0d7437b3bd10b726eb529e394ed54fb09e87fd | 211 | require 'digest'
module Jekyll::HashFilter
def to_hash(input)
if input != nil
return Digest::MD5.hexdigest input
end
return ''
end
end
Liquid::Template.register_filter(Jekyll::HashFilter) | 17.583333 | 52 | 0.706161 |
28147d11d3870c50206203e9d4afe92cbcd94a85 | 1,637 | # frozen_string_literal: true
module Shipping
extend ActiveSupport::Concern
# Returns the current shipping class, memoized.
def shipping_class
@shipping_class ||= find_shipping_class(session[:shipping_class_id])
end
# Returns the current shipping class without memoization.
def shipping_class!
@sh... | 25.578125 | 89 | 0.748931 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.