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 |
|---|---|---|---|---|---|
e8950541ca32e4e3b68f755c9dda38639dd556cb | 118 | class AddTransferNote < ActiveRecord::Migration[5.1]
def change
add_column :transfers, :note, :string
end
end
| 19.666667 | 52 | 0.737288 |
f81f3b78b49052672e073edec719c4e135ad411d | 320 | # frozen_string_literal: true
require 'rails_helper'
def like(user)
expect do
click_button 'Like'
end.to change(Like, :count).by(1)
expect(page).to have_content('Liked!')
expect(page).to have_content("#{user.first_name} #{user.last_name}")
expect(page).to_not have_xpath('//input', text: 'Dislike')
end
| 22.857143 | 70 | 0.709375 |
e2975e28af6d2d8e61779bbe0173f85ba1c374d7 | 1,541 | # frozen_string_literal: true
require_relative "lib/ruby2d/tiled/version"
Gem::Specification.new do |spec|
spec.name = "ruby2d-tiled"
spec.version = Ruby2d::Tiled::VERSION
spec.authors = ["Mario Visic"]
spec.email = ["mario@mariovisic.com"]
spec.summary = "A tiled map gen... | 40.552632 | 88 | 0.680078 |
216c372a4eae85bef8f336d4f67e2ac8cab984bc | 2,037 | module ActiveScaffold::Config
class Search < Base
self.crud_type = :read
def initialize(core_config)
@core = core_config
@text_search = self.class.text_search
@live = self.class.live?
# start with the ActionLink defined globally
@link = self.class.link.clone
@action_grou... | 29.1 | 191 | 0.635248 |
4ae62898ee7f8faae894dcb983fa673d893a01e2 | 310 | module Erp::Carts
class Compare < ApplicationRecord
has_many :compare_items, dependent: :destroy
def get_number_items
self.compare_items.count
end
def remove_compare_item(compare_item_id)
self.compare_items.where(id: compare_item_id).destroy_all
end
end
end
| 22.142857 | 63 | 0.709677 |
38f96e5ab100431f0c46bc490ff0efe738ffb04a | 195 | require "erubis"
module Capper
module Utils
module Systemd
def systemctl(*args)
run("systemctl --user " + [args].flatten.map(&:to_s).join(" "))
end
end
end
end
| 13.928571 | 71 | 0.589744 |
798bc4e2151f53721003c6f99f26d9a7401d723b | 6,084 | # frozen_string_literal: true
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0... | 38.751592 | 96 | 0.594181 |
b9387592ede025a182d268f7bac5e28ad93199ca | 298 | class CreateClassroomChats < ActiveRecord::Migration
def change
create_table :classroom_chats do |t|
t.references :classroom, index: true, foreign_key: true
t.references :user, index: true, foreign_key: true
t.text :content
t.timestamps null: false
end
end
end
| 24.833333 | 61 | 0.701342 |
abc7b5d44630168733ebb1f7f6fed8d1bb427c80 | 31,664 | # 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... | 45.757225 | 116 | 0.596577 |
61d57207d4d1c3f44865b4ad7645353d38f1cb0b | 269 | class UsersController < ApplicationController
respond_to :json
def show
@user = User.find(params[:id])
end
def currentuser
@user = current_user
render 'users/show'
end
private
def user_params
params.require(:user).permit(:id)
end
end | 14.944444 | 45 | 0.687732 |
7acda88db5998f11d0658e2fd8541425e9b0ca46 | 2,290 | # -*- encoding: utf-8 -*-
# stub: http_parser.rb 0.6.0 ruby lib
# stub: ext/ruby_http_parser/extconf.rb
Gem::Specification.new do |s|
s.name = "http_parser.rb".freeze
s.version = "0.6.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_pa... | 44.901961 | 124 | 0.657205 |
e943bb53fa5b7eeb02a62b5270c05d907e2735b3 | 48 | module Octicons
VERSION = "15.0.1".freeze
end
| 12 | 27 | 0.708333 |
03cc27c31c7b85dcbedacc313028d6ff00cfa411 | 791 | require 'watir'
require_relative 'creds'
require_relative 'prox'
username = $username
counter=0
loop do
$password.each { |val|
# Open Browser, Navigate to Login page
browser = Watir::Browser.new :chrome, :switches => ['--proxy-server=socks5://'+"#{$proxy[counter]}"]
browser.goto "instagram.com/accou... | 25.516129 | 102 | 0.663717 |
e9ad04d01f4e77df4832e3a392d69d0bcd373588 | 166 | module Web::Controllers::Books
class Index
include Web::Action
expose :books
def call(params)
@books = BookRepository.new.all
end
end
end
| 13.833333 | 37 | 0.656627 |
38a49e8f60b3f9dc2d0cd8a287ea48972db04bd0 | 1,642 | require 'spec_helper'
require_relative '../../../app/models/visualization/name_checker'
include CartoDB
describe Visualization::NameChecker do
before :all do
bypass_named_maps
@user = create(:valid_user)
@user2 = create(:valid_user)
@vis1 = build(:derived_visualization, name: 'Visualization 1', use... | 32.84 | 92 | 0.705238 |
e98703a1f874a415d49028239401a66968e1ff44 | 1,818 | module QuestionsHelper
def questions_index_links(questions)
links = []
# links for form mode
if params[:controller] == 'forms'
# add the 'add questions to form' link if there are some questions
unless @questions.empty?
links << batch_op_link(:name => t("form.add_selected"), :path => a... | 32.464286 | 135 | 0.687569 |
21537d8173252d58cd9b1b322006f737cc07ce5e | 2,857 | require 'rails_helper'
RSpec.describe Voucher, type: :model do
fixtures :all
describe "relationships" do
it "should have an associated MASA" do
v1 = vouchers(:voucher1)
expect(v1.manufacturer).to be_present
end
it "should have an associated MASA" do
v1 = vouchers(:voucher1)
ex... | 34.421687 | 103 | 0.690935 |
ed598c3e735a69207ca6143fec4b93abc01a7595 | 2,552 | require 'spec_helper_acceptance'
# Enable Cron Daemon - Section 5.1.1
describe service('crond') do
it { is_expected.to be_running }
end
# Ensure permissions on /etc/crontab are configured - Section 5.1.2
describe file('/etc/crontab') do
it { is_expected.to be_file }
it { is_expected.to be_owned_... | 27.44086 | 74 | 0.679859 |
33d6073a892c47bbaf3bb2099518d1e528e70998 | 265 | name "openopps"
description "Open Opportunities configuration & customizations on Midas for AWS"
run_list "midas"
override_attributes(
midas: {
config_repo: "https://github.com/18F/midas-open-opportunities.git",
config_name: "open-opportunities",
}
)
| 22.083333 | 80 | 0.74717 |
e908d23ee8eb230f50a9969ebb1d351f0ffbb5d6 | 380 | require "domainotron/version"
module Domainotron
def self.get_domain(url, remove_www: true)
normalized = url.sub(/:\d+{2,6}/, '').sub(/\/\Z/, '')
unless url.match /^(http:\/\/|https:\/\/|\/\/)/
normalized = '//' + normalized
end
domain = URI.parse(normalized).host
if remove_www
dom... | 19 | 57 | 0.576316 |
6298a74d9920d5fd0e9d962b405e0bfc3486ee89 | 564 | require 'rails_helper'
RSpec.describe DashboardController, type: :controller do
it 'inherits from ProtectedController' do
expect(subject).to be_a_kind_of(ProtectedController)
end
let(:user_client) { FactoryGirl.create(:user_client) }
before(:example) { sign_in user_client }
describe "GET index" do
... | 20.888889 | 58 | 0.707447 |
3871d939feb62c16ebfaef7d32c06aef82524a2a | 1,517 | require 'spec_helper'
describe Gitlab::Ci::Config do
let(:config) do
described_class.new(yml)
end
context 'when config is valid' do
let(:yml) do
<<-EOS
image: ruby:2.2
rspec:
script:
- gem install rspec
- rspec
EOS
end
describe '#to... | 20.5 | 54 | 0.497034 |
28e34706975e698eb65260feacc171ad7e8ba9e1 | 3,069 | class DatabaseBackup
BACKUP_DIR = 'db/backups'
module Frequency
DAILY = :daily
HOURLY = :hourly
end
attr_accessor :max_num_of_backups
def initialize(database_backup_adapter, max_num_of_backups: 10)
@database_backup_adapter = database_backup_adapter
@max_num_of_backups = max_num_of_backups
... | 23.427481 | 77 | 0.69306 |
6a12c6f988b900384fc14c5f5be702486f0b5dab | 340 | #
# Cookbook:: accesos
# Recipe:: panidiroftp
#
# Copyright:: 2018, The Authors, All Rights Reserved.
#
node.default['openssh']['server']['permit_root_login'] = "no"
node.default['openssh']['server']['password_authentication'] = "yes"
node.default['openssh']['server']['allow_groups'] = "linux_admin panidiroftp"
#
inclu... | 28.333333 | 77 | 0.717647 |
39f381423ebe4e7901097e16909431d2f3bfb26c | 534 | cask 'boxer' do
version '1.4.0'
sha256 'a75f9149612f90fa78f1016a6edef34ed600334f7170d624b083a310ae4c904e'
# github.com/alunbestor/Boxer was verified as official when first introduced to the cask
url "https://github.com/alunbestor/Boxer/releases/download/v#{version}/boxer-#{version}.zip"
appcast 'http://boxer... | 33.375 | 94 | 0.7603 |
33b2eb28ee2684ae8f52a9e27c450b0b4b8c4e4f | 640 | Rails.application.routes.draw do
devise_for :users
resources :facilities
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
post '/file_uploads', to: 'file_uploads#upload'
resources :file_uploads, only: [:index, :new]
get '/file_uploads/:id', to: 'file_uploa... | 35.555556 | 101 | 0.725 |
38d5044c58755debe348400cbd16b7180a89845f | 356 | class CreateInvitations < ActiveRecord::Migration[6.0]
def change
create_table :invitations do |t|
t.integer :user_id
t.integer :event_id
t.boolean :attending, default: false
t.timestamps
end
add_foreign_key :invitations, :events, column: :event_id
add_foreign_key :invitations,... | 27.384615 | 60 | 0.702247 |
26c34b3f125c27b55f931c74af91fc30435577f9 | 1,094 | module Importer
# Import a csv file with one work per row. The first row of the csv should be a
# header row. The model for each row can either be specified in a column called
# 'type' or globally by passing the model attribute
class CSVImporter
def initialize(metadata_file, files_directory, model = nil)
... | 27.35 | 81 | 0.642596 |
1a31e3e37bd2030378e3c5f45b22f09ed22f701f | 521 | require "sentry/rails/tracing/abstract_subscriber"
module Sentry
module Rails
module Tracing
class ActionViewSubscriber < AbstractSubscriber
EVENT_NAME = "render_template.action_view".freeze
def self.subscribe!
subscribe_to_event(EVENT_NAME) do |event_name, duration, payload|
... | 28.944444 | 149 | 0.708253 |
5d6ea812be98fb1b97a0a593a5d02c76fd7034fc | 5,689 | ##
# 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::Scanner
include Msf::Auxiliary::Report
def initialize(info = {})
... | 34.065868 | 165 | 0.652311 |
0864e7ef2af737f1d63b9ef3fd32aecfc7e4d50d | 4,525 | require 'active_support/core_ext/hash/keys'
require 'action_dispatch/middleware/session/abstract_store'
require 'rack/session/cookie'
module ActionDispatch
module Session
# This cookie-based session store is the Rails default. It is
# dramatically faster than the alternatives.
#
# Sessions typically ... | 36.491935 | 107 | 0.676906 |
03d1225767c1dc13c47535d1cd79e0db1a4eeba4 | 504 | # frozen_string_literal: true
require_relative '../options_helper'
describe OctocatalogDiff::CatalogDiff::Cli::Options do
describe '#opt_fact_override' do
include_examples 'global array option', 'fact-override', :fact_override_in
it 'should accept multiple facts of the same type' do
args = ['--to-fac... | 31.5 | 80 | 0.704365 |
38c4a834c57c0cf23e2e189d759de7e631d78536 | 1,039 | # 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... | 43.291667 | 93 | 0.766121 |
2876aecb44c49b16e41348e2d5c87363c3ebbd2d | 336 | # -*- coding: utf-8 -*- #
# frozen_string_literal: true
describe Rouge::Lexers::Stan do
let(:subject) { Rouge::Lexers::Stan.new }
describe 'guessing' do
include Support::Guessing
it 'guesses by filename' do
assert_guess :filename => 'foo.stan'
assert_guess :filename => 'foo.stanfunctions'
... | 19.764706 | 51 | 0.657738 |
21d83e36df91fa9fda87e2330a042530c3a9e5ed | 625 | module DataAbstraction::SensorData
class RainAccumlation < Generic
STANDARD_UNIT = "mm"
def initialize(data, meta_values = {}, unit = STANDARD_UNIT)
super(data, meta_values, unit)
@value = DimensionValue.new(data['value'].to_f, @unit)
@duration = DurationValue.new(data['duration'].to_f, data... | 27.173913 | 89 | 0.6432 |
bf2299573825bdd58f601b9a8e75be5fc8bd6569 | 8,309 | module Bosh
module Release
class Compiler
include Bosh::Common::PropertyHelper
OPTIONS = {
"blobstore_options" => { "blobstore_path" => "/var/vcap/micro_bosh/data/cache" },
"blobstore_provider" => "local",
"base_dir" => "/var/vcap",
"platform_name" => "ubuntu",
... | 31.11985 | 108 | 0.55807 |
62d873b2eb860e985d5c3f87eef051de6116bb3c | 832 | Rails.application.routes.draw do
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
root 'static_page#home'
# root to: 'static_page#home' # 上記はこれの省略形
get '/policy', to: 'static_page#policy'
get '/development', to: 'static_page#development'
get '/about', to... | 37.818182 | 102 | 0.709135 |
d5856444904ddfce5fec0c570151f3eca0617ca8 | 749 | require File.expand_path(File.dirname(__FILE__) + '/edgecase')
class AboutTrueAndFalse < EdgeCase::Koan
def truth_value(condition)
if condition
:true_stuff
else
:false_stuff
end
end
def test_true_is_treated_as_true
assert_equal __, truth_value(true)
end
def test_false_is_tre... | 22.029412 | 62 | 0.734312 |
ed2090324fcbfc1a4c9cab32a104a6b49b4c86cf | 327 | require 'rails_helper'
require Rails.root.join('spec', 'models', 'shared_examples', 'non_null_field.rb')
describe Bookmark do
subject { build( :bookmark ) }
it { should validate_presence_of :user_id }
it { should validate_presence_of :project_id }
it { should belong_to :user }
it { should belong_to :projec... | 27.25 | 81 | 0.730887 |
d55d41fab85e45ee6b289a3d9e467bcd640be6de | 2,070 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe ProjectFeatureUsage, type: :model do
describe '.jira_dvcs_integrations_enabled_count' do
it 'returns count of projects with Jira DVCS Cloud enabled' do
create(:project).feature_usage.log_jira_dvcs_integration_usage
create(:project).f... | 34.5 | 99 | 0.753623 |
28436548b97bb1861c43c3dbe0e415083a44f05f | 720 | Pod::Spec.new do |s|
s.name = "DFUDependence"
s.version = "2.8.2"
s.summary = "DFUDependence SDK for iOS. "
s.homepage = "https://github.com/ttlock/iOS_TTLock_Demo"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "ttlock" => "chensg@sciener.cn" }
s.platform ... | 40 | 101 | 0.622222 |
e87041e09d625c44220a3795c0ee1a848dcc13da | 984 | class Aescrypt < Formula
desc "Program for encryption/decryption"
homepage "http://aescrypt.sourceforge.net/"
url "http://aescrypt.sourceforge.net/aescrypt-0.7.tar.gz"
sha256 "7b17656cbbd76700d313a1c36824a197dfb776cadcbf3a748da5ee3d0791b92d"
bottle do
cellar :any_skip_relocation
sha256 "0cd940c7c9e59... | 30.75 | 92 | 0.738821 |
bf7fd7bd5df04564713c8c3cdf9e2b7c30c30338 | 9,054 | module MuckFriendsHelper
def all_friends(user)
render :partial => 'friends/all_friends', :locals => { :user => user }
end
# Renders a partial that contains the friends of the given user
# Parameters:
# user1: User whose friends are to be shown
# user2: User whose friends ar... | 51.443182 | 226 | 0.690082 |
b9941b6a72e1008164b1c7845e38dad044ee744e | 341 | # frozen_string_literal: true
require 'date'
require 'prometheus/client'
require_relative 'g'
grunnbeløp_gauge = Prometheus::Client::Gauge.new(:grunnbeloep, docstring: 'Dagens grunnbeloep')
grunnbeløp_gauge.set(Grunnbeløp.by_date(DateTime.now)[:grunnbeløp])
prometheus = Prometheus::Client.registry
prometheus.regist... | 26.230769 | 95 | 0.815249 |
91a0a1b875ddf50cf05b162acb2469e182149e99 | 525 | class Prime::Chains::Ethereum < Prime::Chain
scope :enabled_for_staking, -> { where(eth2_staking_enabled: true) }
with_options if: :eth2_staking_enabled? do
validates :anjin_api_url, presence: true
validates :anjin_api_key, presence: true
validates :external_chain_id, presence: true, numericality: { on... | 26.25 | 86 | 0.691429 |
280672a40f4647a8ac21210cf4d8e4b6ca4b51dc | 1,527 | class Sysbench < Formula
desc "System performance benchmark tool"
homepage "https://github.com/akopytov/sysbench"
url "https://github.com/akopytov/sysbench/archive/1.0.20.tar.gz"
sha256 "e8ee79b1f399b2d167e6a90de52ccc90e52408f7ade1b9b7135727efe181347f"
license "GPL-2.0-or-later"
revision 1
head "https://g... | 40.184211 | 122 | 0.714473 |
21ee2796bd87b6888541cd3fdb1c7abded0da74a | 1,341 | # frozen_string_literal: true
require 'spec_helper'
describe 'Showing instance statistics' do
before do
sign_in user if user
end
# Using a path that is publicly accessible
subject { visit explore_projects_path }
context 'for unauthenticated users' do
let(:user) { nil }
it 'does not show the i... | 21.983607 | 79 | 0.683072 |
62157bdce94072464a05b070ab6e4475b0d0b8c0 | 167 | class AddDeletedAtToInstances < ActiveRecord::Migration
def change
add_column :instances, :deleted_at, :datetime
add_index :instances, :deleted_at
end
end
| 23.857143 | 55 | 0.772455 |
33b6ab3f3e5cff1af86a7a6e1121c4d145c3ab9b | 4,852 | # frozen_string_literal: true
module Gem
DEFAULT_HOST = "https://rubygems.org".freeze
@post_install_hooks ||= []
@done_installing_hooks ||= []
@post_uninstall_hooks ||= []
@pre_uninstall_hooks ||= []
@pre_install_hooks ||= []
##
# An Array of the default sources that come with RubyGems
def self... | 23.215311 | 92 | 0.634171 |
6286a276a7932112f4ff685a66f7d628d010bc35 | 309 | class NavicatForPostgresql < Cask
version '11.0.18'
sha256 'de6e44791b99d33c05da075b33d473a4e512297b17d1549fcda43a831b00ddac'
url 'http://download.navicat.com/download/navicat110_pgsql_en.dmg'
homepage 'http://www.navicat.com/products/navicat-for-postgresql'
link 'Navicat for PostgreSQL.app'
end
| 30.9 | 75 | 0.805825 |
f7ac39cdbb19678108c0cc88edac4f657e79b0fd | 2,016 | # Copyright 2014, Abiquo
#
# 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, soft... | 37.333333 | 99 | 0.652778 |
5d3117f919498ccfa5bc45934f940fde27e2b271 | 718 | cask "wpsoffice" do
version "2.3.0,3826"
sha256 "2dfb2472f65c3721db0aa7ab36d168c481b128ff4098d2f1ecc2c3126e791329"
# wdl1.pcfg.cache.wpscdn.com/ was verified as official when first introduced to the cask
url "https://wdl1.pcfg.cache.wpscdn.com/wpsdl/macwpsoffice/download/#{version.before_comma}.#{version.after... | 34.190476 | 179 | 0.750696 |
ac3f406ee4877d982de5984854cd2ccbc1eb1b65 | 923 | Pod::Spec.new do |s|
s.name = 'Taplytics'
s.version = '1.2.14'
s.author = { 'Taplytics' => 'help@taplytics.com' }
s.license = { :type => 'Commercial', :text => 'See http://taplytics.com/terms' }
s.homepage = 'http://taplytics.com'
s.summary = 'iOS framework for using the Tap... | 48.578947 | 112 | 0.658722 |
39d54ced76b938947f85ee7a7526b566d8b2474c | 61,054 | # Copyright 2015 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 writing,... | 40.702667 | 151 | 0.630311 |
7aa202875793a1cbdc105b704c6b66cac4236371 | 882 | require 'spec_helper'
describe Gitlab::FileResponse do
before do
@file_response = described_class.new StringIO.new('', 'rb+')
end
context '.empty?' do
it 'returns false' do
expect(@file_response.empty?).to be false
end
end
context '.to_hash' do
it 'has `filename` key and `data` key' d... | 25.941176 | 100 | 0.673469 |
035a0edbf7dac24eb74abbc0d336bf84c361e8d6 | 455 | # frozen_string_literal: true
module Orchestration
module Services
module Database
module Adapters
class Sqlite3
def name
'sqlite3'
end
def credentials
{
'username' => '',
'password' => '',
'database' =... | 16.25 | 41 | 0.426374 |
01c6a55f243d8bec43d7e2c6e51038d00712e165 | 124 | require 'test_helper'
class BakerMailerTest < ActionMailer::TestCase
# test "the truth" do
# assert true
# end
end
| 15.5 | 46 | 0.709677 |
261ddc7a39784ecf6b3aa4a736c8056a570f96ee | 339 | class PartitionWorld < Partition
class PartitionTree < Tree
def init(partition, item)
super()
@universeSize = partition.universeSize
@partition = partition
@item = item
@parent = nil
@rank = 0
@count = 1
end
attr_reader :partition
attr_accessor :parent
attr_accessor :rank
attr_access... | 18.833333 | 41 | 0.699115 |
1d9669b7818a8d26c716e725381dc88a29eb0a6c | 912 | class User < ApplicationRecord
has_secure_password
has_secure_token :session_token
before_save :downcase_email
has_many :food_pantries
validates :email, format: {with: URI::MailTo::EMAIL_REGEXP}, presence: true, uniqueness: true
def self.authenticate_by(attributes)
passwords, identifiers = attri... | 28.5 | 118 | 0.719298 |
bbf2de6bbf13ce6338fbdc796b9cd45cedf6e310 | 2,308 | require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../../../shared/enumerator/with_index', __FILE__)
require File.expand_path('../../enumerable/shared/enumeratorized', __FILE__)
describe "Enumerator#with_index" do
it_behaves_like(:enum_with_index, :with_index)
it_behaves_like(:enu... | 31.616438 | 80 | 0.62565 |
b9c5217f9e4927985d83f3f9944d3a0f309892b3 | 305 | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__)))
require 'net/http'
require 'slack-ruby-bot'
require 'socket'
require 'yaml'
require 'slackerbutler/version'
require 'slackerbutler/commands'
require 'slackerbutler/butler'
require 'slackerbutler/bot'
require 'slackerbutler/help'
SlackerButler.run!
| 20.333333 | 53 | 0.8 |
1aac0b1e33e9f06862221e4ee694d836827b0aba | 2,243 | # coding: UTF-8
require_relative '../spec_helper'
describe 'cerner_splunk::heavy_forwarder' do
subject do
runner = ChefSpec::SoloRunner.new(platform: 'centos', version: '6.8') do |node|
node.override['splunk']['config']['clusters'] = ['cerner_splunk/cluster']
node.run_state['cerner_splunk'] = {}
... | 29.906667 | 92 | 0.700401 |
919ef6d71a45349343cbc79230dbc0371ea64b21 | 3,097 | require 'spec_helper'
module RailsParamValidation
RSpec.describe ObjectValidator do
before(:all) do
@validator = ValidatorFactory.create({ name: String, amount: Float })
end
it 'should accept valid hashes' do
match = @validator.matches?([], name: "John Doe", amount: 42.0)
expect(match.matches?).to... | 32.6 | 86 | 0.64514 |
034b706f34eb9ac020fe4ab994d02fe4c13d033f | 1,011 | {
matrix_id: '105',
name: 'can_715',
group: 'HB',
description: 'SYMMETRIC PATTERN FROM CANNES,LUCIEN MARRO,JUNE 1981.',
author: 'L. Marro',
editor: 'I. Duff, R. Grimes, J. Lewis',
date: '1981',
kind: 'structural problem',
problem_2D_or_3D: '1',
num_rows: '715',
num_cols: '715... | 28.885714 | 73 | 0.645895 |
bbcec9abe52ee3edce7abdb7d65354b0c315c65f | 583 | class EnvkeyFetch < Formula
desc "Give it an ENVKEY, get back decrypted config as json"
homepage "https://www.envkey.com"
url "https://github.com/envkey/envkey-fetch/archive/v1.2.8.tar.gz"
sha256 "4d1f55ba8d1c024ddc49752979439d035beb890ddd1fe8b40805aa048c5a5bee"
depends_on "go" => :build
def install
EN... | 26.5 | 75 | 0.687822 |
1c6965105fe6ba7a503ea35d25e6e6cef165f1aa | 745 | # frozen_string_literal: true
require 'active_support'
require 'active_record'
require 'delayed_job'
require 'delayed_job_active_record'
require 'delayed/job_groups/compatibility'
require 'delayed/job_groups/job_extensions'
require 'delayed/job_groups/job_group'
require 'delayed/job_groups/plugin'
require 'delayed/job... | 28.653846 | 82 | 0.795973 |
5d28f822bd381b65f1828c9dc8682de192893473 | 1,388 | # -*- encoding: utf-8 -*-
# stub: jbuilder 2.4.1 ruby lib
Gem::Specification.new do |s|
s.name = "jbuilder".freeze
s.version = "2.4.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["David Heinemeie... | 38.555556 | 112 | 0.663545 |
26a6e18a775053fe56c8ae4c382a9603a68da079 | 373 | require 'fileutils'
require 'pathname'
require 'fakefs/base'
require 'fakefs/fake/file'
require 'fakefs/fake/dir'
require 'fakefs/fake/inode'
require 'fakefs/fake/symlink'
require 'fakefs/file_system'
require 'fakefs/fileutils'
require 'fakefs/file'
require 'fakefs/file_test'
require 'fakefs/dir'
require 'fakefs/globbe... | 23.3125 | 29 | 0.793566 |
4a38cb9834e3048fa9a9c5ddae7117e5c1cb9ee8 | 6,851 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... | 35.133333 | 89 | 0.636695 |
87d9adade0409230b9767e9cfce5e1f783af7858 | 8,922 | # encoding: UTF-8
require_relative 'spec_helper'
require ::File.join ::File.dirname(__FILE__), '..', 'libraries', 'uri'
require ::File.join ::File.dirname(__FILE__), '..', 'libraries', 'endpoints'
describe 'openstack-common::default' do
describe 'Openstack endpoints' do
let(:runner) { ChefSpec::SoloRunner.new(CH... | 38.623377 | 127 | 0.559292 |
e21894d37d87fed52e049d4f6a89d8f88443ae35 | 1,198 | require File.join(ENV.fetch('RAILS_ROOT'), 'config', 'environment')
running = true
Signal.trap(:TERM) { running = false }
def process_deposits(coin, channel, deposit)
# Skip if transaction is processed.
return if PaymentTransaction::Normal.where(txid: deposit[:id]).exists?
# Skip zombie transactions (for which... | 30.717949 | 113 | 0.706177 |
ac923f64b5232595c7566e3708f0c3ca668e4240 | 467 | # frozen_string_literal: true
module Types
class ContainerExpirationPolicyCadenceEnum < BaseEnum
OPTIONS_MAPPING = {
'1d': 'EVERY_DAY',
'7d': 'EVERY_WEEK',
'14d': 'EVERY_TWO_WEEKS',
'1month': 'EVERY_MONTH',
'3month': 'EVERY_THREE_MONTHS'
}.freeze
::ContainerExpirationPolicy... | 25.944444 | 81 | 0.691649 |
e93eed3d741cbc9046a0979b6b00254184bc0505 | 646 | require 'test_helper'
module Regaliator
module V15
class ClientTest < Minitest::Test
def setup
@config = Configuration.new
@subject = Client.new(@config)
end
def test_versioned_client_inherits_from_client
assert_operator V15::Client, :<, Regaliator::Client
end
... | 26.916667 | 80 | 0.664087 |
1ca84ff098c4ba33da20716f9b3e574ced805b50 | 1,157 | class Slackcat < Formula
desc "Command-line utility for posting snippets to Slack"
homepage "https://github.com/vektorlab/slackcat"
url "https://github.com/bcicen/slackcat/archive/refs/tags/1.7.3.tar.gz"
sha256 "2e3ed7ad5ab3075a8e80a6a0b08a8c52bb8e6e39f6ab03597f456278bfa7768b"
license "MIT"
bottle do
s... | 44.5 | 122 | 0.78911 |
1a711e0569a40d33a67e5baba55a4d0f4820743f | 1,019 | # coding: utf-8
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "omniauth/xero/version"
Gem::Specification.new do |spec|
spec.name = "omniauth-xero"
spec.version = Omniauth::Xero::VERSION
spec.authors = ["Kale Worsley"]
spec.email ... | 37.740741 | 74 | 0.667321 |
618a647d1c72b9a096e7c177111623237f918c4b | 19,616 | require 'logstash/namespace'
require 'logstash/outputs/base'
require 'java'
require 'logstash-integration-kafka_jars.rb'
require 'logstash/plugin_mixins/kafka_support'
# Write events to a Kafka topic. This uses the Kafka Producer API to write messages to a topic on
# the broker.
#
# Here's a compatibility matrix that ... | 49.660759 | 258 | 0.699429 |
b9dbf512e1b9c6bdbc679effaae57e96ac3a77c2 | 325 | require File.join(File.dirname(__FILE__), '..', 'spec_helper')
describe "math:tan" do
it "is implemented" do
Machine.new.should respond_to(:tan)
end
it "requires one operand" do
lambda { Machine.run([:tan]) }.should underflow_stack
lambda { Machine.run([nil, :tan]) }.should_not underflow_stack
end... | 25 | 66 | 0.695385 |
03b46c5bf3b992ed98a58f4924e9bdd4233b72d4 | 1,145 | require 'chef_helper'
RSpec.describe Registry do
before do
allow(Gitlab).to receive(:[]).and_call_original
end
context 'registry is disabled' do
before do
stub_gitlab_rb(
registry: {
enabled: false
}
)
end
it 'should return false' do
expect(described_... | 19.083333 | 61 | 0.634061 |
1d493f56859972b099cf8c6678dd5da9f8e02a74 | 2,157 | # frozen_string_literal: true
require "uri"
require "cgi"
require "net/http"
require "capybara"
require "capybara/jsdom/version"
require "capybara/jsdom/node"
require "capybara/jsdom/browser"
module Capybara
module Jsdom
# Capybara driver using JSDom lightweight fast DOM implementation.
class Driver < Capyb... | 22.010204 | 97 | 0.637459 |
21e42471028860849c76896f1b786297aca983cd | 2,393 | module ActiveScaffold::Config
class FieldSearch < Base
self.crud_type = :read
def initialize(core_config)
@core = core_config
@text_search = self.class.text_search
# start with the ActionLink defined globally
@link = self.class.link.clone
end
# global level configuration
... | 32.780822 | 156 | 0.653991 |
5dbc183ff88801ee0b6b0f659240eedbc0d49c3b | 384 | require 'medusa'
begin
# make sure that the first option is a URL we can crawl
url = URI(ARGV[0])
rescue
puts <<-INFO
Usage:
medusa count <url>
Synopsis:
Crawls a site starting at the given URL and outputs the total number
of unique pages on the site.
INFO
exit(0)
end
Medusa.crawl(url) do |medusa|
me... | 16.695652 | 70 | 0.705729 |
627b0b939c79f3e73ccad422a01704968ec6c410 | 1,047 | require 'test_helper'
class UsersControllerTest < ActionDispatch::IntegrationTest
include Devise::Test::IntegrationHelpers
setup do
sign_in users(:admin)
@user = users(:admin)
end
test "should get index" do
get users_url
assert_response :success
end
test "should get new" do
get new_us... | 20.134615 | 59 | 0.640879 |
4a48fb8e6fd8a93d012b48046bc8ff6bdbbe7a32 | 4,196 | class QbwcApi < ActionWebService::API::Base
inflect_names false
# --- [ QBWC server version control ] ---
# Expects:
# * string ticket = A GUID based ticket string to maintain identity of QBWebConnector
# Returns string:
# * Return a string describing the server version and any other information tha... | 40.737864 | 111 | 0.592946 |
f82b817af08470b60b8899537226f2308de9413d | 197 | require "omniauth-gca/version"
require "omniauth/strategies/gca"
require "gca_sso_client/engine"
require "gca_sso_client/concerns/controllers/gca_sso_client_authentication"
module GcaSsoClient
end | 28.142857 | 75 | 0.862944 |
1dea8a150e81ca037d298bc28aaed25c7e174955 | 591 | class Admin::TaxDocsController < Admin::BaseController
before_action :year_check, except: [:index]
def index
# FIXME
@years = [2013]
end
def show
redirect_to action: :index, anchor: "y#{year}"
end
def form_1065
@form_1065 = TaxDocs::Form1065Presenter.new(year)
end
def schedule_d
... | 16.416667 | 55 | 0.675127 |
39f6c015dcc735c3a99b4c7ffc12adae65dd7dec | 1,598 | class Vramsteg < Formula
desc "Add progress bars to command-line applications"
homepage "https://gothenburgbitfactory.org/projects/vramsteg.html"
url "https://gothenburgbitfactory.org/download/vramsteg-1.1.0.tar.gz"
sha256 "9cc82eb195e4673d9ee6151373746bd22513033e96411ffc1d250920801f7037"
head "https://github... | 42.052632 | 94 | 0.783479 |
6a7d1594ad7aec43ac71f83d3e7e4176be2b5acd | 1,189 | # frozen_string_literal: true
module Stupidedi
module Versions
module FunctionalGroups
module FiftyTen
module SegmentDefs
s = Schema
e = ElementDefs
r = ElementReqs
HD = s::SegmentDef.build(:HD, "Health Coverage",
"To provide information on healt... | 37.15625 | 73 | 0.602187 |
acb78fd4bc110da7abf45abad63ce340616f1a75 | 1,980 | # frozen_string_literal: true
require 'tempfile'
SiteHealth.require_optional_dependency('html-proofer')
module SiteHealth
# Checks for various HTML misstakes (backed by the excellent HTMLProofer gem)
class HTMLProofer < Checker
name 'html_proofer'
types 'html'
protected
def check
tempfile(... | 29.117647 | 87 | 0.687374 |
7990a3339e8f02611dbe7fb48a6c8e375efd2535 | 1,574 | # frozen_string_literal: false
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic ... | 39.35 | 170 | 0.625794 |
ed6ea638235cb4c84f40e66383afc935d34a12ff | 4,500 | class GitOperationService
attr_reader :user, :repository
def initialize(new_user, new_repository)
@user = new_user
@repository = new_repository
end
def add_branch(branch_name, newrev)
ref = Gitlab::Git::BRANCH_REF_PREFIX + branch_name
oldrev = Gitlab::Git::BLANK_SHA
update_ref_in_hooks(re... | 28.66242 | 111 | 0.7 |
e2fd16fbd38a3de942f6039cbfcf58643577a2cc | 833 | require_relative 'test_helper'
require 'apartment/resolvers/database'
class ExcludedModelsTest < Apartment::Test
def setup
setup_connection("mysql")
Apartment.configure do |config|
config.tenant_resolver = Apartment::Resolvers::Database
config.excluded_models = %w(Company User)
end
supe... | 25.242424 | 76 | 0.777911 |
2166841f2ae7297458735af495e60e882d26d06c | 3,624 | # This file defines factory methods that are functionally related
# to the Expertiza quiz feature. Factories can be used to create
# objects unique to quizzes, including:
# QuizQuestionnaire
# QuizQuestion
# QuizQuestionChoice
# QuizResponseMap
# QuizResponse
# Answer
#
# Note that many of these classes are... | 37.75 | 95 | 0.750828 |
33c87a3525701c8d80b77cc3352603085292f425 | 1,995 | # typed: ignore
require 'ddtrace/contrib/support/spec_helper'
require_relative 'support/helper'
RSpec.describe 'ClientTracerTest' do
include_context 'Sidekiq testing'
subject(:perform_async) { job_class.perform_async }
let(:job_class) { EmptyWorker }
before do
Sidekiq.configure_client do |config|
... | 27.328767 | 70 | 0.690226 |
627ee4a66e2ddbbfc2c95831cb6a747e3cacdd78 | 974 | class Chicken < Formula
desc "Compiler for the Scheme programming language"
homepage "http://www.call-cc.org/"
url "http://code.call-cc.org/releases/4.10.0/chicken-4.10.0.tar.gz"
sha256 "0e07f5abcd11961986950dbeaa5a40db415f8a1b65daff9c300e9b05b334899b"
head "http://code.call-cc.org/git/chicken-core.git"
b... | 28.647059 | 95 | 0.725873 |
1df961b31dd0e603bf94cf3012e1dfd037411061 | 59 | module Kickscraper
class Update < Api
end
end | 11.8 | 22 | 0.627119 |
26f484a8940375525125dac7739fdc0df4c7d9e6 | 5,090 | require 'uri'
require 'stringio'
require 'rack'
require 'rack/lint'
require 'rack/utils'
require 'rack/response'
module Rack
# Rack::MockRequest helps testing your Rack application without
# actually using HTTP.
#
# After performing a request on a URL with get/post/put/delete, it
# returns a MockResponse wit... | 26.649215 | 108 | 0.594303 |
5df88d5626f7a673eed64aeaa304c415d214d85b | 939 | class CreateUserAuthentications < ActiveRecord::Migration
def change
create_table :user_authentications do |t|
t.integer :user_id
t.string :uuid
t.string :uid
t.string :provider
t.string :name
t.string :email
t.string :username
t.string :toke... | 27.617647 | 58 | 0.603834 |
b94343ed2596027ea51bda126175f81e7ca535df | 91 | module Japanese
module Train
module Access
VERSION = "1.1.0"
end
end
end
| 11.375 | 23 | 0.615385 |
01d0fd227c7c2252fc5f767c8245a7b82bde5df0 | 212 | module Mole
module Version
MAJOR = 1
MINOR = 0
TINY = 15
# Returns the version string for the library.
#
def self.version
[ MAJOR, MINOR, TINY].join( "." )
end
end
end
| 13.25 | 49 | 0.556604 |
39194baab3e30d29a3fe3e8fdd9387a565f7ce98 | 637 | Pod::Spec.new do |s|
s.name = 'MSCircularSlider'
s.version = '1.2.2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.authors = { 'ThunderStruct' => 'mohamedshahawy@aucegypt.edu' }
s.summary = 'A full-featured circular slider for iOS applications'
s.homepage ... | 39.8125 | 127 | 0.587127 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.