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 |
|---|---|---|---|---|---|
d57c65fd185661577b49f0e5b43d2db6f7265ebc | 589 | require File.dirname(__FILE__) + '/test_helper.rb'
class TestNicovideoRanking < Test::Unit::TestCase
def setup
account = YAML.load_file(ENV['HOME'] + '/.nicovideo/account.yml')
@nv = Nicovideo.new(account['mail'], account['password'])
@nv.login
end
def test_ranking_valid
rv = nil
assert_n... | 18.40625 | 69 | 0.617997 |
613d11afd5a63b487c2c6cc36b436ad6f9c9eb96 | 113 | #!/usr/bin/env jruby
require_relative "../helper"
describe Doubleshot::Dependencies::JarDependencyList do
end
| 14.125 | 55 | 0.778761 |
91e53d4fccd5191d15123e242f326deaed03735a | 103 | require 'spec_helper'
describe DayX do
describe '#part1' do
end
describe '#part2' do
end
end
| 10.3 | 22 | 0.68932 |
390e47d76314afe868d1f1cf4aa9b81274b898c0 | 647 | class AddedLastTransitionMetadataToBalanceTransfers < ActiveRecord::Migration
def change
execute %Q{
CREATE OR REPLACE VIEW "1"."balance_transfers" AS
SELECT bt.id,
bt.user_id,
bt.project_id,
bt.amount,
bt.transfer_id,
zone_timestamp(bt.created_at) AS created_at,
zone_timestamp(weekdays... | 32.35 | 101 | 0.766615 |
e2144159403c2e47eba69324cb3af11e96428583 | 155 | # Load the Rails application.
require File.expand_path('../application', __FILE__)
# Initialize the Rails application.
AstroDash::Application.initialize!
| 25.833333 | 52 | 0.793548 |
ff579daa9ec3f99e0f9900dc3b45908eea1598de | 655 | require "foreman"
class Foreman::Env
attr_reader :entries
def initialize(filename)
@entries = File.read(filename).split("\n").inject({}) do |ax, line|
if line =~ /\A([A-Za-z_0-9]+)=(.*)\z/
key = $1
case val = $2
# Remove single quotes
when /\A'(.*)'\z/ then ax[key] =... | 21.833333 | 82 | 0.519084 |
ac6a32be6f70486c0362a2210c1c2f951d8765cb | 517 | class TitleScreen
def initialize(ui, options)
@ui = ui
@options = options
@messages = Messages[:title]
end
def render
ui.message(0, 0, messages[:name])
ui.message(7, 1, messages[:by])
handle_choice prompt
end
private
attr_reader :ui, :options, :messages
def prompt
ui.choice... | 17.827586 | 57 | 0.644101 |
4ac0a79fcfa9ba8ad5eb6007b2c6faee09667a92 | 2,503 | # -*- coding: utf-8 -*-
# Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
require 'optparse'
require 'rubygems'; require 'require_relative'
require_relative '../command'
require_relative '../../app/default'
require_relative '../../interface/server' # server interface (remote debugging)
class Trepan::Command... | 34.287671 | 88 | 0.641231 |
797fa5774636661bccb3ce2e302a6dda0c64e785 | 128 | # typed: true
module Vonage
class AbstractAuthentication
def initialize(config)
@config = config
end
end
end
| 12.8 | 30 | 0.6875 |
d5738bf8cf19868f63822d788457769606c096d8 | 1,877 | class Id3ed < Formula
desc "ID3 tag editor for MP3 files"
homepage "http://code.fluffytapeworm.com/projects/id3ed"
url "http://code.fluffytapeworm.com/projects/id3ed/id3ed-1.10.4.tar.gz"
sha256 "56f26dfde7b6357c5ad22644c2a379f25fce82a200264b5d4ce62f2468d8431b"
license "GPL-2.0"
bottle do
sha256 cellar:... | 52.138889 | 122 | 0.729355 |
6ae61725f80b06abb87798d7c4e814344224bf55 | 602 | require 'spec_helper'
describe Reru::IO::Reader do
it "spits what it reads down the stream" do
StringIO.open("hello world\nhere we go!") do |input|
reader = Reru::IO::Reader.new(input)
xs = []
reader.perform { |x| xs << x }
Reru.run
xs.should == ["hello world\n", "here we go!"]
... | 23.153846 | 56 | 0.549834 |
03d04c15b5e0de97db3a434975441f6caca044bf | 1,535 | class Student::WriteupsController < ApplicationController
before_action except: :index do
@writeup_topic = WriteupTopic.where(cohort_id: params[:cohort_id]).find(params[:writeup_topic_id])
end
def index
@writeups = Writeup.where(user_id: current_user).
order('created_at desc').
includes(:wri... | 22.573529 | 102 | 0.672964 |
7a7487810aa7f07ba687b589339166832833e18e | 536 | require 'whmcs'
class Biller::WHMCSOnboarder < Biller::Onboarder
include Biller::WHMCSRegistrar
def initialize
register
end
def onboard(onboard_options={})
begin
WHMCS::Client.add_client(onboard_options).attributes
rescue StandardError => se
{:result => "error", :... | 20.615385 | 65 | 0.621269 |
3333c8c611bfbe3b8b96af337538eaf786f988c1 | 2,875 |
Given(/^that the user is on the Family Relationships page$/) do
login_as consumer, scope: :user
visit financial_assistance_applications_path
create_plan
click_button "Start new application"
find(".btn", text: "ADD INCOME & COVERAGE INFO").click
find("#income_from_employer_no").click
find("#self_employed_no").click
... | 41.071429 | 92 | 0.735652 |
21292d8ca088731bfa124d03b122638f0f73793b | 2,428 | require "mkmf"
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
require "debase/ruby_core_source"
require "native-package-installer"
class NilClass
def empty?; true; end
end
# Just a replacement of have_header because have_header searches not recursively :(
def real_have_header(header_name)
if (have_hea... | 31.947368 | 85 | 0.594728 |
1d189c0d238320806adea4d0dcd7bee4dd358055 | 994 | require 'rails_helper'
describe "Edit paper page", type: :feature do
it "should save changes" do
paper = FactoryGirl.create :paper
visit edit_paper_path(paper)
fill_in 'Title', with: 'BEAUTIFUL DATA, BEAUTIFUL MIND'
click_button 'Update Paper'
end
it "should allow to sele... | 28.4 | 71 | 0.645875 |
7a4e734393eacfed582f5020fe9d73af1feaca32 | 4,779 | require 'spec_helper_integration'
test_name 'LDAP user access'
# There have been SIMP problems in the past in which some LDAP users
# have not been able to login when their respective passwords have
# been changed. This test is to make sure that regression never occurs!
# facts gathered here are executed when the f... | 36.761538 | 157 | 0.672316 |
b92a02598598085071c2fd25c7224fb326fc0c3e | 958 | class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :null_session
before_action :authenticate
before_action :set_logged_in_user
def set_logged_in_user
email, password = Act... | 29.030303 | 98 | 0.750522 |
62a41b164cef8dcaa192c360011f39642fc52740 | 208 | module Chewy
module Resque
class Worker
@queue = :chewy
def self.perform(index_name, ids)
type = Chewy.derive_type(index_name)
type.import(ids)
end
end
end
end
| 14.857143 | 44 | 0.605769 |
01c8afb538c5190b2c2eef9b774355ba65d0b40e | 934 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 32.206897 | 74 | 0.730193 |
911874b7aba3951730d94733a880e93cbb117dbe | 5,210 | # frozen_string_literal: true
require_relative '../test_helper'
SingleCov.covered!
describe SlackMessage do
let(:deploy) { deploys(:succeeded_test) }
let(:msg) { SlackMessage.new deploy }
let(:body) { msg.message_body }
let(:super_admin) { users(:super_admin) }
let(:deployer_buddy) { users(:deployer_buddy) ... | 30.290698 | 120 | 0.573512 |
e9b85e9cb8c4e35be7caca95940ba24aa47532b2 | 398 | # frozen_string_literal: true
# rubocop:disable Style/Documentation
module Gitlab
module BackgroundMigration
module UserMentions
module Models
class MergeRequestUserMention < ActiveRecord::Base
self.table_name = 'merge_request_user_mentions'
def self.resource_foreign_key
... | 20.947368 | 58 | 0.678392 |
b925efb5baafeaf725593d101a7218ccba78ad8a | 3,130 | # encoding: utf-8
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# /spec/fixtures/responses/whois.dns.pl/pl/status_registered.expected
#
# and regenerate the tests with the following rake task
#
# $ rake spec:generate
#
require 'spec_helper'
describe ... | 47.424242 | 92 | 0.73738 |
f8579a28e151aa80298d0b152b67f672ed657880 | 441 | require 'rails_helper'
module Dallal
RSpec.describe DallalJob, type: :job do
let(:args) { { class: 'User', id: '1', event: 'create'} }
describe '#perform' do
it 'constantizes and calls #create_notification on notifier with correct args' do
expect(UserNotifier).to receive(:create_notification).... | 29.4 | 91 | 0.659864 |
26624b72af0d584132c0be78b2b482cbaf386277 | 1,601 | # OMF_VERSIONS = 6.0
def create_switch(ovs)
ovs.create(:ovs_proxy, {name: "test"}) do |reply_msg|
if reply_msg.success?
switch = reply_msg.resource
switch.on_subscribed do
info ">>> Connected to newly created switch #{reply_msg[:res_id]} with name #{reply_msg[:name]}"
on_switch_creat... | 27.135593 | 111 | 0.64772 |
7959bf2d42c406ddb597ab32561ff3f69ab9ab26 | 433 | class CreatePages < ActiveRecord::Migration
def self.up
create_table :pages do |t|
t.string :name
t.string :url
t.integer :parent_id
t.integer :lft
t.integer :rgt
t.timestamps
end
add_index :pages, :parent_id
# Create parent Welcome page
Page.create(:... | 18.041667 | 69 | 0.612009 |
f78152dfde9e6f479e6c41e38b0e647f0d67b41c | 2,075 | require "unit_soup/measurement"
require "unit_soup/unit"
include UnitSoup
describe "Measurement" do
describe ".new" do
describe "from separate strings" do
m = Measurement.new("3/4", "cm")
it "should have initialized correctly" do
expect(m.amount).to eq(3/4r)
expect(m.unit).to eq(Uni... | 24.127907 | 68 | 0.618795 |
bf13504dec706b0dfb9cfa792e1990e0723aa8a2 | 2,288 | class Haxe < Formula
desc "Multi-platform programming language"
homepage "https://haxe.org/"
url "https://github.com/HaxeFoundation/haxe.git",
:tag => "3.4.7",
:revision => "bb7b827a9c135fbfd066da94109a728351b87b92"
bottle do
cellar :any
rebuild 1
sha256 "c0fb5f2d7e35d16ac66311d1d9... | 29.714286 | 93 | 0.627622 |
33e52aa749d2ebc3e539b5a8fb0336c1887ad9e1 | 186 | class AddCommitUrlColumn < ActiveRecord::Migration
def self.up
add_column :commits, :url, :string, :null => false
end
def self.down
remove_column :commits, :url
end
end
| 18.6 | 54 | 0.704301 |
33aca6cb527b4ff3a3a0ac4745945405bcb54704 | 18,872 | require 'rails_helper'
describe 'Issue Boards', js: true do
include DragTo
let(:group) { create(:group, :nested) }
let(:project) { create(:project, :public, namespace: group) }
let(:board) { create(:board, project: project) }
let(:user) { create(:user) }
let!(:user2) { create(:user) }
before do
... | 31.505843 | 163 | 0.630988 |
616c98d9c37540bef0e062773636919d8c545cf3 | 3,214 | # 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_01_01
module Models
#
# Vpn Client Parameters for package generation
#
class VpnClientParameters
... | 33.134021 | 77 | 0.554138 |
ff2a3a3b2b103d16d929a3b8ea8b0a24e5395afd | 2,288 | # 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::Compute::Mgmt::V2018_06_01
module Models
#
# Describes a virtual machines scale set IP Configuration's PublicIPAddress
# configu... | 31.342466 | 93 | 0.586976 |
d53adc0b2e46fb63647294d2f206c1b77ff5dbca | 827 | require 'spec_helper'
RSpec.describe Interactors::Players::CreatePlayer do
let(:player_attributes) { { 'id' => 1, 'name' => 'octane' } }
let(:team) { { 'id' => 'X0klA3' } }
let(:access_token) { 'fdgdfg908g9n9gf09fgh8' }
let(:repository) { PlayerRepository.new }
let(:create_player) { described_class.new(repos... | 25.060606 | 69 | 0.625151 |
7a2fc6b1184ba0a9be3990dab8b735ca95891ace | 2,996 | class Api::V3::ArticlesController < Api::V3::BaseController
before_filter :load_article, only: [:update, :destroy]
def index
# Filter by source parameter, filter out private sources unless admin
# Load articles from ids listed in query string, use type parameter if present
# Translate type query parame... | 41.611111 | 246 | 0.665554 |
e8ea6aff64f932dff49bf840f0cf77f3fa075c77 | 6,174 | require 'fileutils' # http://www.ruby-doc.org/stdlib-1.9.3/libdoc/fileutils/rdoc/index.html
require 'matrix' # http://www.ruby-doc.org/stdlib-1.9.3/libdoc/matrix/rdoc/index.html
require 'mustache' # https://github.com/defunkt/mustache
THIS_DIR = File.expand_path('..', __FILE__)
PROJECT_ROOT = File.expa... | 28.850467 | 119 | 0.657272 |
bb79af5c0bd7d43145f63618859d54b642966902 | 10,323 | module VerificationHelper
include DocumentsVerificationStatus
def doc_status_label(doc)
case doc.status
when "not submitted"
"warning"
when "downloaded"
"default"
when "verified"
"success"
else
"danger"
end
end
def ridp_type_status(type, person)
... | 34.99322 | 230 | 0.734573 |
381034eab384e33c0efcfc41a16cb9b129a4ccdf | 918 | #
# Session implementation for Android
#
require 'gcm'
module Pntfr
module Session
class Android < Pntfr::Session::Base
attr_reader :gcm
def initialize notification_key=nil
if notification_key.nil?
notification_key= Pntfr.config.gcm[:notification_key]
end
@gcm= ::GC... | 23.538462 | 74 | 0.530501 |
91efb049652434e6e3b186df2f1a4342285ac526 | 9,137 | module GraphQL
class Schema
# Used to convert your {GraphQL::Schema} to a GraphQL schema string
#
# @example print your schema to standard output
# MySchema = GraphQL::Schema.define(query: QueryType)
# puts GraphQL::Schema::Printer.print_schema(MySchema)
#
module Printer
extend s... | 34.609848 | 110 | 0.56605 |
b9b12a05b89331aeadbc7f9d3628f0883ef29183 | 148 | class Test::Unit::TestCase
def assert_matcher_accepts(matcher, instance)
assert matcher.matches?(instance), matcher.failure_message
end
end
| 24.666667 | 62 | 0.790541 |
0125f171ecb6117a2ddc2b7c991afda9f2d3f691 | 4,834 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe EventFilter do
describe '#filter' do
it 'returns "all" if given filter is nil' do
expect(described_class.new(nil).filter).to eq(described_class::ALL)
end
it 'returns "all" if given filter is ""' do
expect(described_class.new... | 33.569444 | 135 | 0.674597 |
624abfc64ae55ffc9d5feb684f989e418bdb3d97 | 1,760 | require_relative 'model/person'
require_relative 'renderers/renderer'
require_relative 'logging'
require 'thread'
class Pat
attr_accessor :svc_mgr, :person_mgr
def initialize(svc_mgr, person_mgr)
@svc_mgr = svc_mgr
@person_mgr = person_mgr
end
def retrieve_events(selected_persons, selected_services,... | 27.5 | 86 | 0.65625 |
62a782e468232b332d77fa2f856abfd65221d0bb | 1,227 | module AStar
# A heuristic is a lambda that takes two arguments (Vertex, Vertex) and returns
# a Double
#
# this factory contains lambdas used to calculate heuristic.
#
class HeuristicFactory
# Returns a function used to calculate heuristic between two
# nodes for a 2D grid.
#
# Assumption i... | 34.083333 | 244 | 0.673187 |
bfd16cd2322b71a5590ff17c30b50635ee94493f | 185 | # frozen_string_literal: true
desc 'Get the application set up for development'
task bootstrap: :environment do
Rake::Task['db:create'].invoke
Rake::Task['db:migrate'].invoke
end
| 20.555556 | 49 | 0.751351 |
1d2504a6f2339ec11c9008fb43de34beed6763ad | 1,957 | # Copyright © 2011 MUSC Foundation for Research Development
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this list of c... | 51.5 | 145 | 0.784364 |
18f98b00a302151ddbfeca7f6e8f8eb642d38144 | 199 | # Constants Variables
WIN_WIDTH = 640
WIN_HEIGHT = 400
MENU_BUTTON_WIDTH = 130
MENU_BUTTON_HEIGHT = 50
FONT_SMALL = Gosu::Font.new(20)
FONT_MEDIUM = Gosu::Font.new(30)
FONT_LARGE = Gosu::Font.new(50) | 24.875 | 32 | 0.768844 |
1ab5652881e11ec93fc65df699f8a66db557ae0c | 6,890 | require 'mechanize/test_case'
class TestMechanizeParser < Mechanize::TestCase
class P
include Mechanize::Parser
attr_accessor :filename
attr_accessor :response
attr_accessor :uri
def initialize
@uri = URI 'http://example'
@full_path = false
end
end
def setup
super
... | 21.803797 | 74 | 0.642816 |
ff96d1d91bd382e02b01ca1476c2054312ef4cd4 | 1,661 | require 'spec_helper'
describe TemplateFileSerializer do
let(:template_model) { Template.new }
it 'exposes the attributes to be jsonified' do
serialized = described_class.new(template_model).as_json
expected_keys = [
:name,
:description,
:keywords,
:type,
:documentation,
... | 20.506173 | 85 | 0.569536 |
265e3abf844bf8d0b19f3dc2b6d52a5da6b1849a | 2,328 | require 'spec_helper'
require 'skyed'
require 'highline/import'
describe 'Skyed::Destroy.execute' do
context 'when destroying vagrant machine' do
let(:options) { { rds: false } }
let(:opsworks) { double('Aws::OpsWorks::Client') }
let(:repo_path) { '/home/ifosch/opsworks' }
let(:hostname) ... | 27.069767 | 64 | 0.583333 |
186f90ac2b94420799436b34af07cf4fb25ba390 | 579 | # This service class is intented to provide callback behaviour to handle
# the case where a subscription order cannot be processed because a payment
# failed
module SolidusSubscriptions
class PaymentFailedDispatcher < Dispatcher
def dispatch
order.touch :completed_at
order.cancel!
installments.... | 24.125 | 75 | 0.696028 |
7a427b1b419175a818c4ea3584fba12610747977 | 1,875 | #
# Be sure to run `pod lib lint ImageDuplicate.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 = 'Imag... | 41.666667 | 252 | 0.666133 |
7a72a1390d14c2c71003497d8bbbb61ee9cc2e7d | 50 | # https://docs.ruby-lang.org/en/3.0.0/String.html
| 25 | 49 | 0.7 |
b9cf783f37aed78fde3dc051f53c3f5ae0a58aef | 1,225 | #snippet-sourcedescription:[<<FILENAME>> demonstrates how to ...]
#snippet-keyword:[Ruby]
#snippet-keyword:[Code Sample]
#snippet-keyword:[AWS Identity and Access Management (IAM)]
#snippet-service:[iam]
#snippet-sourcetype:[<<snippet or full-example>>]
#snippet-sourcedate:[]
#snippet-sourceauthor:[AWS]
# Copyr... | 35 | 81 | 0.720816 |
1c83007353f94694f7dfdf6c638a7cc5b4fc46dd | 2,088 | require File::expand_path('../../spec_helper', __FILE__)
require 'opbeat'
describe Opbeat do
before do
@send = double("send")
@event = double("event")
allow(Opbeat).to receive(:send) { @send }
allow(Opbeat::Event).to receive(:from_message) { @event }
allow(Opbeat::Event).to receive(:from_exceptio... | 32.123077 | 97 | 0.694923 |
6a52e4afb220bcad2ba4703d3b94602ffc085d93 | 1,047 | # frozen_string_literal: true
lib = File.expand_path('./lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'tolerance/version'
Gem::Specification.new do |s|
s.name = 'tolerance'
s.version = Tolerance::VERSION
s.authors = ['Yoshiyuki Hirano']
s.email = [... | 31.727273 | 68 | 0.625597 |
e2eb85b30e4021eb5d5ffe32c647d721791bb171 | 939 | module RockSolid
module Mappers
class ListItems < RockSolid::Mappers::Base
def to_domain
list_items.map do |list_item|
RockSolid::Domain::ListItem.new(dasherized_attributes(list_item))
end
end
private
def list_items
if empty_list?
[]
el... | 23.475 | 113 | 0.636848 |
011f2125985acce31031e0ca629b4c289d4dbc85 | 4,357 | require 'json'
# require 'yelp'
require 'http'
require 'optparse'
# Place holders for Yelp Fusion's OAuth 2.0 credentials. Grab them
# from https://www.yelp.com/developers/v3/manage_app
CLIENT_ID = "zIReGNNX_JUrNTHXFvmd6A"
CLIENT_SECRET = "3z7eEXqt3kFJOBFtXqDLftUZtHeo1WvvDoopMjyEMVDoPWj5nhuyrIF4NynSsaj5"
# Consta... | 26.567073 | 196 | 0.694056 |
f8187de7f5d5523c7b0520127424c21fc6bd3fbe | 175 | class CreateQuestions < ActiveRecord::Migration
def change
create_table :questions do |t|
t.text :question_text
t.timestamps null: false
end
end
end
| 17.5 | 47 | 0.691429 |
e9b7c9445b4deef4a444538687227111c1debbd8 | 3,787 | FactoryGirl.define do
factory :chargeback_rate_detail do
chargeback_rate
detail_currency { FactoryGirl.create(:chargeback_rate_detail_currency) }
transient do
tiers_params nil
end
trait :tiers do
after(:create) do |chargeback_rate_detail, evaluator|
if evaluator.tiers_params
... | 34.427273 | 112 | 0.695801 |
79a5f5b9d428f3ffb6092520f6a344e89ab763df | 6,263 | $:.unshift(File.dirname(__FILE__))
require 'helper'
class XmlParamsParsingTest < ActionDispatch::IntegrationTest
class TestController < ActionController::Base
class << self
attr_accessor :last_request_parameters
end
def parse
self.class.last_request_parameters = request.request_parameters
... | 32.450777 | 164 | 0.663101 |
91861a3feee6c2c147b6a8391adc7dfb59ce8561 | 142 | class AddDropoffLocationToSettings < ActiveRecord::Migration[5.2]
def change
add_column :settings, :dropoff_location, :string
end
end
| 23.666667 | 65 | 0.78169 |
21ff13ac39d0a9b3ce811916e88eabfc44fcba79 | 1,106 | # frozen_string_literal: true
require 'bundler/setup'
require 'k_usecases'
require 'ktg_configuration_management'
require 'pry'
# Dir.chdir('lib') do
# Dir['ktg_configuration_management/document_usecase/*.rb'].sort.each { |file| require file }
# end
RSpec.configure do |config|
# Enable flags like --only-failures... | 26.333333 | 95 | 0.644665 |
1a426ac2eaac3e3767bcb3bfd31e15bf1a50292c | 217 | module Rails
module Commands
module Environment
extend self
def fork
Kernel.fork do
yield
Kernel.exit
end
Process.waitall
end
end
end
end | 13.5625 | 23 | 0.529954 |
4a2a5bcd1908d8a35ae84630e4a8edbf22d5fad2 | 1,264 | require 'fog/openstack/volume/models/snapshot'
module Fog
module OpenStack
class Volume
class V2
class Snapshot < Fog::OpenStack::Volume::Snapshot
identity :id
attribute :name
attribute :status
attribute :description
attribute :metadata
a... | 28.088889 | 94 | 0.488133 |
38eba7063262087dbc0c9a7f6f2f822ccf321180 | 948 | # frozen_string_literal: true
require 'base64'
class InvokeBinaryCommand < EvilerWinRM::Command
NAME = 'exec'
ALIASES = [].freeze
def initialize
@loaded = false
end
def call(args)
unless @loaded
conn.shell.run(File.read(File.expand_path('../../../data/Invoke-Binary.ps1', __dir__)))
@lo... | 21.545455 | 93 | 0.649789 |
5d531991358499c56feecd357a997b3fd58d11ce | 433 | # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :sponsor do
name { Faker::Company.name }
website_url { Faker::Internet.url }
description { Faker::Lorem.paragraph }
sponsorship_level
after(:create) do |sponsor|
File.open("spec/support/logo... | 22.789474 | 68 | 0.660508 |
03e05f253f32e2ff795c273794cfc43b62cbfb16 | 4,411 | # encoding: UTF-8
require 'image_optim/cmd'
require 'image_optim/configuration_error'
require 'image_optim/worker/class_methods'
require 'shellwords'
require 'English'
class ImageOptim
# Base class for all workers
class Worker
extend ClassMethods
class << self
# Default init for worker is new
... | 28.275641 | 80 | 0.642485 |
621832acb9ff7f56d0564f7a462f7de9f5b19d3e | 890 | module Fastlane
module Actions
class ImportFromGitAction < Action
def self.run(params)
# this is implemented in the fast_file.rb
end
#####################################################
# @!group Documentation
#####################################################
def... | 22.25 | 108 | 0.506742 |
6a73d1b051a1713ea5ce472b9693357dd3ab8e08 | 339 | # frozen_string_literal: true
module Renalware
module LowClearance
class MDMPresenter < Renalware::MDMPresenter
def low_clearance
@low_clearance ||= begin
LowClearance.cast_patient(patient).profile&.document ||
Renalware::LowClearance::ProfileDocument.new
end
end... | 22.6 | 65 | 0.678466 |
ab168f6e0e883e36e5eab1bfc34ce4f1e6d83bd7 | 663 | module Phrasing
class String
attr_reader :value
def initialize(value)
@value = value
end
def to_bool
if major_version >= 5
ActiveModel::Type::Boolean.new.cast(value)
elsif major_version == 4 && minor_version >= 2
ActiveRecord::Type::Boolean.new.type_cast_from_databa... | 19.5 | 72 | 0.650075 |
624bd1937fed386f61f69025ec29ec95138ec2f2 | 749 | cask 'font-fantasquesansmono-nerd-font' do
version '1.0.0'
sha256 'c083b7af3f507ef86e19b73fd0bc0d6109fd59bb7d05bea29f9717a3a75a2cf0'
url "https://github.com/ryanoasis/nerd-fonts/releases/download/v#{version}/FantasqueSansMono.zip"
appcast 'https://github.com/ryanoasis/nerd-fonts/releases.atom',
check... | 46.8125 | 99 | 0.794393 |
333cd51f439410b6d28d92e619ccd48702e1e367 | 144 | module MailEngine
module Sendgrid
extend ActiveSupport::Autoload
autoload :Base
autoload :SmtpApi
autoload :RestApi
end
end | 16 | 34 | 0.729167 |
e2d53eec94d130f472c2db040eb599764cf416a7 | 5,415 | RSpec.describe "coronavirus_local_restrictions/results.html" do
include CoronavirusLocalRestrictionsHelpers
include CoronavirusContentItemHelper
describe "current restrictions" do
it "rendering tier 4 results for a postcode in tier 4" do
render_results_view(local_restriction: { current_alert_level: 4 }... | 46.282051 | 130 | 0.76362 |
acb00ef0673b109555541d7bec13527979d29171 | 789 | # frozen_string_literal: true
module BannerMessageSteps
step 'I edit the banner message' do
@banner_message = Fabricate.build(:banner_message)
click_on 'Banner Message'
fill_in 'banner_message_title', with: @banner_message.title
within '.markdown-field-wrapper__bannermessage__body' do
value = ... | 31.56 | 86 | 0.724968 |
79726a03c2919436846ec001197cf64f0df8300a | 1,074 | class FixReportSettingCols < ActiveRecord::Migration[4.2]
def up
Report::Report.all.each do |r|
# convert values in the report display_type, bar_style, question_labels, and percent_type columns to be underscored values, which work as i18n keys
%w(display_type bar_style question_labels percent_type).ea... | 38.357143 | 153 | 0.689944 |
08062b03d5b625f0f7bd14e20e373fbb2830636e | 1,238 | class RemoveDesolateInstances < ActiveRecord::Migration
def up
# Rest all column information in case someone runs all migrations at once
Character.reset_column_information
Feat.reset_column_information
Item.reset_column_information
Log.reset_column_information
PowerAttribute.reset_column_infor... | 30.195122 | 85 | 0.732633 |
620b3ec8b35860aee8eed3e940583fc7dd4db5aa | 587 | require 'rubygems'
require 'sinatra'
require 'sinatra/reloader'
require 'sinatra/activerecord'
set :database, 'sqlite3:timetable.db'
class Client < ActiveRecord::Base
validates :name, presence: true
validates :role, presence: true
end
class Week < ActiveRecord::Base
end
before do
@clients = Client.all
@c = ... | 14.675 | 37 | 0.688245 |
f87cc4bdadee460444d01789023a0ad432ded244 | 257 | class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
include SessionsHelper
before_action :logged_in?
end
| 32.125 | 56 | 0.793774 |
397d5efbac667985f7f44854e8f82929ded55292 | 349 | class FontBentham < Cask
version '002.001'
sha256 '40e607c31bbd253acc04a7f0772d2a4c1cbd693771f5c3585ce255522057a524'
url 'https://googlefontdirectory.googlecode.com/hg-history/67342bc472599b4c32201ee4a002fe59a6447a42/ofl/bentham/Bentham-Regular.ttf'
homepage 'http://www.google.com/fonts/specimen/Bentham'
fo... | 34.9 | 134 | 0.82235 |
bb9971a3d614761282f8426a9ecfce2d59d0ce67 | 547 | # frozen_string_literal: true
# Selects a story from given request
class LoadStoryService
attr_reader :story
def initialize(request)
@request = request
set_story
end
def update(user)
save_game = user.save_games.find_or_create_by story: story
user.update active_game: save_game
end
def fou... | 16.575758 | 63 | 0.700183 |
6264e8b3efd94486b1db584fb2f46f24c7b12179 | 4,906 | require File.dirname(__FILE__) + '/test_helper'
class Tree
def self.human_name; 'Tree'; end
end
class TreesController < InheritedResources::Base
has_scope :color, :unless => :show_all_colors?
has_scope :only_tall, :boolean => true, :only => :index, :if => :restrict_to_only_tall_trees?
has_scope :shadown_range... | 35.042857 | 95 | 0.704036 |
085c50cd6486dcc6a37b322630ffcde67bcea149 | 1,874 | Rails.application.routes.draw do
devise_for :users
root to: "home#index"
get 'home/index'
get 'terms' => 'pages#terms'
get 'about' => 'pages#about'
resource :contacts, only: [:new, :create], path_names: {:new => '' }
resources :articles do
resources :comments, only: :create
end
# The priori... | 26.394366 | 84 | 0.64301 |
61b271ddd7c3f58adeca329b90c53a284b07e6e2 | 1,448 | # frozen_string_literal: true
#--
# Copyright (c) 2014-2021 David Heinemeier Hansson
#
# 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... | 35.317073 | 72 | 0.780387 |
d54898c111bbacd8f517c3f94bc77489e988c993 | 573 | # frozen_string_literal: true
# == Schema Information
#
# Table name: interviews
#
# id :bigint not null, primary key
# time :datetime
# priority :string(10)
# job_application_id :integer
# created_at :datetime not null
# updated_at :datetime ... | 22.92 | 61 | 0.579407 |
031892ab5a6d823ccd8c99e725b1445509938b1a | 78 | # frozen_string_literal: true
module GraphqlGraceful
VERSION = "0.1.0"
end
| 13 | 29 | 0.75641 |
3847eac462a3fc1048b413d49862ab52983d0e5c | 180 | class CreateJsons < ActiveRecord::Migration
def change
create_table :jsons do |t|
t.string :type
t.string :data
t.timestamps null: false
end
end
end
| 16.363636 | 43 | 0.65 |
ffdafc7e84f85a7b9e578b981d5fbe1d989c5c13 | 1,231 | # 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-apprunner'
... | 38.46875 | 113 | 0.6645 |
7976480ef06b3f3b5e0899b85fdbf95482b969f0 | 442 | class ConditionIsStorageland < ConditionNickname
def names
[
"calciform pools",
"crucible of the spirit dragon",
"dreadship reef",
"fountain of cho",
"fungal reaches",
"mage-ring network",
"mercadian bazaar",
"molten slagheap",
"rushwood grove",
"saltcru... | 19.217391 | 48 | 0.597285 |
4a0a2d5a999c52ecf167ce0aacd00086d848d2c8 | 130 | module EnvLint
class Variable < Struct.new(:name, :value, :optional, :comment)
alias_method :optional?, :optional
end
end
| 21.666667 | 65 | 0.715385 |
bbccc99c43e1851edb82d69bbd2d9d5eaa8d7f28 | 53 | # no longer required, all methods moved to install.rb | 53 | 53 | 0.792453 |
873eef09ffa352083c3a1ba737bafaec698d84f1 | 2,915 | require "spec_helper"
require "teaspoon/environment"
describe Teaspoon::Environment do
subject { Teaspoon::Environment }
describe ".load" do
it "calls require_environment if Rails isn't available" do
subject.should_receive(:rails_loaded?).and_return(false)
subject.should_receive(:require_environ... | 36.4375 | 119 | 0.734134 |
62abc57e7ec1df72cdcc58919b7f79747df5dfa4 | 7,619 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# Source: google/cloud/automl/v1/service.proto for package 'Google.Cloud.AutoML.V1'
# Original file comments:
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with t... | 55.210145 | 154 | 0.648248 |
eda7d65c82b50b1dd407d044910accbd31bdad23 | 1,109 | =begin
#Selling Partner API for Merchant Fulfillment
#The Selling Partner API for Merchant Fulfillment helps you build applications that let sellers purchase shipping for non-Prime and Prime orders using Amazon’s Buy Shipping Services.
OpenAPI spec version: v0
Generated by: https://github.com/swagger-api/swagger-cod... | 31.685714 | 182 | 0.798918 |
873d7d6d09903b632685bf27a05ee630d5a92f51 | 2,683 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# dat... | 40.651515 | 116 | 0.727544 |
0358a3251cb7ca6971c305c9dd41dc15f64410cb | 272 | require_relative 'plan'
require_relative 'input'
require_relative 'worker_group'
plan = Plan.new(INPUT)
workers = WorkerGroup.new(5, plan: plan)
while (plan.more?) do
workers.work_on plan.next_steps
end
puts "The total time to complete was #{workers.time_completed}"
| 20.923077 | 63 | 0.775735 |
79269dc7cbf34c846d50d0da24c6007439348cbd | 26,046 | # frozen_string_literal: true
# rubocop:disable Lint/RedundantCopDisableDirective, Layout/LineLength, Layout/HeredocIndentation
module Engine
module Config
module Game
module G18CO
JSON = <<-'DATA'
{
"filename": "18_co",
"modulename": "18CO",
"currencyFormatStr": "$%d",
"bankCash": 10000,
"ce... | 20.622328 | 304 | 0.534285 |
f73d860c048b08c465cf9bf2cb832e83db14e6b7 | 877 | require 'test_helper'
class UsersIndexTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
def setup
@admin = users(:michael)
@non_admin = users(:archer)
end
test "index as admin including pagination and delete links" do
log_in_as(@admin)
get users_path
a... | 24.361111 | 66 | 0.669327 |
f724387581fe22a703b9bcd9e60e76d7a4970ae7 | 2,796 | #
# Copyright:: Copyright (c) 2015 Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.... | 29.125 | 93 | 0.658441 |
7917a11b57c21eaf39dbe8e0b225b9e5e6c7c74f | 411 | require './gemspec'
Gem::Specification.new do |s|
info(s)
s.name = "vpim_icalendar"
s.version = "1.1"
s.summary = "Virtual gem depending on vPim's iCalendar support for ruby"
s.description = <<'---'
This is a virtual gem, it exists to depend on vPim, which provides iCal... | 27.4 | 84 | 0.635036 |
e254e9a5d1d804e6c539a848ff79ad88834cfb45 | 138 | class ChangeForeignKeyForComments < ActiveRecord::Migration[7.0]
def change
rename_column :comments, :user_id, :author_id
end
end
| 23 | 64 | 0.775362 |
1a7bc5413757d0327260757334225a7f1b7b94b5 | 1,444 | require 'test_helper'
class FileInstructionsControllerTest < ActionController::TestCase
setup do
@file_instruction = file_instructions(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:file_instructions)
end
test "should get new" do
get :ne... | 28.88 | 186 | 0.760388 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.