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 |
|---|---|---|---|---|---|
8729cbf3e28bf5bfe06953e9d0e32d8d0b1db7c9 | 2,289 | require 'spec_helper'
require 'ionoscloud_request_wait'
Chef::Knife::IonoscloudRequestWait.load_deps
describe Chef::Knife::IonoscloudRequestWait do
subject { Chef::Knife::IonoscloudRequestWait.new }
describe '#run' do
it 'should call api_client.wait_for' do
request_status = request_status_mock
su... | 30.52 | 104 | 0.663609 |
015d22c00560db10355fa2ea5ff7908695e73901 | 1,992 | class Solr < Formula
desc "Enterprise search platform from the Apache Lucene project"
homepage "https://lucene.apache.org/solr/"
url "https://www.apache.org/dyn/closer.cgi?path=lucene/solr/6.4.1/solr-6.4.1.tgz"
mirror "https://archive.apache.org/dist/lucene/solr/6.4.1/solr-6.4.1.tgz"
sha256 "ebce206dd4a666003... | 31.125 | 117 | 0.608434 |
bbd16f215e02397bb8824d6bd66963564cc76fcd | 2,391 | #
# These are theme helper tags
#
module ActionView::Helpers::AssetTagHelper
# returns the public path to a theme stylesheet
def theme_stylesheet_path( source=nil, theme=nil )
theme = theme || controller.current_theme
compute_public_path(source || "theme", "themes/#{theme}/stylesheets", 'css')
end... | 36.227273 | 123 | 0.650355 |
61d869512a3a0cc6decd83552db05f32f5f575f2 | 280 | # Don't forget! This file needs to be 'required' in its spec file
# See README.md for instructions on how to do this
def fizzbuzz(number)
if (number % 3 == 0) && (number % 5 == 0)
"FizzBuzz"
elsif number % 5 == 0
"Buzz"
elsif (number % 3 == 0)
"Fizz"
end
end
| 21.538462 | 65 | 0.607143 |
39a184be6476e216cc1942447ef291b264f7d380 | 951 | module BenefitSponsors
module Serializers
class OrganizationSerializer < ActiveModel::Serializer
attributes :legal_name, :dba, :entity_kind, :entity_kind_options
attribute :fein, if: :is_non_exempt_benefit_sponsor?
attribute :entity_kind_options
def is_non_exempt_benefit_sponsor?
... | 24.384615 | 78 | 0.68244 |
1d9e1c3e54614e5575112984094e3048f3ad1a0e | 888 | #
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'ali_auth'
s.version = '0.1.3'
s.summary = 'A new flutter plugin project.'
s.description = <<-DESC
是一个集成阿里云号码认证服务SDK的flutter插件
DESC
... | 30.62069 | 106 | 0.579955 |
ab0f8ffc023b5a1e2288e99e5f2e24eb96f20069 | 7,864 | require 'sinatra'
require 'vwo'
require 'haml'
require "json"
require 'time'
require 'erb'
require_relative 'user_storage'
require_relative 'constants'
config = JSON.load(File.open(File.join(File.dirname(__FILE__), 'config/vwo.json')))
USERS = %w(Ashley Bill Chris Dominic Emma Faizan Gimmy Harry Ian John King Lisa Mon... | 40.328205 | 160 | 0.773398 |
1df90154852255ed31a8d0a577e54bd706c22507 | 1,434 | # Set up gems listed in the Gemfile.
# See: http://gembundler.com/bundler_setup.html
# http://stackoverflow.com/questions/7243486/why-do-you-need-require-bundler-setup
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
# Require ge... | 28.68 | 89 | 0.725244 |
87c13645f9c7f777aa82c338fb3801daea955363 | 477 | Rails.application.routes.draw do
next if GDS::SSO::Config.api_only
get "/auth/gds/callback", to: "authentications#callback", as: :gds_sign_in
get "/auth/gds/sign_out", to: "authentications#sign_out", as: :gds_sign_out
get "/auth/failure", to: "authentications#fail... | 47.7 | 91 | 0.631027 |
1c5904d3abd58ccf8726ba2463d7447f146bd77e | 1,802 | class Zebra < Formula
desc "Information management system"
homepage "https://www.indexdata.com/resources/software/zebra/"
url "https://ftp.indexdata.com/pub/zebra/idzebra-2.2.3.tar.gz"
sha256 "85ade449d161d97df47d4a8910a53a5ea3bd5e3598b6189d86fc8986a8effea4"
license "GPL-2.0-or-later"
revision 1
livechec... | 35.333333 | 93 | 0.640954 |
1cef6706e1b77246cc9b3c58cba5d28736b630ff | 4,112 | describe TestResult do
it { is_expected.to belong_to(:test_group_result) }
it { is_expected.to validate_presence_of(:name) }
it { is_expected.to validate_presence_of(:status) }
it { is_expected.to validate_presence_of(:marks_earned) }
it { is_expected.to validate_presence_of(:marks_total) }
it { is_expecte... | 28.957746 | 92 | 0.626946 |
e2d1ef603dfef8762a4a4b89c9aab8efbdd1a68f | 93 | Spree::ContentController.class_eval do
def bank_transfer
render layout: false
end
end | 18.6 | 38 | 0.784946 |
5df8eced830e2aaa8cfc0fd84954bf41ccf61101 | 459 | cask 'qtpass' do
version '1.3.2'
sha256 '04a091602bfd8da1b19e95fcf9cd48df6a544a44a4a1e97cccfb950df90512ef'
# github.com/IJHack/qtpass was verified as official when first introduced to the cask
url "https://github.com/IJHack/qtpass/releases/download/v#{version}/qtpass-#{version}.dmg"
appcast 'https://github.c... | 30.6 | 92 | 0.749455 |
bbf604838bbdd948ab66ccf31cd25ad0ea881545 | 4,005 | #
# Description: This method sends an e-mail when the following event is raised:
#
# Events: vm_provisioned
#
# Model Notes:
# 1. to_email_address - used to specify an email address in the case where the
# vm's owner does not have an email address. To specify more than one email
# address separate email address ... | 42.157895 | 224 | 0.691136 |
28d7246bfcd883ff6c62c44554cf697af2d59e4d | 7,923 | require 'test_helper'
require 'net/http'
class RemoteMigsTest < Test::Unit::TestCase
include ActiveMerchant::NetworkConnectionRetries
include ActiveMerchant::PostsData
def setup
@gateway = MigsGateway.new(fixtures(:migs))
@amount = 100
@declined_amount = 105
@visa = credit_card('4987654321098... | 35.370536 | 118 | 0.726997 |
288ecf4a489fb6fc547b737c9fcb0d7d2b114443 | 967 | =begin
#API v1
#FormAPI is a service that helps you fill out and sign PDF templates.
OpenAPI spec version: v1
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 3.3.0-SNAPSHOT
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for FormAPI::RenameFolderData
# Automatically g... | 23.02381 | 102 | 0.7394 |
f7bee5a67a6a6da68ddbe67bd2143e292d13a9e2 | 1,156 | class Admin::DashboardController < Admin::BaseController
def index
@recent_activity = []
Refinery::Plugins.active.each do |plugin|
begin
plugin.activity.each do |activity|
@recent_activity += activity.class.find(:all,
:conditions => activity.conditions,
:order... | 29.641026 | 90 | 0.631488 |
ac95e1e6c253af671ce11062b55fc5aa19f21477 | 1,119 | class Sha2 < Formula
desc "Implementation of SHA-256, SHA-384, and SHA-512 hash algorithms"
homepage "http://aarongifford.com/computers/sha.html"
url "https://aarongifford.com/computers/sha2-1.0.1.tgz"
sha256 "67bc662955c6ca2fa6a0ce372c4794ec3d0cd2c1e50b124e7a75af7e23dd1d0c"
bottle do
cellar :any_skip_re... | 36.096774 | 92 | 0.757819 |
28518deb141e5ade3433eb8c5f30e305d6e12c1e | 2,620 | # frozen_string_literal: true
require "action_cable"
require "motion"
module Motion
class Channel < ActionCable::Channel::Base
include ActionCableExtentions::DeclarativeNotifications
include ActionCableExtentions::DeclarativeStreams
include ActionCableExtentions::LogSuppression
ACTION_METHODS = Se... | 27.010309 | 78 | 0.720229 |
01e806b88b7925b500ec12123e9c68b64a764370 | 415 | require 'rexml/document'
require_relative 'evidence_handler'
module BEL::Translator::Plugins
module Xbel
class EvidenceYielder
def initialize(io)
@io = io
end
def each(&block)
if block_given?
handler = EvidenceHandler.new(block)
REXML::Document.parse_stre... | 16.6 | 52 | 0.6 |
33c9560307c48e584cb74b15535529606b6c954f | 234 | # frozen_string_literal: true
class Completion < ApplicationRecord
belongs_to :user
belongs_to :course
has_many :certificates, dependent: :destroy
def sorted_certificates
certificates.sort_by(&:classification)
end
end
| 19.5 | 45 | 0.786325 |
1c16ad11cc094bf099aa146038bebb588f2efc4a | 42 |
RSpec.describe Yaks::Format::Halo do
end
| 10.5 | 36 | 0.761905 |
d583c6f476ffc49c7550a010419ccd4ac3f82d8e | 15,923 | require 'minitest/autorun'
require 'rack/test'
require 'mocha/setup'
require 'rack/cors'
require 'ostruct'
Rack::Test::Session.class_eval do
unless defined? :options
def options(uri, params = {}, env = {}, &block)
env = env_for(uri, env.merge(:method => "OPTIONS", :params => params))
process_request(... | 32.102823 | 129 | 0.658544 |
1dd3d98fb4a8fdd3117229a2ec9bf913d0ad0aae | 1,172 | #!/usr/bin/env ruby
require 's3'
require 'erb'
require 'ostruct'
service = S3::Service.new(:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'])
S3_BUCKET = 'lattice'
objs_by_day = {}
service.buckets.find(S3_BUCKET).objects.each do |obj|
next if !obj.key.start_with... | 32.555556 | 110 | 0.726109 |
8769c8df57300432f208a324e88d0a0f27e03024 | 4,673 | cask 'java' do
version '1.8.0_102-b14'
sha256 '9f53b71af203502da4ff416b5ab1a217a655006786bcbb8f8d8ad501debda748'
url "http://download.oracle.com/otn-pub/java/jdk/#{version.sub(%r{^\d+\.(\d+).*?_(.*)$}, '\1u\2')}/jdk-#{version.sub(%r{^\d+\.(\d+).*?_(\d+)-.*$}, '\1u\2')}-macosx-x64.dmg",
cookies: {
... | 55.630952 | 261 | 0.559384 |
012c132d7c04946f48c1990593d6a464e042ce44 | 1,858 | require 'rails_helper'
RSpec.describe SignUpInteraction do
subject do
SignUpInteraction.new(
scheme: scheme,
bcrypt: bcrypt,
repository: repository
)
end
let(:params) { attributes_for(:user) }
let(:scheme_result) { double('scheme_result', success?: true) }
let(:scheme) { -> (_) { s... | 25.452055 | 74 | 0.659311 |
f7b943792cf74d4f8c0c8f55d54d47f62cbbda19 | 5,086 | =begin
#Clever API
#The Clever API
OpenAPI spec version: 2.1.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.18
=end
require 'date'
module Clever
class CourseResponse
attr_accessor :data
# Attribute mapping from ruby-style variable name to JSON key.
d... | 27.491892 | 107 | 0.611286 |
1cb3c93b411c55af53c893349b5c26c956184c6b | 321 | require 'test/unit'
require 'syck'
module Blank
end
class SyckAdditionsToYamlTest < Test::Unit::TestCase
def test_syck_additions_to_yaml
assert_equal [], (Blank.methods - YAML.methods)
assert_equal ["DomainType", "Object", "PrivateType", "Syck"], YAML.constants.collect {|const| const.to_s }.sort
end
en... | 24.692308 | 115 | 0.735202 |
337ed0bc503b784b89392afc287d705305fbadc4 | 2,036 | module Hermes
class EventProducer
extend Forwardable
attr_reader :publisher, :serializer, :distributed_trace_repository, :producer_error_handler, :config
private :publisher, :serializer, :distributed_trace_repository, :producer_error_handler, :config
def self.publish(event, properties = {}, opti... | 31.8125 | 108 | 0.699411 |
ffd8b32da502453e016105487711d23bdcc7a75a | 581 | # frozen_string_literal: true
module Navigation
# Reads an FSBuild Radio Navigation Aids File and stores the data.
class RadioNavigationAidIO
include NavigationDataIO
NAVTYPE = /VOR|NDB/
FIELDS = [
[:name, /^[0-9A-Z]{1,3}/],
[:fullname, /[_A-Z]+/],
[:latitude, LONGLAT],
[:longi... | 23.24 | 68 | 0.614458 |
87e780138036af239396b2d21c3b2f8d7315ca8e | 1,676 | require 'test_helper'
class MemberTest < ActiveSupport::TestCase
test 'not valid without email' do
user = FactoryGirl.build(:member, email: nil)
refute user.valid?, 'Allows save without an email'
end
test 'not valid without firstname' do
user = FactoryGirl.build(:member, firstname: nil, email: 'test... | 38.090909 | 116 | 0.720167 |
abd79b329ae06e54a22ed5ecd5cdf6e8076da288 | 2,491 | require 'html/pipeline/filter'
require 'html/pipeline/sanitization_filter'
module Banzai
module Filter
# Sanitize HTML
#
# Extends HTML::Pipeline::SanitizationFilter with a custom whitelist.
class SanitizationFilter < HTML::Pipeline::SanitizationFilter
UNSAFE_PROTOCOLS = %w(javascript :javascri... | 25.418367 | 73 | 0.600963 |
b987c7419ac6c92637a00679f6c4394aaedc8a0f | 3,264 | # encoding: utf-8
# Monkeypatch for JRUBY-6970
module Kernel
alias_method :require_JRUBY_6970_hack, :require
def require(path)
old_load_path = nil
if path =~ /^jar:file:.+!.+/
path = path.gsub(/^jar:/, "")
puts "JRUBY-6970: require(#{path})" if ENV["REQUIRE_DEBUG"] == "1"
end
# Work a... | 31.68932 | 79 | 0.620711 |
799011aebf6b35ae2682de8450cfda39c76df649 | 435 | def schedule(time='1h', first_in=10)
SCHEDULER.every time, :first_in => first_in+rand(30) do
yield
end
end
def send_metric_with_targets event, data, options = {}
if data == 0 || data.nil?
data = {
'actual' => 0,
'annual_target' => 0,
'ytd_target' => 0
}
end
send_event event, ... | 25.588235 | 131 | 0.636782 |
21077130445d4fc4850ff9f3e22ea54ee5e84354 | 290 | Given /^the input "([^"]*)"$/ do |input|
@input = input
end
When /^the calculator is run$/ do
@output = `ruby calc.rb #{@input}`
raise('Command failed') unless $?.success?
end
Then /^the output should be "([^"]*)"$/ do |expected_output|
expect(@output).to eq(expected_output)
end
| 22.307692 | 60 | 0.634483 |
1d34b8b07f9713b81cce40e520b2be4afd4ecb9c | 45 | module Kredentials
VERSION = "0.1.0.0"
end
| 11.25 | 21 | 0.688889 |
38b64337502968226ef97e7508db5f752e7afafd | 377 | cask "sizzy" do
version "0.33.0"
sha256 "487c1ccc30213f343d7c3d94a797322764b024ad4edc7875c88b5dd330285e35"
url "https://sizzy.co/get-app"
appcast "https://www.macupdater.net/cgi-bin/check_urls/check_url_redirect.cgi?url=https://sizzy.co/get-app&user_agent=Intel%20Mac%20OS%20X"
name "Sizzy"
homepage "https:... | 26.928571 | 141 | 0.755968 |
1c4e8321fd16043dab00502166f485f43c944db7 | 887 | #!/usr/bin/env rspec
require 'spec_helper'
require 'puppet/application/facts'
describe Puppet::Application::Facts do
before :each do
subject.command_line.stubs(:subcommand_name).returns 'facts'
end
it "should fail if no key is given to find" do
subject.command_line.stubs(:args).returns %w{find}
expe... | 30.586207 | 83 | 0.711387 |
915ad6959bed8639fe44518ad4a4d4eada6c58a7 | 5,156 | # Store object full path in separate table for easy lookup and uniq validation
# Object must have name and path db fields and respond to parent and parent_changed? methods.
module Routable
extend ActiveSupport::Concern
included do
has_one :route, as: :source, autosave: true, dependent: :destroy # rubocop:disab... | 28.021739 | 123 | 0.675524 |
ff88fd834b57256e87186c4204e02a9258fded9d | 22,617 | # 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.
#
# This file is the source Rails uses to define your schema when running `rails
#... | 40.898734 | 129 | 0.703453 |
186da3c108f01e0caf985e666f11bbd646fc6d86 | 1,374 | require "rails_helper"
RSpec.describe RailsNotFounder::RequestLogger do
describe ".call" do
subject { described_class }
it { should forward_to_instance(:call).with_2_args }
end
describe "#call" do
let(:service) { described_class.new(params, request) }
let(:params) do
ActionController::Pa... | 23.288136 | 76 | 0.544396 |
ab18a59f621aed84440ca8023af5ff7e11cb3efc | 402 | require './config/environment'
class ApplicationController < Sinatra::Base
configure do
set :public_folder, 'public'
set :views, 'app/views'
enable :sessions
set :session_secret, "secret"
end
get '/' do
erb :welcome
end
helpers do
def current_user
User.find_by(id: session[:... | 15.461538 | 43 | 0.639303 |
0854d0a693a9f3fedac16dad8fed532940beb84f | 70 | module ActiveAdmin
module Globalize
VERSION = '1.1.0'
end
end
| 11.666667 | 21 | 0.685714 |
0355d4d08a7fe589afc50e66e34d58d848648fa4 | 10,613 | module ThinkingSphinx
class Index
# The Builder class is the core for the index definition block processing.
# There are four methods you really need to pay attention to:
# - indexes
# - has
# - where
# - set_property/set_properties
#
# The first two of these methods allow you to defin... | 36.850694 | 81 | 0.611514 |
61446b23e47cbf24dee6202768259f4938d25107 | 2,239 | #-- 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 ... | 32.926471 | 91 | 0.734256 |
331350c80e0023553cfc2fd10854c6fcdf356a98 | 5,497 | =begin
#Kubernetes
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.2.3
=end
require 'date'
module Kubernetes
# Initializer is informati... | 28.189744 | 107 | 0.621066 |
38f1bf357c54944a4b4c8f6264fa2fd186c7a42e | 10,087 | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
describe RuboCop::Cop::Lint::UnusedMethodArgument, :config do
subject(:cop) { described_class.new(config) }
let(:cop_config) do
{ 'AllowUnusedKeywordArguments' => false, 'IgnoreEmptyMethods' => false }
end
describe 'inspection' do
... | 26.132124 | 80 | 0.559036 |
ff0d190e25d70c2e09a0b74ab3ce0bc6516258ac | 2,185 | require File.join(File.dirname(__FILE__), 'helper')
Geokit::Geocoders::UsGeocoder.key = nil
class UsGeocoderTest < BaseGeocoderTest #:nodoc: all
GEOCODER_US_FULL='37.792528,-122.393981,100 Spear St,San Francisco,CA,94105'
def setup
super
@us_full_hash = {:city=>"San Francisco", :state=>"CA"}
@us_ful... | 38.333333 | 116 | 0.746453 |
01f69a296b333c6881bf044600f712d8edd87311 | 480 | require 'rails_helper'
RSpec.describe JwtUser, type: :jwt do
let(:token_payload) do
# call JWTF the way Doorkeeper does
token = JWTF.generate(resource_owner_id: user_id)
token_payload = extract_payload_from(token)
token_payload
end
subject { described_class.new(token_payload) }
context 'when t... | 22.857143 | 53 | 0.689583 |
2176192ededcaaf5c355fa02b57d487a10a407e4 | 6,177 | # -*- ruby -*-
# frozen_string_literal: true
require 'pg' unless defined?( PG )
# Simple set of rules for type casting common Ruby types to PostgreSQL.
#
# OIDs of supported type casts are not hard-coded in the sources, but are retrieved from the
# PostgreSQL's pg_type table in PG::BasicTypeMapForQueries.new .
#
# Qu... | 31.840206 | 126 | 0.699045 |
1c750eeed20979ecb57f843dea4b89fec4198829 | 707 | # frozen_string_literal: true
# @api private
# @since 0.5.0
class Qonfig::Loaders::JSON < Qonfig::Loaders::Basic
class << self
# @param data [String]
# @return [Object]
#
# @raise [Qonfig::JSONLoaderParseError]
#
# @api private
# @since 0.5.0
# @version 0.26.0
def load(data)
... | 22.09375 | 78 | 0.612447 |
330d27d129eb77d4388ed91db04325c854d56d02 | 6,214 | # dependencies
require "active_support"
require "forwardable"
# methods
require "pghero/methods/basic"
require "pghero/methods/connections"
require "pghero/methods/explain"
require "pghero/methods/indexes"
require "pghero/methods/kill"
require "pghero/methods/maintenance"
require "pghero/methods/queries"
require "pghe... | 33.229947 | 193 | 0.690055 |
6ad13b431a49d8aaaefba8cf2dcd12a179155340 | 663 | # This code was automatically generated using xdrgen
# DO NOT EDIT or your changes may be overwritten
require 'xdr'
# === xdr source ============================================================
#
# enum ThresholdIndexes
# {
# THRESHOLD_MASTER_WEIGHT = 0,
# THRESHOLD_LOW = 1,
# THRESHOLD_MED = 2,... | 24.555556 | 77 | 0.497738 |
f8bffadd929999ead3712fda7249ce18140fedd3 | 267 | # noinspection RubyResolve,RubyResolve
require_relative '../test_helper'
require 'logging'
Logging.logger.root.appenders = Logging.appenders.stdout
require_solution 'TST'
class ClientTest < Minitest::Test
def test_one
assert_equal 1, One.new.apply
end
end
| 19.071429 | 56 | 0.786517 |
bf228d1bbcddf813056ef3f3a2b6e4a799956171 | 6,922 | =begin
#Ory Kratos API
#Documentation for all public and administrative Ory Kratos APIs. Public and administrative APIs are exposed on different ports. Public APIs can face the public internet without any protection while administrative APIs should never be exposed without prior authorization. To protect the administa... | 31.607306 | 429 | 0.642589 |
62839c46378f3076d0b1bc5f8b71b1d5eb8d94bb | 11,985 | module ActiveRecord
module Associations
class HasManyThroughAssociation < AssociationProxy #:nodoc:
def initialize(owner, reflection)
super
reflection.check_validity!
@finder_sql = construct_conditions
construct_sql
end
def find(*args)
options = args.extr... | 43.740876 | 281 | 0.631039 |
28d291e4806ac6187c5548c4eefffec94c892893 | 607 | cask "ipa-manager" do
version "2.3.2"
sha256 "d48a1dcfbe3b3c1c17fc35353f84ff381791da0839f1ece1b991499276c5ef5f"
url "https://www.blugs.com/Downloads/IPAPalette_#{version}.dmg"
appcast "https://www.blugs.com/Appcasts/IPAPalette.xml"
name "IPA Palette"
homepage "https://www.blugs.com/IPA/"
auto_updates tr... | 30.35 | 133 | 0.751236 |
abde24bf4cc71cef9e18b7ac3e8961e8d2f95a6c | 3,314 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::HttpClient
include Msf::Auxiliary::Report
def initialize(info = {})
super(update_info(info,
'N... | 36.417582 | 127 | 0.633374 |
621520de2654072d2596dc19070968fa21bb5aef | 453 | class CreateProfiles < ActiveRecord::Migration[4.2]
def change
create_table :profiles do |t|
t.references :user, null: false, index: { unique: true }
t.string :name, null: false, limit: 128
t.string :nickname, null: false, limit: 64
t.string :university, null: false, limit: 64
t.stri... | 30.2 | 62 | 0.646799 |
f715385dfb05938f34143398882bc6fa7103e5c1 | 873 | Pod::Spec.new do |spec|
spec.name = "AWMOSS"
spec.version = "0.0.1"
spec.summary = "A Lib For 阿里对象服务器."
spec.description = <<-DESC
AWMOSS一个是阿里封装
DESC
spec.homepage = "https://github.com/StoneStoneStoneWang/AWMKit.git"
spec.license = { :type => "MIT", :file => "LICENSE.m... | 27.28125 | 106 | 0.626575 |
03a54b1bf643699f208309ac5b9f9c4921ba3657 | 395 | # 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::Batch::Mgmt::V2019_08_01
module Models
#
# Defines values for InterNodeCommunicationState
#
module InterNodeCommunicationSta... | 23.235294 | 70 | 0.716456 |
33710406d82b149c2396ebbf0533f1663d41bbad | 250 | class WelcomeController < ApplicationController
layout "welcome"
def index
@sale_totals = Sale.all.count
@produt_totals = Product.all.count
@customer_totals = Customer.all.count
@reserve_totals = Reservation.all.count
end
end
| 20.833333 | 47 | 0.74 |
1899cd229fb23f2aa5cdee91852d8eec72644f97 | 746 | module Brightbox
desc I18n.t("groups.desc")
command [:groups] do |cmd|
cmd.desc I18n.t("groups.add_servers.desc")
cmd.arg_name "grp-id [srv-id...]"
cmd.command [:add_servers] do |c|
c.action do |global_options, _options, args|
grp_id = args.shift
raise "You must specify the serve... | 27.62963 | 129 | 0.617962 |
e9a67d4460c519d2714f6293e444f68e9f280f41 | 8,157 | # frozen_string_literal: true
RSpec.describe RuboCop::Cop::VariableForce::Scope do
include RuboCop::AST::Sexp
subject(:scope) { described_class.new(scope_node) }
let(:ast) do
RuboCop::ProcessedSource.new(source, ruby_version).ast
end
let(:scope_node) { ast.each_node(scope_node_type).first }
describ... | 22.226158 | 80 | 0.562829 |
393b2d7d5df1e963f391cad9db56be0c9f22f322 | 435 | Rails.application.routes.draw do
resources :opinions, only:[:create, :destroy, :show]
devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }
root 'users#index'
resources :users, only: [:show]
resources :followings, only: [:create, :destroy]
resources :comments, only: [:create, :s... | 39.545455 | 102 | 0.733333 |
2813524d517348a97443ec4cbb2c5c55dfb57380 | 1,933 | require 'nokogiri'
class CASRequest
def initialize(request)
@request = request
end
def ticket
@ticket ||= if single_sign_out?
sso_ticket
elsif ticket_validation?
ticket_param
end
end
def service_url
RackCAS::URL.parse(@request.url).remove_param('ticket').to_s
end
def lo... | 23.289157 | 116 | 0.6627 |
08965ffe3a4245c5a5f6b33f55df313508a49ab5 | 5,902 | class OAuth::CLI
class BaseCommand
def initialize(stdout, stdin, stderr, arguments)
@stdout, @stdin, @stderr = stdout, stdin, stderr
@options = {}
option_parser.parse!(arguments)
end
def run
missing = required_options - options.keys
if missing.empty?
_run
else... | 28.239234 | 116 | 0.584378 |
21706fab36f1c32a03b45140d420a561263e0d63 | 981 | module Admin
module EnrollmentExemptions
class RejectForm < BaseChangeStateForm
def params_key
:admin_enrollment_exemptions_reject
end
def self.locale_key
"admin.enrollment_exemptions.reject.new"
end
property :comment, virtual: true
validates(
:commen... | 22.813953 | 73 | 0.654434 |
5db37aa0b6697531a58508d252546938752d198d | 8,388 | # encoding: UTF-8
# frozen_string_literal: true
module API
module V2
module Admin
class Deposits < Grape::API
helpers ::API::V2::Admin::Helpers
desc 'Get all deposits, result is paginated.',
is_array: true,
success: API::V2::Admin::Entities::Deposit
params do
... | 44.380952 | 132 | 0.548879 |
08100f6d2bcaadb4b3262d571f521e0221e889df | 362 | require 'jruby_activiti'
require 'minitest/autorun'
require 'minitest/unit'
require 'minitest/pride'
Activiti = JrubyActiviti.build_engine do |engine|
engine.config_path = "config/activiti.cfg.xml"
end
def assert_difference(cmd, target_count)
count1 = eval(cmd)
yield if block_given?
count2 = eval(cmd)
ass... | 21.294118 | 49 | 0.776243 |
91ade3c05a09fd111b1b18bb011db1f6b5434ce1 | 5,293 | require "spec_helper"
describe "Remitano::Client#merchant_charges" do
describe "#get", :vcr do
context "object not found" do
it "raises error" do
client = Remitano::Client.default
expect do
client.merchant_charges.get("invalid_id")
end.to raise_error(Remitano::Client::Requ... | 36.253425 | 138 | 0.604572 |
1accfc8c63e278e935d622b1ab82a423d296009b | 1,509 | # frozen_string_literal: true
class MakeTagUniqueByNameAndMission < ActiveRecord::Migration[5.1]
def up
# returns PG::Result like [{"agg_array": "{tag_id, tag_id}", "name": "tag_id", "mission_id": m_id}]
# GROUP_BY treats null as equal, so works for standard tags that have mission_id = null
select_sql =
... | 41.916667 | 109 | 0.693174 |
1cb6afe6ca73c97d907165028b2f7c9b6f27c4e5 | 607 | class Parent::HomeController < Parent::BaseController
def index
if current_parent.profile.nil?
redirect_to parent_profile_path
end
end
def catalog
@semester = Semester.current
if @semester
@courses = Semester.current.courses
else
redirect_to :back, notice: "There is no semes... | 20.931034 | 75 | 0.621087 |
182b4ee06d66ff81c126ab5fb47d6257b85d7fba | 699 | Pod::Spec.new do |s|
s.name = 'BGECycleScrollView'
s.version = '1.0.1'
s.summary = 'Swift循环滚动视图控件'
s.description = <<-DESC
Swift循环滚动视图控件
DESC
s.homepage = 'https://github.com/MiniCamel/BGECycleScrollView'
s.license = { :type => 'MIT... | 38.833333 | 114 | 0.556509 |
ff131a7d9113624fbae5ec761cd391faefd0fd68 | 4,532 | #
# Author:: Seth Falcon (<seth@chef.io>)
# Copyright:: Copyright 2010-2016, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | 35.40625 | 133 | 0.704987 |
d5acd0e19465379d4c1d36bc3dfbcd5b375c55d4 | 982 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'cassandra_lock/version'
Gem::Specification.new do |spec|
spec.name = "cassandra_lock"
spec.version = CassandraLock::VERSION
spec.authors = ["Leandro Moreira"]
spec.em... | 37.769231 | 74 | 0.668024 |
1d41bcd417677a7aae2c61e8b224f983efd8c903 | 2,739 | #
# Copyright 2014 Mike Heijmans
# Copyright 2014-2018 Chef Software, 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 requir... | 25.361111 | 79 | 0.599489 |
117bf509d62d90ca9d0a0caa7fc72c17c892da3d | 1,527 | # frozen_string_literal: true
module AcaEntities
module Crms
module Contacts
# contract for crm contact
class ContactContract < AcaEntities::Contracts::Contract
params do
required(:hbx_id).filled(:string)
required(:relationship_to_primary).filled(:string)
optiona... | 36.357143 | 71 | 0.625409 |
e2ec679dd22f6369f554256918541081219e89ed | 5,674 | # frozen_string_literal: true
require "spec_helper"
require "generators/graphql/install_generator"
class GraphQLGeneratorsInstallGeneratorTest < Rails::Generators::TestCase
tests Graphql::Generators::InstallGenerator
destination File.expand_path("../../../tmp/dummy", File.dirname(__FILE__))
setup do
prepare... | 28.512563 | 111 | 0.702326 |
1a327b19ac74b21311392a0aa11869daec89f46e | 1,319 | # Use this hook to configure merit parameters
Merit.setup do |config|
# Add application observers to get notifications any time merit changes reputation.
config.add_observer 'DummyObserver'
config.orm = ENV['ORM'].try(:to_sym)
end
# Create application badges (uses https://github.com/norman/ambry)
badge_id = 0
[... | 27.479167 | 96 | 0.678544 |
18c81462681a425ef3695757774c36ee5212a232 | 810 | module Elastic
module DSL
module Search
module Filters
# A filter which returns documents which have a `null` value in the specified field
# (ie. the reverse of the `exists` filter)
#
# @example
#
# search do
# query do
# fil... | 23.142857 | 98 | 0.491358 |
e2b7cd4d7bc66f1efbb6436639bbd3606ae3e05e | 1,760 | # frozen_string_literal: true
module Facter
module Resolvers
module Macosx
class SystemProfiler < BaseResolver
SP_HARDWARE_DATA_TYPE = %i[model_name model_identifier processor_speed number_of_processors processor_name
total_number_of_cores l2_cache_per_core l3_cac... | 40 | 118 | 0.65625 |
33e7c1b84c2122cbae7f68848ea39937e14ef79a | 2,598 | # This code is free software; you can redistribute it and/or modify it under
# the terms of the new BSD License.
#
# Copyright (c) 2013, Sebastian Staudt
require 'spec_helper'
require 'mestral/repository'
describe Repository do
describe '.current=' do
it 'sets the current repository to the given path' do
... | 27.0625 | 95 | 0.680139 |
79d61176e1d0ed0d7513e45523fa48eb8b5fbe45 | 3,563 | module Eps
class DataFrame
attr_reader :columns
attr_accessor :label, :weight
def initialize(data = [])
@columns = {}
if data.is_a?(Eps::DataFrame)
data.columns.each do |k, v|
@columns[k] = v
end
elsif rover?(data) || daru?(data)
data.to_h.each do |k, ... | 22.550633 | 80 | 0.507999 |
1889a6184ea8f6d9e9f7cd91559a841424dd45ff | 558 | # -*- encoding: utf-8 -*-
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
Gem::Specification.new do |gem|
gem.name = 'producer_agent'
gem.version = '1.0.0'
gem.summary = 'Gom Agents example actor'
gem.description = 'This example actor produces data for use by other actors'
gem.au... | 29.368421 | 80 | 0.623656 |
1d1457bb0722c7b23e5913cd5f6c043d16b38ada | 12,107 | # encoding: utf-8
module Bunny
# Queues store and forward messages. Queues can be configured in the server or created at runtime.
# Queues must be attached to at least one exchange in order to receive messages from publishers.
class Queue09 < Qrack::Queue
def initialize(client, name, opts = {})
# chec... | 37.138037 | 426 | 0.656562 |
5de581c80dc54f77d12f1b8f4c4d2cdb3a8a4ef2 | 250 | # frozen_string_literal: true
module Jekyll::Minibundle
module Log
TOPIC = 'Minibundle:'
def self.error(msg)
::Jekyll.logger.error(TOPIC, msg)
end
def self.info(msg)
::Jekyll.logger.info(TOPIC, msg)
end
end
end
| 15.625 | 39 | 0.644 |
114da5d1aea6040c922f46aa6f72ae1df5dbc406 | 444 | require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'minitest'
require 'minitest/autorun'
require 'minitest/ci'
if ENV['CIRCLECI']
Minitest::Ci.report_dir = "#{ENV['CIRCLE_TEST_REPORTS']}/reports"
end
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/... | 26.117647 | 82 | 0.747748 |
ab444e1408b7e6b1ecebe25a94cd4fdf510128bb | 162 | require 'rspec'
require 'quipper-mixpanel-exporter'
require 'securerandom'
Dir["./support/**/*.rb"].each do |f|
require f
end
RSpec.configure do |config|
end
| 14.727273 | 36 | 0.716049 |
e27bfe1be62c537e0cfd445754c46489a076a32b | 2,260 | module SCSSLint
# Checks for the presence of a single space before an opening brace.
class Linter::SpaceBeforeBrace < Linter
include LinterRegistry
def check_node(node)
source = source_from_range(node.source_range).strip
# Only lint `@include`s which have curly braces
if source[-1] == '{... | 29.350649 | 82 | 0.647345 |
5dc03492a462aaa5f8638561ca181ffdfdaa3758 | 338 | module UsersHelper
# Returns the Gravatar for the given user.
def gravatar_for(user, options = { size: 80 })
size = options[:size]
gravatar_id = Digest::MD5::hexdigest(user.email.downcase)
gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}"
image_tag(gravatar_url, alt: user.name, class: "gr... | 30.727273 | 76 | 0.739645 |
1d72f970c49a2022dc530f31762bc8ef4f7b8d18 | 1,424 | # frozen_string_literal: true
# Serializes diffs with pagination data.
#
# Avoid adding more keys to this serializer as processing the
# diff file serialization is not cheap.
#
class PaginatedDiffEntity < Grape::Entity
include RequestAwareEntity
expose :diff_files do |diffs, options|
submodule_links = Gitlab:... | 22.967742 | 84 | 0.719101 |
1c44746c6b9d0fc7fd46fcd4f79d49596bb4eda9 | 818 | module AwsPluralResourceMixin
include AwsResourceMixin
attr_reader :table
# This sets up a class, AwsSomeResource::BackendFactory, that
# provides a mechanism to create and use backends without
# having to know which is selected. This is mainly used for
# unit testing.
# TODO: DRY up. This code exists ... | 37.181818 | 75 | 0.750611 |
086d821f896d11f0eb2cca8eff48d44730ec6d50 | 94 | class CreateArtists > ActiveRecord::Migration
def up
end
def down
end
def change
end
end
| 6.714286 | 45 | 0.765957 |
5d413fa3334373b705172fb34a0f06d155ddc386 | 5,931 | require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)
EvalSpecs::A.new.c
describe "Kernel#eval" do
it "is a private method" do
Kernel.should have_private_instance_method(:eval)
end
it "is a module function" do
Kernel.respond_to?(:eval).shou... | 28.514423 | 107 | 0.649806 |
913320f7598b90fc8610dd6ed07b2960045ff96e | 278 | class FixPrefNaming < ActiveRecord::Migration
def up
execute "UPDATE preferences SET name='sharing.events.followed' where name = 'sharing.events.bookmarked'"
execute "UPDATE preferences SET name='sharing.events.viewed' where name = 'sharing.events.watched'"
end
end
| 39.714286 | 108 | 0.766187 |
bfce7d3fa747d336551f4419f59d2ab9b825fbd5 | 229 | def exponenciacao(base, expoente)
result = base
expoente.pred.times { result *= base }
result
end
# Teste Manual
puts exponenciacao(5, 2)
puts exponenciacao(5, 5)
# Teste Automatizado
require_relative 'ExponenciacaoTest'
| 17.615385 | 40 | 0.755459 |
1ca684325a70bc2cee12b72104a8f1730c861214 | 1,685 | #
# Be sure to run `pod lib lint FlagPhoneNumber.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 http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'FlagP... | 43.205128 | 195 | 0.68368 |
e83445f6609189c3e7ae5bdee17bd806ab3375a9 | 1,655 | # 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... | 33.1 | 103 | 0.733535 |
d5bc574349043f0de255e57a7aec1f746e887f17 | 1,384 | module ActionView
module Helpers
module AssetTagHelper
##
# Displays a version of an upload and sets stored width and height attributes
#
# === Parameters
#
# [model (Model)] model instance
# [mounted_to (Sym)] attribute to which uploader is mounted
# [version (Sym... | 33.756098 | 95 | 0.614884 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.