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 |
|---|---|---|---|---|---|
5deead6b023249673c72bbc8fdcfcc072c04c4e9 | 1,563 | SeattleIo::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test... | 42.243243 | 85 | 0.774792 |
b957412815768ea894977158fab7333f38354107 | 7,236 | class RubyAT20 < Formula
desc "Powerful, clean, object-oriented scripting language"
homepage "https://www.ruby-lang.org/"
url "https://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p648.tar.bz2"
sha256 "087ad4dec748cfe665c856dbfbabdee5520268e94bb81a1d8565d76c3cc62166"
revision 5
bottle do
sha256 "05e1cbc... | 31.736842 | 97 | 0.642344 |
4a61abb7e4c5bc44b137449972a70697118fe610 | 170 | class SceneLocationship < ApplicationRecord
include HasContentLinking
belongs_to :user
belongs_to :scene
belongs_to :scene_location, class_name: 'Location'
end
| 18.888889 | 52 | 0.805882 |
03c841071b5ea76342fb0fa1f77349e22de4a845 | 2,459 | require 'serverspec'
require 'net/ssh'
require 'yaml'
set :backend, :ssh
if ENV['ASK_SUDO_PASSWORD']
begin
require 'highline/import'
rescue LoadError
fail "highline is not available. Try installing it."
end
set :sudo_password, ask("Enter sudo password: ") { |q| q.echo = false }
else
set :sudo_pass... | 23.198113 | 76 | 0.576251 |
bb145cb1d350cbc5a0e02a48c9e73db77b13554f | 1,718 | require 'test_helper'
class UsersSignupTest < ActionDispatch::IntegrationTest
def setup
ActionMailer::Base.deliveries.clear
end
test "invalid signup information" do
get signup_path
assert_no_difference 'User.count' do
post users_path, params: { user: { name: "",
... | 33.038462 | 78 | 0.614086 |
4a9e93adfce5b62a0f6fbe8c343261e84c46b4a3 | 6,244 | property :name, String, required: true, name_property: true
property :value, [String, Array]
property :type, String, required: true
property :ttl, Integer, default: 3600
property :weight, String
property :se... | 28.381818 | 131 | 0.642857 |
d59c2a7e6a04867370c5cc9a95d43f3bc2d658a4 | 149 | class RemoveMeasurementsFromTanks < ActiveRecord::Migration[5.2]
def change
remove_reference :measurements, :tank, foreign_key: true
end
end
| 24.833333 | 64 | 0.785235 |
e204336fcb6901c41bba7c907b9391df358626c9 | 3,807 | # frozen_string_literal: true
require "spec_helper"
describe Lita::Authorization, lita: true do
let(:requesting_user) { instance_double("Lita::User", id: "1") }
let(:robot) { Lita::Robot.new(registry) }
let(:user) { instance_double("Lita::User", id: "2") }
subject { described_class.new(robot) }
before do
... | 30.95122 | 85 | 0.673496 |
e91e22f3527fa3fd91f2efd4a69572e6df9032d1 | 447 | require 'thor/group'
module Foodie
module Generators
class Recipe < Thor::Group
include Thor::Actions
argument :group, :type => :string
argument :name, :type => :string
def create_group
empty_directory(group)
end
def copy_recipe
template("recipe.txt", "#{grou... | 17.88 | 54 | 0.595078 |
bb3eb856ed30d82cf9d4029074d0fe7f5162e497 | 848 | require 'hashie'
require 'faraday'
require 'gmxcheckout/version'
module GmxCheckout
autoload :API, 'gmxcheckout/api'
autoload :Base, 'gmxcheckout/base'
autoload :JsonMiddleware, 'gmxcheckout/json_middleware'
autoload :Model, 'gmxcheckout/model'
autoload :Response, 'gmxche... | 21.74359 | 61 | 0.665094 |
6a3a71e99986ff9973675189b5ca59199effeb11 | 973 | #!/usr/bin/env ruby
# This script only support ASCII format
# and tick download.
require 'uri'
require 'net/http'
require 'mechanize'
agent = Mechanize.new
agent.pluggable_parser.default = Mechanize::Download
for i_date in 2020..2023 # change date
date = i_date.to_s
for i_month in 1..12 # change month
month... | 26.297297 | 155 | 0.679342 |
bbe5397d9c1f3b76b47f0e0841e3112f02cdb176 | 442 | # InSpec test for recipe pola::default
# The InSpec reference, with examples and extensive documentation, can be
# found at https://www.inspec.io/docs/reference/resources/
unless os.windows?
# This is an example test, replace with your own test.
describe user('root'), :skip do
it { should exist }
end
end
#... | 26 | 73 | 0.728507 |
1da791c0d22e79b4c531ee7d4f920e01725b485f | 862 | class LmSensors < Formula
desc "Tools for monitoring the temperatures, voltages, and fans"
homepage "https://github.com/groeck/lm-sensors"
url "https://github.com/lm-sensors/lm-sensors/archive/V3-6-0.tar.gz"
version "3.6.0"
sha256 "0591f9fa0339f0d15e75326d0365871c2d4e2ed8aa1ff759b3a55d3734b7d197"
license an... | 26.9375 | 108 | 0.696056 |
f8d045d4fbb0978e13dd0881d4157a626f3d2b4e | 557 | class User < ActiveRecord::Base
has_many :lightbulbs
belongs_to :family
def self.from_omniauth(auth)
where({uid: auth.uid}).first_or_initialize.tap do |user|
user.uid = auth.uid
user.name = auth.info.name
user.first_name = auth.info.name.split(' ')[0]
user.image_url = auth.info.image
... | 29.315789 | 66 | 0.671454 |
1a55b0924a1727f0da4dca99d1a132a94ebc8185 | 27,697 | # 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_09_01
#
# ExpressRouteGateways
#
class ExpressRouteGateways
include MsRestAzure
#
# Creates and init... | 46.008306 | 170 | 0.716937 |
0835199231dba5d61b72ace9b21bed1d33c71825 | 220 | require 'spec_helper'
RSpec.describe ArrayPrinter do
it 'can properly format its output' do
input = %w(A B C D H L K J I E F G)
expect(ArrayPrinter.new(input).print).to eq('a b c d h l k j i e f g')
end
end
| 24.444444 | 74 | 0.663636 |
1c3cd5d3dc5abca84966616d68fe972c8a14e983 | 152 | require_relative './mugatu/version'
require_relative './mugatu/entity'
require_relative './mugatu/attribute'
require_relative './mugatu/attribute_type'
| 30.4 | 42 | 0.815789 |
f7c0438691c4f55c5dcf00153bc8feceac023086 | 2,832 | class RequestsController < ApplicationController
before_action :set_request, only: [:show, :edit, :update, :destroy]
before_action :authenticate_user!
before_action :require_permission, only: [:show, :edit, :update]
# GET /requests
# GET /requests.json
def index
@incoming_requests = Request.where(:use... | 29.5 | 120 | 0.671963 |
01ade74f7b7281e8ca1facd8a1b6439f21d394d3 | 1,851 | #
# Be sure to run `pod lib lint CAFSequenceImageView.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 =... | 39.382979 | 115 | 0.659103 |
f725866fce8612b0263c9f90f6ae1915cb3e46b1 | 106 | Pollett.configure do |config|
config.reset_url = ->(token) { "https://example.com/#{token}/reset" }
end
| 26.5 | 71 | 0.679245 |
ab2f00ca1ae3e30648827f09faa8c5d54e248c01 | 228 | # frozen_string_literal: true
require 'graphql'
require_relative 'base_object'
module Types
class Game < BaseObject
description 'Games item'
field :id, ID, null: false
field :name, String, null: false
end
end
| 16.285714 | 36 | 0.719298 |
e97a2bd26202a192ed70e5ae357db470d72a8cf8 | 272 | module Tomo
class Runtime
class TaskAbortedError < Tomo::Error
attr_accessor :task, :host
def to_console
<<~ERROR
The #{yellow(task)} task failed on #{yellow(host)}.
#{red(message)}
ERROR
end
end
end
end
| 17 | 61 | 0.5625 |
267fda77b5d99a232fc4087efd68a65f1b76c28b | 5,547 | #
# Author:: AJ Christensen (<aj@junglist.gen.nz>)
# Copyright:: Copyright (c) 2008 Opscode, 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
#
# ... | 31.697143 | 129 | 0.667027 |
01d92b9ade8bfc2fd517e3d2496140927b5618bd | 1,109 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Cv
class Application < Rails::Application
# Settings in config/environments/* take precedence... | 41.074074 | 99 | 0.732191 |
bb2240da8055388cb64219e7850699b80f84f4a1 | 3,144 | module TournamentSystem
module Algorithm
# This module provides utility functions for helping implement other
# algorithms.
module Util
extend self
# @deprecated Please use {#padd_teams_even} instead.
def padd_teams(teams)
message = 'NOTE: padd_teams is now deprecated in favour ... | 30.230769 | 102 | 0.611323 |
9123546c03c84d3a92039fc247d3ed84d4c55876 | 5,815 | require File.expand_path("../lib/reptar", File.dirname(__FILE__))
require "ostruct"
User = OpenStruct
Post = OpenStruct
Company = OpenStruct
test "single attribute" do
UserReptar = Class.new(Reptar) do
attribute :name
end
user = User.new(name: "Julio")
result = {name: "Julio"}.to_json
assert_equal User... | 20.261324 | 67 | 0.624764 |
87de446dd3306d8da7c99d98f84d724fa24cc96f | 1,792 | #
# Author:: Vasundhara Jagdale (<vasundhara.jagdale@msystechnologies.com>)
# Copyright:: Copyright 2008-2016, Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obta... | 32.581818 | 95 | 0.739955 |
08a911d049ae8221cae3be60d6a088bc11dcd876 | 7,117 | module FormulaCellarChecks
def check_PATH(bin)
# warn the user if stuff was installed outside of their PATH
return unless bin.directory?
return unless bin.children.length > 0
prefix_bin = (HOMEBREW_PREFIX/bin.basename)
return unless prefix_bin.directory?
prefix_bin = prefix_bin.realpath
... | 32.646789 | 103 | 0.677392 |
4abe83c943f34561a2b410904efe2e21437d14ed | 132 | ##Patterns: Lint_BlockAlignment
variable = lambda do |i|
i
end
variable = lambda do |i|
i
##Warn: Lint_BlockAlignment
end
| 12 | 31 | 0.69697 |
03d3a8ac1f18ec8defb00b6cdf2c66719aa9c797 | 5,492 | # 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.comlaude.com/status_registered.expected
#
# and regenerate the tests with the following rake task
#
# $ rake spec:generate
#
require 'spec_helper'
require... | 41.293233 | 96 | 0.708485 |
26486da1ed8423d4fe570f6a20bec1bb0461ae2c | 12,812 | # -*- coding: binary -*-
# toybox
module Msf
autoload :OptionContainer, 'msf/core/option_container'
###
#
# The module base class is responsible for providing the common interface
# that is used to interact with modules at the most basic levels, such as
# by inspecting a given module's attributes (name, descriptio... | 30.004684 | 121 | 0.644864 |
bf0c46fbbc7886bf2eda0c6fce4bc3aee93c0539 | 218 | FactoryGirl.define do
factory :comment do
user
text { FFaker::CheesyLingo.paragraph }
factory :team_comment do
team
end
factory :application_comment do
application
end
end
end
| 14.533333 | 42 | 0.665138 |
26f06a4e8ce31c54c23c52595d3c5650e1fdac7c | 7,711 | # frozen_string_literal: true
require 'rake'
require 'resque/tasks'
#
# NOTE: This is an entrypoint for workers. DO NOT require this file from rails
# application
#
require "#{__dir__}/../../../../baw-app/lib/baw_app"
namespace :baw do
def init(is_worker: false, settings_file: nil, is_scheduler: false)
BawApp.... | 38.555 | 125 | 0.70367 |
38a16ce7e4222dea04322deecea1c1cd2e27d20d | 651 | class ReportsController < ApplicationController
before_action :authenticate_user!
# Find the current household to use for household scoping
# This 3 lines should be present in every controller (except the User controller)
set_current_tenant_through_filter
before_action do
set_current_tenant current_hous... | 23.25 | 83 | 0.778802 |
015db19c54974d3adcd4565460134be6e0600200 | 109 | require_relative 'range_value'
module MSFLVisitors
module Nodes
class DateTime < Date
end
end
end | 15.571429 | 30 | 0.752294 |
e22e80e4b6aafbebf20b56567ddece331f42e10b | 9,030 | require 'plist'
module Fastlane
module Actions
class VerifyBuildAction < Action
def self.run(params)
Dir.mktmpdir do |dir|
app_path = self.app_path(params, dir)
values = self.gather_cert_info(app_path)
values = self.update_with_profile_info(app_path, values)
... | 45.15 | 316 | 0.561462 |
6a78efde225391e579948ae04b88ad85c10b6940 | 1,044 | Trestle.resource(:batteries) do
menu do
group :categories, priority: :last do
item :batteries, icon: "fa fa-battery"
end
end
# Customize the table columns shown on the index view.
#
# table do
# column :name
# column :created_at, align: :center
# actions
# end
# Cu... | 27.473684 | 86 | 0.645594 |
e90fa684ef4f46813fcb693782eaaf6233287c03 | 1,926 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... | 36.339623 | 99 | 0.658879 |
21627b2fd38fca49c5d83df7833e6d46fd8bcbf7 | 103 | # frozen_string_literal: true
class WCC::Contentful::Model::DropdownMenu < WCC::Contentful::Model
end
| 20.6 | 67 | 0.786408 |
035e284b5a7c4bcc47c99584e512c5bab9c00e47 | 2,846 | module Fog
module Network
class OpenStack
class Real
CREATE_OPTIONS = [
:name,
:shared,
:admin_state_up,
:qos_policy_id,
:port_security_enabled,
:tenant_id,
].freeze
# Advanced Features through API Extensions
#
... | 31.977528 | 103 | 0.517217 |
9120de3b509b52e77e49fbf3332243b5eccabba3 | 4,606 | # 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::ServiceFabric::V6_5_0_36
module Models
#
# Application Upgrade Started event.
#
class ApplicationUpgradeStartedEvent < Appli... | 29.33758 | 70 | 0.47373 |
796ff029bf086beab850f3c5eff2f83a26d17975 | 1,964 | require File.expand_path(File.dirname(__FILE__) + '/edgecase')
class AboutScope < EdgeCase::Koan
module Jims
class Dog
def identify
:jims_dog
end
end
end
module Joes
class Dog
def identify
:joes_dog
end
end
end
def test_dog_is_not_available_in_the_cur... | 24.55 | 71 | 0.651222 |
336ead4cc6c8db8f523f71ed5651eeb59f6c7d5d | 2,392 | # This class represents a todo item and its associated
# data: name and description. There's also a "done"
# flag to show whether this todo item is done.
class Todo
DONE_MARKER = 'X'
UNDONE_MARKER = ' '
attr_accessor :title, :description, :done
def initialize(title, description='')
@title = title
@de... | 15.044025 | 78 | 0.639214 |
f7ffe288d571c4d9d06b2528101f11cca447ef43 | 3,987 | # frozen_string_literal: true
module ResourceAccessTokens
class CreateService < BaseService
def initialize(current_user, resource, params = {})
@resource_type = resource.class.name.downcase
@resource = resource
@current_user = current_user
@params = params.dup
end
def execute
... | 31.393701 | 183 | 0.700527 |
ac3ad18c7106a6754f37c8aa7d4f5d7a907b653c | 711 | class BoardPrinter
FILE_LETTERS = ("A".."H").to_a
ENCODING = 'utf-8'
def initialize
@unicode_dict = UnicodeChess.new
end
def print(board)
board_string = ""
Board::RANKS.reverse.each do |rank, index|
board_string << "#{rank}|"
Board::FILES.each do |file|
piece = board.find_pie... | 26.333333 | 109 | 0.64557 |
acdc6bdc6704b14e6476ce512b21510a50afa142 | 16,765 | module Roby
module Distributed
class << self
# The block which is called when a new transaction has been proposed to us.
attr_accessor :transaction_handler
# Sets up the transaction handler. The given block will be called
# in a separate thread whenever a remote peer proposes a new
... | 33.868687 | 120 | 0.654757 |
182306a97432603d940d021170082b4563708a9b | 3,673 | require File.expand_path('../helper', __FILE__)
class YouTrackTest < Service::TestCase
def setup
@stubs = Faraday::Adapter::Test::Stubs.new
@data = {'base_url' => 'http://yt.com/abc', 'committers' => 'c',
'username' => 'u', 'password' => 'p'}
end
def valid_process_stubs
@stubs.post "/ab... | 26.42446 | 83 | 0.629186 |
9108592ec54894104b80dcac2831b03a4c36c7dd | 1,189 | require "language/node"
class Typescript < Formula
desc "Language for application scale JavaScript development"
homepage "https://www.typescriptlang.org/"
url "https://registry.npmjs.org/typescript/-/typescript-3.6.2.tgz"
sha256 "9495625742582db7cb5cc04d34a0b56b8b4b7af1b56b87944fbf30be439a1641"
head "https:/... | 30.487179 | 93 | 0.71741 |
ac9fa140ae41216b3e6c97470bd41327c3ad4001 | 2,321 | require File.expand_path("../../helpers", __FILE__)
class ExpressionSet < Test::Unit::TestCase
def test_expression_set_expand_members_digit
set = RP.parse('[\d]').first
assert_equal ['0-9'], set.expand_members
assert_equal ['\p{Digit}'], set.expand_members(true)
end
def test_expression_set_e... | 27.305882 | 66 | 0.663507 |
d56b4256cf1ed80b54685e2df6fb10010dd343ee | 660 | require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Railstime
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails... | 33 | 82 | 0.765152 |
b9aa2a9da9ae166311d0a14cac674658d3d82ad0 | 318 | module TD::Types
# Contains information about saved card credentials.
#
# @attr id [String] Unique identifier of the saved credentials.
# @attr title [String] Title of the saved credentials.
class SavedCredentials < Base
attribute :id, TD::Types::String
attribute :title, TD::Types::String
end
end
| 28.909091 | 65 | 0.720126 |
ab2aabeb7cc5487cb036b2729d6c8762f04278c9 | 30 | module BuyTypeListsHelper
end
| 10 | 25 | 0.9 |
bfe69a0499e5d972c748b1016868aca1dde2c061 | 3,894 |
class Printer
def self.warning_message
puts "======================================================================================================"
puts "!!!!!!!!! The doctor, team or specialty or language that you have choosen does not exit !!!!!!!!!"
puts "=====================================... | 33.282051 | 113 | 0.4453 |
6aa4f073b4a9f8e156f494cf5fab33263f3748bd | 2,223 | require 'rails_helper'
RSpec.describe OfferedCourseOptionDetailsCheck do
let(:course_option) { create(:course_option, study_mode: :full_time) }
it 'is successful when all the provided details correspond to the course option' do
service = described_class.new(provider_id: course_option.provider.id,
... | 49.4 | 138 | 0.651372 |
bb56349f6be9a63f5b8d079838cd017f57cfc97b | 6,637 | # Farmbot Device models all data related to an actual FarmBot in the real world.
class Device < ApplicationRecord
DEFAULT_MAX_CONFIGS = 300
DEFAULT_MAX_IMAGES = 100
DEFAULT_MAX_LOGS = 1000
TIMEZONES = TZInfo::Timezone.all_identifiers
BAD_TZ = "%{value} is not a valid timezone"
THROTTLE_ON = "Device is send... | 31.755981 | 80 | 0.656471 |
39b8c536c9e105b24e3cd9576ca44c0e91e459f3 | 125 | require File.expand_path('../../lib/suitable_services', __FILE__)
RSpec.configure do |config|
config.mock_with :mocha
end
| 20.833333 | 65 | 0.76 |
f88c18c888635147c25c1bbe7963e48000e72bf8 | 822 | # frozen_string_literal: true
require 'dopp/error'
module Dopp
module Type
# PDF type "Literal String".
class Text
include ::Dopp::Error
# Initialize.
# @param [String] text String.
def initialize(text)
check_is_a!(text, String)
@string = text
end
# Conv... | 20.04878 | 48 | 0.537713 |
0101a91ce6640feafd396046f621359615e765b6 | 930 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "alohaha/settings"
Gem::Specification.new do |spec|
spec.name = "Alohaha"
spec.version = Settings::VERSION
spec.authors = ["jiunjiun"]
spec.email = ["quietmes@... | 33.214286 | 74 | 0.646237 |
ed4b406ec14019ef2b8c9b04137ec610e106a3d0 | 1,685 | class Codec2 < Formula
desc "Open source speech codec"
homepage "https://www.rowetel.com/?page_id=452"
# Linked from https://freedv.org/
url "https://github.com/drowe67/codec2/archive/v1.0.1.tar.gz"
sha256 "14227963940d79e0ec5af810f37101b30e1c7e8555abd96c56b3c0473abac8ef"
license "LGPL-2.1-only"
bottle d... | 45.540541 | 123 | 0.69911 |
1a9373feeee07357bde4bfbe1476cfe627e297f6 | 5,348 | require 'spec/runner/options'
require 'spec/runner/option_parser'
require 'spec/runner/example_group_runner'
require 'spec/runner/command_line'
require 'spec/runner/drb_command_line'
require 'spec/runner/backtrace_tweaker'
require 'spec/runner/reporter'
require 'spec/runner/spec_parser'
require 'spec/runner/class_and_a... | 28.296296 | 109 | 0.625841 |
1c26d274784b67b467a861d8e30a389d24851252 | 1,482 | class Mtools < Formula
desc "Tools for manipulating MSDOS files"
homepage "https://www.gnu.org/software/mtools/"
url "https://ftp.gnu.org/gnu/mtools/mtools-4.0.25.tar.gz"
mirror "https://ftpmirror.gnu.org/mtools/mtools-4.0.25.tar.gz"
sha256 "8b6d4a75122984350186250aaa6063665bfa69100253fd77b972d2744e07dc08"
... | 24.7 | 93 | 0.709177 |
bfa3bb1faa3f8e4bed0eb1e767f48ea050e744a1 | 705 | $:.push File.expand_path("../lib", __FILE__)
Gem::Specification.new do |gem|
gem.name = "administrate-field-ckeditor"
gem.version = "0.0.9"
gem.authors = ["Rikki Pitt"]
gem.email = ["rikkipitt@gmail.com"]
gem.homepage = "https://github.com/jemcode/administrate-field-ckeditor"
gem.summary = "Plugin for addi... | 33.571429 | 73 | 0.66383 |
1103ee23b6411eef332103031ddde4a742f3e480 | 85 | json.array! @ag_apartments, partial: 'ag_apartments/ag_apartment', as: :ag_apartment
| 42.5 | 84 | 0.8 |
7939e7d714f9909ae66c6633e36bf1dbd1acd7f6 | 543 | class Shop < ApplicationRecord
belongs_to :user ,optional: true
validates :name, presence: true, length: { maximum: 100 }
validates :introduction, presence: true, length: { maximum: 255 }
validates :time, presence: true, length: { maximum: 50 }
validates :holiday, presence: true, length: { maximum: 50 }
... | 33.9375 | 67 | 0.714549 |
87dd58f3f05c97107e74e89d4f9d6bc3f7173ea1 | 7,997 | # 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... | 47.60119 | 141 | 0.672377 |
e878eaae5dc3cb7c39b1121132a1f8b9696429dc | 2,367 | require 'spec_helper'
describe Mastermind::Game_Engine do
let(:start) { Mastermind::Game_Engine.new }
before :each do
allow_message_expectations_on_nil
end
it 'display welcome message' do
allow(start).to receive(:puts).and_return(nil)
expect(start.welcome).to be (nil)
end
it 'prints logo' ... | 33.338028 | 68 | 0.683988 |
d5fccd1c1a0ee3613a35d5fbce9b6d6b2e8afdf8 | 5,593 | module Sp2db
class BaseTable
attr_accessor :name,
:sheet_name,
:worksheet,
:find_columns,
:spreadsheet_id,
:client
def initialize opts={}
if opts[:name].blank? && opts[:sheet_name].blank?
raise "Must spe... | 22.643725 | 90 | 0.570177 |
08dc68646709867692f74338f1b289bc9a7abb85 | 216 | # Add your variables here
first_number = 4
second_number = 3
sum = first_number + second_number
difference = first_number - second_number
product = first_number * second_number
quotient = first_number / second_number | 30.857143 | 41 | 0.810185 |
1d268600e22630e8e4095f7f8230e2532c8ab9ee | 616 | exclude :test_feed, "needs investigation"
exclude :test_feed_before_first_next, "needs investigation"
exclude :test_feed_mixed, "needs investigation"
exclude :test_feed_yielder, "needs investigation"
exclude :test_generator, "needs investigation"
exclude :test_initialize, "needs investigation"
exclude :test_initialize_... | 47.384615 | 60 | 0.844156 |
21fcea6b778f4380c9f53ecfbec9f52e9097ba5c | 391 | module CandidateInterface
class Reference::RefereeNameForm
include ActiveModel::Model
attr_accessor :name
validates :name, presence: true, length: { minimum: 2, maximum: 200 }
def self.build_from_reference(reference)
new(name: reference.name)
end
def save(reference)
return fals... | 19.55 | 73 | 0.693095 |
2675827c2515cf8853af7babf169bef137fd67f5 | 753 | module Txbr
class CampaignsApi
CAMPAIGN_BATCH_SIZE = 100 # from braze docs
CAMPAIGN_LIST_PATH = 'campaigns/list'.freeze
CAMPAIGN_DETAILS_PATH = 'campaigns/details'.freeze
attr_reader :braze_api
def initialize(braze_api)
@braze_api = braze_api
end
def each(&block)
return to_... | 25.1 | 95 | 0.686587 |
f88f9d0ff8de33849ae0f59e62755a8301de9d55 | 255 | require 'test/unit'
require 'rubygems'
require 'mocha'
ENV['RAILS_ENV'] = 'test'
require 'active_support'
require File.dirname(__FILE__) + '/../lib/rails-footnotes/footnotes'
require File.dirname(__FILE__) + '/../lib/rails-footnotes/notes/abstract_note' | 28.333333 | 78 | 0.752941 |
790e917b22f9583cbc0a9cf33be2e7ba044e08fb | 1,676 | module Hbc
class CLI
class InternalAppcastCheckpoint < InternalUseBase
def self.run(*args)
calculate = args.include? "--calculate"
cask_tokens = cask_tokens_from(args)
raise CaskUnspecifiedError if cask_tokens.empty?
if cask_tokens.all? { |t| t =~ %r{^https?://} && t !~ /\.r... | 27.032258 | 114 | 0.569212 |
62572b841dbfdcd8b11543b1b5e000b183aa54c8 | 123 | class AddFilenameToCharts < ActiveRecord::Migration[5.2]
def change
add_column :charts, :filename, :string
end
end
| 20.5 | 56 | 0.747967 |
bbec74911be72ec3d303e3dc150ac9d99a1b7165 | 9,769 | #
# Author:: Daniel DeLeo (<dan@chef.io>)
# Copyright:: Copyright (c) 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:/... | 34.641844 | 125 | 0.660354 |
3874de6390f2edcc725ea09558dc6240f7a3ab31 | 473 | require './auth_wrap'
title = ARGV.shift
dir = ARGV.shift
app = GDriveApp.new('messtin')
mid = app.messtinFolder
puts mid
folder_id = app.createFolder(title, title, mid)
tm_id = app.createFolder('tm', 'thumbnail', folder_id)
Dir.glob(dir + '/*.jpg').each do |jpg|
name = File.basename(jpg)
puts name
app.uploa... | 19.708333 | 54 | 0.691332 |
b98b2b186a709cdd70e5a6d1249ac38290495512 | 4,726 | #
# Be sure to run `pod spec lint KnobControl.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github... | 36.921875 | 144 | 0.591832 |
1820164445321957c4474559b8357986de629474 | 115 | # frozen_string_literal: true
class OrderItem < ActiveRecord::Base
belongs_to :order
belongs_to :beverage
end
| 16.428571 | 36 | 0.791304 |
bbb2378f5c56becac22646212beb343549da5170 | 28,558 | # Copyright (C) The Arvados Authors. All rights reserved.
#
# SPDX-License-Identifier: AGPL-3.0
require 'can_be_an_owner'
class User < ArvadosModel
include HasUuid
include KindAndEtag
include CommonApiTemplate
include CanBeAnOwner
extend CurrentApiClient
serialize :prefs, Hash
has_many :api_client_auth... | 34.038141 | 160 | 0.654738 |
f88106f259b67a6a10d07d54555e26a8ff00b70b | 685 | # frozen_string_literal: true
module PerformanceMonitoring
class PrometheusPanelGroup
include ActiveModel::Model
attr_accessor :group, :priority, :panels
validates :group, presence: true
validates :panels, presence: true
class << self
def from_json(json_content)
build_from_hash(js... | 22.833333 | 88 | 0.652555 |
085d24da57d92f2d58f3386bbb85537a4c0a321f | 1,400 | # frozen_string_literal: true
# Copyright (C) 2015 Twitter, Inc.
# note: the following is just a simple example. before making any stats calls, make
# sure to read our best practices for analytics which can be found here:
#
# https://dev.twitter.com/ads/analytics/best-practices
# https://dev.twitter.com/ads/analytics/... | 32.55814 | 83 | 0.760714 |
18dccaf94c953265f48ff6e42fb004bdf9596bdd | 1,125 | require_dependency 'issue'
module SerialNumberField
module IssuePatch
extend ActiveSupport::Concern
included do
after_save :assign_serial_number!
end
def assign_serial_number!
serial_number_fields.each do |cf|
next if assigned_serial_number?(cf)
target_custom_value = se... | 23.4375 | 62 | 0.690667 |
62c80ba07206e99817ebebe7aa0e5b431f1d7af2 | 4,339 | # frozen_string_literal: true
module GraphQL
class Query
# Turn query string values into something useful for query execution
class LiteralInput
def self.coerce(type, ast_node, variables)
case ast_node
when nil
nil
when Language::Nodes::NullValue
nil
w... | 37.08547 | 112 | 0.596681 |
d5d7d80bb446ed6d9c778b76b9ef24bfc2c2231d | 133 | class User < ApplicationRecord
has_secure_password
has_many :dogs
accepts_nested_attributes_for :dogs, allow_destroy: true
end
| 22.166667 | 58 | 0.827068 |
032b3c31af9547631677f80b4862287743d6e405 | 5,997 | # -------------------------------------------------------------------------- #
# Copyright 2002-2020, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# no... | 37.716981 | 78 | 0.481574 |
f7e7bb9453ce895a2e704b73572fd41590ea7513 | 1,486 | require 'rails/generators'
module SqlSearchNSort
class InstallGenerator < Rails::Generators::Base
source_paths << File.expand_path('../views/application', __FILE__)
source_paths << File.expand_path('../assets/javascripts', __FILE__)
source_paths << File.expand_path('../helpers', __FILE__)
source_paths << Fil... | 34.55814 | 110 | 0.711306 |
91d712dd7a00883e7870db67f2051a8fe2cb3f7d | 1,469 | class Pioneers < Formula
desc "Settlers of Catan clone"
homepage "http://pio.sourceforge.net/"
url "https://downloads.sourceforge.net/project/pio/Source/pioneers-15.3.tar.gz"
sha256 "69afa51b71646565536b571b0f89786d3a7616965265f196fd51656b51381a89"
bottle do
sha256 "ab5a8f58765f5121b134507c3c12e0f4f6c0bf... | 30.604167 | 92 | 0.686862 |
ed34df191db95c65380a703fd69980e3dfdb8ec8 | 15,847 | # frozen_string_literal: true
module Flexirest
# JSON API requests and responses
module JsonAPIProxy
@object ||= nil
@headers ||= {}
# Methods used across other modules
module Helpers
def singular?(word)
w = word.to_s
w.singularize == w && w.pluralize != w
end
de... | 36.180365 | 98 | 0.600682 |
61d11930f74479f14b93a967ec20ec1080abf822 | 1,979 | class CategoriesController < ApplicationController
before_action :set_category, only: [:show, :edit, :update, :destroy]
before_action :login_check
# GET /categories
# GET /categories.json
def index
@categories = Category.all.order(:no)
end
# GET /categories/1
# GET /categories/1.json
def show
... | 26.039474 | 96 | 0.676604 |
7a95fb8081255a1498841cb0f0e71d5f99a81ae5 | 537 | require 'test_helper'
require 'vcr_setup'
class CqlToElmHelperTest < ActiveSupport::TestCase
include WebMock::API
setup do
dump_database
load_measure_fixtures_from_folder(File.join('measures', 'CMS160v6'))
@measure = CQM::Measure.first
end
test 'translate_cql_to_elm produces json' do
VCR.use... | 24.409091 | 77 | 0.748603 |
bf33cb9b526c39cc6bcb70b47a73274ff7188ad0 | 14,718 | #
# Author:: Adam Jacob (<adam@opscode.com>)
# Author:: Seth Falcon (<seth@opscode.com>)
# Author:: Kyle Goodwin (<kgoodwin@primerevenue.com>)
# Copyright:: Copyright 2008-2010 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | 38.328125 | 118 | 0.71416 |
26d5413920698b70ee209d8a6c4c18567953c5b5 | 1,432 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
require 'aws-sdk-core'
require 'aws-sigv4'
require_relative 'aws-sdk-sagemaker/t... | 26.518519 | 92 | 0.75 |
e2d398897092e8be1781a065118ee94278953a4e | 1,546 | require 'rails_helper'
describe 'users/delete/show.html.slim' do
let(:user) {build_stubbed(:user, :signed_up)}
let(:decorated_user) {user.decorate}
before do
allow(user).to receive(:decorate).and_return(decorated_user)
allow(view).to receive(:current_user).and_return(user)
end
it 'displays headings... | 31.55102 | 95 | 0.743208 |
61e70c8238e0b3879178c6d2bfb4dd5785392003 | 4,319 | # -*- coding: binary -*-
require 'rex/java/serialization'
require 'rex/text'
module Msf
module Java
module Rmi
module Util
# Calculates a method hash to make RMI calls as defined by the JDK 1.2
#
# @param signature [String] The remote method signature as specified by the JDK 1.2,
... | 34.830645 | 174 | 0.59273 |
0386601d8926cb1ccfabfd6ed0586c6440f59acf | 1,430 | require 'rails_helper'
RSpec.describe TimelineEvent do
let(:timeline_event) { FactoryGirl.build(:timeline_event) }
#should_validate_presence_of :event_type
before(:each) do
FactoryGirl.create :package_rating
end
it 'has a valid factory' do
expect(timeline_event).to be_valid
end
describe 'vali... | 25.535714 | 88 | 0.709091 |
bba145c8bdb15750a0c20a1ee1c386801ec65499 | 114 | class AddMassToStars < ActiveRecord::Migration[5.1]
def change
add_column :stars, :mass, :decimal
end
end
| 19 | 51 | 0.72807 |
0874fcc577337fce059410316a67faf6ae4d0e8d | 5,303 | module Roadworker
class Client
include Roadworker::Log
include Roadworker::Utils::Helper
def initialize(options = {})
@options = OpenStruct.new(options)
@options.logger ||= Logger.new($stdout)
String.colorize = @options.color
@options.route53 = Aws::Route53::Client.new
@heal... | 27.910526 | 125 | 0.600226 |
1ae106a30a8730360223e9bf527121d40673df66 | 4,389 | require "rails_helper"
feature "View providers", type: :feature do
let(:organisation_page) { PageObjects::Page::Organisations::OrganisationPage.new }
let(:current_recruitment_cycle) { build(:recruitment_cycle) }
let(:provider_1) { build :provider, provider_code: "A0", include_counts: [:courses] }
let(:rollover... | 34.833333 | 120 | 0.689451 |
08636e10553ce61f8e75946a894a52e3af00b10f | 260 | if RUBY_VERSION < '3'
require './lib/backports/3.0.0/ractor.rb'
require './lib/backports/2.3.0/string/uminus.rb'
PATH = './test/test_ractor.rb'
require './test/mri_runner_patched.rb'
nil.freeze
true.freeze
false.freeze
exec_test [PATH]
end
| 17.333333 | 50 | 0.688462 |
4ac489520aee6c565b1deb48aa4bf4afb5c2f4e8 | 6,399 | require 'rexml/document'
require 'html/document'
module ActionController
module Assertions
# Pair of assertions to testing elements in the HTML output of the response.
module TagAssertions
# Asserts that there is a tag/node/element in the body of the response
# that meets all of the given conditi... | 49.223077 | 111 | 0.571183 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.