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 |
|---|---|---|---|---|---|
0188ab1120fadae707a14e16b5c5199b64c63013 | 4,260 | module Hancock::News
module Admin
module News
def self.config(nav_label = nil, fields = {})
if nav_label.is_a?(Hash)
nav_label, fields = nav_label[:nav_label], nav_label
elsif nav_label.is_a?(Array)
nav_label, fields = nil, nav_label
end
Proc.new {
... | 29.178082 | 109 | 0.497183 |
26aaf5860cac2d4b8b9d4ad4f37e9abef20d9300 | 447 | module Zenform
module Param
class TicketField < Base
FIELDS = %w{title type visible_in_portal editable_in_portal required_in_portal description custom_field_options}
FIELDS.each { |field| attr_reader field }
def validate!
%w{title type}.each { |field| validate_field! field }
va... | 23.526316 | 118 | 0.666667 |
21aaa038ba0ac63c603f5813c963562f47403913 | 872 | require File.dirname(__FILE__) + '/../test_helper'
class Widget
include XML::Mapping
time_node :work_start_on, 'WorkStartOn', :default_value => nil
end
class TimeNodeTest < Test::Unit::TestCase
def setup
@xml = <<-END
<Widget>
<WorkStartOn>11:30:00</WorkStartOn>
</Widget>
END
end
def test_load_... | 22.947368 | 96 | 0.71789 |
7a1049cd7e64ace603ef5ed0919e26cc5611af3c | 432 | module Paynl
module Api
class GetService < Api
def getData
Paynl::Helper::requireServiceId
@@data['serviceId'] = Paynl::Config::getServiceId
Paynl::Helper::requireApiToken
@@data['token'] = Paynl::Config::getApiToken
return super;
end
def doRequest
... | 19.636364 | 57 | 0.601852 |
38eef58299a827321bc2efe9bfe6c8a989963cc0 | 831 | # frozen_string_literal: true
class CostSplit::CostSplitCompanyMonthlyAdjustsController < CostSplit::BaseController
def create
to_split_company_code = split_cost_cost_split_company_monthly_adjust_params.delete(:to_split_company_code)
month = split_cost_cost_split_company_monthly_adjust_params.delete(:month)
... | 46.166667 | 128 | 0.836342 |
39c05f554248bbe23de1e2a72f249e227c319ac4 | 3,411 | require "spec_helper"
module Spree
describe Spree::ProductDuplicator, type: :model do
let(:product) { create(:product, properties: [create(:property, name: "MyProperty")]) }
let!(:duplicator) { Spree::ProductDuplicator.new(product) }
let(:image) { File.open(File.expand_path("../../../fixtures/thinking-c... | 33.116505 | 100 | 0.646438 |
e85e24bb6370e264a76b26f471dbea14a91ef637 | 1,275 | Pod::Spec.new do |s|
s.name = 'SVProgressHUD'
s.version = '2.2.6'
s.ios.deployment_target = '8.3'
s.tvos.deployment_target = '9.0'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.summary = 'A clean and lightweight progress HUD for your iOS and tvOS app.'
s.homepage = 'https://github.com/SVPro... | 42.5 | 237 | 0.694118 |
284097b73542d37df2485fbfb14a9d0da516d02f | 2,115 | # 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.673077 | 116 | 0.736643 |
380f10b54dce5d833251ab3fbe7ecc7d6d5884df | 196 | # frozen_string_literal: true
require 'rails_helper'
describe OrganizationDisplayName do
context 'Extends LocalizedName' do
it { is_expected.to validate_presence :organization }
end
end
| 19.6 | 57 | 0.795918 |
1c453468089d2be71e711489c7e8e2ae2490c56b | 360 | require 'simplecov'
SimpleCov.start
require 'bundler/setup'
require 'rake'
require 'support/shared_contexts/rake'
require 'rake_template'
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = '.rspec_status'
config.expect_with :rspec ... | 18.947368 | 63 | 0.761111 |
03f027d18a70fc39f62c01b3826faf6094f4fd08 | 136 | # frozen_string_literal: true
module RailsBestPractices
module Core
# Mailer classes.
class Mailers < Klasses; end
end
end
| 15.111111 | 32 | 0.735294 |
bf6f6c86c6862d862b835d94bfefc18eedd705bb | 3,281 | # frozen_string_literal: true
# Include this into controller to enable site_account support.
module SiteAccountSupport
def self.included(base)
base.class_eval do
helper_method :site_account
helper_method :domain_account
end
end
private
class NoAccountForDomain < ActiveRecord::RecordNotFou... | 25.632813 | 128 | 0.722341 |
4abcf138f5fc3f8e0dd33bd15453649ec350febc | 121 | require 'multi_spec'
describe 'Multi Tests v 5.x' do
include_examples 'multi::init', "5.1.2", ["ingest-geoip"]
end
| 13.444444 | 59 | 0.677686 |
5df3ba32dfa9999fdeb1ecd89aa4ecd45a0985dd | 2,470 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads/v6/errors/image_error.proto
require 'google/protobuf'
require 'google/api/annotations_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_file("google/ads/googleads/v6/errors/image_error.proto", :syntax => :proto3... | 35.797101 | 166 | 0.722672 |
e20c6b2d8504153f471e012e735ad087b0a338c5 | 16,915 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core/auxiliary/report'
class MetasploitModule < Msf::Auxiliary
# Exploit mixins should be called first
include Msf::Exploit::Remote::SMB::Client
include Msf::Exp... | 33.037109 | 145 | 0.567957 |
61f14f28bb0cd31301171d7a0454a624ba343c7d | 39,493 | #: * `audit` [`--strict`] [`--fix`] [`--online`] [`--new-formula`] [`--display-cop-names`] [`--display-filename`] [`--only=`<method>|`--except=`<method>] [`--only-cops=`<cops>|`--except-cops=`<cops>] [<formulae>]:
#: Check <formulae> for Homebrew coding style violations. This should be run
#: before submitting a... | 34.04569 | 214 | 0.622794 |
1138102442805c8f574c025c141f0c4b3bdb92f6 | 4,186 | class UsersController < ApplicationController
load_and_authorize_resource
before_action :set_user, only: [:show, :edit, :update, :destroy]
skip_before_action :authenticate_user!, only: [:create]
skip_before_filter :verify_authenticity_token, only: [:create]
# GET /users
def index
if params[:role]
... | 31.473684 | 123 | 0.617535 |
d51cbd519481ef4c21237ae5d50303e331e1929e | 1,128 | require 'rails_helper'
describe AssessorsImport::Builder do
let(:csv_path) { File.join(Rails.root, 'spec','support','file_samples','emails.csv') }
subject { AssessorsImport::Builder.new(csv_path) }
describe '#initialize' do
it 'creates an instance with a valid filepath' do
expect(subject).to be_a(Asse... | 28.2 | 88 | 0.671986 |
7944c6a7f705797ca1ad819805002ad2063c9f64 | 3,922 | class EmsEvent
module Automate
extend ActiveSupport::Concern
def manager_refresh(sync: false)
refresh_targets = manager_refresh_targets
return if refresh_targets.empty?
EmsRefresh.queue_refresh(refresh_targets, nil, :create_task => sync)
end
def refresh(*targets, sync)
retu... | 30.640625 | 110 | 0.629271 |
bf79ad31db1a54500016e9ea2fac29e02281f261 | 1,701 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... | 36.978261 | 85 | 0.775426 |
01f12d0341fafe33d5464da17046e0c85ed18f80 | 1,120 | # encoding: UTF-8
require 'em-synchrony'
require 'redis'
require 'redis/connection/synchrony'
require File.expand_path("./helper", File.dirname(__FILE__))
#
# if running under Eventmachine + Synchrony (Ruby 1.9+), then
# we can simulate the blocking API while performing the network
# IO via the EM reactor.
#
EM.sy... | 19.310345 | 63 | 0.622321 |
e82a167013e9f7d78adf35758bfe23268cf7e07e | 2,138 | require 'puppet/parameter'
# This specialized {Puppet::Parameter} handles validation and munging of paths.
# By default, a single path is accepted, and by calling {accept_arrays} it is possible to
# allow an array of paths.
#
class Puppet::Parameter::Path < Puppet::Parameter
# Specifies whether multiple paths are ac... | 36.862069 | 105 | 0.715622 |
5dbecfe58665231d9b416a013d55fd5160a10202 | 748 | module FHIR
# fhir/referred_document_status.rb
class ReferredDocumentStatus < PrimitiveCode
include Mongoid::Document
def as_json(*args)
result = super
result.delete('id')
unless self.fhirId.nil?
result['id'] = self.fhirId
result.delete('fhirId')
end
... | 26.714286 | 101 | 0.640374 |
62734572d574d20d1cd95785c7f175ace2fcb32d | 152 | class CreateSongs < ActiveRecord::Migration[5.1]
def change
create_table :songs do |t|
t.string :name
t.timestamps
end
end
end
| 15.2 | 48 | 0.651316 |
91ca4bd699bb7290ce5b83315cfcbb1ffe36a7d9 | 106 | module Fluent
class ConfigError < StandardError
end
class ConfigParseError < ConfigError
end
end
| 13.25 | 38 | 0.773585 |
4afef67894619ae6d18fccdcafccd3dc3453d9a3 | 9,357 | # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
# It is recommended to regenerate this file in the future when you upgrade to a
# newer version of cucumber-rails. Consider adding your own code to a new file
# instead of editing this one. Cucumber will automatically load all features/**/*... | 29.332288 | 129 | 0.636849 |
bb3206f53990c331589c61bd02352ad6dc3e4fb8 | 1,165 | # frozen_string_literal: true
module Preloaders
# This class preloads the `project`, `group`, and subscription associations for the given
# labels, user, and project (if provided). A Label can be of type ProjectLabel or GroupLabel
# and the preloader supports both.
#
# Usage:
# labels = Label.where(...)
... | 33.285714 | 118 | 0.696137 |
9104b6aeed0d314606ba6396954f0a3badf9e872 | 1,118 | require 'sinatra/base'
require 'mechanize'
require './app/models/sweep'
class PaypalAutosweep < Sinatra::Base
set paypal_settings = YAML.load(
File.read("config/paypal.yml")
)
# Tasks uris
# Autosweep
post '/tasks/sweeps' do
sweep = Sweep.new
sweep.environment = paypal_settings['paypal']['envi... | 29.421053 | 79 | 0.701252 |
bf859e38c5cb73f9cb41b61be8ebbcb690e048a2 | 1,765 | require 'spec_helper'
describe "clients/index" do
before(:each) do
assign(:clients, [
stub_model(Client,
:name => "Name",
:company_name => "Company Name",
:title => "Title",
:email => "Email",
:website => "Website",
:user_id => 1,
:address => "Address... | 32.685185 | 87 | 0.526912 |
ac8a2f8bd5fc32d47706c420977efbd295e68484 | 9,706 | module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class BarclaysEpdqGateway < Gateway
TEST_URL = 'https://secure2.mde.epdq.co.uk:11500'
LIVE_URL = 'https://secure2.epdq.co.uk:11500'
self.supported_countries = ['UK']
self.default_currency = 'GBP'
self.supported_cardtypes = [:vis... | 31.822951 | 108 | 0.530497 |
b9e12e8d44db7aff2fa96b350342aa0e7002abf6 | 31,124 | #
# Copyright 2019 ThoughtWorks, 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 ... | 54.034722 | 169 | 0.63443 |
26c14f18eac9b3a15b6617ec8cfb0985b2b0af52 | 871 | unless { a: 1 }.respond_to?(:fetch_values)
# Add fetch_values if this version of ruby does not define it.
class Hash
def fetch_values(*keys)
result = []
keys.each do |k|
result <<
if block_given?
yield(self[k])
else
self[k]
end
end
... | 18.934783 | 64 | 0.580941 |
ac779c1574b86548280cfe194d26f34e5cc218a5 | 8,116 | require 'spec_helper'
require 'net/http'
require 'timeout'
require 'uri'
require 'capybara/rspec'
require 'capybara/poltergeist'
Capybara.default_driver = :poltergeist
Capybara.server = :webrick
describe "SAML Authentication", type: :feature do
let(:idp_port) { 8009 }
let(:sp_port) { 8020 }
shared_examples_for... | 34.683761 | 213 | 0.666092 |
38885a460db33afd1d408cfe70afec627cb35391 | 569 | require 'test/unit'
require 'redgreenblue'
class Test_int < Test::Unit::TestCase
def test_to_i
assert_equal 0, RGB.black.to_i
assert_equal 16777215, RGB.white.to_i
# https://codegolf.stackexchange.com/questions/43155
assert_equal 4563356, RGB.rgb(69,161,156).to_i
end
def test_at
a... | 21.884615 | 56 | 0.699473 |
3905a648468d530759f6b12977d5f5d74e51e66b | 4,842 | ###############################################################################
# Copyright 2008-2010 Amazon Technologies, 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:/... | 33.625 | 113 | 0.675754 |
386c5a9933f19327ac172257ee1c8863dd3b2cf9 | 2,511 | require_relative 'naming'
require_relative 'special_cases'
module USCoreTestKit
class Generator
class MustSupportTestGenerator
class << self
def generate(ig_metadata, base_output_dir)
ig_metadata.groups
.reject { |group| SpecialCases.exclude_resource? group.resource }
... | 27.293478 | 114 | 0.652728 |
bb0d7d5da04624767258e0018b7c116e5d66cf07 | 43 | module Transformer
VERSION = "0.3.0"
end
| 10.75 | 19 | 0.697674 |
d56a7a72f41b0acccbeb5610d4e56049b1c85241 | 783 | class Ability
include CanCan::Ability
def initialize(user)
@user = user || User.new
# Normal Users
can :read, [Board, Post, Tripcode]
can :create, [User, Report, Post]
can :search, Board
# Users can delete a post if they have they have created the post or if they moderate the board.
# ... | 21.75 | 100 | 0.623244 |
4ae2ee72968c44c3378f95306657b685891231ee | 628 | # frozen_string_literal: true
require File.expand_path('bot_config/environment', __dir__)
require 'slack-ruby-bot/version'
require 'slack-ruby-bot/support/loggable'
require 'slack-ruby-bot/about'
require 'slack-ruby-bot/config'
require 'slack-ruby-bot/hooks'
module SlackRubyBot
class << self
def configure
... | 21.655172 | 59 | 0.743631 |
1cee42774efd8f9e6997fb9dca430360c3f368ec | 2,430 | require 'seek/annotation_common'
module Seek
module AssetsCommon
include Seek::AnnotationCommon
include Seek::ContentBlobCommon
include Seek::PreviewHandling
include Seek::AssetsStandardControllerActions
def find_display_asset(asset = instance_variable_get("@#{controller_name.singularize}"))
... | 34.225352 | 114 | 0.693827 |
b9a39362b9d10f5aae57e2c1b9cccb6000a04d03 | 5,818 | class Person < ActiveRecord::Base
include WikiEnabled
include Freezable
include Statistics
include MovieListings
include Logging
class_inheritable_accessor :stub_fields
freezable_attribute :name
freezable_attribute :birthday
freezable_attribute :birthplace
freezable_attribute :deathday
freezable... | 30.783069 | 175 | 0.562221 |
f7245bb4890f2f277026c759646ec2df1af02818 | 1,167 | require 'test_helper'
class CategoriesControllerTest < ActionController::TestCase
setup do
@category = categories(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:categories)
end
test "should get new" do
get :new
assert_response :succe... | 23.34 | 112 | 0.703513 |
281ccc125bc8075107259ada642f73a7b816ed34 | 315 | require 'browser_crawler/version'
require 'browser_crawler/options'
require 'browser_crawler/engine'
require 'browser_crawler/followups/screenshots_indexer'
require 'browser_crawler/followups/wraith_integrator'
# Crawls web site and extracts links available.
module BrowserCrawler
# Your code goes here...
end
| 24.230769 | 55 | 0.828571 |
6239f300d09945e2271eb1ec5f7a9507654e58a9 | 1,246 | require 'spec_helper'
describe Dragonfly::Encoding::ImageMagickEncoder do
before(:all) do
sample_file = File.dirname(__FILE__) + '/../../../samples/beach.png' # 280x355, 135KB
@image = Dragonfly::TempObject.new(File.new(sample_file))
@encoder = Dragonfly::Encoding::ImageMagickEncoder.new
end
de... | 29.666667 | 99 | 0.652488 |
1d2c98ad2e2cda6ba7da09988dd40e195073028f | 1,686 | #
# Be sure to run `pod lib lint CustomField.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 = 'CustomF... | 41.121951 | 146 | 0.664294 |
f8c75c1b6b5e59f90bbb0952f6f7c3c3f8a0cbc4 | 3,142 | user = User.find_by_first_name('a user')
admin = User.find_by_first_name('an admin')
site_with_calendars =
Site.create! :name => 'site with calendar',
:title => 'site with calendar title',
:host => 'site-with-calendar.com'
admin.roles.create!(:name => 'admin', :context => site_... | 37.404762 | 79 | 0.546785 |
91333af668cf5a63c6acd2b87dfc2ce8e478c549 | 2,190 | require 'json'
module Fastlane
class JSONReturnValueProcessor
def prepare_object(return_value: nil, return_value_type: nil)
case return_value_type
when nil
UI.verbose("return_value_type is nil value: #{return_value}")
return process_value_as_string(return_value: return_value)
wh... | 30.84507 | 114 | 0.708219 |
01dc97fdc4f52c840686a5c8cc84ef891113e66a | 336 | require "helper"
require "fluent/plugin/out_file_with_header.rb"
class FileWithHeaderOutputTest < Test::Unit::TestCase
setup do
Fluent::Test.setup
end
test "failure" do
flunk
end
private
def create_driver(conf)
Fluent::Test::Driver::Output.new(Fluent::Plugin::FileWithHeaderOutput).configure(... | 17.684211 | 90 | 0.738095 |
1878191b9ae13d27566d2111b7dede15000d1b26 | 17,612 | require_relative 'strToArray'
require_relative 'read_file_line_by_line'
require_relative 'paranthesis_compactor'
require_relative 'replace_strings'
require_relative 'rollblocks'
def compile_named_functions(input_file_contents, named_code_blocks, nested_functions, temporary_nila_file)
#This method compiles all the n... | 25.304598 | 200 | 0.690495 |
036a8bccd533e10b069ccb79de056ed6c5ff3865 | 498 | # frozen_string_literal: true
require "shipengine"
module TestUtils
# @param spy [Spy] - spy from "Spy" library
# @return [Array<ShipEngine::Emitter::HttpEvent>]
def get_dispatched_events(spy)
spy.calls.map { |event| event.args[0] }
end
def titlecase(str)
str.split(/([[:alpha:]]+)/).map(&:capitalize... | 26.210526 | 104 | 0.714859 |
b956e2c95155a0d9f9db03a835866114ff8180f2 | 709 | # frozen_string_literal: true
require 'spec_helper'
describe ArtifactsFinder do
let(:project) { create(:project) }
describe '#execute' do
before do
create(:ci_build, :artifacts, project: project)
end
subject { described_class.new(project, params).execute }
context 'with empty params' do
... | 22.15625 | 74 | 0.655853 |
282dd689ea98f86c126c7ee03fbe7190b37f76fc | 817 | require "Rover"
describe Rover,"#position" do
it "should have some intial position" do
expect(Rover.new([1,2,"N"]).position).to eq([1,2,"N"])
end
it "should raise error if no position is given" do
expect{Rover.new.position}.to raise_error(RuntimeError,"Position not found")
end
end
describe Rover,"#mo... | 27.233333 | 85 | 0.647491 |
62a1dfa829668cfe49a693e6ae5a36f597750545 | 149 | json.array!(@users) do |user|
json.extract! user, :id, :name, :city, :country, :email, :year_of_birth
json.url user_url(user, format: :json)
end
| 29.8 | 73 | 0.684564 |
87d4fa00e37e99760ec23dfb0669151d36ce08a7 | 70 | class Crypto::AccountSyncService < Cosmoslike::AccountSyncService
end
| 23.333333 | 65 | 0.857143 |
b9244f5ae9dae00bf5a375c14f81e4915e087eff | 987 | # frozen_string_literal: true
module CKB
module Types
class LockHashCapacity
attr_accessor :capacity, :cells_count, :block_number
# @param capacity [String | Integer] integer or hex number
# @param cells_count [String | Integer] integer or hex number
# @param block_number [String | Integ... | 26.675676 | 68 | 0.625127 |
39346d16458c1336a0c43085a87486e9ab4b0a2c | 896 | cask 'glyphs' do
version '2.6.3,1271'
sha256 'be27543241dc5e8c3766c3f14c0edbd696885bade96ebba0feae51525cf94802'
url "https://updates.glyphsapp.com/Glyphs#{version.major_minor_patch}-#{version.after_comma}.zip"
appcast "https://updates.glyphsapp.com/appcast#{version.major}.xml"
name 'Glyphs'
homepage 'https... | 40.727273 | 156 | 0.710938 |
f7faf27c56932d026e36773213168f004d93306a | 300 | Deface::Override.new(
:virtual_path => "spree/admin/users/_lifetime_stats",
:name => "add_gdpr_under_lifetime_stats",
:insert_after => "[data-hook='admin_user_lifetime_stats']",
:original => 'b9f3ea1e30e19d2a4a4f86785b7ba1c2cd6157e5',
:partial => "spree/admin/gdpr",
:disabled => false
)
| 33.333333 | 61 | 0.73 |
bfc6684375a2449ba066ea0a327348f7cff56ae4 | 1,520 | # Documentation: https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Formula-Cookbook.md
# http://www.rubydoc.info/github/Homebrew/brew/master/Formula
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
class Owl2jsonld < Formula
desc ""
homepage ""
url "https:/... | 41.081081 | 100 | 0.714474 |
183275f587d95a909c94a5cbd7ffe21d4a38e485 | 2,139 | # Stolen from http://github.com/technoweenie/restful-authentication/tree/master/generators/authenticated/lib
# Modified by Dennis Theisen
# Thanks a lot !
Rails::Generator::Commands::Create.class_eval do
def route(name, path, options = {})
cmd = "map.#{name} '#{path}', :controller => '#{options[:controller]}'... | 28.905405 | 108 | 0.59093 |
e8cce4af3bb480b6b82b04fcca8ef566cd664806 | 1,090 | cask 'unity-ios-support-for-editor@2017.2.0b8' do
version '2017.2.0b8,c5fc3ca9cbbf'
sha256 :no_check
url "http://beta.unity3d.com/download/c5fc3ca9cbbf/MacEditorTargetInstaller/UnitySetup-iOS-Support-for-Editor-2017.2.0b8.pkg"
name 'iOS Build Support'
homepage 'https://unity3d.com/unity/'
pkg 'UnitySetup-... | 30.277778 | 127 | 0.709174 |
0331ae78375e1eb8516edc23d51d9089f2a61ab7 | 1,476 | require File.dirname(__FILE__) + '/../spec_helper'
class AliasObject
def value; 5; end
def false_value; 6; end
end
describe "The alias keyword" do
before(:each) do
@obj = AliasObject.new
@meta = class << @obj;self;end
end
it "creates a new name for an existing method" do
@meta.class_eval do
... | 22.363636 | 72 | 0.668699 |
eda9ab4ea3c8b556542482dc7768e5d5e159392a | 294 | class DropHdfsFileReferencesAndAssociatedEvents < ActiveRecord::Migration
def up
drop_table :hdfs_file_references
end
def down
create_table :hdfs_file_references do |t|
t.string :path, :limit => 2048
t.integer :hadoop_instance_id
t.timestamps
end
end
end
| 21 | 73 | 0.72449 |
622e4f242221660b975178cfa6ffe316f02733a7 | 1,443 | module Dawanda
# = OAuth
#
# Provides access to sesitive user data
class OAuth
API_PREFIX = '/api/v1/oauth'
def self.connect key, secret
@@consumer = Dawanda::OAuth.create_consumer key, secret
@@request_token = @@consumer.get_request_token
end
def self.rebuild key, ... | 27.226415 | 91 | 0.63271 |
4a8d38a44f6719a12fde70d21c52aab099b35053 | 2,625 | require 'rails_helper'
describe BypassParamsManager do
describe '#present?' do
context 'empty params' do
it 'returns false' do
expect(described_class.new(empty_params).present?).to be false
end
end
context 'invalid bypass params' do
it 'returns true' do
expect(describe... | 24.082569 | 101 | 0.651048 |
018fd4c1b2def422babf82935d0efd53addc3d39 | 1,854 | # -*- encoding: utf-8 -*-
# stub: logstash-output-udp 3.0.6 ruby lib
Gem::Specification.new do |s|
s.name = "logstash-output-udp".freeze
s.version = "3.0.6"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "logstash_group" => "output... | 46.35 | 208 | 0.675836 |
e8cdeaa0db4a3de233781683f1e3767189b06064 | 3,265 | # -*- encoding: utf-8 -*-
#
# Author:: SAWANOBORI Yukihiko <sawanoboriyu@higanworks.com>)
#
# Copyright (C) 2015, HiganWorks 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://... | 26.762295 | 101 | 0.616845 |
28189db78373dd92843247fac34014c971f62ce4 | 2,071 | require 'active_merchant'
require 'support/gateway_support'
class SSLVerify
def initialize
@gateways = GatewaySupport.new.gateways
end
def test_gateways
success, failed, missing, errored, disabled = [], [], [], [], []
puts "Verifying #{@gateways.count} SSL certificates\n\n"
@gateways.each do ... | 22.268817 | 113 | 0.597779 |
382b93f2d2a540b9aa44dd5c19f05201d95d1f8f | 645 | require 'rails_helper'
describe "the add an addition process" do
it "adds an addition to a story" do
visit stories_path
click_on "Add a New Story"
fill_in 'Title', :with => "Deez Nuts"
fill_in 'Starter sentence for your story', :with => "There was a man with peanuts."
fill_in 'Your Name', :with =... | 32.25 | 87 | 0.666667 |
ac054fcf638c77a274be191d0bd5e305ddd874ba | 423 | Gem::Specification.new do |s|
s.name = 'testrail'
s.version = '0.0.1'
s.date = '2016-09-07'
s.summary = "TestRail Gem-ified"
s.description = "Gem wrapper for: https://github.com/gurock/testrail-api/tree/master/ruby"
s.authors = ["Nate Reynolds"]
s.email = 'nate@n8r.us'
s.... | 35.25 | 92 | 0.600473 |
6ac52abb8b84a9c37b4603b919ef0d5d9c51b9a1 | 784 | 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 SampleApp
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails... | 34.086957 | 82 | 0.772959 |
184db7516eb09da0f2def12375a6d27c73a4e701 | 9,598 | # frozen_string_literal: true
module Ci
# This class responsible for assigning
# proper pending build to runner on runner API request
class RegisterJobService
attr_reader :runner, :metrics
TEMPORARY_LOCK_TIMEOUT = 3.seconds
Result = Struct.new(:build, :build_json, :valid?)
##
# The queue d... | 34.035461 | 108 | 0.680663 |
2629618938bf3b804229462d449eef915224a07a | 3,708 | # This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rail... | 37.08 | 86 | 0.747573 |
7925df14b5a6542767e52af507399270f44b99bd | 38,314 | # 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... | 54.969871 | 153 | 0.558516 |
f72dd8974c19e4af982e328dc8f2d0db347a1cdc | 109 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'os_platform'
require 'minitest/autorun'
| 21.8 | 58 | 0.752294 |
0173de6c241b94d43343979be047ff9d4317133e | 124 | class AddManufactureToParts < ActiveRecord::Migration
def change
add_column :parts, :manufacturer, :string
end
end
| 20.666667 | 53 | 0.766129 |
211b6b871b9ef271198451f6fef46857092b4abf | 4,447 | #
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may n... | 38.336207 | 86 | 0.706544 |
28abf4714ab39047f00aa7b0517e5ddb4d647ba9 | 44 | module TradeTracker
VERSION = '0.2.3'
end
| 11 | 19 | 0.704545 |
21b784fe3b6087116c1b09c7f9ed70d716bcd7b9 | 1,347 | # Copyright (c) 2018-2019 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: MIT
# DO NOT MODIFY. THIS CODE IS GENERATED. CHANGES WILL BE OVERWRITTEN.
# vcenter - VMware vCenter Server provides a centralized platform for managing your VMware vSphere environments
require 'spec_helper'
require 'json'
requi... | 35.447368 | 129 | 0.798812 |
87aec828717e30d3c3819e697d7ba952a3eb8535 | 1,683 | module Unimatrix::Authorization
class RequiresResourceOwner
def before( controller )
client_id = Unimatrix.configuration.client_id
client_secret = Unimatrix.configuration.client_secret
access_token =
if controller.params[ 'access_token' ].present?
controller.params[ 'acc... | 25.5 | 79 | 0.68568 |
0109de047fd9e03b152710ae16bdf6de92f83baa | 1,844 | Pod::Spec.new do |s|
s.name = 'NSString-HTML'
s.version = '0.0.1'
s.summary = "Decode and encode HTML character entities."
s.homepage = "https://github.com/Koolistov/NSString-HTML"
s.author = 'Johan Kool'
s.source = { :git => 'https://github.com/Koolistov/NSStri... | 80.173913 | 758 | 0.737527 |
b94b5502a5d60585e967397a3a2b01beb2df7432 | 1,364 | module PulsarSdk
module Options
class Connection < Base
DEFAULT_PORT = 6650
attr_accessor :logical_addr, :physical_addr,
:connection_timeout,
:operation_timeout,
:auth_provider,
:tls_options,
:keepaliv... | 26.230769 | 99 | 0.573314 |
e89bc500802fbd4d1427f88a320ad0da15b690e8 | 1,691 | #
# Be sure to run `pod lib lint Chargebee.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 = 'Chargebee... | 38.431818 | 111 | 0.630988 |
87131decc75891a1ffea0e315c83d9dcd2af3868 | 609 | class ReviewsController < ApplicationController
before_action :authenticate_user!
def new
@image = Image.find(params[:image_id])
@review = @image.reviews.new
end
def create
@image = Image.find(params[:image_id])
@review = @image.reviews.new(review_params)
if @review.save
# redirect_t... | 21 | 72 | 0.668309 |
0823058a79c8aa097b767070eb27339a88721999 | 497 | # frozen_string_literal: true
require 'test_helper'
class Gecko::Record::PurchaseOrderLineItemAdapterTest < Minitest::Test
include TestingAdapter
include SharedAdapterExamples
let(:adapter) { @client.PurchaseOrderLineItem }
let(:plural_name) { "purchase_order_line_items" }
let(:record_class) { Gec... | 29.235294 | 98 | 0.788732 |
21ef94ac5d1873c7ddefab851b362f31bcd72534 | 1,927 | require 'spec_helper'
describe MergeRequestsFinder do
let(:user) { create :user }
let(:user2) { create :user }
let(:project1) { create(:empty_project) }
let(:project2) { create(:empty_project, forked_from_project: project1) }
let(:project3) { create(:empty_project, :archived, forked_from_project: project1)... | 37.784314 | 142 | 0.70109 |
21eb305015805b4aff7f43f79ef0089d637f6a2e | 163 | require 'shared_user_without_omniauth'
class UserOnEngine < ActiveRecord::Base
self.table_name = 'users'
include Shim
include SharedUserWithoutOmniauth
end
| 20.375 | 39 | 0.815951 |
5de560881ec71d9d19f4bc965d6c602d33867800 | 377 | require 'finacle_api/common/serializable_object'
require 'finacle_api/models/amount'
module FinacleApi
module ODAcctInq
module ResponseEntity
class AcctBalAmt < SerializableObject
attr_accessor :amount_value, :currency_code
def to_amount
Amount.new(value: amount_value, currency:... | 20.944444 | 66 | 0.713528 |
1a243ee24ff252d72be9ac7afd0ab850de54c66f | 2,039 | describe ManageIQ::Providers::Lenovo::PhysicalInfraManager::AuthenticatableProvider do
let(:described_class_path) { described_class.name.underscore }
let(:auth) do
FactoryBot.create(:authentication,
:userid => 'admin',
:password => 'password',
... | 40.78 | 171 | 0.630701 |
7adb7f6341f8a976af39f70b692e5230f58f74f9 | 1,402 | module Terraforming
module Resource
class IAMInstanceProfile
include Terraforming::Util
def self.tf(client: Aws::IAM::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::IAM::Client.new)
self.new(client).tfstate
end
def initialize(client)
... | 25.035714 | 78 | 0.573466 |
62703dc23a9623ad257f9dae1ae93e0f1c5bd99b | 2,700 | require 'spec_helper'
describe 'java::oracle_i386' do
let(:chef_run) do
runner = ChefSpec::ServerRunner.new
runner.converge(described_recipe)
end
it 'should include the set_java_home recipe' do
expect(chef_run).to include_recipe('java::set_java_home')
end
it 'should configure a java_ark[jdk] re... | 26.732673 | 90 | 0.642963 |
338912c9f5f4916b966d90e4799091cd5a16dc8d | 220 | class AddBrowserPreference < ActiveRecord::Migration
def self.up
add_column :users, :use_browser, :boolean, :default => false, :null => false
end
def self.down
remove_column :users, :use_browser
end
end
| 22 | 80 | 0.718182 |
e2de0608a75a7d3c543f0f8eb964bf55f9a628c0 | 1,660 | # A method for retrieving external trusted facts
module Puppet::TrustedExternal
def retrieve(certname)
command = Puppet[:trusted_external_command]
return nil unless command
Puppet.debug _("Retrieving trusted external data from %{command}") % {command: command}
setting_type = Puppet.settings.setting(:t... | 39.52381 | 126 | 0.680723 |
87c76571885be2d23b5b43620032c0e6e703d8f2 | 1,163 | # A facter fact to determine the root home directory.
# This varies on PE supported platforms and may be
# reconfigured by the end user.
module Facter::Util::RootHome
class << self
def get_root_home
root_ent = Facter::Util::Resolution.exec("getent passwd root")
# The home directory is the sixth element in ... | 25.282609 | 77 | 0.656062 |
79051a21d7bb7acf0fc49b24ed5f13771d499373 | 364 | class Sale < ActiveRecord::Base
has_one :configuracion, dependent: :destroy
has_one :client, dependent: :destroy
has_many :lineFurnitures, dependent: :destroy
has_many :furnitures, :through => :lineFurnitures
accepts_nested_attributes_for :configuracion, :allow_destroy => true
accepts_nested_attributes_for ... | 40.444444 | 71 | 0.793956 |
6131cfaae11f9d0334b1f976f18ed65de2644d61 | 217 | class ChangeItemsNameTypeToText < ActiveRecord::Migration
def self.up
change_column :gallery_items, :description, :text
end
def self.down
change_column :gallery_items, :description, :string
end
end
| 21.7 | 57 | 0.75576 |
e92a27387748a24525061a5a007db3c1ae3af2bc | 528 | ActiveAdmin.register AdminUser do
menu priority: 2
permit_params :email, :password, :password_confirmation
index do
selectable_column
id_column
column :email
column :current_sign_in_at
column :sign_in_count
column :created_at
actions
end
filter :email
filter :current_sign_in_at... | 17.6 | 57 | 0.700758 |
03042601cec049847b0d77a7dc49b5454c60f137 | 532 | class Wireshark < Cask
url 'http://wiresharkdownloads.riverbed.com/wireshark/osx/Wireshark%201.10.3%20Intel%2064.dmg'
homepage 'http://www.wireshark.org'
version '1.10.3'
sha1 '5fa924b3c8c3e5bd80662b95047cea51b12ec0e8'
link :none
install 'Wireshark 1.10.3 Intel 64.pkg'
uninstall :pkgutil => 'org.wireshark... | 40.923077 | 96 | 0.656015 |
d5cc8c2b1dc94cbbf72878e90f17e5a28d796418 | 834 | require 'restfulie/common'
module Restfulie
module Client
autoload :MasterDelegator, 'restfulie/client/master_delegator'
autoload :HTTP, 'restfulie/client/http'
autoload :Configuration, 'restfulie/client/configuration'
autoload :EntryPoint, 'restfulie/client/entry_point'
autoload :Base, 'restfuli... | 33.36 | 73 | 0.755396 |
e94dce57b64429d9d7a0d7195e0e91701abe3061 | 6,064 | # -*- coding: utf-8 -*- #
# frozen_string_literal: true
module Rouge
module Lexers
class GraphQL < RegexLexer
desc 'GraphQL'
tag 'graphql'
filenames '*.graphql', '*.gql'
mimetypes 'application/graphql'
name = /[_A-Za-z][_0-9A-Za-z]*/
state :root do
rule %r/\b(?:query... | 23.145038 | 86 | 0.503793 |
01b54ea2ed44198023ed17c7ddf1255dfa76f6ea | 4,221 | # frozen_string_literal: true
class SushiService
def initialize(customer_id, platform, requestor_id)
@customer_id = customer_id
@platform = platform
@requestor_id = requestor_id
end
def status
fulcrum_status = ::SwaggerClient::SUSHIServiceStatus.new
fulcrum_status.description = "COUNTER Usag... | 38.724771 | 203 | 0.693201 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.