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 |
|---|---|---|---|---|---|
79e7decaf1b2100768f991b16832754e9f2655cb | 956 | #
# UserAuthentication provides a method create_session to the included class
# that will build and return a session model.
#
# There are three knobs to tweak to modify behavior per-controller.
# auth_module: #login(self) will be called on this class to get back user || nil
# user_model: the class to use to find the us... | 28.969697 | 80 | 0.762552 |
11088bd4f9e50af6a0c1ed0ee33def27cb36aa2d | 379 | name "keepalived"
maintainer "Opscode, Inc."
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Installs and configures keepalived"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "1.2.0"
supports "ubuntu"
... | 34.454545 | 73 | 0.670185 |
f89be8e6b040989628c244c38f1a1190cce7d875 | 1,785 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/google_ads/v2/resources/ad_group_bid_modifier.proto
require 'google/protobuf'
require 'google/ads/google_ads/v2/common/criteria_pb'
require 'google/ads/google_ads/v2/enums/bid_modifier_source_pb'
require 'google/protobuf/wrappers_pb'
requ... | 55.78125 | 142 | 0.788796 |
bf26774efd90f5cb6281ee295dfad1782b13d0fc | 1,545 | ##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
# http://metasploit.com/
##
require 'msf/core'
class Metasploit3 < Msf::Post
def initialize(info={})
sup... | 24.52381 | 87 | 0.662136 |
b913bc67195ddf1f10565ae8e4e15289282820c4 | 457 | class StartController < ApplicationController
def show
return unless authenticated?
@client_applications = artsy_client.links.try(:applications).try(:embedded).try(:applications) || []
@selected_client_application = @client_applications.find { |app| app.attributes.id == params[:id] } if params.key?(:id)
... | 41.545455 | 123 | 0.73523 |
87a9e19a2573aa6fa3783928c97e52eb5aa8a9c5 | 1,484 | #https://api.foursquare.com/v2/venues/search?ll=40.7,-74&client_id=LPOO1Y3SF1IRX04VJZC53XKKQQHCAMIQSB1SQ1BWYDFY1BSV&client_secret=3WL0SL5JODGZDJD1PNVRJPQ4JQAVN2SW42AUBQJIMMXZ3VE2&v=20120609
require "net/http"
require "curb"
require "addressable/uri"
require "json"
require "twitter"
class FoursquareSearcher
def ... | 29.68 | 190 | 0.644879 |
ed8e16caf74af363f16f269e1e6343aa77d111dd | 680 | ##################################
##### SET THESE VARIABLES ########
##################################
root = "/home/deploy/Lari-Explorer/current" # path to application current folder
sock_name = "unicorn_Lari-Explorer" # must be unique name with no '.'
port_num = 8136 # must be a unique port number for this applicat... | 35.789474 | 83 | 0.626471 |
5daaa039f5b1ce28a503f7e2eecfc9299307f3b0 | 3,806 | # frozen_string_literal: true
class FeaturesController < ApplicationController
before_action :authenticate_user!
before_action :set_feature,
only: %i[show edit update destroy copy
delete_artifact delete_passage]
# GET /projects/:project_id/features
def index
@proj... | 30.943089 | 122 | 0.680504 |
218ef0702213531d47619070e92766347e07fb10 | 13,586 | # frozen_string_literal: true
RSpec.shared_examples 'variable list' do
it 'shows list of variables' do
page.within('.js-ci-variable-list-section') do
expect(first('.js-ci-variable-input-key').value).to eq(variable.key)
end
end
it 'adds new CI variable' do
page.within('.js-ci-variable-list-sect... | 35.015464 | 128 | 0.665612 |
6a735fadde12c2b53061b41d0dcc9fb152b7e7a9 | 1,650 | class Dcraw < Formula
desc "Digital camera RAW photo decoding software"
homepage "https://www.dechifro.org/dcraw/"
url "https://www.dechifro.org/dcraw/archive/dcraw-9.28.0.tar.gz"
mirror "https://mirrorservice.org/sites/distfiles.macports.org/dcraw/dcraw-9.28.0.tar.gz"
sha256 "2890c3da2642cd44c5f3bfed2c9b2c1d... | 43.421053 | 106 | 0.746061 |
1c1d9c7f89ec4c14d83ff423730cef1320ea696a | 207 | class CreatePendingEpisodes < ActiveRecord::Migration[5.1]
def change
create_table :pending_episodes do |t|
t.string :origin_id
t.string :episode_type
t.timestamps
end
end
end
| 18.818182 | 58 | 0.695652 |
01d96e72401aa5784d02ea66d82a8a31e1318b46 | 659 | 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 PhotoApp
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails ... | 32.95 | 82 | 0.764795 |
613c32d0de0babf09228afe8012137affcb982c1 | 2,095 | module Fog
module DNS
class Dynect
class Real
# Create a zone
#
# ==== Parameters
# * rname<~String> - administrative contact
# * ttl<~Integer> - time to live (in seconds) for records in this zone
# * zone<~String> - name of zone to host
# * options<~... | 29.097222 | 127 | 0.442482 |
87b91e1d41157b773afd376f6cbc594744ef64f5 | 595 | require 'spec_helper'
describe Queri::Stats::UnansweredCalls::CallOverview do
let(:report_class) { Queri::Stats::UnansweredCalls::CallOverview }
let(:xml_code) { report_class.xml_code }
before do
Queri.configure_with(File.join(File.dirname(__FILE__), '..', '..', 'config.yml'))
end
it_behaves_like "a re... | 25.869565 | 85 | 0.744538 |
1de4740a2e2bcb0b601665880e548ee49ae09405 | 256 | # @param {Integer} num
# @return {Boolean}
def is_ugly(num)
return false if num < 1
return true if num == 1
valid_primes = [2, 3, 5]
valid_primes.each do |prime|
while num % prime == 0
num = num / prime
end
end
num == 1
end
| 17.066667 | 30 | 0.585938 |
795a35b3d05e015ecc16ceacb9577f89ca2d375a | 690 | module DP
class LongestCommonSubsequenceRecursive
attr_reader :str1, :str2
def initialize(str1: , str2: )
@str1 = str1
@str2 = str2
end
def find
find_helper(str1.size-1, str2.size-1)
end
private
def find... | 23 | 85 | 0.488406 |
b9d83f7d5b0baa06e055780ccaacda7c22b8d292 | 217 | Rails.application.routes.draw do
root to: #'home#index'
get '/login' => 'sessions#new', as: :login
post '/login' => 'sessions#create'
get '/logout' => 'sessions#destroy', as: :logout
resources :users
end
| 19.727273 | 50 | 0.64977 |
5df88d9db99c38de7b34b189521ba8dc7975d766 | 137 | class MessageListAction < Cramp::Action
def start
para = params
ap para
render "This is MessageList!"
finish
end
end
| 15.222222 | 39 | 0.671533 |
1cdd05d90efb0848ccce57b3ce630dfc3a9452e5 | 812 | =begin
#Fireblocks API
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 1.5.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.3.0
=end
require 'spec_helper'
require 'json'
require 'date'
# Uni... | 28 | 107 | 0.791872 |
1d10c551ddf4291fa5d948448340dc7da0b03732 | 722 | module SmtpLw
module Default
API_BASE = 'https://api.smtplw.com.br'.freeze
API_VERSION = '/v1/'.freeze
class << self
def api_endpoint
ENV['SMTP_LW_API_ENDPOINT'] || (API_BASE + API_VERSION)
end
def api_token
ENV['SMTP_LW_API_TOKEN']
end
def api_version
... | 19 | 70 | 0.577562 |
26496796b7d03a173fd2fcfcf90b60506e06e100 | 1,101 | # frozen_string_literal: true
module EwStripe
class AlipayAccount < APIResource
include EwStripe::APIOperations::Save
include EwStripe::APIOperations::Delete
OBJECT_NAME = "alipay_account"
def resource_url
if !respond_to?(:customer) || customer.nil?
raise NotImplementedError,
... | 31.457143 | 75 | 0.654859 |
1a7cf68d4c34ddc83277035f34928a96c2c2e4f8 | 443 | require 'test_helper'
class SiteLayoutTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
test "layout links" do
get root_path
assert_template 'static_pages/home'
assert_select "a[href=?]", root_path, count:2
assert_select "a[href=?]", help_path
assert_select... | 23.315789 | 54 | 0.690745 |
380886769a2ceeb4c1eae7a7756b5ef07b18ecfb | 1,688 | # This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../spec/dummy/config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and it... | 31.849057 | 79 | 0.729858 |
28bec15444e505db6ac2fe76d57f1d0787163705 | 36 | module Rhohub
VERSION = "1.1"
end
| 9 | 17 | 0.666667 |
f8cd02ed9639d8cbc096a7b37f7f141bda87f1aa | 946 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 32.62069 | 74 | 0.733615 |
acc3e1712abc3294b69683c4ab330ffc7b4cfe07 | 5,013 | # frozen_string_literal: true
module Gitlab
module SidekiqMiddleware
module SizeLimiter
# Handle a Sidekiq job payload limit based on current configuration.
# This validator pulls the configuration from application settings:
# - limiter_mode: the current mode of the size
# limiter. This... | 37.133333 | 99 | 0.648314 |
08ffe208bf984124fd1108eb7a489c0c4ff9c727 | 1,640 | U::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite ... | 41 | 85 | 0.772561 |
117c395b6d2ea9f7f405c4e9e1c6828c00af9402 | 3,407 | require 'spec_helper_package'
describe 'Using the PDK configuration commands' do
def env_var(host, var_name)
value = host.get_env_var(var_name)
value.empty? ? nil : value[var_name.length + 1, value.length - var_name.length - 1]
end
def host_system_configdir(host)
# This emulates the PDK::Util.system... | 37.032609 | 112 | 0.67919 |
bf7ceee578949eb3fe8caa7e949d501d4d8c0a60 | 43 | =begin
/[A-WYZa-wyz]/
or
/[a-wyz]/i
=end
| 5.375 | 14 | 0.534884 |
087132729472ba214148b5f52b8a915f5cfb777a | 1,233 | # Finders::Issues class
#
# Used to filter Issues collections by set of params
#
# Arguments:
# current_user - which user use
# params:
# scope: 'created-by-me' or 'assigned-to-me' or 'all'
# state: 'open' or 'closed' or 'all'
# group_id: integer
# project_id: integer
# milestone_id: integer
# ... | 25.163265 | 100 | 0.687753 |
7a2e7ee00b43dc8f8e8d5c54fa0271b43bd78402 | 2,014 | # frozen_string_literal: true
require_relative '../../code_reuse_helpers'
module RuboCop
module Cop
module SidekiqLoadBalancing
# This cop checks for a call to `data_consistency` to exist in Sidekiq workers.
#
# @example
#
# # bad
# class BadWorker
# def perform
... | 30.515152 | 117 | 0.636544 |
214cd4ebd5b7f1726a4edb3509ae61546791d5e0 | 1,374 | require File.expand_path('../helper', __FILE__)
begin
require 'radius'
class RadiusTest < Minitest::Test
def radius_app(&block)
mock_app do
set :views, File.dirname(__FILE__) + '/views'
get('/', &block)
end
get '/'
end
it 'renders inline radius strings' do
radius_app { radius '<h1>H... | 22.9 | 70 | 0.607715 |
e9a4f21fde1f2c0d72554d16c3100f7169298d4c | 2,936 | require_relative('../lib/event.rb')
RSpec.describe(Event) do
describe '#initialize' do
context 'create new events' do
it 'returns total_events quals to one' do
Event.clear
Event.new('Introduction to Javascript', '10AM to 2PM', 'meetup.com/codificadas')
expected = Event.total_events
... | 39.146667 | 100 | 0.646117 |
b999e5c675279146a2a6ee8765193afb6993d4b2 | 42 | module PDK
VERSION = '1.1.0'.freeze
end
| 10.5 | 26 | 0.666667 |
4a2b21a1343646ca2e5c9690ec191c2989d2024a | 4,477 | # Copyright (C) 2019 MongoDB, 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 writi... | 33.661654 | 87 | 0.641501 |
f7c0be58a799f269904c015e0d5ba4abcc6c38ef | 7,601 | # Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic... | 38.388889 | 245 | 0.690304 |
61ab6b5a4acd10c8a9f97f6645a36c431b4c2f68 | 835 | # frozen_string_literal: true
require 'yarr/command/base'
require 'yarr/query'
require 'yarr/command/concern/ast_digger'
require 'yarr/command/concern/authorize'
require 'yarr/command/concern/user'
module Yarr
module Command
# Adds a new factoid if there isn't one already with the same name
class AddFact < ... | 23.857143 | 74 | 0.662275 |
4aaa034fa4868b3b9f5aaa1dd6bd1d44034e0723 | 7,196 | #
# Author:: Vasundhara Jagdale (<vasundhara.jagdale@msystechnologies.com>)
# Copyright:: Copyright (c) Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... | 38.074074 | 154 | 0.620067 |
6a985f389799d91459168116845c2d78b02946b6 | 1,598 | require "test/unit/testcase"
require "rexml/document"
require "rexml/parseexception"
=begin
# THIS DOESN'T WORK
begin
require 'iconv'
UnixCharsets = open("| iconv -l") do |f|
f.readlines[5..-1].collect { |x| x.sub(/\/\/\n/,"").delete(' ') }
end
DATA = <<END
<?xml version="1.0" encoding='ENC'?>
<Ruby xm... | 26.633333 | 126 | 0.604506 |
33bf1c129586fccf72e8c4840d3e5781d06a0519 | 6,432 | require 'spec_helper'
require 'bosh/dev/vsphere/micro_bosh_deployment_manifest'
require 'psych'
module Bosh::Dev::VSphere
describe MicroBoshDeploymentManifest do
subject { described_class.new(env, 'manual') }
let(:env) { {} }
it 'is writable' do
expect(subject).to be_a(Bosh::Dev::WritableManifest)... | 30.483412 | 96 | 0.640081 |
1afc796fc847a4e32de0bd5437a0cf7c724f7788 | 5,391 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::DataFactory::Mgmt::V2018_06_01
module Models
#
# Spark Server dataset.
#
class SparkObjectDataset < Dataset
include M... | 30.286517 | 78 | 0.427935 |
39120588fa616bbda74fa4c8c8d035ebc55d9198 | 1,915 | require File.dirname(__FILE__) + "/spec_helper"
module Conductor::ActionView
describe CollectionFormBuilder, "with a collection" do
before do
@collection = stub_everything
@object = stub_everything(:foo => "bar")
@builder = CollectionFormBuilder.new(stub, @object, stub, { :collection => @collec... | 35.462963 | 114 | 0.664752 |
181d5d2a2ae76920e41e1eff059751a96761a01e | 2,595 | # Author:: Eyal Oren
# Copyright:: (c) 2005-2006 Eyal Oren
# License:: LGPL
require 'uuidtools'
require 'strscan'
# ntriples parser
class NTriplesParser
def self.parse_node input
case input
when MatchBNode
RDFS::Resource.new("http://www.activerdf.org/bnode/#{UUID.random_create}/#$1")
when MatchLit... | 28.516484 | 84 | 0.570713 |
d5cb6601f92cf00f39a446277be8cde2d5dfbba1 | 2,521 | require 'spec_helper'
shared_examples 'standard::init' do |es_version,plugins|
describe user('elasticsearch') do
it { should exist }
end
describe service('node1_elasticsearch') do
it { should be_running }
end
describe package('elasticsearch') do
it { should be_installed }
end
describe fil... | 27.107527 | 122 | 0.688616 |
08b2671d0d5a91ffea8a49250cb5e9a52ace6582 | 375 | # frozen_string_literal: true
module CMSScanner
module Finders
# Same Type Finder
module SameTypeFinder
def self.included(klass)
klass.class_eval do
include IndependentFinder
# @return [ Array ]
def finders
@finders ||= NS::Finders::SameTypeFinders.new... | 18.75 | 57 | 0.592 |
b9c6ac2a8e5acd6fd549e07a30b189cac72eb5b4 | 715 | require 'logger'
# Provides an instance of the Ruby stdlib logger as a mixin.
module Loggable
# Instance method wrapping self.logger. This is the method invoked by logger calls, eg logger.debug()
#
# @return [Logger] an instance of the Ruby stdlib logger
def logger
Loggable.logger
end
# Returns the... | 24.655172 | 103 | 0.696503 |
7ad926bfe31fe18aa883fc5de50c3149bf2bf616 | 392 | require "test_helper"
class EncryptedValueTest < ActiveSupport::TestCase
test "It should be able to encrypt data" do
value_to_encrypt = "sensitive_data"
encrypted_value = EncryptedValue.dump(value_to_encrypt)
decrypted_value = EncryptedValue.load(encrypted_value)
refute_equal encrypted_value, value_... | 30.153846 | 59 | 0.80102 |
794d0521e696d6d538b92d9e3fc27fdd623dfc9e | 314 | module VCAP::CloudController
class LabelError < Struct.new(:is_valid?, :message)
def self.error(message)
LabelError.new(false, message)
end
def self.none
@none ||= LabelError.new(true)
end
def to_s
"#<LabelError is_valid:#{is_valid?} message:#{message}"
end
end
end
| 19.625 | 61 | 0.643312 |
abfec90b6d8da3b2f82d481e47a8545ce06bd98d | 19,653 | # frozen_string_literal: true
require "yaml"
require "active_support/core_ext/hash/keys"
require "active_support/core_ext/object/blank"
require "active_support/key_generator"
require "active_support/message_verifier"
require "active_support/encrypted_configuration"
require_relative "engine"
require_relative "secrets"
... | 35.474729 | 157 | 0.681372 |
7ab413875d631b788dc5a813db99483abb406a5c | 276 | nicole = User.create(name: "Nicole", )
Kid.create(name: "Veronica", gender: "Female", birthdate:"8/11/2018", owner: nicole)
Kid.create(name: "Ryan", gender: "Male", birthdate:"8/11/2018", owner: nicole)
Event.create(name: "Ari's Birthday Party", date: "4/5/2020", time:"" ) | 39.428571 | 84 | 0.673913 |
b914ec147d27828b1510151e9c642472f004d7cb | 37 | class Admin < ActiveRecord::Base
end
| 12.333333 | 32 | 0.783784 |
ed08dcec05b697a6c5acd249e466128d0564788e | 1,044 | #
# Be sure to run `pod spec lint sequencing-app-chains-api-swift.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 rep... | 38.666667 | 132 | 0.657088 |
9156cd44d6bed08bee81c34063a00134f9c652e0 | 110 | # frozen_string_literal: true
module CashAddr
##
# Version of the cash-addr gem.
VERSION = '0.3.0'
end
| 13.75 | 33 | 0.681818 |
28d64ba29291f6175b7129fff1bc25f7587b10d1 | 2,321 | class Fobis < Formula
include Language::Python::Virtualenv
desc "KISS build tool for automaticaly building modern Fortran projects"
homepage "https://github.com/szaghi/FoBiS"
url "https://files.pythonhosted.org/packages/2d/45/00c4c768f507401f9f95e978494b9964bc1d8cce841eb1dfffacd90278d9/FoBiS.py-2.2.9.1.tar.gz"... | 39.338983 | 143 | 0.765187 |
28f60e7c8f99617119d2ef0926f7b2038f9e510e | 211 | class ShowsController < ApplicationController
skip_before_action :authorized
def index
shows = Show.all
render json: shows.to_json(:except => [:updated_at, :created_at])
end
end
| 23.444444 | 73 | 0.677725 |
389395055012e7b967733976b13f35e38e460edf | 5,022 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = GreatRanking
include Msf::Exploit::Remote::SMB::Client
include Msf::Exploit::Brute
def initialize(info = {})
super... | 31 | 76 | 0.525289 |
1882e8b535a57ffed0f6ae05d4b961752e17f50a | 1,974 | require 'rails_helper'
RSpec.describe 'Blog App', type: :feature do
describe 'post index page' do
before :each do
@user = User.new(
email: 'admin@gmail.com',
bio: 'Lorenzo is my partner',
password: 'password',
password_confirmation: 'password',
name: 'Admin',
... | 26.32 | 77 | 0.627153 |
61f0430d3bd4ea2df8f4f5bba7ae0883dfef915a | 3,946 | Rails.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
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... | 41.536842 | 102 | 0.756969 |
bb90c22d8d9943c12d11f0ffbb60a076b54bff64 | 1,522 | # frozen_string_literal: true
#
# Copyright:: 2020, Chef Software Inc.
# Author:: Scott Vidmar (<svidmar@chef.io>)
#
# 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/li... | 30.44 | 184 | 0.651117 |
e92e3195046769042116cad06ff57a6de5c89231 | 1,144 | # 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... | 34.666667 | 86 | 0.746503 |
e2ba8a99503dde8392f9687704edf1ece5df584b | 3,230 | # frozen_string_literals: true
require_relative 'helper'
require 'http_parser'
OptionParser.new do |opts|
opts.banner = 'Usage: upgrade_client.rb [options]'
end.parse!
uri = URI.parse(ARGV[0] || 'http://localhost:8080/')
sock = TCPSocket.new(uri.host, uri.port)
conn = HTTP2::Client.new
def request_header_hash
... | 20.974026 | 90 | 0.630031 |
28578a3d79aaf130d0e606202066165e4f5a382d | 1,206 | # frozen_string_literal: true
require 'spec_helper'
require_migration!
RSpec.describe BackfillIntegrationsEnableSslVerification do
let_it_be(:migration) { described_class::MIGRATION }
let_it_be(:integrations) { described_class::Integration }
before do
stub_const("#{described_class.name}::BATCH_SIZE", 2)
... | 36.545455 | 83 | 0.720564 |
ac2c6e94c93fce136266a399d3be55858db93b42 | 415 | Spina::Engine.routes.draw do
namespace :news do
root to: 'articles#index'
resources :articles, only: [:index, :show]
get 'archive/:year(/:month)', to: 'articles#archive', as: :archive_articles
end
namespace :admin do
namespace :news do
resources :articles do
collection do
... | 18.863636 | 79 | 0.590361 |
1cc793fa967a40f3f5f142a1447c026f1fbddd02 | 14,063 | #!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../test_helper'
class ActionView::Base
def nested_tag
content_tag(:span) {content_tag(:div) {"something"}}
end
def wacky_form
form_tag("/foo") {"bar"}
end
end
module Haml::Helpers
def something_that_uses_haml_concat
haml_concat('foo').to_s
... | 30.049145 | 206 | 0.651284 |
62f72f93ac3770bcca04e292ebc32516eb8fb5c0 | 510 | class TaxTribs::SaveCaseForLater
attr_reader :tribunal_case, :user
def initialize(tribunal_case, user)
@tribunal_case = tribunal_case
@user = user
@email_sent = false
end
def save
tribunal_case.nil? || tribunal_case.user.present? || claim_case_ownership
end
def email_sent?
@email_sent... | 19.615385 | 77 | 0.739216 |
086d0eed9e7ebf3338b8ae8a4a55a2fb2773e092 | 111 | class RemoveUserIdFromNote < ActiveRecord::Migration
def change
remove_column :notes, :user_id
end
end
| 18.5 | 52 | 0.774775 |
38ce1dbf9b76ae8d50f9edd3fde93dc68cd52069 | 671 | class CreateAttachmentReferences < ActiveRecord::Migration[4.2]
def change
create_table :attachment_references do |t|
t.references :attachable, polymorphic: true
t.references :attachment, null: false
t.string :name, null: false
t.datetime :expires_at
t.userstamps null: false, foreig... | 33.55 | 67 | 0.721311 |
628c6b276f4120098bc293be5332c00e0ee36278 | 589 | require 'formula'
class Abcde < Formula
homepage 'https://code.google.com/p/abcde/'
url 'http://abcde.googlecode.com/files/abcde-2.5.4.tar.gz'
sha1 'eb0a933f869faf0013bc1382511936797506d108'
depends_on 'lame' => :optional
depends_on 'vorbis-tools' => :optional
depends_on 'flac' => :optional
depends_on '... | 26.772727 | 62 | 0.706282 |
6aa3c8b6f19f0798f20a1e2e463354ade47f7020 | 134 | class RemoveBatchIdFromStartup < ActiveRecord::Migration[5.1]
def change
remove_column :startups, :batch_id, :integer
end
end
| 22.333333 | 61 | 0.768657 |
1c9a6208ad81940789ecc41fa688ea2505bb2d9e | 638 | # encoding: UTF-8
module NfeReader
# Identificação do Destinatário da Nota Fiscal eletrônica
class Customer
include AttributeHelper
attr_reader :person, :address
# == Fields Values
#
# indIEDest: 1 - Contribuinte ICMS (informar a IE do destinatário),
# 2 - Contribuinte isento de... | 26.583333 | 91 | 0.65047 |
0158a410794ab376bee22e7a25a8180caf7a70f8 | 667 | module WebsiteTokenHelper
def auth_token_params
@auth_token_params ||= ::Widget::TokenService.new(token: request.headers['X-Auth-Token']).decode_token
end
def set_web_widget
@web_widget = ::Channel::WebWidget.find_by!(website_token: permitted_params[:website_token])
@current_account = @web_widget.acc... | 26.68 | 106 | 0.745127 |
1cc401f192ac38298af2c23880ae33c7ce948aea | 446 | class UsersController < ApplicationController
def index
end
def show
end
def new
end
def edit
end
def create
@user = User.new(user_params)
if @user.save
redirect_to root_path, :notice => "Signed up!"
else
redirect_to root_path
end
end
def update
end
def destr... | 12.054054 | 75 | 0.661435 |
bf0dfb13013a8927433c223f4dac36143a1c5158 | 519 | # a simple object that represents a failed constraint. acts as SwitchGroup.
class FailedSolutionSwitchGroup
attr_accessor :failed_solutions
def initialize(failed_solution_dimacs_strings)
@failed_solutions = failed_solution_dimacs_strings
end
def dimacs
@failed_solutions.map { |str| inverse_of(str) }.j... | 19.961538 | 75 | 0.695568 |
e9fac0ac8ffedd6fb5a90da41c0cc6807ade6222 | 807 | # frozen_string_literal: true
describe Lead, type: :model do
describe 'validations' do
let!(:user) { create :user }
it { should validate_presence_of :name }
it { should validate_presence_of :phone }
it { should validate_presence_of :comments }
it { should validate_length_of(:phone).is_equal_to 1... | 26.9 | 64 | 0.66171 |
e8cdb019cdb1a777258b5f15c09e162307a05833 | 1,727 | module Neo4j
module Embedded
class EmbeddedRelationship
class << self
Java::OrgNeo4jKernelImplCore::RelationshipProxy.class_eval do
include Neo4j::Embedded::Property
include Neo4j::EntityEquality
include Neo4j::Relationship::Wrapper
include Neo4j::Core::Active... | 23.337838 | 69 | 0.556456 |
1a38b91cb8cc8943a9f3e7cbe7445e361c3aab32 | 336 | class PrivateGalleriesController < ApplicationController
respond_to :html
def show
@photographer = Photographer.first
@private_gallery = PrivateGallery.find_by_token(params[:id])
if @private_gallery
render
else
redirect_to(root_path, :alert => "Unable to find that private gallery.")
... | 22.4 | 78 | 0.723214 |
f749f49e76119e990d37c17119ff48caf547b182 | 700 |
Pod::Spec.new do |s|
s.name = 'YCLogger'
s.version = '0.1.0'
s.summary = 'A short description of YCLogger.'
s.description = <<-DESC
TODO: Add long description of the pod here.
DESC
s.homepage = 'https://github.com/沈伟航/YCLogger'
s.license ... | 29.166667 | 96 | 0.555714 |
d5f1e35a79bcaa0a0ecf2f85e2dc5acc007a77f6 | 15,028 | # frozen_string_literal: true
require 'gon'
require 'fogbugz'
class ApplicationController < ActionController::Base
include Gitlab::GonHelper
include GitlabRoutingHelper
include PageLayoutHelper
include SafeParamsHelper
include WorkhorseHelper
include EnforcesTwoFactorAuthentication
include WithPerforman... | 29.524558 | 176 | 0.725645 |
6acc1c43d01b70b8b07958a4d6777342b1cc4c78 | 179 | # frozen_string_literal: true
# unconditionally rewrite a generic form
require "yast"
# Yast namespace
module Yast
def foo
@var = Ops.get(object, index, default)
end
end
| 16.272727 | 42 | 0.73743 |
ff517eb4d10e44a02cfb60637cc1c03564688e20 | 564 | require 'test/unit'
Dir["#{File.dirname(__FILE__)}/../lib/bossman.rb"].each { |file| require file }
class TestZeroCount < Test::Unit::TestCase
include BOSSMan
def test_zero_count
BOSSMan.application_id = 'xXySTCfV34HiWg67Cwwym2mvf4tUfLJS3B73thD5ws_xFbLYh6uVvNJmBZDDCoByFRIY'
begin
BOSSMan::Search... | 29.684211 | 102 | 0.712766 |
33bc896b7efd9859baac7346ca9e96e90b842a93 | 2,304 | # frozen_string_literal: true
require('test_helper')
module Bootsnap
class SetupTest < Minitest::Test
def setup
@_old_env = ENV.to_h
@tmp_dir = Dir.mktmpdir('bootsnap-test')
ENV['BOOTSNAP_CACHE_DIR'] = @tmp_dir
end
def teardown
ENV.replace(@_old_env)
end
def test_default... | 24.774194 | 64 | 0.668403 |
91eb2b4210695f3d5735edb41f756ef03ffae942 | 4,694 | # frozen_string_literal: true
require 'support/helpers/is_expected_block'
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will ... | 48.391753 | 96 | 0.716447 |
035aaa9c9fd70f16a7e96f72d4d9aeacaf25fcc1 | 3,327 | #-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
#
# 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 of ... | 33.606061 | 115 | 0.590622 |
bf1ff4a85bcb471e2210cfb91e35765a7c6c4fd8 | 152 | class Subscription < ActiveRecord::Base
belongs_to :playlist
belongs_to :arcade_machine
validates :playlist, :arcade_machine, presence: true
end
| 21.714286 | 54 | 0.796053 |
ff8f0b8c97ee0e8942cfa1f60c749153da2635af | 806 | require 'pathname'
$:.unshift(Pathname.new(__FILE__).dirname.parent.parent)
$:.unshift(Pathname.new(__FILE__).dirname.parent.parent.parent.parent + 'easy_type' + 'lib')
require 'easy_type'
require 'ora_utils/oracle_access'
require 'ora_utils/title_parser'
module Puppet
#
# Create a new type oracle_user. Oracle us... | 20.666667 | 92 | 0.708437 |
bbd47a89fa232420e10650ce5e1f6d76d14bd53a | 550 | module Eligible
class Payer < APIResource
def self.list(params, api_key = nil)
send_request(:get, api_url('payers'), api_key, params)
end
def self.get(params, api_key = nil)
send_request(:get, api_url('payers', params, :payer_id), api_key, params, :payer_id)
end
def self.search_optio... | 30.555556 | 91 | 0.669091 |
1843b023a565ba23dec79362b57c6192feb8a3b8 | 1,006 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'bills/version'
Gem::Specification.new do |spec|
spec.name = "bills"
spec.version = Bills::VERSION
spec.authors = ["Miguel Palhas"]
spec.email = ["mpalhas@gmai... | 33.533333 | 74 | 0.643141 |
acf74ac871ae53a00733bc5e181401c856974f64 | 894 | require "petitest/subscribers/base_subscriber"
require "petitest/subscriber_concerns/output_concern"
require "petitest/subscriber_concerns/time_concern"
module Petitest
module Subscribers
class ProgressReportSubscriber < ::Petitest::Subscribers::BaseSubscriber
include ::Petitest::SubscriberConcerns::Output... | 28.83871 | 80 | 0.692394 |
261bf265a6d898576a7c721844ecccf625067e4f | 4,157 | require "logstash/util/retryable"
describe LogStash::Retryable do
class C
include LogStash::Retryable
end
class E < StandardError; end;
class F < StandardError; end;
subject {C.new}
context "with default fixed 1 second retry sleep" do
it "should execute once" do
expect(subject).to receive... | 29.692857 | 107 | 0.619437 |
38ffca8c5ae53f4bdc97555cad1198271e7dfd06 | 7,505 | # frozen_string_literal: true
module GoogleApi
module CloudPlatformHelpers
def stub_google_api_validate_token
request.session[GoogleApi::CloudPlatform::Client.session_key_for_token] = 'token'
request.session[GoogleApi::CloudPlatform::Client.session_key_for_expires_at] = 1.hour.since.to_i.to_s
end... | 44.94012 | 165 | 0.692605 |
1d967f06df7e2f700f0e3a13acf4e5e6ca0cb598 | 7,988 | # encoding: UTF-8
#
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
require_relative 'scheduled_mail/dashboard_attachment'
require_relative 'scheduled_mail/report_attac... | 28.630824 | 121 | 0.608413 |
01dfb5aa0dbfe70612574ae4d15a6bf2ef009062 | 48,660 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe GeoNodeStatus, :geo do
include ::EE::GeoHelpers
using RSpec::Parameterized::TableSyntax
let!(:primary) { create(:geo_node, :primary) }
let!(:secondary) { create(:geo_node, :secondary) }
let_it_be(:group) { create(:group) }
let_it_be(... | 34.781987 | 166 | 0.704254 |
1d85f2714c2f26bc78e3c69c3dee17801a29be90 | 497 |
# Rudimentary screen info
# TODO: use more portable info source, color caps, etc
class Console
class Screen
def initialize
end
def width
get_info
@width
end
def height
get_info
@height
end
def get_info
return if @info_loaded
@... | 15.060606 | 60 | 0.559356 |
ff00e0d38b713654cb90214de257521511bf2fa1 | 174 | class RemoveBonusAddSelfmadeToItems < ActiveRecord::Migration[5.0]
def change
remove_column :items, :bonus, :boolean
add_column :items, :selfmade, :boolean
end
end
| 24.857143 | 66 | 0.758621 |
5dc1db3c34b050a9090d7b75a06b16c8b79da2fa | 828 | # == Schema Information
#
# Table name: donations
#
# id :integer not null, primary key
# name :string(255)
# email :string(255)
# comment :text
# amount_cents :integer
# stripe_token :string(255)
# stripe_charge_id :string(255)
# created_at :... | 25.875 | 60 | 0.629227 |
ac307a9e9293bc85fcd594dd080e8b46877b8fc7 | 324 | # Since we no longer explicitly require the 'jasmine' gem, we lost the
# `jasmine:ci` task used by GitLab CI jobs.
#
# This provides a simple alias to run the `spec:javascript` task from the
# 'jasmine-rails' gem.
task jasmine: ['jasmine:ci']
namespace :jasmine do
task :ci do
Rake::Task['teaspoon'].invoke
end
... | 24.923077 | 73 | 0.712963 |
38d05b7382b130008d77004ebeb10f9c12e09d4d | 237 | # frozen_string_literal: true
namespace :event_log do
desc "create a event log model and migration"
task :create, [:file_name] => :environment do |_task, args|
puts EventLogProcessor.new(args[:file_name]).create_table
end
end
| 26.333333 | 61 | 0.746835 |
9130db30ab0949b5ca617f19ffec5ba2c7d3c941 | 642 | #!/usr/bin/env ruby
# frozen_string_literal: true
require_relative '../lib/aws_utils'
include AwsCommon
a = AwsUtils.new(cached?('volumes', true))
regions = ARGV[0] && ARGV[0] != 'all' ? ARGV : a.region_names
regions.each do |region|
reg_vols = a.vols_by_region(region).select { |v| v.encrypted == false }
next if... | 29.181818 | 118 | 0.727414 |
87e41665ebc737ed02a8ffbe3ef14bf7afd22c74 | 428 | module StripeMock
module RequestHandlers
module Checkout
module Session
def Session.included(klass)
klass.add_handler 'get /v1/checkout/sessions/(.*)', :get_checkout_session
end
def get_checkout_session(route, method_url, params, headers)
route =~ method_url
... | 25.176471 | 83 | 0.651869 |
2648ca4a872b4933e1f67e5f0d67f8a3b63369cb | 169 | class Tag < ActiveRecord::Base
has_many :taggings, :dependent => :delete_all
has_many :tags, :through => :taggings
has_many :users, :through => :taggings
end | 28.166667 | 48 | 0.692308 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.