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 |
|---|---|---|---|---|---|
b9f1e71b3aaea9c86ed19cc9f9aa6a83457b5c10 | 4,428 | require 'pathname'
Puppet::Type.newtype(:dsc_xd7storefrontunifiedexperience) 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 XD7StoreFrontUnifiedExperience resource type.
... | 31.856115 | 140 | 0.682023 |
18cc5fb197e29f311597c484d5e9c1eba877aafd | 136 | # Be sure to restart your server when you modify this file.
Moya::Application.config.session_store :cookie_store, key: '_moya_session'
| 34 | 74 | 0.794118 |
0110246c373702816fb76e620de5d2e8cd0e9398 | 5,471 | require 'rails_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to specify the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold... | 33.359756 | 100 | 0.67282 |
61978c47eeb959767128e373dd982250d149f8cb | 8,348 | # encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
require 'new_relic/agent/datastores/metric_helper'
module NewRelic
module Agent
#
# This module contains helper methods to facilitate instrumentation ... | 39.563981 | 127 | 0.64758 |
ed3c4318794a87cd1a132b4a2e20d6ebecec7b05 | 747 | # frozen_string_literal: true
class QueryDelegator
module MemoryFetching
# Returns the first record that meets the +condition+, otherwise
# returns the given +block value+ or
# returns +nil+ by default unless a second argument is specified.
def fetch(condition, default_value = nil)
grep(conditi... | 33.954545 | 118 | 0.720214 |
e99920d53ff4a32e54ebbf162d2a10201f9240e9 | 490 | # Rake tasks used to update the aasm_state of the employer to enrolled && plan year aasm state to enrolled.
# To run rake task: RAILS_ENV=production bundle exec rake migrations:link_employees_to_employer ce=57644137f1244e0adf000011,57644137f1244e0adf000005
require File.join(Rails.root, "app", "data_migrations", "link_e... | 61.25 | 148 | 0.828571 |
b906013285782c832b2a1f5ba40b0f7fff5b611b | 850 | cask :v1 => 'coda' do
version '2.5.12'
sha256 '3bcb4a1f99a47edd087b9579c206a38cecae1a31287e84121c5775b8752a8c3f'
url "https://download.panic.com/coda/Coda%20#{version}.zip"
name 'Coda'
homepage 'https://panic.com/Coda/'
license :commercial
tags :vendor => 'Panic'
zap :delete => [
'~/Library/Applic... | 32.692308 | 76 | 0.710588 |
1c20072dfa5bd1c1f4dc93945fe2c69ed78372ea | 1,547 | module SessionsHelper
def log_in(user)
session[:user_id] = user.id
end
def log_out
user = current_user
forget(user)
session.delete(:user_id)
@current_user = nil
end
def current_user
if (user_id = session[:user_id])
@current_user ||= User.find_by(id: user_id)
elsif (user_id ... | 23.089552 | 80 | 0.660633 |
f7caa43ac88fe614edee37562a17bff1b2591ac5 | 1,238 | require 'rails/generators/active_record'
module ActiveRecord
module Generators
class ModelGenerator < Base
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
check_class_collision
class_option :migration, :type => :boolean
class_option :timestamps... | 30.95 | 129 | 0.65105 |
01243648e7817f3310efc103af8a974cd5799518 | 5,257 | # frozen_string_literal: true
describe 'Ridgepole::Client#diff -> migrate' do
context 'when rename table' do
let(:actual_dsl) do
erbh(<<-ERB)
create_table "clubs", force: :cascade do |t|
t.string "name", default: "", null: false
t.index ["name"], name: "idx_name", unique: true
... | 37.021127 | 150 | 0.562108 |
03f3c2cd549bb2f614df5ab7f61d1248a6eab4a8 | 1,007 | require "rails_helper"
include Warden::Test::Helpers
include FormAnswerFilteringTestHelper
Warden.test_mode!
describe "As Assessor I want to filter applications", js: true do
let!(:assessor) { create(:assessor) }
let!(:ceremonial_county) { create(:ceremonial_county) }
before do
@forms = []
4.times do
... | 23.97619 | 106 | 0.722939 |
1afa1f51b379e58d9370b146c9108055686e0951 | 141 | class RemoveUserFromBook < ActiveRecord::Migration
def change
remove_reference :books, :user, index: true, foreign_key: true
end
end
| 23.5 | 66 | 0.765957 |
d5c5618540de2d7b7278126db42a099a20458e2a | 1,595 | # vFabric Administration Server Ruby API
# Copyright (c) 2012 VMware, Inc. 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... | 32.55102 | 148 | 0.739185 |
626da622812eae3931f4830263b6ffccf511988a | 451 | module PactBroker
module Pacts
module LazyLoaders
HEAD_PACT_PUBLICATIONS_FOR_TAGS = lambda {
consumer_version_tag_names = PactBroker::Domain::Tag.select(:name).where(version_id: consumer_version_id)
PactPublication
.for_consumer(consumer)
.for_provider(provider)
... | 30.066667 | 113 | 0.682927 |
e2f894a34808dec24998cb7435ec637e237e071f | 1,113 | $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require './test/replica_sets/rs_test_helper'
class ComplexConnectTest < Test::Unit::TestCase
def setup
ensure_rs
end
def teardown
@rs.restart_killed_nodes
@conn.close if defined?(@conn) && @conn
end
def test_complex_connect
prima... | 24.195652 | 60 | 0.621743 |
1cda0f198d65ce51d7f95a5becb23bf6b61e868b | 6,041 | require 'alki/feature_test'
describe 'Overlays' do
it 'should allow setting an overlay on a service' do
values = []
assembly = Alki.create_assembly do
service :svc do
:test
end
overlay :svc, :test_overlay
set :test_overlay, ->(value) {values << value; :transformed}
end
... | 23.057252 | 79 | 0.606025 |
1c456e4c8d397cd7b018dde7fd2d15c152cf85ee | 4,920 | require_relative '../test_helper'
class XmlFormatTest < Test::Unit::TestCase
ERROR_DIR = File.join('tmp', 'errors', 'XmlFormatTest')
ERROR_LOSSY_DIR = File.join('tmp', 'errors', 'XmlLossinessTest')
EXAMPLE_ROOT = File.join('lib', 'fhir_stu3_models', 'examples', 'xml')
# Automatically generate one test method ... | 37.846154 | 151 | 0.690447 |
2615bd6bda36c281602692ce0185b27af7d635d4 | 717 | class TreeBuilderOpsDiagnostics < TreeBuilderOps
private
def tree_init_options(_tree_name)
{
:open_all => true,
:leaf => "Diagnostics"
}
end
def set_locals_for_render
locals = super
locals.merge!(:autoload => true)
end
def root_options
region = MiqRegion.my_region
... | 29.875 | 120 | 0.504881 |
4a4b0235c2d2c1598309e420f5a64f86d13414e7 | 994 | class Staff::TwentySevenForm
include ActiveModel::Model
attr_accessor :twenty_seven
delegate :persisted?, :save, to: :twenty_seven
def initialize(twenty_seven = nil)
@twenty_seven = twenty_seven
@twenty_seven ||= TwentySeven.new
end
def assign_attributes(params = {})
@params = params
... | 47.333333 | 566 | 0.741449 |
2627b34feb13ac6c46a8c290f9be14b89b09fe5e | 3,137 | #-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2021 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork ... | 29.87619 | 95 | 0.744661 |
016e20b528af0cef03570f41db5b8b6adce72bbb | 1,082 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'logfile_interval/version'
Gem::Specification.new do |spec|
spec.name = "logfile_interval"
spec.version = LogfileInterval::VERSION
spec.authors = ["Philippe Le Rohellec"... | 40.074074 | 79 | 0.680222 |
21decd3d45957c6ff7496640c95c296b72e821a0 | 4,616 | class Workout < ActiveRecord::Base
attr_accessor :intensity
belongs_to :log_entry
has_many :completed_workouts, :dependent => :destroy
has_many :planned_workouts, :dependent => :destroy
has_many :messages, :dependent => :destroy
accepts_nested_attributes_for :completed_workouts
accepts_nested_attributes_f... | 26.377143 | 99 | 0.678293 |
874d5fd410898f1b26d3d7d131a3681e348b4c0a | 1,575 | require_relative '../test_helper'
class ControllerTest < MiniTest::Test
def setup
@controller = ControllerStub.new
@controller.current_user = :someone
@controller.params = {id: 1, name: 'Hello'}
end
def test_create
# The resource that the controller should create.
obj = Minitest::Mock.new
... | 26.25 | 97 | 0.696508 |
01724caa6976e3415fec7a4d6e0060072a03e7d0 | 839 | # encoding: utf-8
require 'faraday'
require 'bitbucket_rest_api/error'
module BitBucket
class Response::RaiseError < Faraday::Response::Middleware
def on_complete(env)
case env[:status].to_i
when 400
raise BitBucket::Error::BadRequest.new(env)
when 401
raise BitBucket::Error::... | 26.21875 | 60 | 0.665077 |
f8ebcb060c14063382ae320c386aa5b8c03efe5d | 600 | require 'httparty'
require 'hashie'
module SgDeliverySlotChecker
module Stores
class Giant
def initialize(postal_code:)
@postal_code = postal_code
end
def available?
get_availability
end
private
attr_reader :postal_code
def get_availability
r... | 20 | 116 | 0.661667 |
38208361c745416a3fa98e44baf20c77d442c373 | 6,496 | require 'sinatra'
require 'json'
require 'webrick'
require 'webrick/https'
require 'openssl'
CERT_PATH = ENV['CERT_PATH']
if CERT_PATH.nil? || !File.exists?(CERT_PATH+'/hapi.crt')
puts "set CERT_PATH env var to where your hapi.crt and hapi.key are"
exit 1
end
webrick_options = {
:Host => "0.... | 25.47451 | 112 | 0.581589 |
1ccad11ef8827966c97c32c2a5c188de52af5068 | 1,245 | # coding: utf-8
bigdecimal_version = '1.3.5'
Gem::Specification.new do |s|
s.name = "bigdecimal"
s.version = bigdecimal_version
s.authors = ["Kenta Murata", "Zachary Scott", "Shigeo Kobayashi"]
s.email = ["mrkn@mrkn.jp"]
s.summary = "Arbitrary-precision decimal floating-p... | 31.125 | 100 | 0.677108 |
081a7806846d7bcd74f696bd7128279987ad87e7 | 7,875 | #======================== Change in Electricity Baseload Analysis =============
require_relative 'alert_electricity_only_base.rb'
class AlertChangeInElectricityBaseloadShortTerm < AlertElectricityOnlyBase
MAXBASELOADCHANGE = 1.15
attr_reader :average_baseload_last_year_kw, :average_baseload_last_week_kw
attr_re... | 40.178571 | 141 | 0.715683 |
21fad3d74c9d20f455fa61934c12a789ba4ce3c6 | 715 | Pod::Spec.new do |s|
s.name = 'AWSCloudWatch'
s.version = '2.9.1'
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 = 'htt... | 39.722222 | 157 | 0.613986 |
f76964e2c093fcd1cadb3097456f7736d85df961 | 2,150 | describe 'Conditionally required fields', js: true do
before do
login
end
context 'when viewing an empty form' do
let(:draft) { create(:empty_variable_draft, user: User.where(urs_uid: 'testuser').first) }
context 'when viewing a form with always required fields' do
before do
visit edit... | 28.289474 | 94 | 0.637209 |
b98e903c9c469b18207199dc29f16c7a10967ec5 | 670 | module TokenAuthenticatable
extend ActiveSupport::Concern
included do
before_filter :authenticate_player_from_token!
before_filter :authenticate_player!
end
private
def authenticate_player_from_token!
auth_token = params[:auth_token].presence
player = auth_token && Player.find_by_aut... | 25.769231 | 85 | 0.723881 |
28a2586ff8d365c454c7bd9028a9a7c872ad5f61 | 572 | FactoryBot.define do
factory :feedback_comment, class: Comment do
account
content { generate :lorem_ipsum }
name { "feedback" }
term
commentable { create(:submission) }
end
factory :notes_comment, class: Comment do
account
content { generate :lorem_ipsum }
name { "internal_notes" ... | 22 | 50 | 0.674825 |
62af6c95fd2e83347c6b7d648bc193ecd770cac3 | 1,959 | #
# Author:: Stephan Renatus <srenatus@chef.io>
# Copyright:: Copyright (c) 2016 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://www.apache.org/licenses/LIC... | 33.775862 | 90 | 0.764676 |
62db907c56302199d354075338f3495cbfdc80b6 | 627 | module Leg
module Markdown
class HTMLRouge < Redcarpet::Render::HTML
include Rouge::Plugins::Redcarpet
end
HTML_RENDERER = HTMLRouge.new(with_toc_data: true)
MARKDOWN_RENDERER = Redcarpet::Markdown.new(HTML_RENDERER, fenced_code_blocks: true)
def self.render(source)
html = MARKDOWN_R... | 29.857143 | 88 | 0.583732 |
911d13dd4141ed8a491314fba4572fb023b69023 | 250 | module Kubes::Docker::Strategy::Build
class Docker < Base
def perform
params = args.flatten.join(' ')
command = "docker build #{params}"
run_hooks("docker.rb", name: "build") do
sh(command)
end
end
end
end
| 20.833333 | 46 | 0.596 |
f82d8c17e6b1dd109cae8603e3a60e46adf3c48c | 93 | # desc "Explaining what the task does"
# task :acts_as_rateable do
# # Task goes here
# end | 23.25 | 38 | 0.709677 |
87431cde248017630e5051fad46ffd2dd904604b | 3,050 | # frozen_string_literal: false
# @!parse
# class ActiveRecord::Migration
# # Create a composite type
# #
# # @param [#to_s] name (nil) The qualified name of the type
# # @option options [#to_s] :comment (nil) The comment describing the constraint
# # @yield [t] the block with the type's definitio... | 29.326923 | 84 | 0.540328 |
f8cc07f2d083b5f4643e2e304ae32f09401689f1 | 1,562 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe MemoizeBlock, '#memoize' do
let(:memoized_name) { nil }
let(:returned_value) { 'default' }
let(:action) { ->(returned) { return returned } }
def memoize_result
memoize(memoized_name) do
action.call(returned_value)
end
end
c... | 24.40625 | 103 | 0.670935 |
bf1ee7698781159b2ee23e51235675a2f72a5125 | 755 | module HealthSeven::V2_7_1
class Ndl < ::HealthSeven::DataType
# Name
attribute :name, Cnn, position: "NDL.1"
# Start Date/time
attribute :start_date_time, Dtm, position: "NDL.2"
# End Date/time
attribute :end_date_time, Dtm, position: "NDL.3"
# Point of Care
attribute :point_of_care, Is, position: "NDL... | 29.038462 | 57 | 0.692715 |
38566f64accf003aa84209513a39ed127880f0b0 | 2,868 | ##
# $Id$
##
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##
require 'msf/core'
class Metasploit3 < Msf::Au... | 28.117647 | 150 | 0.615063 |
1810e44ce706c7c7383830de4a00e36785999cee | 2,407 | # Copyright (c) 2018 Public Library of Science
# 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 without restriction, including without limitation
# the rights to use, copy, modify, merge, pub... | 34.884058 | 92 | 0.738679 |
21c7be285a572bc1316062c15eeba5c1a23367cd | 28,684 | # -*- coding: binary -*-
require 'rex/post/meterpreter/packet'
require 'rex/post/meterpreter/core_ids'
require 'rex/post/meterpreter/extension'
require 'rex/post/meterpreter/extension_mapper'
require 'rex/post/meterpreter/client'
# certificate hash checking
require 'rex/socket/x509_certificate'
require 'openssl'
m... | 29.848075 | 140 | 0.68404 |
e27e4fa758e5eade7f7cf4b6a0019b2ff75925ef | 973 | require "rails_helper"
RSpec.describe Admin::TeamsController, type: :controller do
let(:admin) { create(:admin) }
let(:user) { create(:user) }
context "as admin user" do
before :each do
create(:registry)
sign_in admin
end
describe "GET #index" do
it "paginates teams" do
g... | 19.46 | 62 | 0.610483 |
1ab8af48bd99f251aaaf0625b86f5d8c94ab94a3 | 440 | require_relative 'meta'
require_relative 'range'
require_relative 'hour_range'
class RentalPlan
attr_reader :ranges
def self.make name
make_meta name
make_ranges
new @meta, @ranges
end
def self.make_meta name
@meta = Meta.new name
end
def self.make_ranges
@ranges = [ PlanRange.make ]... | 13.75 | 32 | 0.679545 |
ab8fd73ffc245b1b6a727eb1a7645da141a1074d | 404 | # frozen_string_literal: true
class Analytics < ApplicationRecord
scope :hits_by_ip, ->(ip, col = "*") { select("#{col}").where(ip_address: ip).order("id DESC")}
def self.count_by_col(col)
calculate(:count, col)
end
def self.parse_field(field)
valid_fields = ["ip_address", "referrer", "user_agent"]
... | 21.263158 | 97 | 0.65099 |
625cf1fb985cff03036d634d08cfa56e352b8633 | 216 | module Payjp
class Customer < APIResource
include Payjp::APIOperations::Create
include Payjp::APIOperations::Delete
include Payjp::APIOperations::Update
include Payjp::APIOperations::List
end
end
| 24 | 40 | 0.75463 |
871cf1f0b92d543abaa5c16f8761f58c106337bf | 160 | require 'bundler'
Bundler.require :default, ENV['RACK_ENV'] || ENV['RAILS_ENV'] || :development
require './lib/banner_syncinator'
BannerSyncinator.initialize!
| 26.666667 | 77 | 0.7625 |
219fd92bd73292fa662d8652a70b23908c5a0504 | 7,053 | #! /usr/bin/ruby
# coding: utf-8
$: << File.dirname(__FILE__) + '/../lib'
#require 'rubygems'
require 'test/unit'
require 'ole/storage'
require 'digest/sha1'
require 'stringio'
require 'tempfile'
#
# = TODO
#
# These tests could be a lot more complete.
#
# should test resizeable and migrateable IO.
class TestStora... | 31.77027 | 105 | 0.726641 |
26dd81bde58a587f6531c0a91f8dfea7c93457f7 | 181 | if ENV['COVERAGE']
require 'simplecov'
SimpleCov.start
end
require File.expand_path('../lib/web_translate_it', __dir__)
require 'rspec'
class I18n
def self.reload!; end
end
| 15.083333 | 60 | 0.740331 |
ac09771781aada4917633737db8ab228e3392c31 | 1,423 | require 'rails_helper'
describe PivCacAuthenticationSetupPresenter do
let(:user) { create(:user) }
let(:presenter) { described_class.new(user, false, form) }
let(:form) do
OpenStruct.new
end
describe '#title' do
let(:expected_title) { t('titles.piv_cac_setup.new') }
it { expect(presenter.title)... | 26.849057 | 78 | 0.669712 |
080840b7350b95df79f2fb56974c4e1869b569fe | 508 | name 'kernel_module'
maintainer 'Chef Software, Inc.'
maintainer_email 'cookbooks@chef.io'
license 'MIT'
description 'Load kernel modules'
version '1.1.4'
%w(amazon centos debian fedora oracle redhat scientific suse opensuse opensuseleap ubuntu).each do |os|
supports os... | 33.866667 | 103 | 0.716535 |
ffefb912b1048b78e4649c8cfc7c24e66d58d978 | 21,077 | # 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... | 41.819444 | 269 | 0.727238 |
113b1964c4834967b60db8b9ff2f56e80ff09440 | 2,139 |
class OutdoorController < ApplicationController
skip_before_filter :authorize
include OutdoorHelper
def index
@buildings = Building.order(:name)
@nearest_locations = Location.all
# Google Map
@users = [Building.first]
@hash = Gmaps4rails.build_markers(@users) do |user, marker|
marker... | 25.164706 | 104 | 0.661992 |
0842427760ffdf43e54e06b3c055751a90e3167c | 3,804 | # frozen_string_literal: true
require 'test/unit'
require_relative 'scheduler'
class TestFiberMutex < Test::Unit::TestCase
def test_mutex_synchronize
mutex = Mutex.new
thread = Thread.new do
scheduler = Scheduler.new
Fiber.set_scheduler scheduler
Fiber.schedule do
assert_not_predi... | 17.21267 | 100 | 0.590694 |
7a7bc9b27d24f95bfdf8f57f6b33a4bc5eb013a2 | 50 | json.array! @alerts, partial: 'alert', as: :alert
| 25 | 49 | 0.68 |
03590648ddfd16c13143119efd532385512ab928 | 4,538 | require 'brakeman/processors/lib/basic_processor'
class Brakeman::FindAllCalls < Brakeman::BasicProcessor
attr_reader :calls
def initialize tracker
super
@current_class = nil
@current_method = nil
@in_target = false
@calls = []
@cache = {}
end
#Process the given source. Provide either... | 22.136585 | 79 | 0.598281 |
edf78f62f9a213f21b10ce8abb7243150ea1c6b9 | 2,631 | class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
step 'project has deploy key' do
create(:deploy_keys_project, project: @project)
end
step 'I should see project deploy key' do
page.within '.deploy-keys' do
... | 29.897727 | 430 | 0.749525 |
26e10c64297c0444ae0b1b93c17a59ed428e3263 | 1,524 | require 'test_helper'
class TranscriptLinesControllerTest < ActionController::TestCase
setup do
@transcript_line = transcript_lines(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:transcript_lines)
end
test "should create transcript_line" do
... | 38.1 | 382 | 0.778871 |
016e81d12ceafd967bebf55f0a3a09e3b197e76f | 19,091 | #--
# Author:: Adam Jacob (<adam@chef.io>)
# Author:: Thom May (<thom@clearairturbulence.org>)
# Author:: Nuo Yan (<nuo@chef.io>)
# Author:: Christopher Brown (<cb@chef.io>)
# Author:: Christopher Walters (<cw@chef.io>)
# Author:: Daniel DeLeo (<dan@chef.io>)
# Copyright:: Copyright 2009-2018, Chef Software Inc.
# Lice... | 35.353704 | 155 | 0.659211 |
61728b4ca9474124ff41d772205a7f9075286552 | 7,226 | # frozen_string_literal: true
module Inferno
module Generator
class USCoreUnitTestGenerator
def tests
@tests ||= Hash.new { |hash, key| hash[key] = [] }
end
def generate(sequence, path, module_name)
template = ERB.new(File.read(File.join(__dir__, 'templates', 'unit_tests', 'uni... | 37.440415 | 133 | 0.649045 |
f76548648695ed6f4c7456dfbbdf0949c149020c | 60 | module ConcertoWeather
module ApplicationHelper
end
end
| 12 | 26 | 0.833333 |
f744ee3c7a3e201f37d5b496fd35a35cd48d2b9e | 855 | require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)
describe "Kernel#instance_variables" do
describe "immediate values" do
it "returns an empty array if no instance variables are defined" do
0.instance_variables.should == []
end
it "... | 30.535714 | 84 | 0.692398 |
e9d2e64d0f1196c5b825e5a775c0ed7eb2c185ec | 131 | class RemoveUseridFromPackage < ActiveRecord::Migration[5.0]
def change
remove_column :packages, :user_id, :string
end
end
| 21.833333 | 60 | 0.763359 |
1ae66b2671130fa584d957d55e13c1215e9ed9a0 | 249 | Kaminari.configure do |config|
config.default_per_page = 25
config.max_per_page = 100
config.window = 2
# config.outer_window = 0
# config.left = 0
# config.right = 0
# config.page_method_name = :page
# config.param_name = :page
end
| 22.636364 | 35 | 0.698795 |
38b760a26ac52497b0bf8171fd448d79e18584db | 3,095 | # 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::V2019_04_01
module Models
#
# Result of the request to list all P2SVpnServerConfigurations associated
# to a Virt... | 30.048544 | 80 | 0.557997 |
7a3659c128fdda56c42382161366070a259fc030 | 247 | require "sprockets"
require "sprockets/es6"
require "roger_sprockets/version"
module RogerSprockets; end
# Load modules
require File.dirname(__FILE__) + "/roger_sprockets/middleware"
require File.dirname(__FILE__) + "/roger_sprockets/processor"
| 24.7 | 62 | 0.805668 |
79d9aa706074a30da2a80cc1ef85ecc140230c4f | 3,116 | # frozen_string_literal: true
# The Jak namespace
module Jak
# The MyAbility Class which is the child of JakAbility
class MyAbility < JakAbility
def initialize(resource, &block)
# Invoke Jak Ability methods
super do
instance_eval(&block) if block_given?
end
# Bail out early
... | 45.823529 | 221 | 0.667202 |
61bd8a1c0e73022150135a4f8d2b3a3d945c41ff | 14,013 | begin
require 'pry'
rescue LoadError
end
require 'thor'
require 'frank-cucumber/launcher'
require 'frank-cucumber/console'
require 'frank-cucumber/frankifier'
require 'frank-cucumber/mac_launcher'
require 'frank-cucumber/plugins/plugin'
require 'xcodeproj'
module Frank
class CLI < Thor
include Thor::Actions
... | 36.492188 | 284 | 0.651752 |
ff7da39a7ba452940f4101f006112b17a82e3a0e | 2,045 | require 'test_helper'
class UserTest < ActiveSupport::TestCase
def setup
@user = User.new(name: "Example User", email: "user@example.com", password: "foobar", password_confirmation: "foobar")
end
test "should be valid" do
assert @user.valid?
end
test "name should be present" do
@user.name = " "
... | 28.402778 | 122 | 0.68802 |
01c549fa4a3c6ca5aac376fde52ee3b0ba64fe3c | 1,072 | class Socat < Formula
desc "netcat on steroids"
homepage "http://www.dest-unreach.org/socat/"
url "http://www.dest-unreach.org/socat/download/socat-1.7.3.2.tar.gz"
sha256 "ce3efc17e3e544876ebce7cd6c85b3c279fda057b2857fcaaf67b9ab8bdaf034"
bottle do
cellar :any
sha256 "63cba17ba8512ae70e018d6e918b67e4d... | 32.484848 | 92 | 0.738806 |
62f7a738045c338736b769ccb7c19d33a2176883 | 6,752 | class Releaf::Builders::TableBuilder
include Releaf::Builders::Base
include Releaf::Builders::Toolbox
attr_accessor :collection, :options, :template, :resource_class
def initialize(collection, resource_class, template, options)
self.collection = collection
self.options = options
self.template = tem... | 23.526132 | 96 | 0.674467 |
1146ac3fb2c2c3aed00d65a8f4bd30976f16bf41 | 811 | require "test_helper"
class Stats::ConversationTest < ActiveSupport::TestCase
setup do
Conversation.create!(developer: developers(:one), business: businesses(:one))
end
test "#sent counts all conversations" do
stats = Stats::Conversation.new(Conversation.all)
assert_equal 2, stats.sent
end
test... | 28.964286 | 81 | 0.749692 |
4aa2a0eaed6e06e61964254843984d8e0fd69866 | 152 | #
# Cookbook:: build_cookbook
# Recipe:: syntax
#
# Copyright:: 2017, Exosphere Data, LLC, All Rights Reserved.
include_recipe 'delivery-truck::syntax'
| 21.714286 | 61 | 0.743421 |
f8556e2e2a4735933eeaf2f1355dfb5604d503c6 | 590 | Numeric.unit = 20 # set to 1 for export at real scale, 10 or more for designing
GRID = true # turn on or off the grid lines
union do
difference do
union do
union do
(n_teeth = 4).times do |t|
a = 180.0 / n_teeth * t
rect(~2, ~16)[~-1, ~-8].rotate(a)
end
end
... | 22.692308 | 79 | 0.538983 |
39c0ce363555f8f0621868ff580d9fc2dc26be16 | 62 | json.partial! "categoria/categorium", categorium: @categorium
| 31 | 61 | 0.806452 |
2690caa8987129904ff66fe9890a193614513df9 | 4,077 | # frozen_string_literal: true
require_relative '../../../../src/bin/helpers/gitlab/chart.rb'
require 'tmpdir'
describe Gitlab::Chart do
describe '.load_from_helm_ls' do
subject { described_class.load_from_helm_ls(data, release_name) }
let(:release_name) { 'production' }
let(:data) do
<<~EOS
... | 25.803797 | 92 | 0.566348 |
6a243f28a1e26a0c4bc201f493c6f1ce1e5d28ea | 366 | module Stealth
module Services
module Messagebird
class MessagebirdServiceMessage < Stealth::ServiceMessage
attr_accessor :conversation_id,
:messagebird_id,
:platform,
:display_name,
:first_name,
... | 22.875 | 63 | 0.513661 |
088debb33ebea106ca066a3259b82359aae83dc5 | 686 | # Copyright 2014 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, ... | 32.666667 | 74 | 0.765306 |
6245c3e15ff0b0802add9c2b859a83cfa698fa5d | 1,403 | #-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2014 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,... | 35.974359 | 91 | 0.756237 |
61c0bb0cbb43aa64dec2be59a129387f12bdd560 | 1,972 | require 'thread'
require 'timeout'
module Rbgo
using CoRunExtensions
class TaskList
attr_accessor :last_error
def <<(task)
task_queue << task
self
end
def add(task, timeout: nil, skip_on_exception: false)
task_queue << proc do |last_task_result|
begin
Timeout:... | 19.333333 | 77 | 0.56643 |
08647c91333c439e68ed1f9dc1be9dc8a9b3dcd8 | 872 | require 'yaml'
def _spawner2(_name, _modelURI, _worldName, _x, _y, _z, _roll, _pitch, _yaw, _additionalSDF='')
base_spawn = `rospack find ctu_cras_norlab_absolem_sensor_config_1`.chomp + "/launch/common.rb"
begin
load base_spawn
rescue LoadError
raise "Unknown robot configuration #{_modelURI}. #{base_sp... | 37.913043 | 266 | 0.751147 |
26619c222912b6bd99d7070b2fb922c84ab32742 | 319 | require "../lib/Goofy"
require "goofy/contrib"
Goofy.plugin Goofy::Mote
ITEMS = ("A".."Z").to_a
Goofy.send :remove_const, :Response
Goofy::Response = Rack::Response
Goofy.define do
def mote_vars(content)
{ content: content }
end
on default do
res.write view("home", list: ITEMS)
end
end
run Goofy
| 14.5 | 39 | 0.683386 |
4a23e5a825e6ffb1b4416e875ddf5f3bc2052e21 | 1,469 | require 'hanami/utils/file_list'
module Hanami
module Assets
# Requested asset
#
# @since 0.8.0
# @api private
class Asset
# @since 0.8.0
# @api private
PUBLIC_DIRECTORY = Hanami.public_directory.join('**', '*').to_s.freeze
# @since 0.8.0
# @api private
URL_SE... | 20.402778 | 76 | 0.533696 |
010392ccda2918d171abb36d5fbd9ab7023e31fc | 1,295 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
Gem::Specification.new do |spec|
spec.name = 'aws-sdk-codepipeline... | 39.242424 | 125 | 0.671042 |
625b7f07ac0f3d5f575e271f358d2548a00653aa | 3,130 | class Libspatialite < Formula
desc "Adds spatial SQL capabilities to SQLite"
homepage "https://www.gaia-gis.it/fossil/libspatialite/index"
revision 8
stable do
url "https://www.gaia-gis.it/gaia-sins/libspatialite-sources/libspatialite-4.3.0a.tar.gz"
mirror "https://ftp.netbsd.org/pub/pkgsrc/distfiles/l... | 36.823529 | 141 | 0.715335 |
b94a65aa929027eee21337ec0c35b2bcdb77f8e0 | 4,211 | # frozen_string_literal: true
require_relative "error"
module Ensql
class << self
# Get the current connection adapter. If not specified, it will try to
# autoload an adapter based on the availability of Sequel or ActiveRecord,
# in that order.
#
# @example
# require 'sequel'
# E... | 33.420635 | 122 | 0.6692 |
616a14265b6ad3ef5656b52f4a2e42709d5466a7 | 12,663 | # A bunch of helpers for efficiently generating select options for taggable
# content, e.g. topics, organisations, etc.
module Admin::TaggableContentHelper
# Returns an Array that represents the current set of taggable topics.
# Each element of the array consists of two values: the name and ID of the
# topic.
... | 45.714801 | 167 | 0.765932 |
1ac86d10d6f6aac14b3108f28cdbaaa9dadbc405 | 3,165 | module ActionDispatch
module Journey # :nodoc:
class Router # :nodoc:
class Utils # :nodoc:
# Normalizes URI path.
#
# Strips off trailing slash and ensures there is a leading slash.
# Also converts downcase URL encoded string to uppercase.
#
# normalize_pat... | 31.65 | 98 | 0.524171 |
e8126a38e218a7e76352d4b5f0ee224ef12f711c | 3,066 | # 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::DataFactory::Mgmt::V2018_06_01
module Models
#
# A copy activity Phoenix server source.
#
class PhoenixSource < TabularSourc... | 27.872727 | 70 | 0.445205 |
396946ba834efc69e16992fc8c4878819dd0c619 | 1,908 | # frozen_string_literal: true
module CurrentUser
extend ActiveSupport::Concern
included do
helper_method :current_user
around_action :login_user
# we record with reliable reset
skip_before_action :set_paper_trail_enabled_for_controller
skip_before_action :set_paper_trail_controller_info
end
... | 22.447059 | 116 | 0.726939 |
e2985e945e9ade1b368c62905e8d4e0f09b0a380 | 258 | class AddUniqueConstraintToProfessionalLearningPartners < ActiveRecord::Migration[5.0]
def change
change_table :professional_learning_partners do |t|
t.remove_index column: :name
t.index [:name, :contact_id], unique: true
end
end
end
| 28.666667 | 86 | 0.748062 |
4a406bb48758d7d20bdf6191e3944177d62adea0 | 102 | class ApplicationMailer < ActionMailer::Base
default from: 'contact@one.work'
layout 'mailer'
end
| 20.4 | 44 | 0.764706 |
d5f618799d59404cc8d58279c71a919933a0ef8e | 2,488 | #=========================================================================
#
# Copyright NumFOCUS
#
# 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/license... | 31.1 | 83 | 0.706994 |
8760019dad155ad4e118e0b1b914c3bd984ae3d2 | 1,587 | #
# Be sure to run `pod lib lint YMNetworking.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'YMNetwo... | 36.906977 | 110 | 0.637681 |
08136a6559096d1c84f7506bf9d0130053d5e845 | 72 | module ModulePos
module Fiscalization
VERSION = "0.1.0"
end
end
| 12 | 22 | 0.694444 |
0166e00f176cf0310ad930f4ae7c055bf0f156a3 | 913 | # frozen_string_literal: true
class Flor::Pro::Reverse < Flor::Procedure
#
# Reverses an array or a string.
#
# ```
# reverse [ 0, 2, 4 ]
# # --> sets f.ret to [ 4, 2, 0 ]
# reverse "melimelo"
# # --> sets f.ret to "olemilem"
# ```
#
# Reverses f.ret if there are no arguments
# ```
# [ 5,... | 17.557692 | 78 | 0.561884 |
f89aa708b78381824efb3aed6b3e454eca6a71a1 | 20,343 | # depends on: module.rb class.rb
##
# The Enumerable mixin provides collection classes with several traversal
# and searching methods, and with the ability to sort. The class must provide
# a method #each, which yields successive members of the collection. If
# Enumerable#max, #min, or #sort is used, the objects ... | 28.332869 | 79 | 0.552967 |
038ed5f78e31787f4302c9b6b05d00ab5d5c2599 | 732 | require File.dirname(__FILE__) + '/test_helper'
class TestGemspec < Test::Unit::TestCase
context "A Jeweler::GemSpec, given a gemspec" do
setup do
@spec = build_spec
@helper = Jeweler::GemSpecHelper.new(@spec, File.dirname(__FILE__))
end
should 'have sane gemspec path' do
assert_equal ... | 22.181818 | 73 | 0.650273 |
b9a16618ff5f56ade398737b2143677b3d527fff | 279 | namespace :npm do
desc 'exec `npm install`'
task :install do
puts system('npm install')
end
desc 'exec `npm run build`'
task build: ['install'] do
puts system('npm run build')
end
end
Rake::Task['assets:precompile'].enhance(['npm:build']) do
# doing!
end
| 17.4375 | 57 | 0.648746 |
b9d234534c998ca74bb46e11fdb7e4b5dca224f7 | 2,537 | require 'fireeagle/version'
AUTHOR = 'Jesse Newland' # can also be an array of Authors
EMAIL = "jnewland@gmail.com"
DESCRIPTION = "Ruby wrapper for Yahoo!'s FireEagle"
GEM_NAME = 'fireeagle' # what ppl will type to install your gem
RUBYFORGE_PROJECT = 'fireeagle' # The unix name for your project
HOMEPATH = "http://#{... | 36.242857 | 186 | 0.662594 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.