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 |
|---|---|---|---|---|---|
915cabca4a0cf310877fcb96aea22b8bda7c5f14 | 2,535 | #!/usr/bin/env rspec
require 'spec_helper'
module MCollective
module DDL
describe DataDDL do
before :each do
Cache.delete!(:ddl) rescue nil
@ddl = DDL.new("rspec", :data, false)
@ddl.metadata(:name => "name", :description => "description", :author => "author", :license => "license"... | 38.409091 | 174 | 0.568442 |
e8ff2157b05cc8af0e3cdb676336c9bef18f84ad | 2,699 | require "active_record"
require "active_support/lazy_load_hooks"
module ActiveRecord
module PGEnum
KNOWN_VERSIONS = %w[4.1 4.2 5.0 5.1 5.2 6.0 6.1].map { |v| Gem::Version.new(v) }
class << self
attr_reader :enabled_version
def install(version)
@enabled_version = approximate_version(vers... | 29.021505 | 107 | 0.674324 |
289708a68ba9d9eb29c81cc83a466cdb8e34ce7b | 85 | # frozen_string_literal: true
class SoundType < BaseObject
implements DoiItem
end
| 14.166667 | 29 | 0.811765 |
87307b9819ffaa8f440a12cf448d1a16ea83d29f | 366 | module Fog
module OpenStack
class Monitoring
class Real
def create_metric_array(metrics_list)
request(
:body => Fog::JSON.encode(metrics_list),
:expects => [204],
:method => 'POST',
:path => 'metrics'
)
end
end
... | 18.3 | 55 | 0.480874 |
ff6b832894ad7271ddd6a7ff4aece2095a68a80b | 594 | Rails.application.routes.draw do
devise_for :users, :controllers => { registrations: 'registrations' }
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
resources :users, only:[:show] do
resources :friendships, only:[:create,:destroy]
resources :favorites , ... | 28.285714 | 101 | 0.703704 |
acce41bcf443105e03a6a8e566edbfb1e1e7868f | 1,127 | test_name 'C100297 - A resource triggered by a refresh that fails should be reported as a failure when using --detailed-exitcodes' do
tag 'audit:high',
'audit:integration' # Service type interaction with --detailed-exitcodes
manifest =<<EOS
exec{'true':
command => 'true',
path => ['/bin', '/... | 30.459459 | 133 | 0.629991 |
218aabd3f008a16af0a515ca5132c83602017dea | 6,271 | # Represents a OpenShift Team.
# @!attribute [r] name
# @return [String] Name reserved for this team.
# @!attribute [r] owner
# @return [CloudUser] The {CloudUser} that owns this team.
# @!attribute [r] pending_ops
# @return [Array[PendingTeamOps]] List of {PendingTeamOps} that need to be performed on this team.
... | 33.534759 | 161 | 0.665444 |
e9c94f09c999fb8e8f703f6f7b22cb2fcf3fa47a | 6,589 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe JiraConnect::SubscriptionsController do
let_it_be(:installation) { create(:jira_connect_installation) }
describe '#index' do
before do
request.headers['Accept'] = content_type
get :index, params: { jwt: jwt }
end
let(:co... | 32.141463 | 179 | 0.61633 |
6a78529173f97aadcce4420b4a775992e0ae6d13 | 1,320 | require "rails_helper"
<% module_namespacing do -%>
RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:routing) %> do
describe "routing" do
<% unless options[:singleton] -%>
it "routes to #index" do
expect(get: "/<%= ns_table_name %>").to route_to("<%= ns_table_name %>#index")
en... | 30.697674 | 103 | 0.578788 |
bb91c84f3ec65dd751d139ffb4a85effb0f07f2a | 252 | class ApplicationController < ActionController::API
acts_as_token_authentication_handler_for User
before_action :require_authentication!
private def require_authentication!
throw(:warden, scope: :user) unless current_user.presence
end
end
| 28 | 61 | 0.825397 |
08023ddb7b61e6cf116e5a62896be10ccf20c89c | 2,696 | class PgbouncerHelper < BaseHelper
attr_reader :node
def database_config(database)
settings = node['gitlab']['pgbouncer']['databases'][database].to_hash
# The recipe uses user and password for the auth_user option and the pg_auth file
settings['auth_user'] = settings.delete('user') if settings.key?('us... | 33.283951 | 98 | 0.659125 |
7a5b4102efee9b90d9843e64f19d0e8d2035e094 | 434 | # This migration comes from publify_core_engine (originally 20160108184201)
class MoveLastConnectionToLastSignInAt < ActiveRecord::Migration[4.2]
class User < ActiveRecord::Base
end
def up
User.find_each do |user|
user.update_attribute(:last_sign_in_at, user.last_connection)
end
end
def down
... | 24.111111 | 75 | 0.751152 |
874b39f1e5944a4706f19547299839b3d7aaf8da | 129 | module QualityEnsurance
class BundlerAuditEnsurance < BaseLintEnsurance
def command
'bundle audit'
end
end
end
| 16.125 | 49 | 0.736434 |
f8c2972181de54e8750cb8bcaac9ce4c20f4818e | 554 | Pod::Spec.new do |s|
s.name = 'JCNavigator'
s.version = '1.0.2'
s.summary = 'A decoupled navigator framework of jumping between modules or apps for iOS development.'
s.homepage = 'https://github.com/imjoych/JCNavigator'
s.author = { 'ChenJianjun' => 'imjoych@gmail.com' }
s.license = { :... | 34.625 | 106 | 0.633574 |
ab7916481a299e5ec55ed6346e45fd7510915df9 | 92 | json.partial! "meeting_follow_ups/meeting_follow_up", meeting_follow_up: @meeting_follow_up
| 46 | 91 | 0.869565 |
0368c625691107273620f182c66732c33488dfaf | 607 | class ArticleObserver < ActiveRecord::Observer
def before_save(record)
if (record.is_a?(Article) && record.save_version?) || record.is_a?(Comment)
@event = Event.new
@event.mode = case
when record.is_a?(Comment) then 'comment'
when record.new_record? then 'publish'
else 'edi... | 28.904762 | 142 | 0.652389 |
ac1151e6643ce09375c6525aa7d37bdaf2b00a47 | 2,211 | # -*- encoding: utf-8 -*-
# stub: activesupport 5.1.6 ruby lib
Gem::Specification.new do |s|
s.name = "activesupport".freeze
s.version = "5.1.6"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "changelog_uri" => "https://github.com/... | 49.133333 | 218 | 0.665762 |
ab9c567866f6d7d6b84d1286cd5c351980d1de26 | 227 | # frozen_string_literal: true
module Amadeus
# A list of directions, as used in Busiest Travel Period
module Direction
# Airport
ARRIVING = 'ARRIVING'.freeze
# City
DEPARTING = 'DEPARTING'.freeze
end
end
| 18.916667 | 58 | 0.704846 |
7ac9da0582f277a8291b7a9dc45dff3310ff954f | 447 | cask :v1 => 'owncloud' do
version '1.7.0.1339'
sha256 'baa848c46e0a1cc0e88cf78a2419bfdb7d55fd984100d9fe1babc4a97eb00d9a'
url "https://download.owncloud.com/desktop/stable/ownCloud-#{version}.pkg"
homepage 'http://owncloud.com'
license :unknown
pkg "ownCloud-#{version}.pkg"
uninstall :pkgutil => [
... | 29.8 | 76 | 0.61745 |
f84b61a6bd945942f96abb026d9743456c875865 | 557 | cask 'synology-cloud-station' do
version '3.2-3487'
sha256 'c2446bb15ce0e113253635a3457643c260f9c92cf9aec5e4d69b5d49c2592631'
url "https://global.download.synology.com/download/Tools/CloudStation/#{version}/Mac/Installer/synology-cloud-station-#{version.sub(%r{.*-},'')}.dmg"
name 'Synology Cloud Station'
hom... | 37.133333 | 151 | 0.723519 |
ed0b46502e859bf80330fa0a6bed57be0f57535d | 1,246 | # frozen_string_literal: true
require 'rails_helper'
describe HistogramPlotter do
let(:course) do
create(:course, slug: "Sage's/te,_st_(slug)", id: 1, start: 1.year.ago, end: 1.day.from_now)
end
let(:opts) { { existing_only: true, minimum_improvement: 1 } }
let(:article) { create(:article) }
let(:revisi... | 26.510638 | 96 | 0.674157 |
6ab38e7599f8992f8a361036e3d5be8ac7305235 | 222 | require 'rubygems'
require 'bundler/setup'
require "minitest/reporters"
reporter_options = { color: true }
Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(reporter_options)]
require 'minitest/autorun'
| 24.666667 | 85 | 0.792793 |
398d96d9b50e0d061d5f17b5958b6665ad01ea5f | 7,149 | #!/usr/bin/env ruby
require 'json'
require 'yaml'
require 'puppet_litmus'
require_relative '../lib/task_helper'
def install_ssh_components(platform, container)
case platform
when %r{debian}, %r{ubuntu}, %r{cumulus}
run_local_command("docker exec #{container} apt-get update")
run_local_command("docker exec ... | 50.702128 | 158 | 0.707651 |
61a951fac44c154379269afa010db14ce9ce7e45 | 873 | module RspecLogFormatter
module Analysis
class PrettyPrinter
def initialize(results)
@results = results
end
def to_s
results = @results.reject do |result|
result[:fraction] == 0.0
end.first(10)
header = if results.empty?
"None of the specs we... | 28.16129 | 114 | 0.557847 |
2696f43509817cfadbbab6a5ed365d3f20e31fe9 | 1,766 | module Pageflow
class Membership < ApplicationRecord
belongs_to :user
belongs_to :entity, polymorphic: true
belongs_to :entry,
-> { where(pageflow_memberships: {entity_type: 'Pageflow::Entry'}) },
foreign_key: 'entity_id',
optional: true
belongs_to :account... | 32.109091 | 93 | 0.632503 |
7a5ea5f62bbe3ff043ad1dcaa1cf5329815cc06e | 1,608 | # 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... | 32.16 | 86 | 0.709577 |
bf363de4ca2dc009bc57003bffdb7ef302728a03 | 1,491 | module Jets::Commands::Markdown
class Creator
cattr_accessor :mute
def self.create_all
clean
new.create_all
end
def self.clean
FileUtils.rm_rf("docs/_reference")
FileUtils.rm_f("docs/reference.md")
end
def cli_classes
Jets::Commands::Base.namespaced_commands.ma... | 25.706897 | 114 | 0.639168 |
bb3fc57b8c5d94e3db1b685c016aa216bcc23f17 | 6,148 | require 'spec_helper'
describe API::LdapGroupLinks, api: true do
include ApiHelpers
let(:owner) { create(:user) }
let(:user) { create(:user) }
let(:admin) { create(:admin) }
let!(:group_with_ldap_links) do
group = create(:group)
group.ldap_group_links.create cn: 'ldap-group1', group_access: Gitlab... | 37.717791 | 152 | 0.675016 |
036f826357089c92373378982855eb1331af1171 | 1,440 | require 'active_support'
require 'active_support/core_ext'
Dir["#{__dir__}/mask_type/*.rb"].each {|file| require file }
module Maskdump
class Mask
DIR_PREFIX = "maskdump/mask_type".freeze
def initialize(records, column_settings)
@column_settings = column_settings
@records = records
end
... | 27.692308 | 114 | 0.663889 |
28fb4d0b516dfed131d29628f39cf5ec00560b2c | 658 | require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Testing
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails v... | 32.9 | 82 | 0.764438 |
1c283e9f9e3bbb3fcac3b37d19ebc295fbcce51e | 937 | module VagrantPlugins
module ChefZero
module Action
class Reconfig
include VagrantPlugins::ChefZero::EnvHelpers
include VagrantPlugins::ChefZero::ServerHelpers
def initialize(app, env)
@app = app
if chef_zero_enabled?(env)
@key = get_key_path(env)
... | 22.853659 | 79 | 0.597652 |
61493b69249bd457f235b27e79e8f6a10d718ab2 | 15,451 | #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#
# Copyright (c) 2016, Electric Power Research Institute (EPRI)
# All rights reserved.
#
# OpenADR ("this software") is licensed under BSD 3-Clause license.
#
# Redistribution and use in source and binary forms, with or without m... | 63.32377 | 206 | 0.628244 |
8755871b0c492f92625f823bf5b44170524c24ba | 872 | module Librato
module Services
class Numbers
def self.format_for_threshold(threshold, number, tolerance=2)
threshold_decimals = number_decimal_places(threshold)
number_decimals = number_decimal_places(number)
if !threshold_decimals || !number_decimals
return number
... | 24.914286 | 69 | 0.62156 |
28c65be44eefa5b4dc103d2b1b80d2733e278419 | 275 | class Admin::AccountRequestsController < AdminController
def index
@open_account_requests = AccountRequest.where(confirmed_at: nil).order('created_at DESC')
@closed_account_requests = AccountRequest.where.not(confirmed_at: nil).order('confirmed_at DESC')
end
end
| 39.285714 | 101 | 0.796364 |
28e99d31b3c5af5ee201a793da64bb1b62f35f12 | 672 | require 'spec_helper'
module ShouldaRouting
module Namespaces
describe Method do
subject { Class.new.extend described_class }
describe "#namespace" do
it "calls Namespaces::Base test! method with correct params" do
namespace_instance = Namespaces::Base.new
namespace_insta... | 28 | 71 | 0.590774 |
386d06d4e055901842bc8d6af1a5556a7954fce3 | 1,018 | #
# Be sure to run `pod lib lint PGFoundation.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'PGFoun... | 30.848485 | 102 | 0.604126 |
bffc8ea950e8b9f0bcb694dd572fec091f4be236 | 3,003 | # frozen_string_literal: true
require "concurrent-ruby"
require "ferrum/browser/subscriber"
require "ferrum/browser/web_socket"
module Ferrum
class Browser
class Client
INTERRUPTIONS = %w[Fetch.requestPaused Fetch.authRequired].freeze
def initialize(browser, ws_url, id_starts_with: 0)
@brow... | 29.441176 | 82 | 0.609391 |
bbc1e116e6e18c077021ca2aefe4bcf99b83b7ea | 172 | require File.expand_path('../../../../../spec_helper', __FILE__)
describe "Gem::StubSpecification::StubLine#name" do
it "needs to be reviewed for spec completeness"
end
| 28.666667 | 64 | 0.72093 |
bf9600f0151e2fe27e35d15fbf81a6cf29828e47 | 14,013 | # encoding: utf-8
require "logstash/outputs/base"
require "logstash/namespace"
require "logstash/plugin_mixins/aws_config"
# This output lets you aggregate and send metric data to AWS CloudWatch
#
# ==== Summary:
# This plugin is intended to be used on a logstash indexer agent (but that
# is not the only way, see belo... | 40.267241 | 170 | 0.675087 |
289dfb39c23ee22ed733b3a9bff73628680b0583 | 895 | class Taktuk < Formula
desc "Deploy commands to (a potentially large set of) remote nodes"
homepage "http://taktuk.gforge.inria.fr/"
url "https://gforge.inria.fr/frs/download.php/30903/taktuk-3.7.5.tar.gz"
sha256 "62d1b72616a1b260eb87cecde2e21c8cbb844939f2dcafad33507fcb16ef1cb1"
bottle do
cellar :any
... | 33.148148 | 92 | 0.760894 |
1d496db2b78a3f0fe83bceb64188f9e1584553ad | 1,183 | class Ktoblzcheck < Formula
desc "Library for German banks"
homepage "http://ktoblzcheck.sourceforge.net/"
url "https://downloads.sourceforge.net/project/ktoblzcheck/ktoblzcheck-1.48.tar.gz"
sha256 "0f4e66d3a880355b1afc88870d224755e078dfaf192242d9c6acb8853f5bcf58"
bottle do
sha256 "d176f6ea34fbda13e6ce06... | 42.25 | 104 | 0.764159 |
61b7f47adccd0750bd4761f0cf27f0b26790666f | 1,102 | require_relative "../../lib_lock/ac-library-rb/convolution"
require_relative "../../lib_lock/ac-library-rb/crt"
require_relative "../../lib_lock/ac-library-rb/dsu"
require_relative "../../lib_lock/ac-library-rb/fenwick_tree"
require_relative "../../lib_lock/ac-library-rb/floor_sum"
require_relative "../../lib_lock/ac-l... | 47.913043 | 62 | 0.751361 |
ed5e76ee5f5413e231088ab425084c631f89c408 | 662 | module Hearthstone
module Log
class GameTurn
attr_accessor :number, :player, :timestamp
attr_reader :events
def initialize(number: nil, player: nil, timestamp: nil)
@events = []
@number = number
@player = player
@timestamp = timestamp
end
def... | 20.6875 | 62 | 0.522659 |
03ad50fbb75021589e077a21884a0550c5ee4787 | 1,617 | require 'acceptance_spec_helper'
feature "Global server alias" do
background { config_exists <<-CONFIG }
default_destination 'foo:bar'
project :foo do
environment :bar do
server do
host "1.2.3.4"
port 5678
user "pivo"
location "/var/apps/vodka"
e... | 21 | 45 | 0.606061 |
ac4d04b80eee515d53ec77a7033b744818cec9de | 1,625 | class Libarchive < Formula
desc "Multi-format archive and compression library"
homepage "https://www.libarchive.org"
url "https://www.libarchive.org/downloads/libarchive-3.3.2.tar.gz"
sha256 "ed2dbd6954792b2c054ccf8ec4b330a54b85904a80cef477a1c74643ddafa0ce"
bottle do
cellar :any
sha256 "ee8c56199da11... | 36.111111 | 93 | 0.694154 |
91751aea05ea33baa17fc26221fd34e9505a7379 | 579 | # Load the gem
require 'groupdocs_conversion_cloud'
require 'common_utilities/Utils.rb'
class Working_With_Files
def self.Conversion_Ruby_Copy_File()
# Getting instance of the API
$api = Common_Utilities.Get_FileApi_Instance()
$request = GroupDocsConversionCloud::CopyFileRequest.new("conversi... | 36.1875 | 150 | 0.746114 |
61e072aeae3362e140f9f32f8e2afa6f52b54a43 | 709 | module RgGen
module VerilogUtility
class InterfacePort
def initialize(attributes)
@attributes = attributes
end
def to_s
"#{interface_type} #{port_identifier}"
end
def identifier
Identifier.new(@attributes[:name], nil, nil, nil)
end
private
... | 20.852941 | 62 | 0.589563 |
1c407ae4e58681358c6f6304099dcd4e8aa31f61 | 3,080 | class Opro::Oauth::AuthController < OproController
before_action :opro_authenticate_user!
before_action :ask_user!, :only => [:create]
def new
@redirect_uri = params[:redirect_uri]
@client_app = Opro::Oauth::ClientApp.find_by_app_id(params[:client_id])
@scopes = s... | 38.987342 | 104 | 0.718506 |
e89d07b35f462103c144a527b46641f4ccb70389 | 1,424 | # Copyright (c) 2008-2013 Michael Dvorkin and contributors.
#
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
require File.expand_path(File.... | 31.644444 | 109 | 0.660815 |
edd7f5972435a833354cdd46c5d4294226105869 | 818 | # 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... | 26.387097 | 74 | 0.717604 |
b98cc290038077288772d32e0dfdb85c93225898 | 814 | Pod::Spec.new do |s|
s.name = 'TTReachabilitySwift'
s.version = '5.1.0'
s.module_name = 'Reachability'
s.homepage = 'https://github.com/iWenterHuang/Reachability.swift'
s.authors = {
'iWenter' => 'iwenter@163.com'
}
s.summary = 'Replacement for Apple\'s Reachability re-writt... | 30.148148 | 94 | 0.632678 |
f71a4d37c602f6ffd5e530949c460970c3f5e7f5 | 40 | json.partial! "roles/role", role: @role
| 20 | 39 | 0.7 |
2687fcbc3d2fd894781576074a5deed5620bede9 | 4,880 | module Ironfan
class Dsl
class Component < Ironfan::Dsl
include Gorillib::Builder
include Gorillib::Concern
include Ironfan::Plugin::Base; register_with Ironfan::Dsl::Compute
field :cluster_name, Symbol
field :facet_name, Symbol
field :realm_name, Symbol
field :name,... | 32.317881 | 133 | 0.633811 |
bb36cbf757891b36d87b03070322bc597d96757e | 583 | module Arbre
module HTML
class Document < Tag
def build(*args)
super
build_head
build_body
end
def document
self
end
def tag_name
'html'
end
def doctype
'<!DOCTYPE html>'.html_safe
end
def to_s
doct... | 13.55814 | 83 | 0.495712 |
ffe29794c607a9d0495c2424e71a8b6de5745608 | 136 | require File.join(File.dirname(__FILE__), 'matchers', 'validation')
require File.join(File.dirname(__FILE__), 'matchers', 'association') | 68 | 68 | 0.772059 |
03b8ef45832f7c24cb632a54ce2a98a63bb9a0f9 | 528 | class ImportSourceDataTaskPresenter < JobTaskPresenter
def to_hash
super.merge({
:source_id => model.payload.source_id,
:destination_id => model.payload.destination_id,
:row_limit => model.payload.row_limit,
:truncate => model.payload... | 44 | 105 | 0.583333 |
4a52e6f76cefa2d3cc394aa7fe5706b9dc807d5e | 373 | require "bundler/setup"
require "simple_dsl_parser"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.expect... | 24.866667 | 66 | 0.758713 |
2879b84c0b24e4da0a7374b926e5ed6124a4b3f1 | 170 | module BoolENV
BOOL_TRUE = ["yes", "true", "1"]
def self.[](env_variable)
ENV[env_variable].present? && BOOL_TRUE.include?(ENV[env_variable].downcase)
end
end
| 21.25 | 80 | 0.682353 |
acf62a830456621d6a21d7da5c735cce3af6e2d3 | 965 | require 'geocoder'
require 'xmlsimple'
#filenames = ["TR Oulu 2017 Day 0 Prologi",
# "TR Oulu 2017 Day 1",
# "TR Oulu 2017 Day 2",
# "TR Oulu 2017 Day 3",
# "TR Oulu 2017 Day 4"]
filenames = ["TR Oulu 2017 Day 4"]
filenames.each do |filename|
puts "starting queryinf of #{filename}"
hash = XmlSimple.x... | 24.125 | 73 | 0.574093 |
28310c81c17394e39f0538c94fffcfc34f6b4f11 | 1,312 | #
# Be sure to run `pod lib lint BKMVVMKit.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'BKMVVMKit... | 39.757576 | 177 | 0.58689 |
4a190992560548dced01ee8a1fa9cc7dfdb203ca | 4,119 | require 'lims-core/persistence/search/all'
module Lims::Core
shared_examples_for "comparison filter for plate" do
let(:filter_model) { "plate" }
let(:description) { "lookup plates with 8 rows" }
let(:filter) { Persistence::ComparisonFilter.new(:criteria => criteria, :model => filter_model)}
let(:searc... | 34.325 | 126 | 0.556203 |
bfb1b05ae277da416193fb4890b4439bbec4ccb5 | 26 | require './demo'
run Demo
| 8.666667 | 16 | 0.692308 |
62dfdf6ba61681cadfe6f58e640b99e59391ca4a | 2,386 | require 'rake'
require 'rake/tasklib'
require 'rack/test'
module GrapeSwagger
module Rake
class OapiTasks < ::Rake::TaskLib
include Rack::Test::Methods
attr_reader :oapi
attr_reader :api_class
def initialize(api_class)
super()
@api_class = api_class
define_tasks... | 23.86 | 96 | 0.550712 |
28036ce57d6e2fe95eb2985fac8cbaf95dc9dec0 | 1,336 | module FastVersioning
# a timeline for a tracked property
class Timeline
# @param name [String] tracked property name
# @param fast_versions [ActiveRecord::Collection] FastVersion collection
#
def initialize(fast_versions:, name:)
self.fast_versions = fast_versions
self.name = name
e... | 27.833333 | 104 | 0.617515 |
d5c9e9550d7c6d35fc75457a06d9bc2a2601943f | 494 | # Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attac... | 61.75 | 169 | 0.831984 |
1c4034cd764bdb8b4f676c5dadbd92012d1139bb | 5,198 | #!/opt/puppetlabs/puppet/bin/ruby
require 'json'
require 'puppet'
require 'openssl'
def create_authorization_v1beta1_namespaced_local_subject_access_review(*args)
header_params = {}
params=args[0][1..-1].split(',')
arg_hash={}
params.each { |param|
mapValues= param.split(':',2)
if mapValues[1].inclu... | 30.940476 | 138 | 0.655444 |
ffca309b6459b50cf3b2e5bced25744acff3a2db | 278 | require 'flic/protocol/commands'
require 'flic/protocol/commands/command'
require 'flic/protocol/primitives/bluetooth_address'
module Flic
module Protocol
module Commands
class CreateScanWizard < Command
uint32le :scan_wizard_id
end
end
end
end
| 19.857143 | 52 | 0.744604 |
b9fc2cb05036c8a206c118994939e4988640d3e3 | 9,122 | ##
# This code was generated by
# \ / _ _ _| _ _
# | (_)\/(_)(_|\/| |(/_ v1.0.0
# / /
require 'spec_helper.rb'
describe 'SyncListItem' do
it "can fetch" do
@holodeck.mock(Twilio::Response.new(500, ''))
expect {
@client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
... | 35.772549 | 171 | 0.602061 |
1d68a76469aac7221554641db763284088ed8ef9 | 727 | # This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
require 'kaitai/struct/struct'
unless Gem::Version.new(Kaitai::Struct::VERSION) >= Gem::Version.new('0.9')
raise "Incompatible Kaitai Struct Ruby API: 0.9 or later is required, but you have #{Kaitai::Struct::VERSION}"... | 26.925926 | 112 | 0.708391 |
ed591b01bc0e6d312f236ac057621077fed7d8c7 | 17,018 | # 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... | 38.502262 | 191 | 0.709308 |
5d63d32d05e3df6114447b4b2cb2f05c784c7c16 | 1,604 | module Elasticsearch
module Transport
module Transport
# Handles node discovery ("sniffing").
#
class Sniffer
RE_URL = /\/([^:]*):([0-9]+)\]/ # Use named groups on Ruby 1.9: /\/(?<host>[^:]*):(?<port>[0-9]+)\]/
attr_reader :transport
attr_accessor :timeout
#... | 34.12766 | 109 | 0.579177 |
03fd8c591598ea2f2aaba2d14ea1961b767ac5c9 | 2,577 | require 'rails_helper'
RSpec.describe Tent::Site, type: :model do
before do
@site = build :tent_site
end
subject { @site }
it { should respond_to(:path) }
it { should respond_to(:title) }
it { should respond_to(:description) }
it { should respond_to(:logo_url) }
it { should respond_to(:note) }
... | 19.671756 | 48 | 0.489329 |
287c14134d5fec41e73ee13e1f85de2c1e9173b8 | 323 | # frozen_string_literal: true
module Toller
module Filters
##
# Scope handler for filter
#
class ScopeHandler
def call(collection, value, properties)
scoped_name = properties[:scope_name] || properties[:field]
collection.public_send(scoped_name, value)
end
end
end
e... | 19 | 67 | 0.665635 |
019dca9d0abf1b2e3054b48e09a19a5b620f05fe | 1,257 | require 'unleash/configuration'
require 'unleash/metrics'
require 'net/http'
require 'json'
require 'time'
module Unleash
class MetricsReporter
attr_accessor :last_time
def initialize
self.last_time = Time.now
end
def generate_report
now = Time.now
start = self.last_time
st... | 25.653061 | 125 | 0.66428 |
7ac38d67b8002f3f61020564e93caa0af2396d47 | 835 | # frozen_string_literal: true
require 'active_support/core_ext/string'
require 'bigdecimal'
module Lightspeed
class Prices
def initialize(attributes)
@attributes = attributes
end
def prices
@prices ||= @attributes["ItemPrice"].map { |v| [v["useType"].parameterize.underscore.to_sym, BigDecim... | 18.152174 | 130 | 0.633533 |
e97c8bd2419637eb7e1401e2d4d56c8d6b89d5b3 | 1,918 | require "idsimple/rack/access_token_helper"
require "idsimple/rack/api"
module Idsimple
module Rack
module Helper
def configuration
Idsimple::Rack.configuration
end
def logger
configuration.logger
end
def signing_secret
configuration.signing_secret
en... | 27.797101 | 97 | 0.65902 |
18de9be7e86b569bc58e33829fbb081e64a55b94 | 1,570 | require 'spec_helper'
describe BitBucket::Repos::DefaultReviewers do
subject { described_class.new }
describe '#list' do
before do
expect(subject).to receive(:request).with(
:get,
'/2.0/repositories/mock_user/mock_repo/default-reviewers',
{},
{}
)
end
it 'ma... | 24.153846 | 85 | 0.615924 |
e23f98bc833db18e4c73565e3fd362b7f5c75872 | 6,487 |
require_relative '../app'
require_relative './util'
require 'rspec'
require 'rack/test'
require 'ruby-mpd'
RSpec.describe 'MPD web interface' do
include Rack::Test::Methods
def app
App
end
before(:all) do
music_path = '/var/lib/mpd/music'
Dir.chdir(music_path) do
# create an... | 36.038889 | 165 | 0.632342 |
0828719fa6a478af249804878d5a4fe988c8fb66 | 63 | require 'zapier_rest_hooks/engine'
module ZapierRestHooks
end
| 12.6 | 34 | 0.857143 |
bf49755248006d976ed7979ecfdea1bad6b0bdd7 | 1,613 | #!/usr/bin/env ruby
gem 'minitest', '>= 5.0.0'
require 'minitest/autorun'
require 'date'
require 'time'
require_relative 'gigasecond'
# Test data version:
# 2299e68 Document how to skip the hello world problem
class GigasecondTest < Minitest::Test
def test_2011_04_25
gs = Gigasecond.from(Time.utc(2011, 4, 25, 0... | 29.327273 | 73 | 0.685679 |
1c4db2d3a62a34b2062e886ba06358a29f7fab06 | 2,690 | class RelatorioGeralsController < ApplicationController
before_action :set_relatorio_geral, only: [:show, :edit, :update, :destroy]
# GET /relatorio_gerals
# GET /relatorio_gerals.json
def index
@relatorio_gerals = RelatorioGeral.all.page(params[:page]).per(15)
authorize @relatorio_gerals
end
# GE... | 30.224719 | 148 | 0.717472 |
876ad380b981e8c4b133c468dce91430ef50c44a | 608 | # This task is not actually used.
# Use "ruby setup.rb" instead.
# This task is just here to show you the idea of what is going on
ext_base = File.join(File.dirname(__FILE__), "ext")
task "get_it_done" do
sh "
pushd #{ext_base}/util/src/;
rm *.o
make;
popd;
pushd #{ext_base}/math/src;
rm... | 20.965517 | 65 | 0.564145 |
4acc6e64138777e6f8e94a05d983d1597e7caf65 | 34,128 | ActiveRecord::Schema.define(version: 20180906121026) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "availability_zones", id: :bigserial, force: :cascade do |t|
t.bigint "ems_id", null: false
t.string "name"
t.string "ems_ref"... | 40.292798 | 137 | 0.684335 |
d50b3a027820b848ddaa234ca40bc6138cddbf13 | 4,026 | #! /usr/bin/env ruby
#
# check-ebs-burst-limit
#
# DESCRIPTION:
# Check EC2 Volumes for volumes with low burst balance
# Optionally check only volumes attached to the current instance
#
# OUTPUT:
# plain-text
#
# PLATFORMS:
# Linux
#
# DEPENDENCIES:
# gem: aws-sdk
# gem: sensu-plugin
#
# USAGE:
# ./check-... | 30.732824 | 157 | 0.633631 |
339151a3fbfb5659dcdfe0e8b402ddd7260e0dfa | 6,143 | # frozen_string_literal: true
require 'spec_helper'
require 'fakefs/spec_helpers'
require 'json'
module LicenseFinder
describe Yarn do
let(:root) { '/fake-node-project' }
it_behaves_like 'a PackageManager'
let(:yarn_shell_command_output) do
{
'type' => 'table',
'data' => {
... | 45.169118 | 179 | 0.627544 |
3324bd43c802ee2c1ee2191cb48639ef1956b31d | 564 | # frozen_string_literal: true
module EE
module SelectsHelper
def ldap_server_select_options
options_from_collection_for_select(
::Gitlab::Auth::Ldap::Config.available_servers,
'provider_name',
'label'
)
end
def admin_email_select_tag(id, opts = {})
css_class = [... | 24.521739 | 61 | 0.643617 |
62adf6a81a7c63312265f94821fab352f430f848 | 398 | require "bundler/setup"
require "rails/engine"
require "jquery/easing/rails"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_p... | 24.875 | 66 | 0.756281 |
bb0f248e5daac65954866e7958314fa7ae113ac5 | 1,582 | # frozen_string_literal: true
require "tempfile"
require "webrick"
require "webrick/httpproxy"
module Ferrum
class Proxy
def self.start(*args)
new(*args).tap(&:start)
end
attr_reader :host, :port, :user, :password
def initialize(host: "127.0.0.1", port: 0, user: nil, password: nil)
@ho... | 28.25 | 91 | 0.575221 |
38619bfb020a8fe29c7347c33e359bd9d5b2f344 | 523 | module OrigenTesters
module SmartestBasedTester
class Base
module Processors
# Extracts all runtime variables which are set within the given flow, returning
# them in an array
class ExtractSetVariables < ATP::Processor
def run(nodes)
@results = []
pr... | 22.73913 | 87 | 0.556405 |
611a125cda38fa7cb49b50b2263a8ee2e3560906 | 427 | require 'spec_helper'
describe ResourcesController, 'permissions', type: :controller do
it 'renders 403 if user is not space admin' do
user = double(:user)
log_in user
space = double(:space)
allow(space).to receive(:admin?).with(user) {false}
allow(Space).to receive(:find_by_name!) {space}
p... | 26.6875 | 65 | 0.679157 |
0346d4835bcf657e3ac90691e2303b901036d65e | 561 |
module NilOnInitializationError
# https://stackoverflow.com/questions/10692961/inheriting-class-methods-from-modules-mixins-in-ruby
def self.included base
base.send :include, InstanceMethods
base.extend ClassMethods
end
module InstanceMethods
def new_if_valid(args)
self.new(args)
rescue ... | 20.777778 | 101 | 0.752228 |
d5c35ce356c7fdc9ff15e54220b9a644ec83f433 | 1,539 | class Api::V1::ReadingController < ApplicationController
def create
thermostat = Thermostat.find_by(household_token: params[:household_token])
params_with_tracking_number = add_tracking_number(params[:household_token], reading_params )
reading = Reading.new(params_with_tracking_number)
if reading.v... | 32.0625 | 156 | 0.730344 |
abf8dc977430bb512ee090d4b6bd3fbe4f1366a5 | 363 | class AddUpdatedAtToTodos < ActiveRecord::Migration
def self.up
add_column :todos, :updated_at, :timestamp
execute 'update todos set updated_at = created_at where completed_at IS NULL'
execute 'update todos set updated_at = completed_at where NOT (completed_at IS NULL)'
end
def self.down
r... | 33 | 91 | 0.741047 |
6a0fa74cb20f30dc50a7754fc528a93c61154b4d | 2,372 | # frozen_string_literal: true
require 'spec_helper'
describe CatarsePagarme::BalanceTransferDelegator do
let(:project) { create(:project, state: 'successful') }
let(:project_acc) { create(:project_account, project: project) }
let(:bank) { create(:bank) }
let!(:bank_account) { create(:bank_account, user: proje... | 32.944444 | 123 | 0.693929 |
08f18967f678ab3be201d79e06cbbc0e37027bb5 | 10,829 | require 'spec_helper'
describe Api::RemoteResource, :type => :model do
before :each do
@rr = Api::RemoteResource.new("http://example.com/v1/blahs/1")
allow(Api).to receive(:service_token).and_return("so-fake")
# This is for the basic resource
@good_json = {"blah"=>{
"_links"=>{"s... | 42.633858 | 120 | 0.54982 |
339d17659521ae4c30d6fe4cf019ed2617bb11be | 819 | module RedpenRuby
class FormatMessage
attr_reader :error_status, :message_list, :redpen_version
private :error_status, :message_list
def initialize(raw_message, version)
@message_list = raw_message.split(/\n/)
@redpen_version = version
@error_status = get_error_status
remove_unne... | 19.97561 | 111 | 0.634921 |
f76ffb2bd25dc191e21f0964fd158ae1e1229ca2 | 80 | # frozen_string_literal: true
JRuby::Util.load_ext("org.jruby.ext.digest.MD5")
| 20 | 48 | 0.775 |
b9bc2986d43f03e7eacb4cb7874ce4baab38c687 | 2,785 | # frozen_string_literal: true
module Hearth
module Middleware
describe HostPrefix do
let(:app) { double('app', call: output) }
let(:host_prefix) { 'foo.' }
subject do
HostPrefix.new(
app,
disable_host_prefix: disable_host_prefix,
host_prefix: host_prefix
... | 29.62766 | 72 | 0.533932 |
f7710fa1cc5e67b56674c481a5c5fa754651f4be | 270,295 | # 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::AutoScaling
module Types
# The request failed because an ac... | 37.34388 | 187 | 0.638946 |
1806bc54675ba09c307a634a61505ed41c519cf4 | 150 | class Mtask < ActiveRecord::Base
unloadable
belongs_to :author, :class_name => 'User'
belongs_to :assigned_to, :class_name => 'Principal'
end
| 18.75 | 53 | 0.726667 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.