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 |
|---|---|---|---|---|---|
d5c0dcabb043f39dffe0e7fef855585f6f1b995d | 79 | json.messages do
json.array! @messages, partial: 'message', as: :message
end
| 19.75 | 57 | 0.721519 |
3866a7a03736519363d84b51b7acf9fb6e9df28f | 629 | module Fog
module Compute
class Cloudstack
class Real
# Deletes an traffic monitor host.
#
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/deleteTrafficMonitor.html]
def delete_traffic_monitor(*args)
options = {}
... | 24.192308 | 124 | 0.559618 |
38713fb3695a09e41031772a421e96a0151c5f2a | 71 | class Numeric
def to_json(options = nil) #:nodoc:
to_s
end
end
| 11.833333 | 37 | 0.661972 |
03ab0763431383f1f36a0a380dde1fac3d07e726 | 111 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'mongoid/diff'
require 'minitest/autorun'
| 18.5 | 58 | 0.738739 |
4aecd500c996d2ccd18091454e2b99c042460160 | 316 | #!/usr/bin/env ruby
# frozen_string_literal: true
$LOAD_PATH.unshift('./lib')
require 'binance'
require_relative '../../common'
logger = Common.setup_logger
# set key here
# or BINANCE_PUBLIC_API_KEY in env
client = Binance::Spot.new(key: '', secret: '')
logger.info(client.margin_get_oco(orderListId: 12_345))
| 19.75 | 55 | 0.734177 |
4a574003aff49c936ce22661a9bb3642dbcbfdfa | 191 | class Item
attr_accessor :name, :price, :id, :category
def initialize(name, price, id, category = nil)
@name = name
@price = price
@id = id
@category = category
end
end | 19.1 | 49 | 0.628272 |
037d1450045ed7a596beb310f24772850d2215f2 | 2,357 | # encoding: utf-8
# copyright: 2017, The Authors
title '5.3 Configure PAM'
control 'cis-ubuntu-14.04-5.3.1' do
impact 1.0
title '5.3.1 Ensure password creation requirements are configured (Scored)'
desc 'The pam_pwquality.so module checks the strength of passwords. It performs checks such as making sure a... | 38.639344 | 244 | 0.700891 |
4abfe4913f0a3817b53a6f1ba8ffd9c1443851b0 | 179 | require "mongo_metrics/mute_middleware"
module MongoMetrics
class Engine < ::Rails::Engine
isolate_namespace MongoMetrics
config.middleware.use MuteMiddleware
end
end
| 22.375 | 40 | 0.798883 |
7904c0661c4430220f6e9698d0d492e360f58663 | 377 | class FixUserIdHash < ActiveRecord::Migration
def up
if Company.first
cid = Company.first.id
UserLogin.update_all :company_id => cid
end
if Order.last
vid = Order.last.vendor_id
UserLogin.update_all :vendor_id => vid
end
User.all.each do |u|
u.set_... | 15.708333 | 45 | 0.599469 |
21b3f222564ff6339608a68eab716f7f6c2db300 | 4,645 | require 'spec_helper'
describe AstronomyEngine::App do
include Rack::Test::Methods
def app
AstronomyEngine::App
end
let(:astronomy_instance) { app.new.settings.astronomy }
let(:sample_topic_data) {
[{'name' => 'Brie', 'description' => 'A soft aged creamy spreadable cheese'},
{'name' => 'Chedd... | 27.163743 | 99 | 0.650807 |
e8dc76f87f2a75923f96be87018b7846e1ed83b0 | 146 | require 'test_helper'
module Hawk
class HawkerTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
end
| 14.6 | 44 | 0.664384 |
1d04f2141649350c76353d9126317dd931c406a6 | 532 | class Kerl < Formula
desc "Easy building and installing of Erlang/OTP instances"
homepage "https://github.com/kerl/kerl"
url "https://github.com/kerl/kerl/archive/1.8.5.tar.gz"
sha256 "1dbbabbddc1373837578e2d7c0c0f832291ec9fe1b4181ba0e7da8ca4b8f81ed"
head "https://github.com/kerl/kerl.git"
bottle :unneeded... | 26.6 | 75 | 0.738722 |
eddeeff820f59ebcd4c53d0bbf24be03b380e8a1 | 10,794 | # frozen_string_literal: true
require 'test/unit'
require 'date'
class TestDateNew < Test::Unit::TestCase
def test_jd
d = Date.jd
dt = DateTime.jd
assert_equal([-4712, 1, 1], [d.year, d.mon, d.mday])
assert_equal([-4712, 1, 1], [dt.year, dt.mon, dt.mday])
assert_equal([0, 0, 0], [dt.hour, dt.min... | 32.414414 | 88 | 0.608857 |
f8e54a2706f1222bfbfd1e3dc441795696183cb7 | 3,842 | # frozen_string_literal: true
require 'vk/api/methods'
module Vk
module API
class Photos < Vk::Schema::Namespace
module Methods
# Returns a list of a user's or community's photos.
class Get < Schema::Method
# @!group Properties
self.open = true
self.method = '... | 68.607143 | 280 | 0.665018 |
aca99f484e6b1cd424771ee6cb7ef25dfa8cf62b | 335 | module CoalescingPanda
class GroupMembership < ActiveRecord::Base
belongs_to :user, foreign_key: :coalescing_panda_user_id, class_name: 'CoalescingPanda::User'
belongs_to :group, foreign_key: :coalescing_panda_group_id, class_name: 'CoalescingPanda::Group'
validates :canvas_group_membership_id, presence: ... | 41.875 | 100 | 0.802985 |
21ad104ac4ed1191d6fc42fbbd484c85ebbe751f | 10,729 | # setup array of arrays datastructure, default 0
debug = false
inputs = "35,968 -> 974,29
198,552 -> 124,478
731,697 -> 828,697
335,693 -> 335,699
936,853 -> 936,798
120,93 -> 798,93
150,334 -> 150,876
482,383 -> 388,383
983,262 -> 202,262
324,185 -> 473,334
403,500 -> 205,500
785,273 -> 200,273
415,48 -> 860,48
18,47... | 18.308874 | 58 | 0.607606 |
28674962ceec4cac93fb92c078b85f215ec78ff3 | 737 | require 'beaker-rspec/spec_helper'
require 'beaker-rspec/helpers/serverspec'
unless ENV['BEAKER_provision'] == 'no'
hosts.each do |host|
# Install Puppet
if host.is_pe?
install_pe
else
install_puppet
end
end
end
RSpec.configure do |c|
# Project root
proj_root = File.expand_path(Fil... | 23.774194 | 100 | 0.68521 |
6a19818237af32ecfe46e35b19fcd53f6539329a | 970 | module Intrigue
module Ident
module Check
class Adobe < Intrigue::Ident::Check::Base
def generate_checks(url)
[
{
:type => "application",
:vendor => "Adobe",
:product => "Coldfusion",
:version => nil,
:match_type => :content_cookies,
:match_content => /CFTOKE... | 24.871795 | 83 | 0.536082 |
7a6e761da9a663a8da7fe55a81acda1220f87244 | 711 | require_relative './spec_helper.rb'
require_relative '../fizzbuzz.rb'
# We are missing a 'require_relative' here. Check README.md for instructions and an explanation!
describe "fizzbuzz" do
it 'returns "Fizz" when the number is divisible by 3' do
fizz_3 = fizzbuzz(3)
expect(fizz_3).to eq("Fizz")
end
it ... | 26.333333 | 96 | 0.691983 |
08361a1bd2d9f7616d04e626de97829c2c41b461 | 2,650 | # frozen_string_literal: true
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= "test"
require "spec_helper"
require File.expand_path("../dummy/config/environment", __FILE__)
require "rspec/rails"
# Requires supporting ruby files with custom matchers and macros, etc, in
#... | 39.552239 | 83 | 0.737358 |
1a0a53af81eb35a6091c09d4d9c33a18ece32494 | 10,776 | # frozen_string_literal: true
require 'spec_helper'
describe GDK::Config do
let(:auto_devops_enabled) { false }
let(:nginx_enabled) { false }
let(:protected_config_files) { [] }
let(:overwrite_changes) { false }
let(:yaml) do
{
'auto_devops' => { 'enabled' => auto_devops_enabled },
'gdk' => ... | 27.075377 | 153 | 0.616741 |
91d571c7feb2578a637d054d3b08bd10b4799631 | 6,106 | # Copyright 2016 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 39.141026 | 101 | 0.674582 |
62f9285bc8ae15ebd5ffb66d3362bd550b853c9d | 92 | RSpec.configure do |config|
# Use the following instead if you are on Devise >= 4.1.1
end | 23 | 59 | 0.717391 |
bf966a023937e62cba1d302d7a8a5c92440e53de | 11,990 | # Make sure HOME is set, regardless of OS, so that File.expand_path works
# as expected with tilde characters.
ENV['HOME'] ||= ENV['HOMEPATH'] ? "#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH']}" : Dir.pwd
require 'logger'
require 'net/ssh/config'
require 'net/ssh/errors'
require 'net/ssh/loggable'
require 'net/ssh/transport/se... | 48.346774 | 117 | 0.663636 |
b9d44e91938c056d11765dcab8c0bda6c2152794 | 5,622 | # 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... | 42.916031 | 110 | 0.690679 |
6220de936ec405dcf0e0f80ac644a7923dd89248 | 254 | class CreateEvents < ActiveRecord::Migration[5.0]
def change
create_table :events do |t|
t.string :name
t.integer :type
t.datetime :start_date
t.datetime :end_date
t.text :message
t.timestamps
end
end
end
| 18.142857 | 49 | 0.633858 |
e9bb5e4058b5a193f35c075b8eec871a6612a53e | 382 | # 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::CDN::Mgmt::V2017_04_02
module Models
#
# Defines values for ResourceType
#
module ResourceType
MicrosoftCdnProfilesEnd... | 23.875 | 72 | 0.730366 |
268dc36558ee6fcd9056c648818ec5635ccb6df6 | 1,502 | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/etsy/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["Patrick Reagan", "Katrina Owen"]
gem.email = ["reaganpr@gmail.com", "katrina.owen@gmail.com"]
gem.description = %q{A friendly Ruby interface to the Etsy API}
gem.s... | 41.722222 | 109 | 0.668442 |
08e1cab0fc3f6ca886c534aca182dda3855b41f8 | 790 | require File.dirname(__FILE__) + '/../../../../spec_helper'
require 'net/http'
describe "Net::HTTPGenericRequest#set_body_internal when passed string" do
before(:each) do
@request = Net::HTTPGenericRequest.new("POST", true, true, "/some/path")
end
it "sets self's body to the passed string" do
@request.s... | 35.909091 | 101 | 0.712658 |
91d182869585e19165a8ce64f91ee7f72f2b2d90 | 3,346 | require 'test_helper'
class UserTest < ActiveSupport::TestCase
def setup
@user = User.new(name: "Example User", email: "user@example.com",
password: "foobar", password_confirmation: "foobar")
end
test "should be valid" do
assert @user.valid?
end
test "name should be present" d... | 27.42623 | 78 | 0.671847 |
7a5c3b07e3265e8db7a6d10d5c5a72288b2a66a1 | 1,229 | # frozen_string_literal: true
# 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 applicabl... | 28.581395 | 74 | 0.664768 |
ac7a008105d683cd4a5ccbc996218b63d475f0aa | 133 | require 'test_helper'
class GrowthControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end
| 16.625 | 55 | 0.729323 |
1da5a4e859835b94567352a505c7ceee3d617cba | 236 | class CreateArtists < ActiveRecord::Migration[5.2]
def change
create_table :artists do |t|
t.string :name
t.string :genre
t.integer :age
t.string :hometown
end
end
end | 21.454545 | 50 | 0.550847 |
61600118418776389f00d8f410f31c553b59d951 | 222 | # frozen_string_literal: true
module Area
class BaseController < ApplicationController
private
def set_watched_area
@watched_area = WatchedArea.find_by(slug: params[:slug]) || render404
end
end
end
| 18.5 | 75 | 0.734234 |
91b0074d7e548d0d9f610a4599655eb89ef0c01d | 673 | #
# Copyright 2016 Google 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 ... | 35.421053 | 75 | 0.742942 |
91c9ee9fb3c9c0ce98047fe476dbfeb5d3c1e851 | 530 | cask 'yyets' do
version '3.2.1'
sha256 'c21bbb24885cec37671ee9dfaf3a66733338c3a75978a9b85643a2297e296802'
url "http://appdown.rrys.tv/RRShare_#{version}.dmg"
appcast 'http://app.rrys.tv/'
name 'YYeTs'
name '人人影视'
homepage 'http://app.rrys.tv/'
app '人人影视.app'
zap trash: [
'~/Library/A... | 26.5 | 75 | 0.618868 |
6a6ec14843b7946399bfc165748c5688fb33c476 | 6,778 | =begin
#OpenAPI Petstore
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.1.0
=end
requir... | 29.341991 | 191 | 0.622898 |
03832b76875e05f8f81853184c96e29ce0d286ff | 1,677 | # frozen_string_literal: true
module RailsDeprecationLogAnalyser
module Classifier
class DeepSymbolizeKeysParameters < Base
def match?(log_line)
log_line.include?('Method deep_symbolize_keys is deprecated and will be removed in Rails 5.1, as `ActionController::Parameters` no longer inherits from ha... | 62.111111 | 500 | 0.763268 |
b90d896f3e05fe86e97bf88ec43e0a074a997de8 | 37 | require "wrest/test/request_patches"
| 18.5 | 36 | 0.837838 |
28fa139ad0e4138b28baa12bbeacf796bb44f980 | 247 | require 'pry'
require 'nokogiri'
require 'open-uri'
require 'require_all'
require 'colorize'
require_relative '../lib/hikefinder/version.rb'
require_relative '../lib/cli.rb'
require_relative '../lib/trail.rb'
require_relative '../lib/scraper.rb'
| 22.454545 | 47 | 0.761134 |
796237b9413602e67c20801777994a466cd24c60 | 2,135 | #
# Author:: Arjun Hariharan (<Arjun.Hariharan@Clogeny.com>)
# Cookbook Name:: netapp
# Resource:: lif
#
# Copyright:: 2014, Chef Software, Inc <legal@getchef.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 ob... | 47.444444 | 124 | 0.733021 |
184547ac62c8607bab74363ae8e5eefe2091a598 | 17,394 | require 'spec_helper'
describe Sys::SiteCopyJob, dbscope: :example do
describe "copy opendata site" do
let(:site) { cms_site }
let(:layout) { create :cms_layout, cur_site: site }
let(:task) { Sys::SiteCopyTask.new }
let(:target_host_name) { unique_id }
let(:target_host_host) { unique_id }
let... | 47.654795 | 118 | 0.665517 |
6133b19c650bf9ba2006c06def313f91b5e454e9 | 495 | require 'helper'
#I admit these tests are a bit weak... but at least it is both positive/negative test
class TestFibless < Test::Unit::TestCase
context "Find the Fibonacci number prior to the number entered" do
#test valid input
should "return 89 for 128 as input" do
assert_equal 89, 128.closest_fibonac... | 33 | 91 | 0.723232 |
aba90d3927bec6cdfaa0e4810116e1a7e1cf3c9f | 1,213 | module Tale
class Chapter
EVENT_START_INDEX = 1
class << self
attr_accessor :branches, :parse_sequence
end
def self.init
@parse_sequence ||= 0
@branches ||= {}
end
def self.main_branch
init
return @main_branch if @main_branch.present?
@main_branch = @bra... | 23.326923 | 95 | 0.637263 |
b9fdec56ad8290c39ea78cbe1e9673f2bde52d7c | 1,351 | class ApplicationController < ActionController::Base
rescue_from ActiveRecord::RecordNotFound, with: :record_not_found
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
def require_user
unless current_user
#... | 25.018519 | 122 | 0.710585 |
218c75b4e783cf61b4f8e61e485276fe0bb6fae2 | 358 | require 'rubygems'
require 'bundler/setup'
require 'sass'
require 'compass'
<% if(multipleGridsSupport){ %> require 'sassy-fractions' <% } %>
preferred_syntax = :scss
http_path = '/'
css_dir = 'css/parts'
sass_dir = 'sass'
images_dir = 'images'
javascripts_dir = 'js/src'
relative_assets = true
line_comments = true
out... | 21.058824 | 65 | 0.731844 |
38a6925cf06d594fa25ce7e90d17199ba5c5210c | 634 | json.extract! pinboard_item, :id, :user_id, :pinned_object_type,
:pinned_object_id, :position, :is_inserted, :is_cross_project,
:inserted_count
json.pinned_object_section pinboard_item.pinned_object_type.pluralize
if pinboard_item.pinned_object.kind_of?(Source)
json.pinned_object_documents do
json.array! p... | 30.190476 | 80 | 0.790221 |
036ca2b597100997d306c8ce26f692416a7197dd | 866 | require 'spec_helper'
module Spree
module Calculator::Shipping
describe FlatPercentItemTotal, :type => :model do
let(:variant1) { build(:variant, :price => 10.11) }
let(:variant2) { build(:variant, :price => 20.2222) }
let(:line_item1) { build(:line_item, variant: variant1) }
let(:line_i... | 27.935484 | 73 | 0.60739 |
e8d7dfcbab31d242165a32ab17503a5ffc27688e | 5,392 | config({
extension: "rb",
overrides: <<~INIT_LUA
vim.opt.expandtab = true
vim.opt.shiftwidth = 2
INIT_LUA
})
test "ruby, outside of syntax tree works", <<~END
-█
-
-"foobar"
+
+
+
+"foobar"
END
test "ruby, normal cr works", <<~END
-"foobar"█
+"foobar"
+
END
test "ruby, sequence, indentation is kept", <<~END
- m... | 11.696312 | 103 | 0.636869 |
08b9299ac6c1d638402b4d267fa74aacc07fe9f6 | 261 | class UsageController < ApplicationController
# GET /usage
def index
raise Pundit::NotAuthorizedError unless current_user.present? && (current_user.can_org_admin? || current_user.can_super_admin?)
render('index', locals: { orgs: Org.all })
end
end | 37.285714 | 131 | 0.750958 |
e8ccc20bb0e35e429e9aefe8974e39267e40a196 | 843 |
Pod::Spec.new do |s|
s.name = "QIMCommonCategories"
s.version = "3.0.10211613"
s.summary = "Qunar chat App 6.0+ version QIMCommonCategories"
s.description = <<-DESC
Qunar QIMCommonCategories解决方案
DESC
s.homepage = "https://im.qunar.com"
s.licen... | 30.107143 | 115 | 0.604982 |
4ad6264c09ea1303e508969bea12077c63c7eaca | 1,470 | # frozen_string_literal: true
# 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 'aws-sdk-core'
require 'aws-sigv4'
require_relative 'aws-sdk-wellarchit... | 27.222222 | 93 | 0.758503 |
ed90bcdd7f6724c68341a9f7055c13af3f880947 | 326 | require File.expand_path('test_helper.rb', File.dirname(__FILE__))
class SassTest < Minitest::Test
def test_compilation
path = 'lib/assets/stylesheets'
%w(bigcartel).each do |file|
engine = Sass::Engine.for_file("#{path}/#{file}.sass", syntax: :sass, load_paths: [path])
engine.render
end
en... | 27.166667 | 95 | 0.684049 |
edd535d4440000a07bd95fc6c96005afaae1eb9d | 423 | require 'rails_helper'
RSpec.describe 'songs/index' do
before do
Artist.destroy_all
Song.destroy_all
@song = Song.create(title: "Bullet the Blue Sky", artist_name: "U2")
allow(view).to receive(:display_artist).and_return("They Might Be Giants")
assign(:songs, Song.all)
end
it 'calls the help... | 24.882353 | 78 | 0.704492 |
e827e171018379f3e6dfab991b4b23038fdba385 | 1,548 | # frozen_string_literal: true
require_relative "lib/valet-tasks/version"
Gem::Specification.new do |spec|
spec.name = "valet-tasks"
spec.version = ValetTasks::VERSION
spec.authors = ["Albert Jankowski"]
spec.email = ["albert@xenomedia.com"]
spec.summary = "Valet Tasks"
... | 38.7 | 90 | 0.684109 |
6a6058f3337139e760ae8ee06af2d458e22bf408 | 64 | module Kramdown
module Denden
VERSION = "0.0.1"
end
end
| 10.666667 | 21 | 0.65625 |
397c7c76e4c326932d89eb746bea0e5b1e89c6ff | 65 | class Redis
class Store < self
VERSION = '1.8.0'
end
end
| 10.833333 | 21 | 0.615385 |
4a8f99dd2da7f63419f6de21c888fe195f086b0f | 863 | class UsersController < ApplicationController
before_filter :require_no_user, :only => [:new, :create]
before_filter :require_user, :only => [:show, :edit, :update, :delete, :destroy]
def show
@user = @current_user
end
def new
@user = User.new
end
def create
@user = User.new(params[:user])
... | 18.361702 | 82 | 0.633835 |
2174d2ec322f9b7bc9ac641173c6298d1f394a67 | 727 | class TicketStubResource < ApplicationResource
attributes :attended, :role, :level, :notes
has_one :person, always_include_linkage_data: true
has_one :event, always_include_linkage_data: true
has_one :purchase, class_name: 'Transaction', always_include_linkage_data: true
has_one :ticket, always_include_linka... | 27.961538 | 100 | 0.738652 |
914eb4133a153e26585763bb30730a84123fe1d6 | 3,367 | # UIAButton methods
module Appium
module Android
Button = 'android.widget.Button'
ImageButton = 'android.widget.ImageButton'
private
# @private
def _button_visible_selectors(opts = {})
button_index = opts.fetch :button_index, false
image_button_index = opts.fetch :image_bu... | 33.336634 | 98 | 0.6733 |
6a71a4cf642b4c2522f2c90dd8fb459598c51d8b | 1,544 | require "puppet/parameter/boolean"
# Autogenic core type
Puppet::Type.newtype(:azure_policy_assignment) do
@doc = "The policy assignment."
ensurable
validate do
required_properties = []
required_properties.each do |property|
# We check for both places so as to cover the puppet resource path as w... | 22.376812 | 100 | 0.656736 |
bf86bf1c40d3feeba09ce5eee48c2c90ad6d7dec | 4,916 | require 'simplecov'
SimpleCov.start
if ENV['CI']
require 'codecov'
SimpleCov.formatter = SimpleCov::Formatter::Codecov
end
require 'bundler/setup'
require 'rplidar'
# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_P... | 45.518519 | 92 | 0.742067 |
1cd87dbbafd1f22480a6eed79324157167fecbdc | 2,913 | # -*- encoding: us-ascii -*-
require File.expand_path('../../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)
describe "Enumerator::Lazy#grep" do
before(:each) do
@yieldsmixed = EnumeratorLazySpecs::YieldsMixed.new.to_enum.lazy
@eventsmixed = EnumeratorLazySpecs::Event... | 35.096386 | 148 | 0.678682 |
4a60656225fd3ea2ca8a995a0c21ec00bedea0d4 | 1,433 | require 'ruboto/base'
require 'ruboto/package'
#######################################################
#
# ruboto/service.rb
#
# Basic service set up.
#
#######################################################
java_import 'android.content.Context'
java_import 'org.ruboto.RubotoService'
module Ruboto
module Context
... | 30.489362 | 172 | 0.62596 |
186a83c695d1a82a74818142f3a2d6353fb22c2f | 9,611 | require 'spec_helper'
require 'puppet/ssl'
require 'puppet_spec/ssl'
describe Puppet::SSL::Validator::DefaultValidator do
include PuppetSpec::Files
let(:ssl_context) do
mock('OpenSSL::X509::StoreContext')
end
before(:all) do
@pki = PuppetSpec::SSL.create_chained_pki
end
let(:ca_path) do
Puppe... | 33.371528 | 119 | 0.646967 |
39143624f010355bd7057bdf7174d8a0af606233 | 310 | module Unsplash # :nodoc:
# Raised when there is an error communicating with Unsplash.
class Error < StandardError; end
# Raise for deprecation errors
class DeprecationError < Error; end
class UnauthorizedError < Error; end
class ForbiddenError < Error; end
class NotFoundError < Error; end
end
| 28.181818 | 62 | 0.754839 |
bf98e11de36ec2cfc36fdec502e81441ef794465 | 1,400 | class UsersController < ApplicationController
before_action(:get_user, only:[:show, :edit, :update, :destroy])
def index
@user = User.find(session[:user_id])
redirect_to user_path(@user)
end
def show
@user = User.find(params[:id])
#@upcoming_events = Event.where("user_id = ?", @user.id).order(... | 21.212121 | 120 | 0.663571 |
f844578467093c81856887fa00d5d02f528a0ad6 | 7,109 | class Ocrmypdf < Formula
include Language::Python::Virtualenv
desc "Adds an OCR text layer to scanned PDF files"
homepage "https://github.com/jbarlow83/OCRmyPDF"
url "https://files.pythonhosted.org/packages/c2/0b/f15c5f5398d40d3d04d93488e8d932d029f9c82f1ae3032c9c54269b4a16/ocrmypdf-12.0.1.tar.gz"
sha256 "c18... | 42.065089 | 146 | 0.754255 |
ed1c9c93ffa418e845f4a3b9b387dbd8585d3689 | 15,945 | module Intrigue
module Core
module Model
class Project < Sequel::Model
plugin :validation_helpers
plugin :serialization, :json, :options, :handlers, :allowed_namespaces
plugin :timestamps
one_to_many :logger
one_to_many :task_results
one_to_many :scan_results
one_to_many :issues
incl... | 33.710359 | 142 | 0.596676 |
383a80f4c067ca3f43c872ed3b0d4ec0b5d8c372 | 94,050 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
module Aws::AppSync
# @api private
module ClientApi
include Seahorse:... | 72.013783 | 192 | 0.761701 |
1ca9f6aa021fa0572ff75d95a9ccce559077160b | 1,145 | class LibgpgError < Formula
desc "Common error values for all GnuPG components"
homepage "https://www.gnupg.org/related_software/libgpg-error/"
url "https://gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.36.tar.bz2"
sha256 "babd98437208c163175c29453f8681094bcaf92968a15cafb1a276076b33c97c"
bottle do
sha... | 39.482759 | 94 | 0.719651 |
6a7bb2df882072c807627b543d54a9ceda439baf | 413 | # encoding: utf-8
# validate_class Fixnum
# validate_class Numeric
module Formidable
module Validations
class ValidateClass < Validation
register(:validate_class)
def initialize(element, klass)
@klass = klass
super(element)
end
def valid?
element.cleaned_data.is_... | 16.52 | 42 | 0.624697 |
5d1be041a5e7794925b0c72b16a17e35db17e544 | 372 | require 'test_helper'
require 'rails/performance_test_help'
class BrowsingTest < ActionDispatch::PerformanceTest
# Refer to the documentation for all available options
# self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory]
# :output => 'tmp/performance', :formats => [:f... | 28.615385 | 80 | 0.655914 |
ff391dd31a6582f2b7ff110e41f2f72e97b3005c | 1,169 | #
# Cookbook Name:: test_services
# Recipe:: default
#
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apach... | 29.974359 | 74 | 0.763045 |
5d5d1f86b7eee758166fe879797268e12b1040df | 1,813 | # frozen_string_literal: true
module SettingsHelper
def self.fiscal_year_end(date = nil)
date ||= Time.zone.now
(fiscal_year_beginning(date) + 1.year - 1.day).end_of_day
end
def self.fiscal_year_beginning(date = nil)
date ||= Time.zone.now
fiscal_year_starts = fiscal_year(date.year)
date.to... | 26.661765 | 89 | 0.704357 |
383310bc73b7435908d10571196d88191d55b333 | 483 | require 'test_helper'
class ConfigurationTest < ActiveSupport::TestCase
setup do
FulfilApp.configuration = nil
end
test 'configure' do
FulfilApp.configure do |config|
config.subdomain = 'test'
config.client_id = '1234'
config.client_secret = '4321'
end
assert_equal 'test', Ful... | 24.15 | 62 | 0.728778 |
1d5e7ef6f80f143452a99eb5ead341a0b46d0f1b | 34,922 | require 'spec_helper'
class WatirAccessorsTestPageObject
include PageObject
page_url "http://apple.com"
expected_title "Expected Title"
expected_element :google_search
link(:google_search, :link => 'Google Search')
text_field(:first_name, :id => 'first_name')
hidden_field(:social_security_number, :id =>... | 31.518051 | 88 | 0.705945 |
4ac20a5cd6db4b7a86cb2986260b0b37774ba394 | 130 | require 'rails_helper'
RSpec.describe Confirmation, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
| 21.666667 | 56 | 0.753846 |
f739888f1087fc0e9656d5851dd4ad3a757ce17c | 245 | Given(/^I set up a Pusher spy$/) do
allow(Pusher).to receive(:trigger)
end
Then(/^the Pusher endpoint should have recieved "(.*?)" with "(.*?)"$/) do |metric, message|
expect(Pusher).to have_received(:trigger).with(metric, message, {})
end
| 30.625 | 92 | 0.673469 |
1c26cbc9a1108ddb671344aeb566e60342ed7772 | 2,654 | @log.trace("Started execution 'activedirectory:reset_user_password.rb' flintbit...") # execution Started
begin
# Flintbit input parametes
# Mandatory
@connector_name = @input.get('connector_name') # active-directory connector name
@dn = @input.get('distinguished-names') #distinguished-names to identif... | 45.758621 | 143 | 0.688772 |
b9b260f824614bc70c379a94824fea3496b29809 | 2,314 | # frozen_string_literal: true
#
# Cookbook Name:: aws-parallelcluster
# Recipe:: fsx_mount
#
# Copyright 2013-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the
# License. A copy of th... | 31.69863 | 121 | 0.674157 |
ffbbaec88038b178d4e31be81dee67f102aa6ba4 | 650 | class Jvmtop < Formula
desc "Console application for monitoring all running JVMs on a machine"
homepage "https://github.com/patric-r/jvmtop"
url "https://github.com/patric-r/jvmtop/releases/download/0.8.0/jvmtop-0.8.0.tar.gz"
sha256 "f9de8159240b400a51b196520b4c4f0ddbcaa8e587fab1f0a59be8a00dc128c4"
license "G... | 30.952381 | 90 | 0.72 |
1c4f1c46a40228fe2f61baa0dd53bcd791e4dcac | 4,008 | # frozen_string_literal: true
require File.join(File.expand_path('./../../../', __dir__), 'test_helper_for_routes')
class TestRegistrationRoutes < RouteTester
INTERACTOR = MasterfilesApp::RegistrationInteractor
def test_edit
authorise_pass! permission_check: MasterfilesApp::TaskPermissionCheck::Registration... | 36.108108 | 134 | 0.745509 |
0177288e3a71535f963192a0353e22b3767af300 | 3,532 | require 'spec_helper'
module Capistrano
class Configuration
describe Filter do
let(:available) { [ Server.new('server1').add_roles([:web,:db]),
Server.new('server2').add_role(:web),
Server.new('server3').add_role(:redis),
Server.... | 33.320755 | 101 | 0.55436 |
2635b8b73a180abdc0c7c958615da5cd495358fe | 697 | # frozen_string_literal: true
module ProductionApp
GrowerGradingRuleSchema = Dry::Schema.Params do
optional(:id).filled(:integer)
required(:rule_name).filled(Types::StrippedString)
required(:description).maybe(Types::StrippedString)
optional(:file_name).maybe(Types::StrippedString)
required(:pack... | 36.684211 | 55 | 0.754663 |
613ed84854e85ddf975ba7e3c1667bfba1b68534 | 293 | class AddTimestampsToRecipients < ActiveRecord::Migration
def self.up
add_column :recipients, :created_at, :datetime
add_column :recipients, :updated_at, :datetime
end
def self.down
remove_column :recipients, :created_at
remove_column :recipients, :updated_at
end
end
| 24.416667 | 57 | 0.757679 |
5d8bd8d17d0f8b0f1df49e5a7a1b45127a20f38c | 935 | require 'test_helper'
class UsersSignupTest < ActionDispatch::IntegrationTest
test "invalid signup information" do
get signup_path
assert_no_difference 'User.count' do
post users_path, params: { user: { name: "",
email: "user@invalid",
password: "foo",
... | 29.21875 | 59 | 0.64385 |
ab553ca2969002ae688ce78bbd4d88098c87fc38 | 6,556 | # encoding: utf-8
module RuboCop
# This class handles the processing of files, which includes dealing with
# formatters and letting cops inspect the files.
class Runner
# An exception indicating that the inspection loop got stuck correcting
# offenses back and forth.
class InfiniteCorrectionLoop < Ex... | 30.493023 | 80 | 0.670531 |
e8bd950b9df054d3cc8ea72ca88071e0a68dc1d3 | 240 | class SuggestionRemoveBroadcastJob < ApplicationJob
queue_as :suggestions
def perform(result)
result[:type] = 'destroy'
ActionCable.server.broadcast "chatroom_#{result[:suggestion][:chatroom_id]}:suggestions", result
end
end
| 26.666667 | 100 | 0.766667 |
ff1244c7e0a34fe63909138a544e2119946db82d | 478 | # 617. Merge Two Binary Trees
# 183 / 183 test cases passed.
# Status: Accepted
# Runtime: 88 ms
# @param {TreeNode} t1
# @param {TreeNode} t2
# @return {TreeNode}
def merge_trees(t1, t2)
return nil if t1 == nil && t2 == nil
merge_val = (t1 ? t1.val : 0) + (t2 ? t2.val : 0)
node = TreeNode.new(merge_val)
... | 28.117647 | 70 | 0.623431 |
1a6efdd80fc685a5a3cca5542561f22428ace0f8 | 146 | class RenameCategoriesToStartupCategories < ActiveRecord::Migration[4.2]
def change
rename_table :categories, :startup_categories
end
end
| 24.333333 | 72 | 0.808219 |
21bb8af91173ecf397596ba66f0d4f53a4cb69f0 | 727 | # typed: true
module Kuby
module CertManager
module DSL
module Acme
module V1
class ChallengeSpecSolverDns01DigitaloceanTokenSecretRef < ::KubeDSL::DSLObject
value_field :name
value_field :key
validates :name, field: { format: :string }, presence: true... | 24.233333 | 89 | 0.537827 |
626228ecdfb7228da16a0d2ebf8f5c03288688e0 | 557 | # frozen_string_literal: true
module FileUploadSupport
extend self
extend ActionDispatch::TestProcess
def png_name
'test-image.png'
end
def png_path
file_path png_name
end
def png
upload png_name, 'image/png'
end
def jpg_name
'test-image.jpg'
end
def jpg_path
file_path jp... | 13.585366 | 53 | 0.689408 |
08fb9675b6a65624a2aebe1611fe4046ba43f83d | 430 | class SimpleCms::AdminController < ApplicationController
before_filter :check_authorization
def index
@grouped_pages = SimpleCms::Page.where(:type => nil).order(:url, :name).group_by{|page| page.url}
@full_pages = SimpleCms::FullPage.order(:name)
end
private
def check_authorization
unless admi... | 23.888889 | 101 | 0.727907 |
6ad198d1871198ade5b5b36534af83206e609909 | 910 | class Convox < Formula
desc "Command-line interface for the Rack PaaS on AWS"
homepage "https://convox.com/"
url "https://github.com/convox/rack/archive/20180708231844.tar.gz"
sha256 "b39c43567ffb8d13ec272dd2ac6dc88b14405e3a01760efe382c06cec9f4f0f2"
bottle do
cellar :any_skip_relocation
sha256 "1edb3... | 33.703704 | 93 | 0.73956 |
335f8f890661b5429e2aa5088c4e70f1d19d9887 | 2,462 | # frozen_string_literal: true
require "rails_helper"
module Renalware
module Letters
describe DetermineCounterpartCCs, type: :model do
include LettersSpecHelper
subject(:service) { DetermineCounterpartCCs.new(letter) }
let(:patient) { build(:letter_patient) }
describe "#call" do
... | 32.394737 | 90 | 0.608042 |
aba2c6e8c6d5934ccbf3ebc55067780f9e4d74c7 | 571 | module Fabric
class UpdateCardOperation
include Fabric
def initialize(card, attributes)
@log_data = { class: self.class.name, card: card, attributes: attributes }
flogger.json_info 'Started', @log_data
@card = get_document(Card, card)
@attributes = attributes
end
def call
... | 23.791667 | 80 | 0.66725 |
e2c12cf465875f33620658a00b79922408eaa703 | 79 | Timezone::Lookup.config(:google) do |c|
c.api_key = ENV['GOOGLE_API_KEY']
end | 26.333333 | 39 | 0.721519 |
f867a73f546fc4c98662ec312d70a46b2958c025 | 16,605 | require_relative "../../test_helper"
class Test::Proxy::RateLimits::TestDistributedRateLimits < Minitest::Test
include ApiUmbrellaTestHelpers::Setup
include ApiUmbrellaTestHelpers::RateLimits
include Minitest::Hooks
def setup
super
setup_server
@override_config = {
:apiSettings => {
... | 34.096509 | 189 | 0.589581 |
87eb86deefb58104440478440e853e9264d43168 | 1,982 | module ApiAuth
module RequestDrivers # :nodoc:
class FaradayRequest # :nodoc:
include ApiAuth::Helpers
def initialize(request)
@request = request
fetch_headers
true
end
def set_auth_header(header)
@request.headers['Authorization'] = header
fetch_he... | 23.046512 | 91 | 0.619072 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.