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 |
|---|---|---|---|---|---|
91cdd4fc4375acff754c3c15b07a8e9c07942c1d | 97 | # frozen_string_literal: true
class UsersController < ApplicationController
def show; end
end
| 16.166667 | 45 | 0.814433 |
1d7e289d698122bf04cc04d3e3819b77fa8805b3 | 633 | class Admins::ConfirmationsController < Devise::ConfirmationsController
# GET /resource/confirmation/new
# def new
# super
# end
# POST /resource/confirmation
# def create
# super
# end
# GET /resource/confirmation?confirmation_token=abcdef
# def show
# super
# end
# protected
# Th... | 21.827586 | 73 | 0.729858 |
21364dbc111368f5e675cec68c30067238ffb597 | 1,477 | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright (c) 2016-present, Facebook, Inc.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# htt... | 32.822222 | 74 | 0.710223 |
112432a29ab96e23f2c0e131746ceaa0b411f4b5 | 94 | # frozen_string_literal: true
module Engine
module Game
module G1848
end
end
end
| 10.444444 | 29 | 0.712766 |
3992b76a87acf92b0423f59dd27d54e7f72fa8e6 | 1,426 | # -*- encoding : utf-8 -*-
#coding: utf-8
#coding: utf-8
require "spec_helper"
describe DistributionListsController do
describe "routing" do
it "recognizes and generates #index" do
{ :get => "/distribution_lists" }.should route_to(:controller => "distribution_lists", :action => "index")
end
... | 35.65 | 132 | 0.626227 |
79ddcce30032161895e556460631ac2644ad2d15 | 4,426 | module VagrantPlugins
module Ansible
class Config < Vagrant.plugin("2", :config)
attr_accessor :playbook
attr_accessor :extra_vars
attr_accessor :inventory_path
attr_accessor :ask_sudo_pass
attr_accessor :limit
attr_accessor :sudo
attr_accessor :sudo_user
attr_acces... | 38.824561 | 92 | 0.585178 |
7a91885464e58e8ec66bea3363625a6e55684cf5 | 207 | class AddObjectTypeToSpaceEvents < ActiveRecord::Migration
def change
add_column :space_events, :object_type, :integer, null: false
add_column :space_events, :role, :integer, null: false
end
end
| 29.571429 | 65 | 0.763285 |
62a5eedc9bcf74e419d16273626d470ef6b5412f | 23,974 | #
# a language data file for Ruby/CLDR
#
# Generated by: CLDR::Generator
#
# CLDR version: 1.3
#
# Original file name: common/main/fo.xml
# Original file revision: 1.26 $
#
# Copyright (C) 2006 Masao Mutoh
#
# This file is distributed under the same license as the Ruby/CLDR.
#
private
def init_data
@localized_... | 42.507092 | 67 | 0.58626 |
e9611eb347ddcf808ff0333b4659899ab8fe4510 | 6,119 | =begin
#NSX-T Data Center Policy API
#VMware NSX-T Data Center Policy REST API
OpenAPI spec version: 3.1.0.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.19
=end
require 'date'
module NSXTPolicy
# Query statistics counters to an upstream server including succes... | 29.560386 | 113 | 0.631149 |
bf5bd2e0f4d2bf4f22c98888123bf5adaab4c920 | 1,392 | # frozen_string_literal: true
# Provide service methods for getting a list of all authorities and scenarios for an authority.
module QaServer
class AuthorityListerService
# Return a list of supported authorities
# @return [Array<String>] list of authorities
def self.authorities_list
Qa::LinkedData::... | 43.5 | 154 | 0.770115 |
ac62c856759e6f7b50a03432bf2c3064c3a243d9 | 70 | # add custom rake tasks here
desc 'test it'
task :foo do
puts 1
end
| 11.666667 | 28 | 0.7 |
61039e30aa13acf27fc6de6d3e8e08cd76ff66cb | 730 | module FE
class Document
class Regulation < Element
include ActiveModel::Validations
attr_accessor :number, :date
validates :number, presence: true
validates :date, presence: true
def initialize(args={})
@number = args[:number] ||= "DGT-R-48-2016"
... | 28.076923 | 108 | 0.59726 |
e8121414cae83d27692d479286b703cbea35acb0 | 382 | class CreateApiUsersSupportAppPermission < ActiveRecord::Migration
class SupportedPermission < ApplicationRecord
belongs_to :application, class_name: "Doorkeeper::Application"
end
def up
support = ::Doorkeeper::Application.find_by(name: "Support")
if support
SupportedPermission.create!(applicat... | 29.384615 | 85 | 0.759162 |
1a6591f59458ed2df453eb49fdd29e8777237378 | 145 | class AddOtherOrganisationToUsers < ActiveRecord::Migration[4.2]
def change
add_column :users, :other_organisation, :string
end
end
| 24.166667 | 65 | 0.751724 |
e2bdf39926caba0379169520036555288ec562a5 | 4,934 | =begin
#Accounting API
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 2.1.3
Contact: api@xero.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.3.0
=end
require 'spec_helper'
require 'json'
... | 29.369048 | 107 | 0.707134 |
91bc2afaad5d52bb506d5923a6cc5bd6c968aec0 | 941 | require "rails_helper"
RSpec.describe ContactPreferenceController do
let(:step) { assigns(:step) }
let(:invalid_params) { { step: { blah: "" } } }
let(:step_class) { ContactPreference }
before { session[:snap_application_id] = current_app.id }
include_examples "step controller", "param validation"
descr... | 25.432432 | 78 | 0.676939 |
916d3bc64f1e7455542a89f2ac3ef0bd49b802b0 | 9,141 | # typed: false
# frozen_string_literal: true
require "shellwords"
module Homebrew
# Helper module for running RuboCop.
#
# @api private
module Style
module_function
# Checks style for a list of files, printing simple RuboCop output.
# Returns true if violations were found, false otherwise.
de... | 30.368771 | 117 | 0.564271 |
7ab6a9ab2e631c0ac57b4e8dfc6e932eb84ef787 | 2,644 | class Libtool < Formula
desc "Generic library support script"
homepage "https://www.gnu.org/software/libtool/"
url "https://ftp.gnu.org/gnu/libtool/libtool-2.4.6.tar.xz"
mirror "https://ftpmirror.gnu.org/libtool/libtool-2.4.6.tar.xz"
sha256 "7c87a8c2c8c0fc9cd5019e402bed4292462d00a718a7cd5f11218153bf28b26f"
... | 38.882353 | 130 | 0.68646 |
21bf284a856c0559830025981a5cf6c200ac1ecd | 138 | # frozen_string_literal: true
FactoryBot.define do
factory :sub_item do
item
title
sequence(:position) { |n| n }
end
end
| 13.8 | 33 | 0.673913 |
e9cf862bb99ec5daf4b425965a3cf5cf423767aa | 3,636 | # Task file for tests
ref_file = 'tasks/install.yml'
control 'install-01' do
title 'Install Openshift Python module'
impact 'low'
ref ref_file
describe command('pip3 show openshift') do
its('stdout') { should match(/Name: openshift/) }
its('exit_status') { should eq 0 }
end
end
control 'install-02' ... | 26.735294 | 81 | 0.657866 |
267290c9d128aa101dfaf769e159214035ae13a0 | 879 | require 'nokogiri'
module HTMLProofer
module Utils
def pluralize(count, single, plural)
"#{count} " << (count == 1 ? single : plural)
end
def create_nokogiri(path)
if File.exist? path
content = File.open(path).read
else
content = path
end
Nokogiri::HTML(cle... | 22.538462 | 60 | 0.610922 |
edf3758fecd0cbd3ffbecd1a2f300b00104d4852 | 98 | module Provenance::Governance
def self.table_name_prefix
'provenance_governance_'
end
end
| 16.333333 | 29 | 0.795918 |
acc07a27c1c733eeeb6601af7fc2e0ac237fc9f7 | 1,401 | # Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{rubin}
s.version = "0.2.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rub... | 25.944444 | 105 | 0.630978 |
bb8f1a7d27081aee076e58458f8228517bdeec5c | 200 | class User < ApplicationRecord
validates :username, presence: true
validates :username, uniqueness: true
has_secure_password
has_many :character_notes
has_many :matchup_notes
end
| 22.222222 | 41 | 0.76 |
ed496b7941127d616e2fe51eef5b270c73fc33a5 | 354 | require_relative '../../spec_helper'
describe "Regexp.last_match" do
it "returns MatchData instance when not passed arguments" do
/c(.)t/ =~ 'cat'
Regexp.last_match.should be_kind_of(MatchData)
end
it "returns the nth field in this MatchData when passed a Fixnum" do
/c(.)t/ =~ 'cat'
Regexp.last... | 23.6 | 70 | 0.680791 |
1dfba884dd1c0322e910dd97bcbb506b3e88e9f5 | 146 | # Generated via
# `rails generate hyrax:work Fact`
module Hyrax
module Actors
class FactActor < Hyrax::Actors::BaseActor
end
end
end
| 16.222222 | 46 | 0.712329 |
084c9bdfe2a7887ca1a724daedac195b4faf8d15 | 878 | opal_filter "Opal::Parser" do
fails "Singleton classes returns an empty s(:scope) when given an empty body"
fails "Singleton classes should accept any expressions for singleton part"
fails "Strings from %Q construction should match '{' and '}' pairs used to start string before ending match"
fails "Strings from ... | 79.818182 | 117 | 0.748292 |
ede74bcc588bc8487c539a1605dd53e432b54961 | 108 | class Patient < ActiveRecord::Base
has_many :appointments
has_many :doctors, through: :appointments
end
| 21.6 | 43 | 0.787037 |
39b6b8bc5247fa9fee200c2bcbe52ed9b03e2a11 | 496 | # Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
Mime::Type.register 'text/turtle', :ttl
Mime::Type.register 'application/n-triples', :nt
# Add new mime types for files in "public" directory
# See https://stacko... | 35.428571 | 59 | 0.733871 |
79718b60ac4c7dc135764740187614fa0dfb3fab | 820 | require "test_helper"
describe RootController do
setup do
stub_user_session
end
context "the start page" do
setup do
# create some books
FactoryBot.create_list(:book, 8)
end
should "be a successful request" do
get :start
assert response.successful?
end
should "... | 20 | 68 | 0.67439 |
189700e9975b1d926ea7a144ee1c617216aad539 | 1,167 | #
# Author:: Kendrick Martin (kendrick.martin@webtrends.com)
# Contributor:: David Dvorak (david.dvorak@webtrends.com)
# Cookbook Name:: iis
# Resource:: config
#
# Copyright:: 2011, Webtrends Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with ... | 28.463415 | 74 | 0.735219 |
28c08cfa5c6b613d40a93a4025e55340cc483745 | 120 | require 'spree_core'
require 'spree_extension'
require 'spree_simple_sales/engine'
require 'spree_simple_sales/version'
| 24 | 36 | 0.85 |
e880c35512155334372f8b6faf4fc79ce847f1f6 | 1,301 | # == Schema Info
# Schema version: 20100924060552
#
# Table name: definition_definition_forms
#
# id :integer not null, primary key
# def1_id :integer
# def2_id :integer
# created_by :string(80)
# relationship_from :string(256)
# relationship_to :string(256)
# ... | 28.911111 | 88 | 0.624135 |
87747890fb0bd059bbc973b313ed3540920ea57a | 1,389 | # typed: true
# frozen_string_literal: true
module Tasker
module Constants
module WorkflowStepStatuses
PENDING = 'pending'
IN_PROGRESS = 'in_progress'
ERROR = 'error'
COMPLETE = 'complete'
RESOLVED_MANUALLY = 'resolved_manually'
CANCELLED = 'cancelled'
end
module Task... | 26.207547 | 111 | 0.696184 |
bfcf9e20a4a9defad4ceb1939c9156854cae17f4 | 153 | require "spec_helper"
describe ConvenientGrouper::Error do
it "is a StandardError" do
expect(described_class.new).to be_a StandardError
end
end
| 19.125 | 53 | 0.777778 |
b9423fc8ba3b776a65093b09c8352cb95fb386d3 | 3,129 | secrets = Rails.application.secrets.mailer
OnlineReportingTool::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.co... | 36.811765 | 104 | 0.753276 |
114038bfcf8b4c9b4bbf867b7ad082c322e78226 | 13,605 | require 'strscan'
##
# Parses a gem.deps.rb.lock file and constructs a LockSet containing the
# dependencies found inside. If the lock file is missing no LockSet is
# constructed.
class Gem::RequestSet::Lockfile
##
# Raised when a lockfile cannot be parsed
class ParseError < Gem::Exception
##
# The ... | 22.599668 | 95 | 0.579125 |
ac3c7635591219040419da6350100cebd498fcc7 | 3,964 | # Be sure to restart your server when you modify this file
# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.2... | 50.820513 | 150 | 0.752775 |
1a47c70c0c8a7e51ccc1bd92668f4f61a738fea4 | 586 | json.partial! 'cookbook', cookbook: @cookbook
json.deprecated @cookbook.deprecated
if @cookbook.deprecated? && @cookbook.replacement.present?
json.replacement api_v1_cookbook_url(@cookbook.replacement)
end
json.versions Array(@cookbook_versions_urls)
json.metrics do
json.downloads do
json.total @cookbook.downlo... | 30.842105 | 61 | 0.771331 |
7a2a0707b4eff4ff882c0a4e3b00beb2e0798d40 | 619 | module IOCaptureHelper
def capture_io(&block)
original_stdout = $stdout
original_stderr = $stderr
captured_stdout = StringIO.new
captured_stderr = StringIO.new
$stdout = captured_stdout
$stderr = captured_stderr
yield
{
stdout: captured_stdout.string,
stderr: captured_s... | 17.685714 | 37 | 0.680129 |
4a13567db7f0709c49ee2d646775f3035809128a | 7,455 | require 'delegate'
module Deferring
class DeferredAssociation < SimpleDelegator
include Enumerable
attr_reader :load_state,
:klass,
:parent_record,
:inverse_name,
:dependent
def initialize(original_association, klass, parent_record, invers... | 28.346008 | 101 | 0.64896 |
79211375427b92e0454512790eab812a1971760d | 445 | #
# Cookbook Name:: mirna
# Spec:: default
#
# Copyright (c) 2015 The Authors, All Rights Reserved.
require 'spec_helper'
describe 'mirna::default' do
context 'When all attributes are default, on an unspecified platform' do
let(:chef_run) do
runner = ChefSpec::ServerRunner.new
runner.converge(desc... | 18.541667 | 74 | 0.696629 |
7a0d3599d66743b1d6465a748cab0a7ddb059e8f | 342 | require 'spec_helper_acceptance'
describe 'export_policy' do
it 'makes a export_policy' do
pp=<<-EOS
node 'vsim-01' {
}
node 'vserver-01' {
netapp_export_policy { 'export_policy-test' :
ensure => present,
}
}
EOS
make_site_pp(pp)
run_device(:allow_changes => true)
run_device(:allow_change... | 18 | 47 | 0.675439 |
ac31a936eb6887252582b90f2168610f834172c5 | 362 | class Sshfs < Cask
version '2.5.0'
sha256 'f8f4f71814273ea42dbe6cd92199f7cff418571ffd1b10c0608878d3472d2162'
url "https://github.com/osxfuse/sshfs/releases/download/osxfuse-sshfs-#{version}/sshfs-#{version}.pkg"
homepage 'http://osxfuse.github.io/'
license :oss
pkg "sshfs-#{version}.pkg"
uninstall :pkgu... | 30.166667 | 104 | 0.748619 |
288ac7d8baeac5e423cfc1fc9330dc1df6a9d589 | 2,533 | require File.join(File.dirname(__FILE__), 'test_helper')
class Sample < ActiveRecord::Base
self.table_name = 'sample'
end
class AutoIncrementTest < Minitest::Test
include TestHelper
def test_basic_table_creation
assert_auto_increments
end
def test_modified_primary_key_with_auto_increment
comment_t... | 32.474359 | 167 | 0.717331 |
4a52eb0ef7d5a8b4fb2092b2987a11eb22d22444 | 1,272 | # 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 not u... | 31.02439 | 74 | 0.720126 |
e87e9a87caf2b45e803c20ad4372406f85b67987 | 598 | cask 'virtualhostx' do
version '7.3.0,7_19'
sha256 '0ae7cef8c94d48eb2ebd63df7bae8422c68f3801b8412d2f67d7f80e8e9104ce'
# downloads-clickonideas.netdna-ssl.com/virtualhostx was verified as official when first introduced to the cask
url "https://downloads-clickonideas.netdna-ssl.com/virtualhostx/virtualhostx#{ver... | 42.714286 | 113 | 0.801003 |
4a29b560f1211a937cba39839cc95c3aabd1923a | 1,507 | RSpec.describe ExceedingRequestsController, type: :controller do
let!(:user) { create(:user) }
let!(:account) { create(:account) }
let!(:account_user) do
create(:account_user,
user_id: user.id,
account_id: account.id,
role_id: Role.find_by(name: 'owner').id
)
end
befo... | 33.488889 | 92 | 0.643663 |
91ad1d5870affd769a1e223569ffa3f98a022fbb | 383 | require_dependency 'spree/shipping_calculator'
module Spree
module Calculator::Shipping
class SelfDelivery < Spree::ShippingCalculator
def self.description
I18n.t :self_delivery
end
def compute(object)
object = object.order unless object.kind_of?(Spree::Order)
object.s... | 21.277778 | 66 | 0.686684 |
33f15c42ff14c29b73b06780371ac063b5ea18ed | 605 | =begin
Mojang API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
OpenAPI spec version: 2020-06-05
Generated by: https://github.com/openapitools/openapi-generator.git
=end
class NameHistoryController < ApplicationController
def find_unique_ids_by_name
... | 20.166667 | 106 | 0.722314 |
910fe5a877e9bb8a0869bbd99bfc78edf4235d15 | 1,726 | class Yamllint < Formula
include Language::Python::Virtualenv
desc "Linter for YAML files"
homepage "https://github.com/adrienverge/yamllint"
url "https://github.com/adrienverge/yamllint/archive/v1.11.1.tar.gz"
sha256 "56221b7c0a50b1619e491eb157624a5d1b160c1a4f019d64f117268f42fe4ca4"
revision 1
bottle d... | 33.843137 | 138 | 0.765353 |
331ad2419a6e525fc33c4754bf9db6661d99b47b | 90 | class Management::Admin::ShippersController < ApplicationController
def index; end
end
| 18 | 67 | 0.811111 |
18a635135167946f236bcb9f4912d8ec5877a48c | 2,116 | class Geeqie < Formula
desc "Lightweight Gtk+ based image viewer"
homepage "http://www.geeqie.org/"
# URL needs to be an unshallow clone because it needs history to generate
# the changelog documentation.
# Unfortunately this means that the tarball can't be used to build;
# this is documented in the makefil... | 34.129032 | 129 | 0.702268 |
bbd6d06da672f7a14cd87b0e14a905c4e318c877 | 9,716 | require 'spec_helper'
require 'fixtures/unit/puppet/provider/brocade_alias_membership/brocade_alias_membership_fixture'
describe "Brocade Alias Membership Provider" do
#Given
before(:each) do
@fixture = Brocade_alias_membership_fixture.new
mock_transport=double('transport')
@fixture.provider.stub(:trans... | 52.804348 | 276 | 0.771511 |
1814ac21db34e8534fe6b18eead86b82a0ca0fe9 | 344 | # frozen_string_literal: true
module ActiveJob
# Returns the version of the currently loaded Active Job as a <tt>Gem::Version</tt>
def self.gem_version
Gem::Version.new VERSION::STRING
end
module VERSION
MAJOR = 6
MINOR = 1
TINY = 4
PRE = "4"
STRING = [MAJOR, MINOR, TINY, PRE].comp... | 19.111111 | 85 | 0.651163 |
ff61a81562e12264a773e399080dad9d66a92c3d | 1,156 | # frozen_string_literal: true
require 'hanami/model'
require 'securerandom'
class User < Hanami::Entity
GUEST_EMAIL = 'guest@example.com'
GUEST_NAME = 'Guest User'
GUEST_PROFILE = 'This is the Guest User. It can do nothing.'
def guest?
name == GUEST_NAME && email == GUEST_EMAIL && profile == GUEST_PROFIL... | 29.641026 | 80 | 0.682526 |
4adf54dee68c84fe89598068269a0095e2dc2010 | 1,614 | ###
# Copyright (c) 2015, Upnext Technologies Sp. z o.o.
# All rights reserved.
#
# This source code is licensed under the BSD 3-Clause License found in the
# LICENSE.txt file in the root directory of this source tree.
###
class DeviseCreateAdmins < ActiveRecord::Migration
def change
create_table(:admins) do |t... | 32.28 | 110 | 0.651797 |
911cd18a22762917d948253b60aedbb8e4678373 | 202 | class CreateWegroups < ActiveRecord::Migration[5.1]
def change
create_table :wegroups do |t|
t.string :name
t.references :user, foreign_key: true
t.timestamps
end
end
end
| 18.363636 | 51 | 0.668317 |
62d08ce1a4ba47d07d6d5b9b7caadd983ba2f612 | 136 | # API for default State filter preferences
class StatesController < ApplicationController
def index
@states = State.all
end
end
| 19.428571 | 46 | 0.772059 |
f87cc07ddc8b10ecb4d3edf3e155cc3fa5a1bf5e | 7,052 | =begin
#NSX-T Data Center Policy API
#VMware NSX-T Data Center Policy REST API
OpenAPI spec version: 3.1.0.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.19
=end
require 'date'
module NSXTPolicy
# Traffic counters for IPSec VPN session.
class IPSecVpnTrafficC... | 29.755274 | 107 | 0.626631 |
18119939ddf5bb580f352212af2e68a3fdb025ff | 3,286 | require File.join(File.dirname(__FILE__), '../f5')
require 'json'
Puppet::Type.type(:f5_monitor).provide(:external, parent: Puppet::Provider::F5) do
has_feature :external
def initialize(value={})
super(value)
@create_elements = false
end
def self.instances
instances = []
monitors = Puppet::Pr... | 30.146789 | 193 | 0.632075 |
3902f249cf1d28a69b0787d048a964b90c6b56d1 | 3,672 | require 'test_helper'
class YamlTest < MiniTest::Spec
def self.yaml_representer(&block)
Module.new do
include Representable::YAML
instance_exec &block
end
end
def yaml_representer(&block)
self.class.yaml_representer(&block)
end
describe "property" do
let (:yaml) { yaml_represen... | 22.666667 | 97 | 0.615741 |
1a5071aa5fbcda701f07688b9ffa54d78090eeec | 793 | describe UseCases::Administrator::FormatEmailDomainsList do
let(:result) { subject.execute(email_domains) }
context "with no email domains" do
let(:email_domains) { [] }
it "creates no whitelist" do
expect(result.read).to eq("--- []\n")
end
it "returns an IO object" do
expect(result).... | 24.78125 | 61 | 0.638083 |
ff887851ea8e4f8bfb37a508d94c3cc97026a7d4 | 273 | module ToSelect
module Array
def to_select(text_method = :name, options = {})
list = self.map { |x| [x.send(text_method), x.id] }
list.unshift [options[:default], nil] if options[:default]
list
end
end
end
Array.send :include, ToSelect::Array
| 24.818182 | 64 | 0.644689 |
08bbf265bb6b525ad0bd9b3bebde8711b70d153d | 94 | require 'rspec'
require 'webmock/rspec'
WebMock.disable_net_connect!(allow_localhost: false)
| 18.8 | 52 | 0.819149 |
ffc27d07d69fa4f1540499092761aaddfb441529 | 2,970 | require 'github_api'
require 'net/http'
class GgithubsController < ApplicationController
skip_before_action :verify_authenticity_token
def index
@upstream = Round.where(repo: 'DNN-train').where.not(rate: [888, 999]).order(id: :desc) || Round.none
if params[:select_repo] = 'true'
origin_downstreams =... | 33.370787 | 139 | 0.673401 |
1abd9ccc4f0db5e8e1e297dfc2fd98fdb544a3e2 | 9,749 | # frozen_string_literal: true
require 'spec_helper'
require 'webmock/rspec'
WebMock.disable_net_connect!(allow_localhost: true)
describe Bosh::AzureCloud::AzureClient do
let(:logger) { Bosh::Clouds::Config.logger }
let(:azure_client) do
Bosh::AzureCloud::AzureClient.new(
mock_azure_config,
logger... | 36.376866 | 243 | 0.535747 |
1ab96c63f068c37d23a6c2701e35e275b49e1719 | 7,295 | require File.expand_path('../../../../../helper', __FILE__)
describe 'Sections::Controller::Revisions' do
behaves_like :capybara
textbox_id = CustomFields::Model::CustomFieldType[:name => 'textbox'].id
checkbox_id = CustomFields::Model::CustomFieldType[:name => 'checkbox'].id
section = Sections::Model::S... | 30.911017 | 82 | 0.635504 |
ac867b4c4c65257d37cbf467ab806f57ae0049e0 | 396 | class AddInstitutionsAndEvents < ActiveRecord::Migration[6.0]
def up
create_table(:institutions) do |t|
t.string :name
t.timestamps
end
create_table(:events) do |t|
t.string :name
t.string :type
t.datetime :date
t.belongs_to :institution
t.timestamps
end
en... | 18 | 61 | 0.643939 |
1c25a1b909e86ba3f9c913d60f71c4ae176afe61 | 588 | class OmniauthController < ApplicationController
def google_oauth2
@user = User.create_from_provider_data(request.env['omniauth.auth'])
if @user.persisted?
sign_in_and_redirect @user
else
flash[:error] = 'There was a problem signing you in through Google. Please regist... | 32.666667 | 116 | 0.685374 |
87962392fc3fb5b7a3dba8005f40313cd3af8c4e | 549 | # Adds a very long max-age response header when the requested url
# looks like it includes a cache busting timestamp. Cache busting
# URLs look like this:
# http://HOST/PATH?DIGITS
#
# DIGITS is typically the number of seconds since some epoch but
# this can theoretically be any set of digits. Example:
# http://exa... | 32.294118 | 65 | 0.737705 |
03eccb74a6f240c9ae622ef7a3986408148e6de4 | 228 | class User < ActiveRecord::Base
has_secure_password
has_many :tweets
def slug
username.gsub(" ", "-")
end
def self.find_by_slug(slug)
unslug = slug.gsub("-", " ")
self.find_by(username: unslug)
end
end
| 16.285714 | 34 | 0.649123 |
08fea6c0f08a3451e6bbf83c0f0e2c22987a1ac4 | 1,321 | class Unoconv < Formula
desc "Convert between any document format supported by OpenOffice"
homepage "http://dag.wiee.rs/home-made/unoconv/"
url "http://dag.wieers.com/home-made/unoconv/unoconv-0.7.tar.gz"
sha256 "56abbec55632b19dcaff7d506ad6e2fd86f53afff412e622cc1e162afb1263fa"
head "https://github.com/dagwie... | 44.033333 | 107 | 0.794095 |
1cd743aca9f7819c9e76a42d0ca3b19d645ffd60 | 177 | require 'test/unit'
class TypoTextfilterTextileAndMarkdownTest < Test::Unit::TestCase
# Replace this with your real tests.
def test_this_plugin
flunk
end
end
| 19.666667 | 66 | 0.734463 |
62714b3d5fbe8ec67d6b6d690da4348ac1d7bb9f | 10,852 | # frozen_string_literal: true
require 'rails_helper'
require_relative '../fabricators/reaction_fabricator.rb'
require_relative '../fabricators/reaction_user_fabricator.rb'
describe DiscourseReactions::ReactionNotification do
before do
SiteSetting.discourse_reactions_enabled = true
PostActionNotifier.enable
... | 45.405858 | 118 | 0.740048 |
798edc0e8423bd11a40db6dff961af1a0c2f0870 | 1,730 | require 'rails_helper'
RSpec.describe Api::V0::NewsletterSubscriptionsController, :type => :controller do
describe "POST create" do
before(:each) do
stub_request(:post, "https://us8.api.mailchimp.com/2.0/lists/subscribe.json").
to_return(:status => 200, :body => "", :headers => {})
end
... | 41.190476 | 167 | 0.717341 |
91f4840f84fd321007d9a7e61190795628a7f20e | 233 | class C80AlbumGalleryAddPreviewToProps < ActiveRecord::Migration
def change
add_column :c80_album_gallery_props, :thumb_preview_width, :integer
add_column :c80_album_gallery_props, :thumb_preview_height, :integer
end
end
| 33.285714 | 72 | 0.824034 |
abb69fd20ca58582eab23ba9120930399a958468 | 652 | module Gemfury
module Const
class << self
def host
'www.gemfury.com'
#'localhost:3000'
end
def welcome
"Welcome to Gemfury!\nPlease complete the following information"
end
def email_error
"Invalid email address. Please try again."
end
de... | 24.148148 | 87 | 0.578221 |
330aa04310290b475986083fb907b28da7f058b5 | 3,112 | # frozen_string_literal: true
require "rspec"
require "rspec/expectations"
require "capybara"
require "capybara/rspec" # Required here instead of in rspec_spec to avoid RSpec deprecation warning
require "capybara/spec/test_app"
require "nokogiri"
# Alias be_truthy/be_falsey if not already defined to be able to use in ... | 29.923077 | 117 | 0.638175 |
6257ba5b73de54af121a5e4d4b7a55a70501dd65 | 6,727 | require 'sequel_postgresql_triggers'
Sequel.migration do
up do
extension :pg_triggers
create_table(:std_fruit_size_counts, ignore_index_errors: true) do
primary_key :id
foreign_key :commodity_id, :commodities, null: false
foreign_key :uom_id, :uoms, null: false
String :size_count_descr... | 42.04375 | 102 | 0.718894 |
382187dac186c8faf44c0ddbda0b707a9177dd70 | 1,016 | class Shellharden < Formula
desc "Bash syntax highlighter that encourages/fixes variables quoting"
homepage "https://github.com/anordal/shellharden"
url "https://github.com/anordal/shellharden/archive/v4.1.tar.gz"
sha256 "2714b827f72c336b7abf87f5a291ec182443a5479ec3eee516d6e04c81d56414"
bottle do
sha256 ... | 35.034483 | 93 | 0.748031 |
03695441cf86f3d29b83458a3f2be4fb8e292422 | 735 | src_filename = ::File.basename(node['nginx']['openssl_source']['url'])
src_filepath = "#{Chef::Config['file_cache_path']}/#{src_filename}"
extract_path = "#{Chef::Config['file_cache_path']}/openssl-#{node['nginx']['openssl_source']['version']}"
remote_file src_filepath do
source node['nginx']['openssl_source']['url'... | 35 | 118 | 0.697959 |
08c02bc2d9549cf84e77c51eda8dd8af9d7ddf4a | 556 | module Sip2
module Responses
#
# Sip2 Patron Information
#
class PatronInformation < BaseResponse
register_response_code 64
def patron_valid?
boolean 'BL'
end
def authenticated?
boolean 'CQ'
end
def email
text 'BE'
end
def loc... | 15.027027 | 70 | 0.573741 |
e265b0ff54f2735e22041afb418d5433ef961309 | 1,138 | require 'waffle_api/errors'
require 'net/http'
require 'openssl'
require 'json'
require 'uri'
module WaffleAPI
# List of helpers used in WaffleAPI
module Helpers
NOT_FOUND_ERROR = 'Invalid BTC Address!'
INVALIDATION_TIME = 30 # Seconds
def call_uri
URI "#{WAFFLEPOOL_URL}#{WAFFLEPOOL_API_PATH}?ad... | 22.76 | 79 | 0.656415 |
5dca89cd47c12a8c251202c756996b52122a00a9 | 961 | require 'csv'
module SphyGmo
ErrorInfo = Struct.new('ErrorInfo', :code, :info, :message) do |s|
class << s
attr_accessor :all
def parse(v)
v = v.send(:error_info) if v.respond_to?(:error_info)
infos = case v
when Hash
v['ErrInfo'].split('|')
... | 21.840909 | 78 | 0.471384 |
915c5b517840b414eb1063cac24cbce577dfbc81 | 336 | class Store < ActiveRecord::Base
before_save(:fix)
has_many :brands_stores # points to join table
has_many :brands, through: :brands_stores # links
validates(:name, {:uniqueness => true, :presence => true, :length => { :maximum => 100 }})
private
def fix
self.name=self.name.capitalize
... | 22.4 | 92 | 0.645833 |
f7a687f4739292a69fad3a7c85cd798684d148a3 | 1,973 | module ActiveRecord
module Reflection
class AssociationReflection #:nodoc:
def reverse_for?(klass)
reverse_matches_for(klass).empty? ? false : true
end
attr_writer :reverse
def reverse
if @reverse.nil? and not self.options[:polymorphic]
reverse_matches = reverse_... | 34.614035 | 112 | 0.633046 |
e94c1343904b07ebe3a2aa62f5be8606f8338deb | 9,487 | require 'test_helper'
module Synapse
module UnitOfWork
class UnitOfWorkTest < Test::Unit::TestCase
def setup
@provider = UnitOfWorkProvider.new
@uow = UnitOfWork.new @provider
end
def teardown
if @provider.started?
raise 'Unit of work was not properly cleared ... | 28.151335 | 107 | 0.651523 |
9113bb30ce287b8ed534b055c438689da8ad052f | 770 | class User < ApplicationRecord
has_many :instruments, inverse_of: :user, dependent: :destroy
has_many :songs, inverse_of: :user, dependent: :destroy
has_many :elements, through: :songs, inverse_of: :user, dependent: :destroy
validates :email, :username, :password, :password_confirmation, presence: true
valida... | 32.083333 | 80 | 0.74026 |
26f80cff3fcc0b45e9f313544f0cdc9a590dd8ab | 587 | require 'ddtrace/contrib/cucumber/formatter'
module Datadog
module Contrib
module Cucumber
# Instrumentation for Cucumber
module Instrumentation
def self.included(base)
base.send(:prepend, InstanceMethods)
end
# Instance methods for configuration
module Inst... | 23.48 | 92 | 0.637138 |
ab787c67be6f9714b6cba248f455f35fdf687c83 | 2,659 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = GreatRanking
# [*] x.x.x.x WhatsUp_Gold/8.0 ( 401-Basic realm="WhatsUp Gold" )
HttpFingerprint = { :pattern => [ /WhatsUp... | 32.426829 | 99 | 0.547574 |
4ae42ff1db6d9a04e52aa4f1a1feadab35e71ab9 | 1,209 | class Ftjam < Formula
desc "Build tool that can be used as a replacement for Make"
homepage "https://www.freetype.org/jam/"
url "https://downloads.sourceforge.net/project/freetype/ftjam/2.5.2/ftjam-2.5.2.tar.bz2"
sha256 "e89773500a92912de918e9febffabe4b6bce79d69af194435f4e032b8a6d66a3"
bottle do
cellar :... | 29.487805 | 92 | 0.703888 |
f8276d9dcc656217fdef8d197383b8c2b56ef50e | 1,396 | # frozen_string_literal: true
DiscourseEvent.on(:site_setting_changed) do |name, old_value, new_value|
# Enabling `must_approve_users` on an existing site is odd, so we assume that the
# existing users are approved.
if name == :must_approve_users && new_value == true
User.where(approved: false).update_all(ap... | 29.702128 | 99 | 0.716332 |
bbd66907252c5adbcf1fd3a1f73d81e89f82416c | 687 | cask "banktivity" do
version "8.7.7"
sha256 "63c3c30da83d4f4f131686d7d4f23975e0afb531e8a029256ae4aa551795b49f"
url "https://www.iggsoft.com/banktivity/Banktivity#{version}.dmg",
verified: "iggsoft.com/"
name "Banktivity"
desc "App to manage bank accounts in one place"
homepage "https://www.iggsoftwar... | 27.48 | 75 | 0.704512 |
1ac1529b96c3bfc1b4e24b0845d0a8511a2f1daa | 271 | package 'explicit_action' do
action :lock
end
package 'with_attributes' do
version '1.0.0'
action :lock
end
package 'specifying the identity attribute' do
package_name 'identity_attribute'
action :lock
end
package %w(with array) do
action :lock
end
| 15.055556 | 46 | 0.730627 |
26456611b9bee589228d9e37eac66ece7daae718 | 55 | json.array! @duties, partial: 'duties/duty', as: :duty
| 27.5 | 54 | 0.690909 |
875195cd525598e96045957370238a81634f0e53 | 543 | namespace :env do
desc 'Ensure every non optional ENV variable is defined.'
task :lint => :load do
formatter = EnvLint::Formatter.new
begin
EnvLint.verify_hash(env_definition_file, ENV)
formatter.ok('env looks ok')
rescue EnvLint::MissingVariables => e
formatter.missing_variables(e.do... | 22.625 | 70 | 0.683241 |
6a29562142dc98918b64b14edbde96e16ac98cba | 296 | module DmUniboCommon
class PermissionPolicy < ApplicationPolicy
def index?
@user.is_cesia?
end
def show?
@user.is_cesia?
end
# only superuser
def create?
@user.is_cesia?
end
# only superuser
def update?
create?
end
def destroy?
update?
end
end
end
| 11.384615 | 42 | 0.658784 |
f756592f448fad84fad2215cd5df5b40d2ff0dc6 | 103 | class ApplicationMailer < ActionMailer::Base
default from: 'hello@venue.show'
layout 'mailer'
end
| 17.166667 | 44 | 0.757282 |
e236dff908296ebfd81d207abb7f2adc08a34120 | 1,202 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Subscriptions::Mgmt::V2019_10_01_preview
module Models
#
# The ID of the subscriptions that is being renamed
#
class RenamedSubscriptionId
... | 25.574468 | 74 | 0.5599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.