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 |
|---|---|---|---|---|---|
285466c83ba2be432549428b4b7f2d63e05e68ef | 1,351 | require "test_helper"
class OtpTest < MiniTest::Unit::TestCase
def setup
@user = User.new
@user.email = 'roberto@heapsource.com'
@user.run_callbacks :create
@visitor = Visitor.new
@visitor.email = 'roberto@heapsource.com'
@visitor.run_callbacks :create
end
def test_authenticate_with_otp
... | 30.704545 | 101 | 0.724648 |
e9a7b5d533fc4a14d686c1a9eb27bae380cec0ad | 1,999 | require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "sprockets/railtie"
# require "rails/test_unit/railtie"
Bundler.require
require "doccex"
module ... | 38.442308 | 99 | 0.729865 |
87e1fdc79aeecc928d199319c3753b1a51e16850 | 6,829 | require 'rails_helper'
RSpec.describe People::MembersController, vcr: true do
describe "GET index" do
before(:each) do
get :index
end
it 'should have a response with http status ok (200)' do
expect(response).to have_http_status(:ok)
end
it 'assigns @people and @letters' do
as... | 27.873469 | 89 | 0.607263 |
03c772296a228e78c6f30d5d6301ec9a6b0a202a | 434 | # Encoding: UTF-8
[{name: "Comments",
scope: "text.html.cfm",
settings:
{shellVariables:
[{name: "TM_COMMENT_START", value: "<!--- "},
{name: "TM_COMMENT_END", value: " --->"}]},
uuid: "904C79F1-5730-4D8D-986A-0D71587B2C1F"},
{name: "Smart Typing Pairs",
scope: "meta.scope.output.cfm, string.q... | 31 | 59 | 0.62212 |
ed331132fce884d696071e86671c7fa40280b7b8 | 1,442 | # Redmine - project management software
# Copyright (C) 2006-2016 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any... | 30.041667 | 81 | 0.68724 |
e8e5cef067164695a2b672ea7a5d8b2ea2e210d8 | 588 | # Load Houston
require "houston/application"
# Configure Houston
Houston.config do
# Houston should load config/database.yml from this module
# rather than from Houston Core.
root Pathname.new File.expand_path("../../..", __FILE__)
# Give dummy values to these required fields.
host "houston.test.com"
ma... | 24.5 | 60 | 0.738095 |
f88dec64caf19f295d9856052a3381edfebb4a8d | 1,328 | require 'spec_helper.rb'
Sequel.extension(:migration)
describe 'pg_trgm' do
before(:each) do
DB.create_table(:foods) do |t|
primary_key :id
String :name
end
end
after(:each) do
DB.drop_table(:foods)
DB.drop_table(:schema_info)
end
describe 'add_pg_trgm' do
before do
Se... | 22.508475 | 81 | 0.646084 |
11169874255e2d923a4b2f8834f7bb7ad4b7c74e | 1,386 | # -*- encoding: utf-8 -*-
# stub: activejob 5.1.2 ruby lib
Gem::Specification.new do |s|
s.name = "activejob".freeze
s.version = "5.1.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["David Heineme... | 37.459459 | 112 | 0.675325 |
284798233ed52c1c740f46644581109c5cc25f26 | 1,132 | require 'optparse'
require 'vagrant'
module VagrantPlugins
module Mount
module Command
class Unmount < Vagrant.plugin('2', :command)
def self.synopsis
'Unmount ISO from Virtual Machine'
end
def initialize(argv, env)
@env=env
super
end
... | 28.3 | 133 | 0.567138 |
875356e21250471ff800e8f41e4210335aa1f723 | 5,315 | describe PxeController do
before do
stub_user(:features => :all)
end
describe '#tree_select ' do
it 'calls methods with x_node as param' do
controller.params = {:id => 'root', :tree => :pxe_servers_tree}
expect(controller).to receive(:get_node_info).with("root")
expect(controller).to re... | 40.572519 | 135 | 0.6619 |
79a087bbffceba86c30d41fa9eae255b2e3d9c40 | 1,670 | # ------------------------------------------------------------
# Simplecov
require 'simplecov' if ENV['COVERAGE']
# ------------------------------------------------------------
# Rspec configuration
RSpec.configure do |config|
config.raise_errors_for_deprecations!
config.mock_with :rspec
end
require_relative '.... | 27.377049 | 103 | 0.608982 |
629d7d0f04aa965f4df8d0257f8d6be7d0947d5c | 1,361 | class ProviderSuggestionsController < ApplicationController
rescue_from JsonApiClient::Errors::ClientError, with: :handle_error_request
def suggest
return render(json: { error: "Bad request" }, status: :bad_request) if params_invalid?
sanitised_query = CGI.escape(params[:query])
suggestions = Provider... | 33.195122 | 90 | 0.735489 |
e8f0b628c330256254652250c523767184f9489a | 231 | require 'jekyll/scholar'
require 'uri'
module MarkdownFilter
class Markdown < BibTeX::Filter
def apply(value)
value.to_s.gsub(URI.regexp(['http','https','ftp'])) { |c| "<a href=\"#{$&}\">#{$&}</a>" }
end
end
end
| 21 | 95 | 0.597403 |
26c9f0ec91b5cf41dde739c5a4dd8e77b6286756 | 1,166 |
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "basketball_score_scraper/version"
Gem::Specification.new do |spec|
spec.name = "basketball_score_scraper"
spec.version = BasketballScoreScraper::VERSION
spec.authors = ["anupkhadka"]
... | 40.206897 | 98 | 0.67753 |
edf2ba9702868de0195623dcceb6f0ac9c1fefb4 | 1,335 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads/v7/errors/keyword_plan_campaign_error.proto
require 'google/api/annotations_pb'
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_file("google/ads/googleads/v7/errors/keyword_plan_campaign_... | 37.083333 | 222 | 0.758801 |
262243ad430e94f7a764d85d040ce72299d42c36 | 116 | require_relative 'dto_schema/schema'
module DTOSchema
def self.define(&block)
Schema.new(&block)
end
end
| 11.6 | 36 | 0.732759 |
260ad21d08ad1d001ceec3a098145bab89432786 | 936 | #
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint flutter_blue_elves.podspec' to validate before publishing.
#
Pod::Spec.new do |s|
s.name = 'flutter_blue_elves'
s.version = '0.0.1'
s.summary = 'A new flutter plugin project.'
... | 39 | 104 | 0.604701 |
7939bd9373e786eb899b7e1ea1cc567414986b26 | 1,789 | # Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches... | 40.659091 | 85 | 0.764673 |
acaaabaa49774bff9a2e5249dc7baa44dcde2a3c | 5,615 | require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
module Configliere ; module Crypter ; CIPHER_TYPE = 'aes-128-cbc' ; end ; end
describe "Configliere::Encrypted", :if => check_openssl do
require 'configliere/crypter'
before do
@config = Configliere::Param.new :secret => 'encrypt_me', :norm... | 38.993056 | 109 | 0.682814 |
ff426c43f23b5dd9a8cd34d7ffe1f8c63ae37ac9 | 1,141 | # 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 36.806452 | 93 | 0.751096 |
e2a71ff3c8bb632be05366e5f6dd2cc8f028bc8f | 3,021 | #==
# Copyright (C) 2008 James S Urquhart
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publ... | 33.94382 | 120 | 0.709037 |
e8f560f6ccba3cc61ab6b33762e51b0b7fe64e9d | 2,419 | module Chosen
module Rspec
module FeatureHelpers
def chosen_select(value, *args)
options = args.extract_options!
input = chosen_input(options)
args.unshift(value).uniq.each { |item| chosen_select!(input, item) }
end
def chosen_unselect(value, *args)
options = a... | 26.010753 | 92 | 0.587019 |
110bfc5a84206bd4917692122e53c59ede97bf8a | 3,743 | module FoodCritic
# Encapsulates functions that previously were calls to the Chef gem.
module Chef
def chef_dsl_methods
load_metadata
@dsl_metadata[:dsl_methods].map(&:to_sym)
end
def chef_node_methods
load_metadata
@dsl_metadata[:node_methods].map(&:to_sym)
end
# Is th... | 31.453782 | 77 | 0.633716 |
ac6a8bd01a99e82e3374c8b1e28059c7b0237fe0 | 3,791 | class Portal::District < ApplicationRecord
self.table_name = :portal_districts
acts_as_replicatable
has_many :schools, -> { order :name },
dependent: :destroy,
class_name: 'Portal::School',
foreign_key: 'district_id'
belongs_to :nces_district, :class_name => "Portal::Nces06District", :foreign_key... | 31.591667 | 104 | 0.636508 |
e8556462c0dca1d7fd537b16c7bbba7613dcb856 | 551 |
Pod::Spec.new do |s|
s.name = "SFBNetwork"
s.version = "0.0.1"
s.summary = "A network framework based on AFNetworking."
s.homepage = "https://github.com/SoftBoys/SFBNetwork"
s.source = { :git => "https://github.com/SoftBoys/SFBNetwork.git", :tag => s.version.to_s }
... | 22.04 | 101 | 0.557169 |
4a95abab45ec6c4078962036c332291b5ebd1627 | 656 | ##
# This file is part of WhatWeb and may be subject to
# redistribution and commercial restrictions. Please see the WhatWeb
# web site for more information on licensing and terms of use.
# http://www.morningstarsecurity.com/research/whatweb
##
Plugin.define "x-hacker" do
author "Brendan Coles <bcoles@gmail.com>" # 201... | 21.866667 | 84 | 0.724085 |
4aef952861afcae73eaa094c259cf78b6eff9ef6 | 1,445 | # frozen_string_literal: true
require 'test_helper'
require 'active_record'
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
ActiveRecord::Migration.verbose = false
ActiveRecord::Schema.define do
create_table(:users) do |t|
t.string :first_name
t.string :last_name
end
en... | 22.230769 | 82 | 0.675433 |
ff3c1e7088364a4c4deab0f7c6c59d9722636ea9 | 625 | ActiveAdmin.register AdminUser do
permit_params :email, :password, :password_confirmation
index do
selectable_column
id_column
column :email
column :current_sign_in_at
column :sign_in_count
column :created_at
actions
end
filter :email
filter :current_sign_in_at
filter :sign_in_... | 15.625 | 57 | 0.6816 |
d50025a65617c698a047dcff87a3d6092eb7fc70 | 1,288 | # Encoding: UTF-8
require 'chefspec'
require 'chefspec/berkshelf'
ChefSpec::Coverage.start! { add_filter 'openstack-identity' }
LOG_LEVEL = :fatal
SUSE_OPTS = {
platform: 'suse',
version: '11.03',
log_level: LOG_LEVEL
}
REDHAT_OPTS = {
platform: 'redhat',
version: '6.3',
log_level: LOG_LEVEL
}
UBUNTU_OPTS... | 24.301887 | 70 | 0.682453 |
d5ccc47a4b7e4b3a5dc993961e166fdcda2ba227 | 85 | # desc "Explaining what the task does"
# task :gamfora do
# # Task goes here
# end
| 17 | 38 | 0.670588 |
610099598445336dac9c6d592418cf34165071e6 | 513 | # frozen_string_literal: true
module Collections
# Displays a single table row representing a work in a collection.
class WorkRowComponent < ApplicationComponent
with_collection_parameter :work_version
def initialize(work_version:)
@work_version = work_version
end
attr_reader :work_version
... | 23.318182 | 68 | 0.744639 |
5d457956ba36d54e0bed373a12e1062731837c3d | 1,190 | class Streamripper < Formula
desc "Separate tracks via Shoutcasts title-streaming"
homepage "http://streamripper.sourceforge.net/"
url "https://downloads.sourceforge.net/sourceforge/streamripper/streamripper-1.64.6.tar.gz"
sha256 "c1d75f2e9c7b38fd4695be66eff4533395248132f3cc61f375196403c4d8de42"
bottle do
... | 38.387097 | 93 | 0.740336 |
ac60adc789de7f0eae7e1e4c21a340020fbc0d86 | 10,065 | # encoding: utf-8
require File.expand_path('../spec_helper', __FILE__)
require 'rubygems/mock_gem_ui'
describe ChildProcess do
here = File.dirname(__FILE__)
let(:gemspec) { eval(File.read "#{here}/../childprocess.gemspec") }
it 'validates cleanly' do
mock_ui = Gem::MockGemUi.new
Gem::D... | 25.67602 | 297 | 0.625236 |
d59c9d6c2b932ccbc637818c5e52344f3807cf16 | 99 | if defined?(Rack::Timeout)
Rack::Timeout::Logger.disable # these are verbose and unnecessary
end
| 24.75 | 67 | 0.767677 |
5d2114a77ca6e3653b1137a3c39a317940ed0bd5 | 147 | # Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_PaciferousPanel_session'
| 36.75 | 85 | 0.816327 |
1a69edb4260870b02baa081fccb1e0dc11f5dffc | 390 | class MapReduce<%= name.camelcase %>
include SkynetDebugger
def self.run
job = Skynet::Job.new(
:mappers => 2, #change to whatever is a good number
:reducers => 1, #same
:map_reduce_class => self,
:map_data => [] #acquire your data!
)
job.run
end
def self.map(profiles)
... | 16.956522 | 57 | 0.607692 |
1d671a35f3e013e0dd8e6824a77ba45ad8abd891 | 166 | class AddTransportationRequestToAttendees < ActiveRecord::Migration
def change
add_column :attendees, :transportation_request, :string, :limit => 500
end
end
| 27.666667 | 74 | 0.789157 |
abfb224a49149ec8e7ea943260f40d8cdfbdc363 | 2,106 | module Benchmarks; end
class Benchmarks::CLI
class CLIRB # Version 1.0.0, https://github.com/redding/cli.rb
Error = Class.new(RuntimeError);
HelpExit = Class.new(RuntimeError); VersionExit = Class.new(RuntimeError)
attr_reader :argv, :args, :opts, :data
def initialize(&block)
@options = []... | 35.694915 | 85 | 0.57075 |
bfbe234e83b87546cdfb53d97bb7f85df03c893e | 221 | class Brie
attr_reader :item
def initialize(item)
@item = item
end
def tick
item.sell_in -= 1
return if item.quality >= 50
item.quality += 1
item.quality += 1 if item.sell_in <= 0
end
end
| 13.8125 | 42 | 0.615385 |
f85faf4a599c3eaf108f12afae634a8b20e6d6cb | 951 | module RSwift
class TemplateManager
include Thor::Base
include Thor::Actions
attr_reader :name
def self.source_root
File.dirname(__FILE__)
end
def create_files_for_template(name, template)
@name = name
current_directory_path = File.dirname(__FILE__)
template_director... | 32.793103 | 92 | 0.719243 |
28223ebb8bd8562bfb74bf780e248b5cb2df5133 | 81 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'intact_case'
| 27 | 58 | 0.740741 |
1daf3302657ccfcad67942a6713a9ee100bcc328 | 416 | describe "issue_trackers/issue.txt.erb", type: 'view' do
let(:problem) do
problem = Fabricate(:problem)
Fabricate(:notice, err: Fabricate(:err, problem: problem))
problem
end
before do
allow(view).to receive(:problem).and_return(
ProblemDecorator.new(problem))
end
it "has the problem u... | 23.111111 | 67 | 0.694712 |
1d7196badd33decc58e3dd07a136b79c7888f8d9 | 146 | class RemoveColumnStudentsCriminalExplanation < ActiveRecord::Migration
def change
remove_column :students, :criminal_explanation
end
end
| 24.333333 | 71 | 0.828767 |
1818fa76238bd01a7204c3d6dba55181d9bb92a3 | 2,444 | class Skopeo < Formula
desc "Work with remote images registries"
homepage "https://github.com/containers/skopeo"
url "https://github.com/containers/skopeo/archive/v0.1.40.tar.gz"
sha256 "ee1e33245938fcb622f5864fac860e2d8bfa2fa907af4b5ffc3704ed0db46bbf"
revision 1
bottle do
cellar :any
rebuild 1
... | 38.793651 | 122 | 0.709083 |
1db9f15b790f2ffd815b5202b46c7f0e06810f81 | 978 | require 'spec_helper'
describe Gitlab::Regex do
describe 'path regex' do
it { expect('gitlab-ce').to match(Gitlab::Regex.path_regex) }
it { expect('gitlab_git').to match(Gitlab::Regex.path_regex) }
it { expect('_underscore.js').to match(Gitlab::Regex.path_regex) }
it { expect('100px.com').to match(Gi... | 44.454545 | 75 | 0.695297 |
624fc176a54ee84e1b6b8dcf0626f0e0c21bb6b8 | 1,559 | require File.expand_path("../../Abstract/abstract-php-extension", __FILE__)
class Php53Blitz < AbstractPhp53Extension
init
homepage 'http://alexeyrybak.com/blitz/blitz_en.html'
url 'https://github.com/alexeyrybak/blitz/archive/v0.8.17.tar.gz'
sha1 '9c47e7daf585493dcf5f5bad9e202228c28ed748'
bottle do
roo... | 29.415094 | 75 | 0.708146 |
186b8e1ffe62fb77ba0eb7e80a396ff4a369dad4 | 97 | require 'simplecov'
SimpleCov.start do
add_filter '/spec/'
end
SimpleCov.minimum_coverage 90
| 12.125 | 29 | 0.783505 |
f8a6d9f808eeca4f90579e24f47e86eeed7b7059 | 4,011 | # frozen_string_literal: true
class Explore::ProjectsController < Explore::ApplicationController
include PageLimiter
include ParamsBackwardCompatibility
include RendersMemberAccess
include RendersProjectsList
include SortingHelper
include SortingPreference
MIN_SEARCH_LENGTH = 3
PAGE_LIMIT = 50
befo... | 25.06875 | 162 | 0.715532 |
21f9f7206b355788262da3b4483007335887b3eb | 4,314 | class Platformio < Formula
include Language::Python::Virtualenv
desc "Professional collaborative platform for embedded development"
homepage "https://platformio.org/"
url "https://files.pythonhosted.org/packages/d8/7b/a79280396d25daa2ce01000d77c45dd4703764fcab4d0ae4a73c8f97f183/platformio-5.0.3.tar.gz"
sha25... | 44.020408 | 146 | 0.824293 |
26e8f570fda017be685f97c44e4bb9a1c32b26ac | 687 | require "processor/environment"
require "processor/version"
require "processor/data/array_processor"
require "processor/data/batch_processor"
require "processor/data/null_processor"
require "processor/data/solr_pages_processor"
require "processor/data/csv_processor"
require "processor/data/active_record_batch_processo... | 26.423077 | 54 | 0.84425 |
0838de705d5c16346c2bf8092a48b45242ca7ba5 | 749 | module LeaderboardsHelper
def categories
['Achievements', 'Achievement Points', 'Mounts', 'Minions', 'Orchestrion', 'Emotes',
'Bardings', 'Hairstyles', 'Armoire'].freeze
end
def data_center(server)
Character.servers_by_data_center.each { |dc, servers| return dc if servers.include?(server) }
'Unk... | 24.966667 | 97 | 0.675567 |
21e721250fcf182bebd3014c7e983df51beeb92e | 2,118 | module Restforce
module Bulk
class Job
include Restforce::Bulk::Attributes
JOB_CONTENT_TYPE_MAPPING = {
csv: 'CSV',
xml: 'XML',
zip_csv: 'ZIP_CSV',
zip_xml: 'ZIP_XML'
}
class << self
def create(operation, object_name, content_type=:xml)
b... | 26.475 | 92 | 0.609537 |
5d404fca932bd94cda9620d95597415b4b64f05d | 8,718 | class GccAT8 < Formula
desc "GNU compiler collection"
homepage "https://gcc.gnu.org/"
url "https://ftp.gnu.org/gnu/gcc/gcc-8.5.0/gcc-8.5.0.tar.xz"
mirror "https://ftpmirror.gnu.org/gcc/gcc-8.5.0/gcc-8.5.0.tar.xz"
sha256 "d308841a511bb830a6100397b0042db24ce11f642dab6ea6ee44842e5325ed50"
license all_of: [
... | 34.054688 | 115 | 0.635696 |
91063762f1b02ac6cdc826afeed5e8eb85f07503 | 535 | module PkgAdapter
class Doc < BaseAdapter
def parse
@name = File.basename(@path)
@ext = File.extname(@path).gsub('.', '')
end
def plat
@ext
end
def app_uniq_key
:build
end
def app_name
@name
end
def app_version
""
end
def app_build
... | 12.159091 | 53 | 0.528972 |
ffd571a5c9902abaf4b85c12cf45c1d5e161817a | 46,637 | # 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, ... | 38.039967 | 222 | 0.648005 |
e2f4528c1638c8bf0c9bac0797caf41b7def5589 | 8,751 | # Stole this from Rails; rather copy the source than introduce
# ActiveSupport as a dependency
unless Hash.instance_methods.include? :deep_merge
class Hash
# Returns a new hash with +self+ and +other_hash+ merged recursively.
#
# h1 = { a: true, b: { c: [1, 2, 3] } }
# h2 = { a: false, b: { x: [3... | 33.022642 | 146 | 0.616501 |
e9a0841ac75c1dea9b080d2570dc3c24e74d2e99 | 16,696 | require "concurrent/atomic/atomic_reference"
require "logstash/plugin_mixins/elasticsearch/noop_license_checker"
module LogStash; module Outputs; class ElasticSearch; class HttpClient;
class Pool
class NoConnectionAvailableError < Error; end
class BadResponseCodeError < Error
attr_reader :url, :respons... | 32.48249 | 203 | 0.639974 |
18249a754e9f73f2357906032ad5e9237947263c | 2,432 | module ActiveWindow
# The ListItem is created on the fly
# * to oo-abstract methods to its TreeIter
# * for iteration in TreeController
# * as object in ActiveTreeStore
class ListedItem
def initialize(opts = {})
@traversed = false
self
end
def sort
"item-#{iter}"
end
... | 19 | 69 | 0.585526 |
ab87355a0075cb370cd7e61e9c0de7918aaceab4 | 446 | # frozen_string_literal: true
module FakeActivity
class DateValidator
attr_reader :date
def initialize(date)
@date = date
end
def valid?
date_exist? && date_valid?
end
def message
"#{date} is an invalid argument" unless valid?
end
private
def date_exist?
... | 13.515152 | 52 | 0.609865 |
28f36c4796245103f9d8d45082eb3402a5583ebf | 12,132 | require 'rails_helper'
require 'locale'
RSpec.describe Tokens::Type::AuthorizationCode, type: :oauth2 do
include Locale
before(:all) do
Tokens::Type::AuthorizationCode.send(
:public, *Tokens::Type::AuthorizationCode.protected_instance_methods)
end
subject(:auth_code_token) { Tokens::Type::Authoriza... | 39.647059 | 100 | 0.653396 |
ab5b9cabbaaa8961ce7bca1b7102f39fb64ca520 | 1,078 | module Petstore
#
class Category < BaseObject
attr_accessor :id, :name
# attribute mapping from ruby-style variable name to JSON key
def self.attribute_map
{
#
:'id' => :'id',
#
:'name' => :'name'
}
end
# attribute type
... | 17.966667 | 79 | 0.479592 |
bf86bc1b906ed478277e33c3f6c1519b4c2b5ebf | 1,754 | # frozen_string_literal: true
require "rails_helper"
describe AntivirusValidator do
let(:clean_file) { fixture_file_upload("files/clean_file.pdf") }
let(:infected_file) { fixture_file_upload("files/infected_file.pdf") }
before do
Ratonvirus.configure do |config|
config.scanner = :eicar
config.s... | 21.390244 | 72 | 0.660205 |
0894b93c461fe4643d3d1c88bac80db49bf95efa | 2,428 | # This now builds a version of JACKv1 which matches the current API
# for JACKv2. JACKv2 is not buildable on a number of macOS
# distributions, and the JACK team instead suggests installation of
# JACKOSX, a pre-built binary form for which the source is not available.
# If you require JACKv2, you should use that. Other... | 35.188406 | 107 | 0.707578 |
61e527384dab2079d5dbe941f8089655a8dc49a4 | 995 | module DataAggregation::Index
module EventData
module Transformer
def self.json
JSON
end
def self.instance(raw_data)
instance = EventSource::EventData::Write.build
instance.id = raw_data[:event_id]
instance.type = raw_data[:event_type]
instance.data = raw... | 24.875 | 75 | 0.59397 |
b9f43483efc587b948a96280eb69649c786e4453 | 2,091 | require 'spec_helper'
require 'pact_broker/pacts/pact_params'
module PactBroker
module Pacts
describe PactParams do
let(:body) { load_fixture('a_consumer-a_provider.json') }
let(:consumer_version_number) { '1.2.3' }
let(:headers) { { 'X-Pact-Consumer-Version' => consumer_version_number, 'Host'... | 29.871429 | 105 | 0.58154 |
ffca618ff2074a0ef3ccc05050472c4528adde86 | 438 | require "hamster/deque"
require "hamster/read_copy_update"
module Hamster
# @api private
class MutableQueue
include ReadCopyUpdate
def self.[](*items)
MutableQueue.new(Deque[*items])
end
def enqueue(item)
transform { |queue| queue.enqueue(item) }
end
def dequeue
head = ... | 16.222222 | 47 | 0.618721 |
38df9f2db7fbb2d3a72afc005a7001cb6674a023 | 2,338 | #
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright (c) 2016-present, Facebook, Inc.
# 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. An additional grant
# of patent rights can be foun... | 29.225 | 77 | 0.682207 |
ac8b3c76f298449c3558f0d8840e073b90312561 | 960 | #
# Cookbook Name:: rabbitmq_test
# Recipe:: default
#
# Copyright 2012-2013, Opscode, Inc. <legal@opscode.com>
#
# 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/l... | 32 | 75 | 0.746875 |
7a3e9d14ae48e347e95420f19f4277603134b329 | 2,452 | HeadsUp::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.consider_all_requests_local = false
config.action... | 36.058824 | 104 | 0.758564 |
f72562e3800036fc9842324199ea037e43c3b380 | 147 | require 'logger'
module Logging
def logger
Logging.logger
end
def self.logger
@logger ||= Logger.new 'goldenpeasant.log'
end
end
| 12.25 | 46 | 0.687075 |
38916f7376c0417d3ef278f9f44c67a5171e9e61 | 6,132 | require "active_record"
require "rails"
require "active_model/railtie"
# For now, action_controller must always be present with
# rails, so let's make sure that it gets required before
# here. This is needed for correctly setting up the middleware.
# In the future, this might become an optional require.
require "actio... | 35.04 | 195 | 0.691944 |
213661829f3ea5c258c1472c14a8db751ccfcecc | 632 | require 'test_helper'
module Pickwick
module API
module Models
class ConsumerTest < Test::Unit::TestCase
context "Consumer class" do
should "be able to find consumer by token" do
result = stub(records: [ FactoryGirl.build(:consumer, token: '123') ])
Consumer.exp... | 22.571429 | 82 | 0.583861 |
f87ee6c7c2c61d2c488884077e113d3cd0bf9381 | 2,191 | require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)
require File.expand_path('../shared/new', __FILE__)
describe "IO.open" do
it_behaves_like :io_new, :open
end
describe "IO.open" do
it_behaves_like :io_new_errors, :open
end
# These specs use a spe... | 25.183908 | 86 | 0.638065 |
39fdb8b8a7ff53779778457be495e2d0a9fb13c8 | 1,579 | #!/usr/bin/env ruby
#
# Filesize metrics
# ===
#
# Simple wrapper around `stat` for getting file size stats,
# in both, bytes and blocks.
#
# Based on: Curl HTTP Timings metric (Sensu Community Plugins) by Joe Miller
#
# Copyright 2014 Pablo Figue
#
# Released under the same terms as Sensu (the MIT license); see LICENS... | 23.924242 | 76 | 0.618746 |
8749bf3ca333b237aa605256583670b37302c960 | 736 | # frozen_string_literal: true
require 'erb'
module GenronSF
module EBook
module TemplateUtil
CSS_FILE_PATH = File.expand_path('../../../assets/main.css', __dir__)
class << self
def title_xhtml(title)
ERB.new(title_template).result_with_hash(title: title)
end
def w... | 23 | 101 | 0.608696 |
38d2a2d5c4a046b4d782675bb4a822578975a65c | 3,206 | class AccountController < ApplicationController
before_action :authenticate_user!, except: [:consent, :privacy_policy, :terms_and_conditions]
before_action :fetch_social_profile, only: [:account, :update, :change_password]
# def view_consent
# @pc = YAML.load_file(Rails.root.join('lib', 'data', 'content', "co... | 35.230769 | 248 | 0.733001 |
6a672712c51e939bf2bdef3f043ec1d7abc1cb9a | 1,911 | class Fish < Formula
desc "User-friendly command-line shell for UNIX-like operating systems"
homepage "https://fishshell.com"
url "https://github.com/fish-shell/fish-shell/releases/download/3.2.0/fish-3.2.0.tar.xz"
sha256 "4f0293ed9f6a6b77e47d41efabe62f3319e86efc8bf83cc58733044fbc6f9211"
license "GPL-2.0-only... | 35.388889 | 122 | 0.70853 |
e908d7242528e0c2cc7b6cb843e029d0da44978c | 19,184 | # frozen_string_literal: true
require "spec_helper"
describe GraphQL::Schema::Resolver do
module ResolverTest
class LazyBlock
def initialize
@get_value = Proc.new
end
def value
@get_value.call
end
end
class BaseResolver < GraphQL::Schema::Resolver
end
cl... | 31.193496 | 127 | 0.615826 |
4a101ac103f5264d89ba3d799f1dca05cf5d7f4b | 577 | module WoodShop
ActiveAdmin.register AdminUser, as: 'AdminUser' do
permit_params :email, :password, :password_confirmation
index do
selectable_column
id_column
column :email
column :current_sign_in_at
column :sign_in_count
column :created_at
actions
end
filt... | 19.233333 | 59 | 0.646447 |
f8f4d6c66563e00d34feb64906b878264710ba04 | 3,191 | require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
# require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "sprockets/railtie"
require "rails/test_unit/railtie"
if defined?(Bundler)
# If you precompile... | 43.121622 | 100 | 0.738013 |
623e26f5efdc05055c44fbe4bee2aecf5e6efc89 | 499 | # Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems' # This line not needed for ruby > 1.8
require 'twilio-ruby'
# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new acco... | 33.266667 | 66 | 0.787575 |
01f977b73d187d4d437fc5d9bd31649e1e786122 | 324 | #!/usr/bin/env ruby
require 'qiniu'
Qiniu.establish_connection! access_key: 'Access_Key',
secret_key: 'Secret_Key'
# 你要测试的空间, 并且这个key在你空间中存在
bucket = 'Bucket_Name'
key = 'ruby-logo.png'
# 删除资源
success = Qiniu.delete(
bucket, # 存储空间
key # 资源名
)
puts success # 返回布尔值表示是... | 17.052632 | 53 | 0.623457 |
bfca4475456c67ee6820bd6456c368c857ed50e1 | 790 | require "spec_helper"
require "controllers/rpt/shared_examples_for_reports"
describe Rpt::OutstandingBalanceReportsController do
render_views
it_behaves_like "a report", %w[html]
describe "#show" do
it "shows users with non-zero balances" do
sign_in create :admin
# One user paid too little
... | 23.939394 | 80 | 0.66962 |
ab0f255e70ac28ea311ffa215515984161531cc1 | 861 | require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/fixtures/classes'
describe "Breakpoint#disable" do
before :each do
@cm = BreakpointSpecs::Debuggee.instance_method(:simple_method).compiled_method
@cm.bytecodes = BreakpointSpecs::Debuggee.orig_bytecodes.dup
@orig =... | 30.75 | 83 | 0.692218 |
03f0c7a1289832b75ca606de1ebcaa79d1cfc306 | 402 | require "rails_helper"
RSpec.describe 'login_info/new', :type => :view do
it 'renders the new template for sign up' do
assign(:login_info, LoginInfo.create!({
:email => "hellofriend@gmail.com",
:password => "password",
:password_confirmation => "password"
}))
render
# rendered.sho... | 25.125 | 51 | 0.661692 |
b9ca402722169eb864fc88790de472131371a6d8 | 3,226 | class User < ApplicationRecord
has_many :microposts, dependent: :destroy
has_many :active_relationships, class_name: "Relationship",
foreign_key: "follower_id",
dependent: :destroy
has_many :passive_relationships, class_name: "Relationship... | 27.338983 | 112 | 0.703658 |
387b482731dde65ecad5f9bf4ba356ac49c67c81 | 5,173 | # 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 cause
# this file to always be loaded, without a need to explicitly require ... | 49.740385 | 96 | 0.718539 |
03112d360e43301f090c8fc7efaac34b9ea238bc | 556 | # frozen_string_literal: true
class StringDictionary
attr_reader :sentence, :dictionary
def initialize(sentence, dictionary)
@sentence = sentence
@dictionary = dictionary
end
def substrings
sentence.downcase!
dictionary.each_with_object(Hash.new(0)) do |word, hash|
hash[word] = count_w... | 19.172414 | 82 | 0.726619 |
e965e768c968ba9078cbce1175407f4aba09a284 | 3,116 | class DnscryptProxy < Formula
desc "Secure communications between a client and a DNS resolver"
homepage "https://github.com/jedisct1/dnscrypt-proxy"
url "https://github.com/jedisct1/dnscrypt-proxy/archive/2.0.22.tar.gz"
sha256 "ac8ad326b6da47bb1e515d29a354511a8dc9a5ebfcf4be816b6791532d02d564"
head "https://gi... | 34.241758 | 106 | 0.673941 |
1c5848ec63f83738dbaf7dfed8a85c34ad52a439 | 515 | require 'bio-ucsc'
describe "Bio::Ucsc::Hg19::WgEncodeBroadHistoneNhekH3k4me3StdPk" do
describe "#find_by_interval" do
context "given range chr1:1-800,000" do
it 'returns a record (r.chrom == "chr1")' do
Bio::Ucsc::Hg19::DBConnection.default
Bio::Ucsc::Hg19::DBConnection.connect
i ... | 30.294118 | 85 | 0.666019 |
1892203d4ac41a6ca14f47e0f16bc00979bc204d | 5,477 | require 'spec_helper'
require 'rack'
RSpec.describe Warden::Cognito::TokenAuthenticatableStrategy do
include_context 'fixtures'
include_context 'configuration'
let(:jwt_token) { 'FakeJwtToken' }
let(:authorization_header) { { 'HTTP_AUTHORIZATION' => "Bearer #{jwt_token}" } }
let(:headers) { authorization_he... | 32.60119 | 119 | 0.624429 |
62f036b0fe85b15824407d15e607cd3fbfd4c458 | 362 | module TwoFactorAuthentication
class AuthAppPolicy
def initialize(user)
@user = user
end
def configured?
user&.auth_app_configurations&.any?
end
def enabled?
configured?
end
def visible?
true
end
def enrollable?
available? && !enabled?
end
... | 12.928571 | 41 | 0.610497 |
f7bd137e5ec5ae7f92ca376700247fb0eceebe68 | 2,882 | require 'test_helper'
class LocaleTest < ActiveSupport::TestCase
fixtures :all
test "turning locale without nested phrases into a hash" do
assert_equal({ "se" => { "hello_world" => "Hejsan Verdon" } }, tolk_locales(:se).to_hash)
end
test "turning locale with nested phrases into a hash" do
assert_equa... | 28.82 | 109 | 0.645732 |
b913a1ed11e2d7fbaad7e6757d16065debf782be | 268 | cask 'mixxx' do
version '2.1.0'
sha256 '9c5b8d49939ee2591245f015602256bb258089ce5225eb9adde46298028d920a'
url "https://downloads.mixxx.org/mixxx-#{version}/mixxx-#{version}-osxintel.dmg"
name 'Mixxx'
homepage 'https://www.mixxx.org/'
app 'Mixxx.app'
end
| 24.363636 | 82 | 0.738806 |
edb07309c3ef2e9ebea7c5c24535f07fe9ca5261 | 175 | class AddDeletedAtToMinistries < ActiveRecord::Migration[5.0]
def change
add_column :ministries, :deleted_at, :datetime
add_index :ministries, :deleted_at
end
end
| 25 | 61 | 0.765714 |
089eecbc98fe1cd9169f3e80b45b66efe2b5d369 | 1,518 | class ScrapeItemWorker
include Sidekiq::Worker
def perform(url)
browser = Watir::Browser.new
browser.goto url
browser.div(id: 'packing-header').click
sleep 0.1
code_wrapper = browser.div(id: 'preplist_aurora').div(class: 'drug__list-filterresult').ul.text
codes = code_wrapper.scan(/EAN\s\d... | 32.297872 | 123 | 0.575758 |
7a0f437e0d64f29c422a7dfafe3beb218f274b8e | 6,134 | Rails.application.routes.draw do
# AUTH STARTS
match 'auth/:provider/callback', to: 'home#callback', via: [:get, :post]
mount_devise_token_auth_for 'User', at: 'auth', controllers: {
confirmations: 'devise_overrides/confirmations',
passwords: 'devise_overrides/passwords',
sessions: 'devise_overrides/s... | 31.782383 | 126 | 0.564069 |
abe605ed2e31213bd9f095438cbacf6759f47d38 | 528 | # WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
require_relative '../../aws-sdk-core/spec/shared_spec_helper'
$:.unshift(File.expand_path('../../lib', __FILE__... | 31.058824 | 74 | 0.723485 |
260159e0b3899af15ee8e6c9152028250f4b8d41 | 14,887 | # frozen_string_literal: true
ASCIIDOCTOR_TEST_DIR = File.absolute_path __dir__
ASCIIDOCTOR_LIB_DIR = ENV['ASCIIDOCTOR_LIB_DIR'] || (File.join ASCIIDOCTOR_TEST_DIR, '../lib')
require 'simplecov' if ENV['COVERAGE'] == 'true'
require File.join ASCIIDOCTOR_LIB_DIR, 'asciidoctor'
Dir.chdir Asciidoctor::ROOT_DIR
require... | 28.739382 | 130 | 0.656815 |
bb9ce1280d18224fad33d335c40988017c032ad3 | 1,801 | # frozen_string_literal: true
module Parametric
class BlockValidator
def self.build(meth, &block)
klass = Class.new(self)
klass.public_send(meth, &block)
klass
end
def self.message(&block)
@message_block = block if block_given?
@message_block if instance_variable_defined?('... | 26.880597 | 72 | 0.649084 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.