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 |
|---|---|---|---|---|---|
332743d55bd4e4c3b2325db81de3799b5db6ae9f | 48,959 | require "date"
require 'action_view/helpers/tag_helper'
module ActionView
module Helpers
# The Date Helper primarily creates select/option tags for different kinds of dates and date elements. All of the
# select-type methods share a number of common options that are as follows:
#
# * <tt>:prefix</tt>... | 50.111566 | 137 | 0.605854 |
e2b2623f8227ce6b7c01614492eca41223fc56db | 2,091 | # encoding: UTF-8
#
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
require_relative 'base_action'
module GoodData
module LCM2
class AssociateClients < BaseActio... | 30.75 | 103 | 0.644189 |
9121e39c4ef545833d640103dd4b3c8612ca77cd | 1,281 | module AspaceUtilities
def self.included receiver
receiver.extend self
end
# Simple utility allow ASpace response data to be passed to methods as either
# JSON (directly from API response) or Hash (when included as a linked record
# in another response which has already been parsed)
# Both formats (JS... | 28.466667 | 83 | 0.672912 |
33c4056ed9bc9cb8f36c93f39062ff7ad0ade575 | 508 | class CreateDatasets < ActiveRecord::Migration
def up
create_table :datasets do |t|
t.string :name
t.integer :order
t.text :description
t.boolean :is_default, default: false
t.belongs_to :plan, index: true, foreign_key: true
t.timestamps null: false
end
add_reference ... | 22.086957 | 68 | 0.685039 |
acd24b29d9c88fffe4034224a5b2cabfdebbf839 | 2,054 | require 'faraday'
# @private
module FaradayMiddleware
# @private
class RaiseHttpException < Faraday::Middleware
def call(env)
@app.call(env).on_complete do |response|
case response[:status].to_i
when 400
raise EPayCo::BadRequest, error_message_400(response)
when 404
... | 34.233333 | 122 | 0.64703 |
f8f8f13e2d6fbd43492f8dd6c8852d95fa7e9435 | 1,265 | =begin
#API v1
#FormAPI is a service that helps you fill out and sign PDF templates.
OpenAPI spec version: v1
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 3.3.0-SNAPSHOT
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for FormAPI::AuthenticationSuccessResponse
# Au... | 27.5 | 102 | 0.742292 |
e892db63c6e544679d0cdaa5ca8f27ab4874001f | 152 | class SetFinishesQuantityDefault < ActiveRecord::Migration
def up
change_column :finishes, :quantity, :integer, null: false, default: 1
end
end
| 25.333333 | 73 | 0.763158 |
628f9975f0d55c706a0df74cd4b95f44369bfa39 | 655 | require_dependency "conductor/application_controller"
STATS_DIRECTORIES = [
%w(Controllers app/controllers),
%w(Helpers app/helpers),
%w(Models app/models),
%w(Libraries lib/),
%w(APIs app/apis),
%w(Integration\ tests test/integration),
%w(Controllers\ ... | 31.190476 | 102 | 0.641221 |
f8319e3d85cfabd5b3b3c45170dbf1711c5ac321 | 254 | require "sequel"
require "securerandom"
Sequel::Model.plugin :timestamps, update_on_create: true
class Order < Sequel::Model
RE_ETH_ADDRESS = %r(^0x\h{40}$)
unrestrict_primary_key
def self.generate_id
(SecureRandom.rand * 2**32).to_i
end
end
| 23.090909 | 56 | 0.744094 |
39b6e1e8572456d7b21f54bf8660ff4cf099236d | 1,726 | module Wongi::Engine
class Graph
def initialize rete
@rete = rete
end
def dot io, opts = { }
@seen_betas = []
if String === io
File.open io, "w" do |actual_io|
dot actual_io
end
return
end
@io = io
@io.puts "digraph {"
dum... | 23.324324 | 115 | 0.578795 |
184b3dab3faab7969bc0484f3bcb1d454c914f2e | 1,314 | # 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::PolicyInsights::Mgmt::V2019_07_01
module Models
#
# Additional parameters for a set of operations.
#
class QueryOptions
... | 23.890909 | 70 | 0.515221 |
4a40db7ed273f55612b0240ec007bbda0d93c5c6 | 465 | server ENV['APP_HOST'], roles: %w{app}, user: fetch(:user)
append :linked_files, "docker-compose.local.yml"
namespace :docker do
task :up do
on roles(:all) do |host|
within release_path do
execute :"docker-compose", "pull"
execute :"docker-compose", "-f docker-compose.yml -f docker-compose.... | 27.352941 | 118 | 0.660215 |
5d9ccddc975d5d5a8008be8bd99569d752674473 | 123 | class ApiRequest < ActiveRecord::Base
def date
created_at.utc.iso8601
end
def self.per_page
10000
end
end
| 12.3 | 37 | 0.707317 |
61fa1821546987e55e717ec242ef9eff02a32497 | 736 | module DownloadOptions
# Download options for an asset of type "audio/", original and an mp3
class AudioDownloadOptions
include Rails.application.routes.url_helpers
attr_reader :asset
def initialize(asset)
@asset = asset
end
def options
options = []
# We don't use content_t... | 23 | 73 | 0.652174 |
e21f334835d82688a5cbf834ab9c85abddfd8b63 | 533 | Pod::Spec.new do |s|
s.name = "NTJsonValues"
s.version = "1.00"
s.summary = "NTJsonValues - A NSDictionary Category to aid parsing JSON values."
s.homepage = "https://github.com/NagelTech/NTJsonValues"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "Ethan Na... | 41 | 94 | 0.579737 |
e8124146236b32047a3e2de3a0bf0104db6dcdde | 230 | lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'utracker'
require 'utracker/mongodb'
drawer = Utracker::MongoDB::Drawer.new
drawer.write_graph("examples/services.dot")
| 25.555556 | 55 | 0.765217 |
e8c02083552eecbd04ec1f793b95ea6dad3aedbe | 1,475 | require 'spec_helper'
require 'pact/provider/configuration/pact_verification'
module Pact
module Provider
module Configuration
describe PactVerification do
describe 'create_verification' do
let(:url) { 'http://some/uri' }
let(:pact_repository_uri_options) do
{
... | 28.921569 | 106 | 0.548475 |
875a5829526a7603a54b8f45b0b29eaedd78fe35 | 2,273 | # frozen_string_literal: true
module Inferno
class App
module OAuth2ErrorMessages
def no_instance_for_state_error_message
%(
<p>
Inferno has detected an issue with the SMART launch.
#{param_description}
The authorization server is not returning the corr... | 35.515625 | 154 | 0.659921 |
6235c121df9d7be9d78ba56a6821e8949e935270 | 501 | require 'boker_tov_bot/message_handlers/base_handler'
module BokerTovBot
module MessageHandlers
class ThhHandler < BaseHandler
def initialize(options = {})
@regex = /.*\bט+ח+\b.*/mi
super(options)
end
def match?(message)
@regex.match(message.downcase) ? true : false
... | 21.782609 | 65 | 0.598802 |
872c11689904126098b941769ce11a8fa5c51a5e | 3,300 | =begin
#RDA Collections API
#API Strawman for RDA Research Data Collections WG
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
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 ... | 30.555556 | 103 | 0.737879 |
08637576030e6c82cb7ecc38a1cc920d6fdd43fa | 235 | json.payload do
json.id @contact.id
json.name @contact.name
json.email @contact.email
json.phone_number @contact.phone_number
json.thumbnail @contact.avatar_url
json.additional_attributes @contact.additional_attributes
end
| 26.111111 | 59 | 0.804255 |
ed972389f47a64adafad391b654cf2fad80f7bc8 | 524 | cask 'veusz' do
version '2.0.1'
sha256 'dbf5a1c9ae26f2a40e05bf1afd537ad4927ab41c15a0ad4d717a216909f37ceb'
# github.com/veusz/veusz was verified as official when first introduced to the cask
url "https://github.com/veusz/veusz/releases/download/veusz-#{version}/veusz-#{version}-AppleOSX.dmg"
appcast 'https://... | 37.428571 | 103 | 0.769084 |
39392ba137ec4b00ebd9d8838a5e58e8eee688f3 | 3,287 | # frozen_string_literal: true
RSpec.shared_examples "agency_with_refund examples" do
it "should be able to view revoked reasons" do
should be_able_to(:view_revoked_reasons, WasteCarriersEngine::RenewingRegistration)
end
it "should be able to refund a payment" do
should be_able_to(:refund, WasteCarriersE... | 32.22549 | 102 | 0.718588 |
bf0f822480137669d2977a51137899e467982b48 | 723 | #
# Allows
#
module Mailtime
module Mailtimer
extend ActiveSupport::Concern
module ClassMethods
def mailtimer(email_attribute = :email, options = {})
has_many :mailtime_logs, :as => :thing, :class_name => "Mailtime::Log"
cattr_accessor :mailtimer_email_attribute
cattr_accessor ... | 24.1 | 78 | 0.688797 |
ff3cd6ac5908d14d92ab7359bcfc515c8f855463 | 1,862 | # frozen_string_literal: true
module AppPerfRpm
module Instruments
module ActiveRecordImport
include AppPerfRpm::Utils
def insert_many_with_trace( sql, values, *args )
if ::AppPerfRpm::Tracer.tracing?
sql_copy = sql.dup
base_sql, post_sql = if sql_copy.dup.is_a?( String )... | 32.103448 | 101 | 0.636412 |
62f3639742079905b5368515d8f9f5647355ca54 | 821 | name 'manage_chef_client_task'
maintainer 'Nghiem Ba Hieu'
maintainer_email 'hi3unb@gmail.com'
license 'Apache-2.0'
description 'Installs/Configures manage_chef_client_task'
long_description 'Installs/Configures manage_chef_client_task'
version '0.1.0'
chef_version '>= 13.0'
supports 'windows'
depends 'chef-client'
... | 32.84 | 79 | 0.786845 |
03d95355fbe55d5ee43ba943013d0a6d612cfa8d | 4,823 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::SMB::Client::Psexec_MS17_010
include Msf::Exploit::Remote::SMB::Client::Psexec
include Msf::Auxiliary::Re... | 40.872881 | 130 | 0.624922 |
1d1ca09a53f97954cfde605fcd81f0be60403bed | 6,626 | require_relative '../test_helper'
module SmartAnswer
class StartPageContentItemTest < ActiveSupport::TestCase
include GovukContentSchemaTestHelpers::TestUnit
setup do
load_path = fixture_file('smart_answer_flows')
SmartAnswer::FlowRegistry.stubs(:instance).returns(stub("Flow registry", find: @fl... | 37.862857 | 114 | 0.736342 |
5de2fc09a4a2493ff3cb87bd981caa2de3114d22 | 2,055 | require 'test_helper'
class RepositoriesControllerTest < ActionController::TestCase
setup do
@repository = repositories(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:repositories)
end
test "should get new" do
get :new
assert_respons... | 41.1 | 538 | 0.755718 |
1a33aed0bfd38247afca5333e21e0532f645f9ac | 1,782 | require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Phrase::Team
# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
describe 'Team' do
before do
# run before each test
@instance = Phrase::Team.new
end
after do
# run... | 27 | 102 | 0.697531 |
2630855fe87e8a162f5d6b96f26e2dbd357ff3df | 1,504 | # 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.809524 | 86 | 0.719415 |
ac6297ed1c5f9337197209059e9d0ce3928e5d78 | 1,286 | require File.dirname(__FILE__) + '/../../../spec_helper'
require 'set'
describe "SortedSet#superset?" do
before(:each) do
@set = SortedSet[1, 2, 3, 4]
end
it "returns true if passed a SortedSet that equals self or self is a proper superset of" do
@set.superset?(@set).should be_true
SortedSet[].super... | 37.823529 | 93 | 0.693624 |
f8d6b54fd6a5c26b95f93f98f1cb39d231f1500e | 3,689 | # frozen_string_literal: true
RSpec.describe 'defendants/_offences.html.haml', type: :view do
let(:defendant) { object_double(CourtDataAdaptor::Resource::Defendant.new, offences: [offence]) }
let(:offence) { CourtDataAdaptor::Resource::Offence.new }
before do
assign(:defendant, defendant)
end
context '... | 32.078261 | 103 | 0.627812 |
4aa950cc6e110039759fbe92d0293d608d572aff | 386 | # Copyright (c) 2013 Universidade Federal Fluminense (UFF).
# This file is part of SAPOS. Please, consult the license terms in the LICENSE file.
class CreateResearchAreas < ActiveRecord::Migration
def self.up
create_table :research_areas do |t|
t.string :name
t.string :code
t.timestamps
en... | 21.444444 | 84 | 0.709845 |
11676cad4045c95f848ab07de27ae1ca26fcf312 | 4,078 | module Fog
module Compute
class ProfitBricks
class Real
# Retrieves the attributes of a given Firewall Rule
#
# ==== Parameters
# * datacenter_id<~String> - UUID of the datacenter
# * server_id<~String> - UUID of the server
# * nic_id<~String> ... | 59.101449 | 150 | 0.567925 |
61486b843c5e80ee1b55eb4622950f2fd37ab153 | 348 | # frozen_string_literal: true
require 'spec_helper'
describe 'vpython::module::html5lib' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_package('python3-html5lib').with_ensure('l... | 21.75 | 85 | 0.689655 |
e20c81ea424357bb83e1e329b4db1ced61ebe534 | 2,002 | # frozen_string_literal: true
class ExtraLocalesController < ApplicationController
layout :false
skip_before_action :check_xhr,
:preload_json,
:redirect_to_login_if_required,
:verify_authenticity_token
OVERRIDES_BUNDLE ||= 'overrides'
MD5_HASH_LENGTH ||= 32
def show
bundle = params[:bundle... | 26 | 98 | 0.690809 |
ed4ce0fb248bdb2204aea61629ca95f5e2d57ee2 | 1,723 | require 'rack/body_proxy'
require "rack/transcribr/extensions"
module Rack
class CommonLogger
def log(env, status, header, began_at) end # Disable CommonLogger middleware
end
class Transcribr
FORMAT = %{%s - %s [%s] "%s %s%s %s" %d %s %0.4f\n}
def initialize(app, logger=nil)
@app = app
... | 23.283784 | 80 | 0.56065 |
1cdce872b7bde76bb6520c953b199a47fca44fc2 | 912 | module HttpdCookbook
class HttpdConfigRhel < HttpdConfig
use_automatic_resource_name
provides :httpd_config, platform_family: %w(rhel fedora suse amazon)
action :create do
directory "/etc/#{apache_name}/conf.d" do
owner 'root'
group 'root'
mode '0755'
recursive true
... | 25.333333 | 79 | 0.64364 |
21c5c601e29f7ea3f36ceb11a80948974d58a993 | 1,251 | # encoding: UTF-8
class Post < ActiveRecord::Base
include ArelHelpers::ArelTable
include ArelHelpers::Aliases
has_many :comments
has_many :favorites
end
class Comment < ActiveRecord::Base
include ArelHelpers::ArelTable
include ArelHelpers::Aliases
belongs_to :post
belongs_to :author
end
class Author ... | 22.339286 | 75 | 0.785771 |
87c9068713e6a33c05e1c0cf5c741ec7dbba0ff4 | 2,298 | # frozen_string_literal: true
Rails.application.configure do
$stdout.sync = true
# 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 develop... | 34.818182 | 87 | 0.762402 |
61f425ce68d6d7cd5a7dec774bda3661e552753f | 19,503 |
module Sip
module Concerns
module Controllers
module ModelosController
extend ActiveSupport::Concern
included do
include ModeloHelper
helper ModeloHelper
# Deben registrarse en Sip::Bitacora usos de este controlador
def registrar_en_bitacora
... | 36.250929 | 131 | 0.485977 |
5d43eb5726c2101a529837bbc4b66d3156f733f5 | 4,239 | # frozen_string_literal: true
module Inferno
module USCore311ProfileDefinitions
class USCore311PulseOximetrySequenceDefinitions
MUST_SUPPORTS = {
extensions: [],
slices: [
{
name: 'Observation.category:VSCat',
path: 'category',
discriminator: {
... | 24.222857 | 85 | 0.36636 |
f873b0cf6c267b1e8dbb80be484990282770fc33 | 4,059 | # frozen_string_literal: true
require 'spec_helper'
describe 'apache::mod', type: :define do
let :pre_condition do
'include apache'
end
let :title do
'spec_m'
end
context 'on a RedHat osfamily' do
include_examples 'RedHat 6'
describe 'for non-special modules' do
it { is_expected.to ... | 39.407767 | 136 | 0.480168 |
1c93297c94d43a14c7b6a70e588b2f28fa76cc54 | 4,653 | # frozen_string_literal: true
require "rails_helper"
RSpec.describe GeoserverMessageGenerator do
with_queue_adapter :inline
subject(:generator) { described_class.new(resource: file_set) }
let(:resource_title) { "Test Title" }
let(:file_set) { query_service.find_members(resource: resource).to_a.first }
let(:... | 40.112069 | 134 | 0.670965 |
9147ba7e945b746fdf04362d32718d90b38b6d17 | 155 | # frozen_string_literal: true
Rails.application.config.filter_parameters += [
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
]
| 25.833333 | 73 | 0.709677 |
e85d30e6e3ef9d105893292202cdf23055258b6a | 386 | class AddTransactionFeeToCoreAffiliates < ActiveRecord::Migration[5.2]
def change
add_column :core_affiliates, :transaction_fee, :decimal, null: false, default: 0.0, after: :tax_exempt, precision: 5, scale: 2
remove_column :core_affiliates, :purchase_order_email
remove_column :core_affiliates, :invoice_em... | 42.888889 | 130 | 0.784974 |
1a471d917bf059b66e2ffd87ebd3dceb1c2bb78b | 2,268 | # frozen_string_literal: true
# Copyright 2015-2017, the Linux Foundation, IDA, and the
# CII Best Practices badge contributors
# SPDX-License-Identifier: MIT
# rubocop:disable Metrics/BlockLength
SecureHeaders::Configuration.default do |config|
normal_src = ["'self'"]
if ENV['PUBLIC_HOSTNAME']
fastly_alterna... | 36.580645 | 78 | 0.705467 |
bb92bd056b645252321fbe89a9de2023d3fa9abd | 81 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'blender/cli'
| 27 | 58 | 0.728395 |
bf17c5c02ed3bc8808d99d119767507afdf6c7b0 | 151 | #
# Engine to add to main rails app
#
module MaterialIconsSvg
# Set the base engine to connect with rails
class Engine < ::Rails::Engine
end
end
| 16.777778 | 45 | 0.721854 |
1c120ec1ea189faf0ed84c9e13356f611cbb33e7 | 41 | module Mousereco
VERSION = "0.0.6"
end
| 10.25 | 19 | 0.682927 |
28b819d149399702801132ec9851b5488d142419 | 457 | Puppet::Type.type(:ironic_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/ironic/iron... | 16.321429 | 68 | 0.669584 |
f79c5f4eafe938a9964863182a3e24c06e4c6647 | 467 | # encoding: utf-8
# class Test
# extend Rango::Hookable
# install_hook do |instance|
# p instance
# end
#
# def initialize
# p self
# end
# end
#
# Test.new
module Rango
module Hookable
def new(*args)
instance = super(*args)
self.hooks.each { |hook| hook.call(instance) }
retu... | 14.151515 | 52 | 0.595289 |
8799914db3f516c4d61ae1a4edbafb41d0786a30 | 678 | require 'simplecov'
module SimpleCov::Configuration
def clean_filters
@filters = []
end
end
SimpleCov.configure do
clean_filters
load_adapter 'test_frameworks'
end
ENV["COVERAGE"] && SimpleCov.start do
add_filter "/.rvm/"
end
require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :develop... | 19.371429 | 66 | 0.741888 |
397dcd695740132bbf71660b3189375afcfedd89 | 391 | # rubocop:disable Style/ClassAndModuleChildren
require_dependency "content_manager/application_controller"
module ContentManager
class AdminsController < ApplicationController
include SessionsHelper
helper_method :log_in
helper_method :site_name
layout 'admin'
protected
def authenticate_admin!
retu... | 21.722222 | 59 | 0.820972 |
1c18d80287673d6b312b03c25396e09278816e0b | 1,567 | # frozen_string_literal: true
module DocTemplate
module Objects
module TocHelpers
extend ActiveSupport::Concern
def level1_by_title(title)
l1 = children.find { |c| !c.handled && c.title.parameterize == title }
raise Lcms::Engine::DocumentError, "Level1 header #{title} not found at me... | 29.566038 | 108 | 0.5903 |
e85855ff2ded904f378661530c31879098dba47b | 1,234 | require 'spec_helper'
describe RemindRegistrationDropoffs do
subject(:interactor) { described_class.new(user_mailer: umailer) }
let(:umailer) { class_double(UserMailer, reg_reminder: spy) }
it "sends email to users who haven't registered" do
allow(interactor).to receive(:lazy_users) { [create(:user)] }
... | 28.045455 | 78 | 0.71637 |
ffb84203765f001b72e974be9c93a61d857e3aac | 953 | cask "geogebra" do
version "6.0.603.0"
sha256 "98553962e4b899c4631b202b161a0e909c348ddcc98e1d0748f532f8f001d408"
url "https://download.geogebra.org/installers/#{version.major_minor}/GeoGebra-Classic-#{version.major}-MacOS-Portable-#{version.dots_to_hyphens}.zip"
appcast "https://download.geogebra.org/installer... | 38.12 | 151 | 0.720881 |
1d994718e29c7c1d012151075d2511bc4b7a7c4f | 573 | # frozen_string_literal: true
module Tamashii
module Manager
# :nodoc:
class Authorization < Tamashii::Handler
def resolve(data = nil)
type, client_id = case @type
when Tamashii::Type::AUTH_TOKEN
Authorizator::Token.new.verify!(data)
... | 28.65 | 65 | 0.493892 |
d557d2e474bc0fa2769d8f73954ea1f365c1f280 | 534 | cask 'opera' do
version '60.0.3255.95'
sha256 'a6bad86cdfbe4cd6b7c22d7580a5b9a9e9760b6533e6e98e9fbe0a118fa23d48'
url "https://get.geo.opera.com/pub/opera/desktop/#{version}/mac/Opera_#{version}_Setup.dmg"
appcast 'https://ftp.opera.com/pub/opera/desktop/'
name 'Opera'
homepage 'https://www.opera.com/'
a... | 28.105263 | 93 | 0.683521 |
4a8ab14df6d536f937c99b7779d1846c1bc7eb33 | 469 | # frozen_string_literal: true
# Migration to create client languages table
class CreateClientLanguages < ActiveRecord::Migration[6.1]
def change
create_table :client_languages do |t|
t.references :client, null: false, foreign_key: true
t.references :language, null: false, foreign_key: true
t.bo... | 27.588235 | 60 | 0.71855 |
bb0b289f7e84c507ffc0987df667206fe2192fe0 | 197 | # frozen_string_literal: true
require 'cuprum/collections/constraints'
module Cuprum::Collections::Constraints
# Namespace for constraints that validate query ordering.
module Order; end
end
| 21.888889 | 59 | 0.807107 |
ac7fbc7f1652cd5fb6fc950cea38ccadcab713cd | 6,555 | # frozen_string_literal: true
require 'spec_helper'
require 'advent07'
require 'tracer'
describe Advent07 do
subject(:adv07) { described_class.new }
before do
prgs = {
'PRG1' => [3, 9, 8, 9, 10, 9, 4, 9, 99, -1, 8],
'PRG2' => [3, 9, 7, 9, 10, 9, 4, 9, 99, -1, 8],
'PRG3' => [3, 3, 1108, -... | 31.820388 | 78 | 0.564912 |
6ad7c8e460dca18fad168e007876e93ee59a26bc | 334 | require "bundler/setup"
require 'pry'
require 'spec_helper'
require 'influx_orm'
db_name = 'test'
client = InfluxDB::Client.new
RSpec.configure do |config|
config.before :all do
client.create_database db_name
end
config.before :each do
client.delete_database db_name
client.create_database db_na... | 13.916667 | 34 | 0.742515 |
03a0383d59a776a1afaf4bc2cfcd53a4f72c8716 | 1,019 | # frozen_string_literal: true
# No shebang here. Usage:
# ruby -I lib benchmark/mwm_bipartite/complete_bigraphs/benchmark.rb
require 'benchmark'
require 'graph_matching'
MIN_SIZE = 2
MAX_SIZE = 300
$stdout.sync = true
# Returns a bipartite graph that is:
#
# 1. Complete - Each vertex in U has an edge to each vert... | 23.159091 | 69 | 0.679097 |
39049d7a3bcefa4b1ab3d952e34024fb99ba3aad | 730 | cask 'jollysfastvnc' do
version '1.54'
sha256 '2d205f98db9afaef25e591166a82aab84263df9def3214eea53af423f43e8017'
url 'http://www.jinx.de/JollysFastVNC_files/JollysFastVNC.current.dmg'
appcast 'https://www.jinx.de/JollysFastVNC.update.11.i386.xml'
name 'JollysFastVNC'
homepage 'https://www.jinx.de/JollysFas... | 31.73913 | 84 | 0.686301 |
28be77a652c8d703ce08480e25664c11201ffb23 | 1,313 | # frozen_string_literal: true
require 'webmock/rspec'
WebMock.disable_net_connect!(allow_localhost: true)
RSpec.configure do |config|
config.before(:each, :external) do
# Item Search
search_response = file_fixture('amazon_corgi_search_response.xml').read
stub_request(:get, 'webservices.amazon.com/onca/... | 37.514286 | 82 | 0.66032 |
e8dc55f84f4e80c2b5bb10078f93ce547bdcbf66 | 1,076 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'omniauth/version'
Gem::Specification.new do |spec|
spec.add_dependency 'hashie', ['>= 3.4.6', '< 3.6.0']
spec.add_dependency 'rack', ['>= 1.6.2', '< 3']
spec.add_development_dependency 'bu... | 43.04 | 91 | 0.654275 |
1c8ddacd684e6e506bbc8e95ee25547834c3e6ec | 2,567 | gem 'minitest' # I feel like this messes with bundler, but only way to get minitest to shut up
require 'minitest/autorun'
require 'minitest/spec'
require 'webmock/minitest'
require 'traject'
require 'marc'
# keeps things from complaining about "yell-1.4.0/lib/yell/adapters/io.rb:66 warning: syswrite for buffered IO"... | 26.463918 | 111 | 0.712894 |
08a6656b974be2d27b1886bcdc726d9d6b637f07 | 305 | # frozen_string_literal: true
class PersonPolicy < ApplicationPolicy
def create?
user.present? && user.committer?
end
def update?
user.present? && user.committer?
end
def destroy?
user.present? && user.admin?
end
def unpublish?
user.present? && user.committer?
end
end
| 15.25 | 38 | 0.67541 |
1c04c095b0eab420431fa6d83ff2f88bcd122dc5 | 29,629 | module DuckRecord
module Associations
# Association proxies in Active Record are middlemen between the object that
# holds the association, known as the <tt>@owner</tt>, and the actual associated
# object, known as the <tt>@target</tt>. The kind of association any proxy is
# about is available in <tt>... | 33.179171 | 106 | 0.496574 |
3321bb7ded5403324e83c2ccf99aba28cdbb2fe8 | 612 | class PayloadLogEntry < ActiveRecord::Base
belongs_to :project
default_scope { order('created_at DESC') }
scope :reverse_chronological, -> () { order('created_at DESC') }
scope :recent, -> (count = 1) {
rankings = "SELECT id, RANK() OVER(PARTITION BY project_id ORDER BY created_at DESC) rank FROM payload_... | 25.5 | 119 | 0.676471 |
91220f1e8a60fc50b97533113223c10f7a8c38cc | 32,728 | require 'rubygems/test_case'
require 'stringio'
require 'rubygems/specification'
class TestGemSpecification < Gem::TestCase
LEGACY_YAML_SPEC = <<-EOF
--- !ruby/object:Gem::Specification
rubygems_version: "1.0"
name: keyedlist
version: !ruby/object:Gem::Version
version: 0.4.0
date: 2004-03-28 15:37:49.828000 +02:0... | 25.588741 | 107 | 0.660444 |
6266cfc509111764c3227b12243371862a185411 | 241 | # Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
| 40.166667 | 75 | 0.676349 |
080170595876497cd340dcd284c6cfbf53f13db6 | 3,971 | require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper"))
startup_merb
module Merb::MultipartRequestSpecHelper
def fake_file(read = nil, filename = 'sample.txt', path = 'sample.txt')
read ||= 'This is a text file with some small content in it.'
Struct.new(:read, :filename, :path)... | 44.122222 | 196 | 0.63032 |
b95af279ba72e1776528dfa19ebf612b4868f084 | 543 | class EmailValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
unless value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
record.errors[attribute] << (options[:message] || "is not an email")
end
end
end
class User < ActiveRecord::Base
validates :username, presence:... | 21.72 | 74 | 0.6593 |
b9c8f855bacaa61a7bd720099da532251f25f5ae | 640 | #
# Cookbook:: cdh_kerberos_cookbook
# Spec:: default
#
# Copyright:: 2017, The Authors, All Rights Reserved.
require 'spec_helper'
describe 'cdh_kerberos_cookbook::cdh-pseudo.rb' do
context 'When all attributes are default, on an Ubuntu 16.04' do
let(:chef_run) do
# for a complete list of available platf... | 27.826087 | 79 | 0.7125 |
1d847035d699f0d0421380c0376a6f42d7f2e877 | 146 | module Sinatra
module Environments
VERSION = "0.0.2" unless const_defined?(:VERSION)
def self.version
VERSION
end
end
end
| 13.272727 | 53 | 0.664384 |
acd795a9115c212822188759b283d5ed26182262 | 110 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'chess'
require 'rspec/collection_matchers' | 36.666667 | 58 | 0.772727 |
61121a5c9f7669708b4aea7e0cfc09f03d19e084 | 731 | Gem::Specification.new do |s|
s.name = 'fluent-plugin-sqlite3'
s.version = '1.0.2'
s.date = '2018-04-21'
s.summary = "fluentd output to sqlite3"
s.description = "fluentd output to sqlite3"
s.authors = ["Tomotaka Sakuma", "Hiroshi Hatake"]
s.email = ['ktmtmks@gmail.com', 'co... | 40.611111 | 74 | 0.636115 |
ac717b57c9ee284852055ec7e147f5712487a545 | 106 | Given /^an attack "(.*?)" exists$/ do |attack_name|
expect(Gauntlt.attacks).to include(attack_name)
end
| 26.5 | 51 | 0.707547 |
aca4c9bab33c839fb92b1d43eb3d4c69100de84f | 2,137 | # frozen_string_literal: true
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 35.616667 | 79 | 0.611605 |
e237972c8f7923373e4d867c5bdc86a77297464a | 2,578 | # frozen_string_literal: true
require "httparty"
require "json"
class Channel
ARCHES = %w[linux-32 linux-64 linux-aarch64 linux-armv6l linux-armv7l linux-ppc64le osx-64 win-64 win-32 noarch zos-z].freeze
attr_reader :timestamp
def initialize(channel, domain)
@channel_name = channel
@domain = domain
... | 27.425532 | 127 | 0.674166 |
ab4591c05e96a3dc1ee31f0a066109d3bb5e1870 | 1,861 | #
# Copyright (C) 2017 Brad Ottoson
# This file is released under the zlib/libpng license, see license.txt in the
# root directory
#
# This class contains utility functions useful for all languages.
require 'lang_profile.rb'
class UtilsBase
def initialize(langName)
@langProfile = LangProfiles.insta... | 29.539683 | 98 | 0.73079 |
ed7a04ee7df1366280164ce7da3162cc3f0c1be2 | 4,268 | # frozen_string_literal: true
require "cases/helper"
require "models/post"
module ActiveRecord
class RelationMutationTest < ActiveRecord::TestCase
(Relation::MULTI_VALUE_METHODS - [:extending, :order, :unscope, :select]).each do |method|
test "##{method}!" do
assert relation.public_send("#{method}... | 29.232877 | 142 | 0.669869 |
03404228d023cefadf21e5212fcc232a4a969a8c | 2,716 | require 'test_helper'
class RemotePagoFacilTest < Test::Unit::TestCase
def setup
@gateway = PagoFacilGateway.new(fixtures(:pago_facil))
@amount = 100
@credit_card = ActiveMerchant::Billing::CreditCard.new(
number: '4111111111111111',
verification_value: '123',
first_name: 'Juan',
... | 27.714286 | 81 | 0.667158 |
6227eda0448e2bffd7a6ff1f3d518110e6dbb00f | 405 | require 'spec_helper'
describe "bootstrap::profile::cache_docker" do
let(:node) { 'test.example.com' }
let(:facts) { {
:osfamily => 'RedHat',
:operatingsystem => 'CentOS',
:operatingsystemrelease => '7.2.1511',
:operatingsystemmajrelease => '7',
:kernelversion... | 23.823529 | 46 | 0.565432 |
01b0cd5c314b520463c783f81995704ec5b7c5ff | 292 | # frozen_string_literal: true
class ImportController < Controller
attr_accessor :filepath
def run
log 'Import votes from an external CSV'
get_input :filepath, 'Enter the filepath of the CSV file? '
voting_machine.import_votes(filepath)
log 'Votes imported!'
end
end
| 19.466667 | 63 | 0.736301 |
ff8a3a971df02159b0b132116cead00412f2db0b | 568 | require 'fireap/controller/fire'
require 'fireap/context'
require 'lib/test_config'
class TestContext
attr :ctx
def initialize
config = TestConfig.tasks # will be ctx.config
@ctx = Fireap::Context.new
end
end
describe 'Fireap::Controller::Fire#new' do
ctx = TestContext.new.ctx
config = ctx.confi... | 22.72 | 72 | 0.68838 |
4a1a01104fe25fa2c949ef0cbd5160a06bd2869a | 3,909 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 42.956044 | 146 | 0.745971 |
26166ad5b906694b86db08e2f6f4ce73580a3603 | 1,385 | #
class UsersController < ProtectedController
skip_before_action :authenticate, only: [:signup, :signin]
# POST '/sign-up'
def signup
user = User.create(user_creds)
if user.valid?
render json: user, status: :created
else
head :bad_request
end
end
# POST '/sign-in'
def signin
... | 18.716216 | 70 | 0.620939 |
bbafa9100728c5361ddb4daccf32795fe9deb845 | 1,764 | #
# Author:: Bryan W. Berry (<bryan.berry@gmail.com>)
# Cookbook Name:: java
# Recipe:: oracle
#
# Copyright 2011, Bryan w. Berry
#
# 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:... | 27.138462 | 186 | 0.712585 |
18de4355903bfc0a6594354a646e7b5abcf7b400 | 1,333 | require 'temporal/connection/serializer/continue_as_new'
require 'temporal/workflow/command'
describe Temporal::Connection::Serializer::ContinueAsNew do
describe 'to_proto' do
it 'produces a protobuf' do
command = Temporal::Workflow::Command::ContinueAsNew.new(
workflow_type: 'my-workflow-type',
... | 36.027027 | 88 | 0.691673 |
aca2e63d55ce07e7f4d0f3efde39afcb5f53958c | 345 | # encoding: utf-8
require "logstash/outputs/base"
# An dlq_output output that does nothing.
class LogStash::Outputs::DlqOutput < LogStash::Outputs::Base
config_name "dlq_output"
public
def register
end # def register
public
def receive(event)
return "Event received"
end # def event
end # class LogS... | 20.294118 | 60 | 0.736232 |
bf62b28a0028da3ac63b52106a41b42856ddc594 | 1,199 | require_relative "boot"
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "active_storage/engine"
require "action_controller/railtie"
# require "action_mailer/railtie"
require "action_mailbox/engine"
require "action_text/... | 30.74359 | 79 | 0.765638 |
f83f4923755dde0dc694287dcb08c0f8babeab3d | 280 | cask "font-copse" do
version :latest
sha256 :no_check
url "https://github.com/google/fonts/raw/main/ofl/copse/Copse-Regular.ttf",
verified: "github.com/google/fonts/"
name "Copse"
homepage "https://fonts.google.com/specimen/Copse"
font "Copse-Regular.ttf"
end
| 23.333333 | 77 | 0.710714 |
6176b4cad82fc0459b1cb01a481a43d9af9131e6 | 118 | RSpec.describe FootTraffic do
it "has a version number" do
expect(FootTraffic::VERSION).not_to be nil
end
end
| 19.666667 | 46 | 0.745763 |
ffef38f4534db4bdf1457645bf9ecb7d65718728 | 1,340 | require 'rails_helper'
describe "employers/census_employees/new.html.erb" do
before(:all) do
@user = FactoryGirl.create(:user)
p=FactoryGirl.create(:person, user: @user)
@hbx_staff_role = FactoryGirl.create(:hbx_staff_role, person: p)
end
let(:census_employee) { CensusEmployee.new }
let(:employer_p... | 36.216216 | 145 | 0.738806 |
9191e12d090c51b06c20cee7a659f15cad1af7a4 | 236 | #puts "Hello World!"
#puts "Hello Again"
#puts "I like typing this."
#puts "This is fun."
puts "Yay! Printing."
#puts "I'd much rather you 'not'."
#puts 'I "said" do not touch this.'
puts "This is the extra line requested by the book."
| 26.222222 | 52 | 0.677966 |
6a7a07762462ec5d8fd6ecf4e7bc0dea7adfbbf3 | 820 | require 'rails_helper'
RSpec.feature 'Add Transaction', type: :feature do
login_user
background do
@category = FactoryBot.create(:category, user: @user)
end
given(:activity) { FactoryBot.build(:activity) }
scenario 'Transaction with valid inputs' do
visit new_activity_path
within 'form' do
... | 24.848485 | 62 | 0.7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.