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 |
|---|---|---|---|---|---|
6ad1acdcd9d5139def267eebbddb4aeebac3e4a2 | 204 | class ChangeGameStatusDefaultAsPending < ActiveRecord::Migration
def up
change_column_default(:games, :status, 'pending')
end
def down
change_column_default(:games, :status, nil)
end
end
| 20.4 | 64 | 0.75 |
4a0435d7e969b0ef40f1ee84e50045a9304543a3 | 3,644 | Given(/^You are in the Compliance page$/) do
visit AutomationHomePage
on(LoginPage).login_yml
on(LandingPage).menus.when_present(10).click
sleep(1)
on(LandingPage).compliance.when_present(10).click
sleep(3)
end
And(/^you see Reg$/) do
expect(on(CompliancePage).reg0.present?).to be_truthy
end
And(/^you c... | 37.958333 | 80 | 0.768386 |
01d56f1de4498aa3982f6a7ef107864d7b99d15e | 1,133 | # frozen_string_literal: true
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "email_inquire/version"
Gem::Specification.new do |spec|
spec.name = "email_inquire"
spec.version = EmailInquire::VERSION
spec.authors = ["Maxime Garcia"]
spec.email = ["max... | 32.371429 | 98 | 0.697264 |
e2aefbe1b33fdcb347732fc0936ac9cf2cd4c746 | 217 | # archiveable_id - integer
# archiveable_type - string
# archive_number - string
# archived_at - datetime
class Poly < ActiveRecord::Base
archival_record
belongs_to :archiveable, polymorphic: true
end
| 18.083333 | 44 | 0.741935 |
2664f81171b4546c886e3b81ec2f627b75d7c8c6 | 459 | class DeviseControllers::ConfirmationsController < Devise::ConfirmationsController
include DeviseHelper
protected
def after_confirmation_path_for(resource_name, resource)
sign_in resource
profile_path
end
# The path used after confirmation.
#
def after_confirmation_path_for(resource_name, resou... | 21.857143 | 82 | 0.77342 |
2696f0057086db42d22af14b857d3011fc6e47ec | 7,571 | # frozen_string_literal: true
module OmniauthMacros
# The mock_auth configuration allows you to set per-provider (or default)
# authentication hashes to return during integration testing.
ENV['OSEM_GOOGLE_KEY'] = 'test key google'
ENV['OSEM_GOOGLE_SECRET'] = 'test secret google'
ENV['OSEM_FACEBOOK_KEY'] = '... | 43.763006 | 80 | 0.397834 |
1a0afb56b4fb042a1af8d9e9e195552a4d9dec7d | 659 | module Gitlab
module CycleAnalytics
class PlanStage < BaseStage
def start_time_attrs
@start_time_attrs ||= [issue_metrics_table[:first_associated_with_milestone_at],
issue_metrics_table[:first_added_to_board_at]]
end
def end_time_attrs
@end_time_at... | 21.258065 | 88 | 0.622155 |
2639bd9c453377b015af6d560bb7053f700082a1 | 4,486 | module Purchasing
def purchase(customer, subscriber, invoice=nil, product=nil)
subscription_product = product.nil? ? subscriber.subscription_plan.product : product
if subscription_product.has_variants?
variant = if subscription_product.default_variant.present? and subscription_product.in_stock?
... | 42.320755 | 101 | 0.690816 |
5dbfe5b8dcaec872888a9480d899a1e9b3a131bd | 91 | Pry.config.prompt = lambda do |context, nesting, pry|
"[timeywimey] #{context} > "
end
| 22.75 | 54 | 0.659341 |
1d058051089e58b51bd418b961481bce9f0ba297 | 648 | class AnswersController < ApplicationController
http_basic_authenticate_with name: "admin", password: "password", only: :destroy
def create
@question = Question.find(params[:question_id])
@answer = @question.answers.create(answer_params)
if @question.movie? == @answer.reallife
render :wrong
... | 23.142857 | 82 | 0.695988 |
0873732161424ff6d545e5308e6016166793a26d | 5,149 | #
# Be sure to run `pod spec lint HTCountDownButton.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://... | 37.311594 | 107 | 0.597203 |
210ec161599822c65811ae952fae286084e2b096 | 222 | puts "Hello World!"
print "Please input your string:"
user_input = gets.chomp
user_input.downcase!
if user_input.include? "s"
puts user_input.gsub!(/s/, "th")
else
puts "No ss found!"
end
30.times {print "Ruby!"}
| 15.857143 | 35 | 0.693694 |
1d04aab94aa8eb06fef7ce8bd7875127ae73eadb | 140 | class AddRoleToUserProfile < ActiveRecord::Migration[5.0]
def change
add_column :user_profiles, :role, :integer, default: 0
end
end
| 23.333333 | 58 | 0.75 |
796bbe4caecda661d94f6acf44da61d7362112a4 | 369 | require "open-uri"
class Musicbrainz
def initialize(mbid:)
@mbid = mbid
end
def call
# mbid = "56d2735d-abc7-4070-9c3f-bc27593d922d"
url = "https://musicbrainz.org/ws/2/recording/#{@mbid}?inc=releases&fmt=json"
raw = URI.open(url, "User-Agent" => "curl/7.54.0").read
response = JSON.parse ra... | 21.705882 | 81 | 0.644986 |
28084a93ed7a74fdf3c4f472179fb33d3243a91f | 333 | $LOAD_PATH.unshift(File.expand_path('../', __FILE__))
require 'spec_helper'
require 'netlink'
describe Netlink::NlMsgHdr do
describe '#payload_len' do
it 'should return the length of the message minus header length' do
hdr = Netlink::NlMsgHdr.new
hdr.len += 10
hdr.payload_len.should == 10
e... | 23.785714 | 71 | 0.693694 |
08970c78f4f8c1230b8a66f03b8551f24b11e1f4 | 861 | #
# Cookbook Name:: oneview_test_api300_synergy
# Recipe:: logical_interconnect_remove_from_scopes
#
# (c) Copyright 2017 Hewlett Packard Enterprise Development LP
#
# 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 co... | 39.136364 | 84 | 0.782811 |
080b9ab1559d60fa29dbd2a2c82eda55ef27faef | 792 | module OData
module Core
module Segments
class EntityTypeSegment < OData::Core::Segment
include OData::Core::Countable
attr_reader :entity_type
def initialize(query, entity_type, value = nil)
@entity_type = entity_type
super(query, value || (@entity_type.is_a?(... | 24.75 | 130 | 0.609848 |
bb27eafce56521bff24e7d2c975cb1d1fa1d52fb | 59 | module Resque
class Pool
VERSION = "0.7.0"
end
end
| 9.833333 | 21 | 0.627119 |
ff2f6ba9ad98655d76a21f5ad859d71b54973cb3 | 2,619 | #-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2020 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.761364 | 91 | 0.649866 |
385ee95b715a8820df8903f88c05ff26abec4f5b | 899 | module RailsNewIo
class HtmlDataAttributeGenerator
def initialize(item_name, menu_card_in_all_states, menu_card_id)
@item_name = item_name
@menu_card_in_all_states = menu_card_in_all_states
@menu_card_id = menu_card_id
end
def html_data_attributes
@menu_card_in_all_states[@item_na... | 29.966667 | 133 | 0.728587 |
e9816eb03dea370f6362508fd1f1dd6b3dbe3650 | 1,161 | require "spec_helper"
RSpec.describe Adjudication::Engine::Claim do
describe 'duplicate? method' do
it "must have an npi length of 10 characters" do
provider =
Adjudication::Providers::Provider.new
provider.npi = "0123456789"
expect(provider.valid?).to eq(true)
end
it "must not... | 24.702128 | 68 | 0.653747 |
4a3d3b935d8d0be536c8909d12cf797d88ab5154 | 1,554 | require 'facebook/messenger/configuration/app_secret_proof_calculator'
module Facebook
module Messenger
class Configuration
module Providers
# This is the base configuration provider.
# User can overwrite this class to customize the environment variables
# Be sure to implement a... | 28.254545 | 80 | 0.617761 |
1a5f223f8c3b1ccb234433a0a0bd2db3c1983fdd | 1,331 | class SessionsController < ApplicationController
# This is required because of a quirk the "developer" authentication
# strategy. We'll remove this when we move to a "real" provider.
skip_before_action :verify_authenticity_token, only: :create
skip_before_action :require_login, only: [:new, :create, :destroy]
... | 28.934783 | 70 | 0.659654 |
b974b27254938c60b65d8ecf0c166b2607a462c0 | 1,156 | require 'test_helper'
describe Cassandra::Utils::Stats::Health do
before do
@checker = Cassandra::Utils::Stats::Health.new
end
describe :run! do
it 'succeeds if node is NORMAL and thrift and gossip are running' do
@checker.stub :nodetool_netstats, 'Mode: NORMAL' do
@checker.stub :nodetool_... | 30.421053 | 86 | 0.639273 |
4a248cbe36e80b1fb2ffafbd1b7ae23a8c68e4ac | 415 | # encoding: utf-8
module FriendlyId
module Helpers
# Calculate expected result size for find_some_with_friendly (taken from
# active_record/base.rb)
def expected_size(ids_and_names, options) #:nodoc:#
size = options[:offset] ? ids_and_names.size - options[:offset] : ids_and_names.size
size... | 27.666667 | 90 | 0.689157 |
e275c13b8f811b71e2cd83b3f7ec70c7035ddcdd | 53 | class HeapAPI::Client
include HeapAPI::Helpers
end
| 13.25 | 26 | 0.792453 |
bb90e764f1f975006aef6f12e92454c1c59acefa | 5,112 | require 'rails_helper'
include ActiveSupport::Testing::TimeHelpers
RSpec.describe Api::Url, type: :model do
before do
travel_to Time.local(2021)
end
after do
travel_back
Api::Url.destroy_all
end
describe '#new' do
it "is valid with a slug and a valid original_Api::Url" do
url = Api:... | 32.56051 | 129 | 0.65669 |
b918e176662d3628f169eb49d437f7e2bc14148d | 5,607 | require File.expand_path('../../../Util/platform.rb', __FILE__)
module Applocale
class CompareStringFile
attr_reader :in_multiline_comments, :platform, :file1, :file2, :errorlist, :print_result, :lang
def initialize(platform, file1, file2, lang = nil, print_result = true)
@platform = platform
... | 27.35122 | 181 | 0.531835 |
ff78fdc738349fdc99a8d9180513263ec26d7214 | 2,478 | # frozen_string_literal: true
module HTML
class Pipeline
class AtMentionFilter < Filter
DEFAULT_IGNORED_ANCESTOR_TAGS = %w(pre code tt a style).freeze
# @param context [Hash]
# @options context :users_provider [#call(usernames)] given usernames, returns a list of users.
def initialize(doc... | 31.769231 | 107 | 0.602502 |
915d214d0b9ed695ee3e9b825e6521d2f27ac46d | 829 | require_relative 'spec_utils.rb'
require 'rspec'
require './lib/commit_score_writer'
require './lib/joy_config'
SUBJECT = "This is the subject line without a body"
SCORE = 5
describe 'Commit Score Writer' do
context 'given no commit message' do
it 'should throw an argument error' do
expect {GitCommitScore... | 23.685714 | 71 | 0.712907 |
6a4a5375d182854eadefe6d47c699518873c2c92 | 1,630 | # frozen_string_literal: true
class Fisk
module Instructions
# Instruction MULSS: Multiply Scalar Single-Precision Floating-Point Values
MULSS = Instruction.new("MULSS", [
# mulss: xmm, xmm
Form.new([
OPERAND_TYPES[23],
OPERAND_TYPES[24],
].freeze, [
Class.new(Fisk::En... | 28.103448 | 79 | 0.497546 |
1aeb6b90433d0a46b3e072fa875ecb3b4a83aca9 | 1,217 | require 'colored'
module Rapid
# Utility functions for logging
#
# Rapid::Logger defines a method, #default_logger, that provides a sensible
# logging format for Rapid.
module Logger
# Constructs the default Rapid logger configuration
def self.default_logger
# TODO: Allow redirecting
outp... | 25.893617 | 77 | 0.620378 |
79486c81809c9f84c743fd9f796bfb12697d2666 | 9,705 | require 'spec_helper'
require 'napa/cli/model'
describe Napa::CLI::Model do
let(:test_output_directory) { 'spec/tmp' }
let(:version) { '20000101000000' }
silence_thor
before do
allow_any_instance_of(described_class).to receive(:model_output_directory).and_return(test_output_directory)
allow_any_insta... | 32.567114 | 117 | 0.65729 |
918a65b8aaa8c395355ae8ae560014ee69b29bf7 | 2,391 | require 'spec_helper'
describe BetfairNg::API::Operations::Betting::ListClearedOrders do
include SharedHelper::Config
include SharedHelper::Stubs
describe "Operation" do
before do
stub :certlogin
stub :list_cleared_orders
end
subject { BetfairNg::API::Operations::Betting::ListClearedOrd... | 41.947368 | 473 | 0.654956 |
38070dda61a32688a462705f2af2f99c6644a1d7 | 1,267 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'coloral/version'
Gem::Specification.new do |spec|
spec.name = "coloral"
spec.version = Coloral::VERSION
spec.authors = ["Patrick Metcalfe"]
spec.email = ["git... | 46.925926 | 324 | 0.681926 |
7a3bf2a560fa7d6dd169512cd1a27dcf40bda1b6 | 1,027 | #
# different ways to create a socket:
# ctx.bind(:xreq, 'tcp://127.0.0.1:6666')
# ctx.bind('xreq', 'tcp://127.0.0.1:6666')
# ctx.bind(ZMQ::XREQ, 'tcp://127.0.0.1:6666')
#
module EventMachine
module ZeroMQ
class Context
def initialize(threads_or_context)
if threads_or_context.is_a?(ZMQ::Cont... | 24.452381 | 85 | 0.564752 |
f700dfe19d607846af1cb0892d50f94c497c4530 | 6,139 | # Copyright 2012 Google 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/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 36.111765 | 110 | 0.660694 |
2824d825c35c143d162e7dbb172524c9bba58c45 | 2,097 | require 'handlebars_assets'
require 'handlebars_assets/config'
require 'handlebars_assets/tilt_handlebars'
require 'handlebars_assets/handlebars'
require 'test/unit'
module SprocketsScope
# Try to act like sprockets.
def make_scope(root, file)
Class.new do
define_method(:logical_path) { pathname.to_s.gs... | 24.670588 | 112 | 0.679065 |
1dc378126481a1ddcd543d46583d84f15434aaf3 | 132 | require 'rails_helper'
RSpec.describe LmsInstance, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end
| 22 | 56 | 0.734848 |
21ef8a794c2eaef2c8a409f27ac61dd37b88a46b | 1,233 | # frozen_string_literal: true
class UnconfirmableUser
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Locker
field :locker_locked_at, type: Time
field :locker_locked_until, type: Time
locker locked_at_field: :locker_locked_at,
locked_until_field: :locker_locked_until
##... | 27.4 | 67 | 0.706407 |
f8d913a2b0d54e7a8ae74d7e1b58b3ce51ea7b97 | 1,666 | NULL = nil
module Ragweed; end
module Ragweed::Wraptux;end
module Ragweed::Wraptux::Ptrace
TRACE_ME = 0
PEEK_TEXT = 1
PEEK_DATA = 2
PEEK_USER = 3
POKE_TEXT = 4
POKE_DATA = 5
POKE_USER = 6
CONTINUE = 7
KILL = 8
STEP = 9
GETREGS = 12
SETREGS = 13
ATTACH = 16
DETACH = 17
SYSCALL = 24
SETOP... | 16.174757 | 43 | 0.664466 |
26b23787dd1a883ba66467890581a4d9c17f3ce5 | 26,516 | module Sass
module Selector
# An operator-separated sequence of
# {SimpleSequence simple selector sequences}.
class Sequence < AbstractSequence
# Sets the line of the Sass template on which this selector was declared.
# This also sets the line for all child selectors.
#
# @param li... | 39.933735 | 99 | 0.591228 |
03e4cf2b70e7b8e98298713a1252c7f9ab07c134 | 2,279 | describe ApplicationHelper::Button::InstanceAttach do
describe '#disabled?' do
it "when there are available volumes, then the button is enabled" do
view_context = setup_view_context_with_sandbox({})
tenant = FactoryBot.create(:cloud_tenant_openstack)
volume = FactoryBot.create(:cloud_volume_ope... | 50.644444 | 106 | 0.706889 |
18ce52871007d56bf4a0d07fd5d2d105869e2e15 | 358 | # encoding: utf-8
# frozen_string_literal: true
class String #:nodoc:
unless method_defined?(:ascii_only?)
# Backport from Ruby 1.9 checks for non-us-ascii characters.
def ascii_only?
self !~ MATCH_NON_US_ASCII
end
MATCH_NON_US_ASCII = /[^\x00-\x7f]/
end
unless method_defined?(:bytesize)
... | 19.888889 | 64 | 0.692737 |
39611a9dfdb0e2aa5bde681cb40bbd2aa8921a9d | 7,832 | #
# Cookbook Name:: networking
# Recipe:: default
#
# Copyright 2010, OpenStreetMap Foundation.
# Copyright 2009, Opscode, 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://... | 22.967742 | 110 | 0.675689 |
21dbe7f33d9ee63cd16bbc6e40ff05e79a378a81 | 2,272 | require "test_helper"
require "fluent/plugin/out_remote_syslog"
class RemoteSyslogOutputTest < Test::Unit::TestCase
def setup
Fluent::Test.setup
end
def create_driver(conf = CONFIG)
Fluent::Test::Driver::Output.new(Fluent::RemoteSyslogOutput).configure(conf)
end
def test_configure
d = create_dr... | 26.729412 | 278 | 0.664613 |
2622a68e458871f90b6d99168cc0bded47441c06 | 585 | module HealthDataStandards
class Facility
include Mongoid::Document
include Mongoid::Attributes::Dynamic
store_in collection: 'facilities'
field :name, type: String
field :code, type: Hash
field :start_time, type: Integer
field :end_time, type: Integer
embeds_many :addresses, as: :... | 25.434783 | 82 | 0.697436 |
ac1f2d7bcce431d170cb3d7dac54f5d87485cf16 | 8,303 | require 'date'
module Phrase
class MemberUpdateParameters
# Update strategy, can be any of set, add, remove. If provided, it will set, add or remove given spaces, projects and locale ids from users access list.
attr_accessor :strategy
# Member role, can be any of of Admin, ProjectManager, Developer, Des... | 31.69084 | 208 | 0.618572 |
3992506c738aeb528f637ac969cd989e69c14298 | 120 | class Empresa < Organizacao
def nome_do_tipo
"Empresa"
end
def nome_da_classe
"empresa"
end
end
| 10.909091 | 29 | 0.65 |
e9c8ea974c64a57b6ad67d7a9205a48952e28b6e | 131 | FactoryBot.define do
factory :element do
tag { "para" }
content { "Hello world!" }
identifier { "ch01_1" }
end
end
| 16.375 | 30 | 0.610687 |
38f30b1b5054016980eed346cd758d777cd755f8 | 628 | cask "epic" do
arch = Hardware::CPU.intel? ? "mac" : "macarm"
version "91.0.4472.114"
if Hardware::CPU.intel?
sha256 "52f388b4da04a26a7c5c732eaf8688e0f2bd0a6c34cd10dffe781d38ae974053"
else
sha256 "79951fee34ba9b9bffea5e03b8217776467e65a737d2054ae38b4f76114acb71"
end
url "https://cdn.epicbrowser.c... | 26.166667 | 81 | 0.700637 |
e9b417d6b8a1f1558305758c0f347e84798f53f0 | 3,949 | # frozen_string_literal: true
module Alchemy
module JsonApi
class PagesController < JsonApi::BaseController
before_action :load_page_for_cache_key, only: :show
def index
allowed = [:page_layout, :urlname]
jsonapi_filter(page_scope, allowed) do |filtered_pages|
@pages = fil... | 29.251852 | 113 | 0.605217 |
edcb99c89d87bdfecabc56bbe36ab4636ebdcd0b | 1,711 | class UniversalCtags < Formula
desc "Maintained ctags implementation"
homepage "https://github.com/universal-ctags/ctags"
url "https://github.com/universal-ctags/ctags/archive/refs/tags/p5.9.20210620.0.tar.gz"
version "p5.9.20210620.0"
sha256 "2506c01cf02cfe50c97bd41bb5aa4056884cc0ad927ba41333be4738c0052c2d"
... | 28.516667 | 106 | 0.686733 |
1a5d8efe61645cea2f3dd8076aca4cfd44dcc7f2 | 379 | class Simulation < ActiveRecord::Base
has_paper_trail
belongs_to :user
belongs_to :farm
belongs_to :weather
belongs_to :soil
validates_presence_of :name, :start_on, :end_on
validates_presence_of :farm_id, message: "must be selected"
validates_presence_of :weather_id, message: "must be selected"
valid... | 31.583333 | 64 | 0.783641 |
7958ad7e24fe921a36e10812d407d2fe1b9c8419 | 31,525 | require 'spec_helper'
describe 'Filter issues', js: true, feature: true do
include Devise::Test::IntegrationHelpers
include FilteredSearchHelpers
let!(:group) { create(:group) }
let!(:project) { create(:project, group: group) }
let!(:user) { create(:user, username: 'joe') }
let!(:user2) { create(:user, us... | 36.699651 | 192 | 0.659794 |
1cc4a7c290b00646aa20047add1bf23dd15d2e9c | 4,667 | require 'active_support'
module Tiun::Base
extend ActiveSupport::Concern
included do
#attr_accessor :params
#define_callbacks :subscribe
# include Kaminari::ConfigurationMethods
#class_attribute :_helpers
#self._helpers = Module.new
#include ActiveSupport::Configurable
... | 30.703947 | 116 | 0.6036 |
edf0baea9af93b76ed82102585e8958c73fcc945 | 6,713 | =begin
#NSX-T Manager API
#VMware NSX-T Manager REST API
OpenAPI spec version: 2.5.1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.7
=end
require 'date'
module NSXT
# An endpoint to connect to NSX-Intelligence broker. Either FQDN or IP address can be used in t... | 28.688034 | 115 | 0.615373 |
03b4d56685a875ec51effc9136572cdff4c1d7ee | 1,581 | #
# Be sure to run `pod lib lint TSBezierPathView.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 = 'TS... | 35.931818 | 108 | 0.636939 |
086244926e26b697044d1f0423ac2982eaa25e7b | 31 | module SfaccountHelper
end
| 7.75 | 23 | 0.774194 |
4aca2d1ffcab328b4adfecce304326341d996918 | 8,388 | # Copyright (c) 2009-2012 VMware, Inc.
module Bosh::Director
class ProblemScanner
AGENT_TIMEOUT = 10 # seconds
attr_reader :event_log, :logger
@queue = :normal
# @param [String] deployment_name Deployment name
def initialize(deployment)
@deployment = deployment
@instance_manager =... | 31.182156 | 114 | 0.577611 |
1cd358112e5381c0fbc35e819ff6476308ce0873 | 367 | require "spec_helper"
describe "brightbox servers" do
describe "update" do
let(:output) { FauxIO.new { Brightbox.run(argv) } }
let(:stdout) { output.stdout }
let(:stderr) { output.stderr }
context "" do
let(:argv) { %w(servers update) }
it "does not error" do
expect { output }.... | 19.315789 | 55 | 0.607629 |
03e1b949b7a1a522cb85e91449295081217e9b52 | 4,818 | # frozen_string_literal: true
def env
ENV["APP_ENV"] || ENV["RACK_ENV"]
end
def test_env?
env == "test"
end
def development_env?
env == "development"
end
class InitialSchema < ActiveRecord::Migration[7.0]
def change
create_table :tags, if_not_exists: true do |t|
t.string :name, null: false
end... | 25.357895 | 91 | 0.660232 |
3338df4c80728137a53da2a11fea82ffcd744224 | 5,702 | require File.dirname(__FILE__) + '/spec_helper.rb'
describe "Twitter::Base" do
before do
@base = Twitter::Base.new('foo', 'bar')
end
describe "being initialized" do
it "should require email and password" do
lambda { Twitter::Base.new }.should raise_error(ArgumentError)
end
end
describe "t... | 37.513158 | 103 | 0.672571 |
f822d937dabde4a3ecebc74faea63e07af24ce17 | 1,108 | 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
before_filter :configure_permitted_parameters, if: :devise_controller?
#private
#def current_user
# @current_us... | 27.02439 | 106 | 0.731047 |
3875b0420f423eaec7a7cc1e59ba586449e905dd | 279 | require 'action_view'
module ActionView
module Helpers
class FormBuilder
def autocomplete_select(method, path, label_or_options = nil, *args)
text_field(method, @template.autocomplete_select_options(path, label_or_options, args))
end
end
end
end
| 23.25 | 95 | 0.734767 |
5d758386727a16d5976ca014285b8bd80e78bec2 | 1,045 | require 'test_helper'
class DocumentsControllerTest < ActionDispatch::IntegrationTest
setup do
@document = documents(:one)
end
test "should get index" do
get documents_url
assert_response :success
end
test "should get new" do
get new_document_url
assert_response :success
end
test "... | 21.326531 | 63 | 0.714833 |
1a0ff945997c1f3bf8d702d97852a95c52c9c96c | 148 | class CreateQueSchema < ActiveRecord::Migration[7.0]
def up
Que.migrate!(version: 6)
end
def down
Que.migrate!(version: 0)
end
end
| 14.8 | 52 | 0.675676 |
01dfe14e570dc62a2990a914b404a0dfba903e6c | 15,190 | # frozen_string_literal: true
# Assuming you have not yet modified this file, each configuration option below
# is set to its default value. Note that some are commented out while others
# are not: uncommented lines are intended to protect your configuration from
# breaking changes in upgrades (i.e., in the event that... | 48.685897 | 154 | 0.752535 |
08c0c805448fdd41b9aae22697a7caa6e5d6b18b | 52,653 | # frozen_string_literal: true
require_relative 'test_helper'
context 'Attributes' do
default_logger = Asciidoctor::LoggerManager.logger
setup do
Asciidoctor::LoggerManager.logger = (@logger = Asciidoctor::MemoryLogger.new)
end
teardown do
Asciidoctor::LoggerManager.logger = default_logger
end
co... | 31.509874 | 150 | 0.613754 |
3318d5cf900026fb6f3275778967d850542da754 | 447 | class CreateUnitOfMeasures < ActiveRecord::Migration[5.0]
def change
create_table :unit_of_measures do |t|
t.string :name, null: false
t.string :description
t.string :code, null: false
t.integer :uom_type, default: 0, null: false
t.decimal :ratio, precision: 8, scale: 2, null: false
... | 27.9375 | 59 | 0.668904 |
e8997ea5b917df561b30fabd92a4ea4423bb3f2e | 76 | json.extract! @post, :id, :title, :body, :user_id, :created_at, :updated_at
| 38 | 75 | 0.697368 |
617306862fe45bc407eb7fdd59387eb3e7b0784f | 500 | require 'pact/provider/rspec'
require_relative "provider_states_for_zoo_app"
class AnimalService
def call env
response_body = {}
if env['PATH_INFO'] == '/alligators'
response_body = {'name' => 'Bob'}.to_json
end
[200, {'Content-Type' => 'application/json'}, [response_body]]
end
end
Pact.se... | 20.833333 | 66 | 0.696 |
e9eccf61a4f46600029f7fc75589dfc39dfbd716 | 1,258 | module Idv
class SsnForm
include ActiveModel::Model
ATTRIBUTES = [:ssn].freeze
attr_accessor :ssn
validates :ssn, presence: true
validates_format_of :ssn,
with: /\A\d{3}-?\d{2}-?\d{4}\z/,
message: I18n.t('idv.errors.pattern_mismatch.ssn'),
... | 22.070175 | 90 | 0.605723 |
33b2616e723b0b66a956bc1069b71e953677d5d4 | 1,576 | module Overviews
class Engine < ::Rails::Engine
engine_name :overviews
include OpenProject::Plugins::ActsAsOpEngine
initializer 'overviews.menu' do
::Redmine::MenuManager.map(:project_menu) do |menu|
menu.push(:overview,
{ controller: '/overviews/overviews', action: 'show... | 30.901961 | 125 | 0.623731 |
ffbaf2f5a859ea2677d2d6291329c57216acab04 | 907 | # frozen_string_literal: true
RSpec::Matchers.define :have_mime_type do |expected|
match do |actual|
@actual = actual.mime_type
values_match?(expected, @actual)
end
failure_message do |actual|
msg = []
msg << %(expected that response of "#{resource}" has mime type "#{expected}", but has "#{actua... | 23.868421 | 103 | 0.584344 |
189ef5ae950b400148242d60aeb93728b32c89e3 | 673 | $:.unshift(File.dirname(__FILE__)) unless
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
require 'active_support/all'
require 'rubigen/base'
require 'rubigen/lookup'
require 'rubigen/commands'
RubiGen::Base.send(:include, RubiGen::Lookup)
RubiGen::Base.send(:include, ... | 30.590909 | 94 | 0.76523 |
213885dfe79de7966d3367960a5742c14cc2720f | 146 | class AddApiTitleToYoutubeVideos < ActiveRecord::Migration
def change
add_column :youtube_videos, :api_title, :string, after: :id
end
end
| 24.333333 | 63 | 0.773973 |
d5dc06bc221b9873071fe207e2bc007c7bd1ccf4 | 535 | # Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems' # This line not needed for ruby > 1.8
require 'twilio-ruby'
# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new acco... | 38.214286 | 71 | 0.779439 |
ac96aa3c0db8ab37928b5b3fc289ede517e775e7 | 1,870 | # frozen_string_literal: true
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 35.961538 | 123 | 0.745455 |
e8748f9a6dd5e9e1689059f0fc51a3a998b0528d | 1,405 | # frozen_string_literal: true
# installer for dotfiles
# author: Playstay
require 'optparse'
require 'pathname'
require 'fileutils'
LN_OPTION = { verbose: true }.freeze
def link_files(source, destination, fileutil, ignore_files)
source.each_child do |dir|
next if ignore_files.include?(dir.basename.to_s)
n... | 24.224138 | 89 | 0.744484 |
014d4d3dc3c758ad3c06c82f524db0e894876e97 | 4,190 | # frizen_string_literal: true
require 'redis'
require 'connection_pool'
require_relative './middleware_chain'
module MultiBackgroundJob
class Config
class << self
private
def attribute_accessor(field, validator: nil, normalizer: nil, default: nil)
normalizer ||= :"normalize_#{field}"
... | 27.385621 | 125 | 0.643198 |
87b50894691650535eb17d642ed8cf9962f29435 | 86 | module Ravelry
module Errors
class Configuration < StandardError; end
end
end
| 14.333333 | 44 | 0.755814 |
01c54558c58f055b0933c1836320c350f2989f4a | 945 | require 'sidekiq-scheduler'
require_relative 'job_presenter'
module SidekiqScheduler
# Hook into *Sidekiq::Web* Sinatra app which adds a new '/recurring-jobs' page
module Web
VIEW_PATH = File.expand_path('../../../web/views', __FILE__)
def self.registered(app)
app.get '/recurring-jobs' do
... | 27 | 80 | 0.687831 |
ed0523517b678de01864bf6b070b9cb37797743b | 61 | class Car < ActiveRecord::Base
include Storext.model
end
| 10.166667 | 30 | 0.754098 |
080c36033bf623830770f99d6782f4ac1417f93d | 764 | Pod::Spec.new do |s|
s.name = 'Stacksift'
s.version = '0.3.5'
s.summary = 'Capture and submit crashes to Stacksift'
s.homepage = 'https://github.com/stacksift/SDK'
s.license = { :type => 'BSD-3-Clause', :file => 'LICENSE' }
s.author = { 'Matt Massicotte' => 'support@chimehq... | 30.56 | 89 | 0.592932 |
4adf2c708f8d7d0d4d877ce4d428d499c37f04fd | 824 | class StudentDistributionResolver < ApplicationQuery
include AuthorizeReviewer
property :course_id
property :coach_id
property :coach_notes
property :tags
def student_distribution
course.levels.map do |level|
teams = TeamsResolver.filter_by_coach(teams_in_level(level), coach_id)
teams = Te... | 24.235294 | 76 | 0.709951 |
39e466268d1789a15a9228adfac52c34635e24d8 | 2,146 | # 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... | 42.92 | 143 | 0.715284 |
795d7831e1f388a15b7dd8554c6bf84c2201dc51 | 190 | class GoogleApi
include HTTParty
base_uri 'https://www.googleapis.com'
def verify_id_token(id_token)
self.class.get('/oauth2/v3/tokeninfo', query: {id_token: id_token})
end
end
| 21.111111 | 71 | 0.736842 |
211a119025331f3148d3c48d5dc279fb1defb57f | 183 | module Magnum
module TimeZone
class Minute
def initialize(start_time,end_time)
@start_time = start_time
@end_time = end_time
end
end
end
end
| 14.076923 | 41 | 0.63388 |
f817ba9aa85de13f094d7ae115ea385b17845a1f | 1,306 | require "spec_helper"
RSpec.describe Endpoints::Infections do
include Committee::Test::Methods
include Rack::Test::Methods
def app
Routes
end
def schema_path
"./schema/schema.json"
end
describe 'POST /infections/:id' do
before do
@negan = Survivor.create(name:'Negan',age:50,gender:'... | 25.607843 | 87 | 0.643185 |
ace4004c5e812146214dc7da8f50d37dea0ae89b | 56 | json.data do
json.things_to_measure @measurements
end
| 14 | 38 | 0.821429 |
1a0b0f7a27c3af4456cf4665f3efe5f289791a8e | 3,934 | # encoding: utf-8
#
# This file is a part of Redmine Invoices (redmine_contacts_invoices) plugin,
# invoicing plugin for Redmine
#
# Copyright (C) 2011-2013 Kirill Bezrukov
# http://www.redminecrm.com/
#
# redmine_contacts_invoices is free software: you can redistribute it and/or modify
# it under the terms of the GNU ... | 38.194175 | 148 | 0.665735 |
03b56cc8d1a1c8c5131a70a8f68e24178071cb48 | 263 | module OpenActive
module Models
module Schema
class ArriveAction < ::OpenActive::Models::Schema::MoveAction
# @!attribute type
# @return [String]
def type
"schema:ArriveAction"
end
end
end
end
end
| 18.785714 | 67 | 0.585551 |
7a62a19db1c61e53632a794eca4678e78572ee5f | 288 | require_relative '../setup.rb'
require_relative '../src/shared/system.rb'
FILES = ['./src/compiler/_requires.rb'].freeze
check = ARGV.last == '--check'
FILES.each do |file|
if check
psystem("sort #{file} | diff #{file} -")
else
psystem("sort #{file} -o #{file}")
end
end
| 19.2 | 46 | 0.631944 |
01ae4e2b14cc7efff12624562b1ce75227608551 | 232 | require 'aruba/cucumber'
Before do
copy File.join(aruba.config.fixtures_path_prefix, 'blueprint.apib'), 'blueprint.apib'
copy File.join(aruba.config.fixtures_path_prefix, 'invalid_blueprint.apib'), 'invalid_blueprint.apib'
end
| 33.142857 | 103 | 0.797414 |
f77c2327618c83a32a3280e4b9e18530d328747f | 7,095 | # Este controlador tiene la finalidad de hacer contenido por paginas, ej la lista de invasoras
class PaginasController < ApplicationController
skip_before_action :set_locale
layout Proc.new{['exoticas_invasoras_paginado'].include?(action_name) ? false : 'application_b3'}
# La pagina cuando entran por get
def ... | 32.695853 | 217 | 0.603383 |
b94fb400393c29d4c96cb060614b3acd37294e96 | 1,069 | cask 'mullvadvpn-beta' do
version '2019.7-beta1'
sha256 '71f0322c35bcd93b9f29dcf58a8e88b409fb143cd52abf5edd254ef4f3aa45d9'
# github.com/mullvad/mullvadvpn-app was verified as official when first introduced to the cask
url "https://github.com/mullvad/mullvadvpn-app/releases/download/#{version}/MullvadVPN-#{vers... | 39.592593 | 147 | 0.684752 |
1d908db0972b2e62cc9a4dfc9710b1ec7edaf086 | 3,129 | class UsersController < ApplicationController
get '/' do
redirect to '/login'
end
get '/signup' do
if logged_in?
flash[:signed_up] = "You already have an account and are logged in."
redirect to "/users/#{current_user.slug}"
else
erb :'/users/signup... | 38.158537 | 263 | 0.590284 |
381753d7e88d7d378649fbd6784e3ffd3f117f29 | 2,678 | require 'formula'
class Openssl < Formula
homepage 'http://openssl.org'
url 'https://www.openssl.org/source/openssl-1.0.1f.tar.gz'
mirror 'http://mirrors.ibiblio.org/openssl/source/openssl-1.0.1f.tar.gz'
sha256 '6cc2a80b17d64de6b7bac985745fdaba971d54ffd7d38d3556f998d7c0c9cb5a'
bottle do
sha1 "2687c0abb5... | 27.326531 | 127 | 0.662061 |
f7eb7f3ce3752d941233a2ad3c5a634781f828ce | 402 | # -*- coding: utf-8 -*-
#--
# Copyright (C) 2004 Mauricio Julio Fernández Pradier
# See LICENSE.txt for additional licensing information.
#++
module Gem::Package::FSyncDir
private
##
# make sure this hits the disc
def fsync_dir(dirname)
dir = open dirname, 'r'
dir.fsync
rescue # ignore IOError if ... | 16.75 | 57 | 0.674129 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.