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 |
|---|---|---|---|---|---|
7aad76c5571589443709ff1176f642b49f028a61 | 341 | require 'delegate'
require 'hay/message'
module Baler
class Message
class Encoder
class MsgPack < DelegateClass(Hay::Message)
def initialize(message)
@message = message
super
end
def payload
@payload ||= @message.payload.to_msgpack
end
e... | 16.238095 | 50 | 0.58651 |
edf9103b51397f5b7114724b96be36954df449ee | 903 | Detour::Application.routes.draw do |map|
# map.resources :products, :member => { :detailed => :get }
resources :products do
get :detailed, :on => :member
end
# map.resources :forums, :collection => { :sortable => :get, :sort => :put } do |forums|
# forums.resources :topics
# end
resources :forums... | 28.21875 | 122 | 0.563677 |
f84e366a88ef90d0e1e9f1f901f5af5cf387890e | 793 | Pod::Spec.new do |s|
s.name = "BarcodeScanner"
s.summary = "Simple and beautiful barcode scanner."
s.version = "5.0.0"
s.homepage = "https://github.com/hyperoslo/BarcodeScanner"
s.license = 'MIT'
s.author = { "Hyper Interaktiv AS" => "ios@hyper.no" }
... | 31.72 | 68 | 0.587642 |
036f85e2b0ad1b419d9bc88a243756b78445d0f9 | 1,472 | require "test_helper"
class UsersLoginTest < ActionDispatch::IntegrationTest
def setup
@user = users(:michael)
end
test "login with valid email/invalid password" do
get login_path
assert_template 'session/new'
post login_path, params: { session: { email: @user.email, password: "invalid" } }
... | 28.307692 | 88 | 0.697011 |
2884a311349bbd5823e3d852d401fc9e47d72d41 | 122 | class AddVersionToInstances < ActiveRecord::Migration
def change
add_column :instances, :version, :string
end
end
| 20.333333 | 53 | 0.770492 |
ff2b4d777b141e2cc7e808e9d6bc89cf8c4ee570 | 803 | class SessionsController < ApplicationController
include SessionsHelper
def create
user = User.find_by(email: params[:session][:email].downcase)
if user && user.authenticate(params[:session][:password])
log_in user
params[:session][:remember_me] == '1' ? remember_user(user) : forget_user(user)
... | 22.942857 | 85 | 0.616438 |
1c4ffc7b8cc8af163e474960e8c9a7c40e37b53e | 8,954 | # encoding: utf-8
require 'common/validation_error_tools'
=begin
= CalendarDAO
- Goggles framework vers.: 4.00.570
- author: Leega
DAO class containing the structure for calendar rendering.
=end
class CalendarDAO < Draper::Decorator
class MeetingSessionDAO
# These must be initialized... | 34.438462 | 190 | 0.617154 |
01848b0ff280fb2bb17071ae7486de51106f2157 | 8,255 | =begin
#Ory Kratos API
#Documentation for all public and administrative Ory Kratos APIs. Public and administrative APIs are exposed on different ports. Public APIs can face the public internet without any protection while administrative APIs should never be exposed without prior authorization. To protect the administa... | 32.888446 | 429 | 0.642883 |
5dda797ce10de45f45454704e6f725947d7088f5 | 1,041 | # encoding: UTF-8
require 'coffee-script'
module Spontaneous::Rack
class JS
JS_EXTENSION = /\.js$/o
def initialize(app, options = {})
@roots = options[:root]
@app = app
end
def call(env)
try_coffeescript(env[S::PATH_INFO]) or @app.call(env)
end
def try_coffeescript(reque... | 24.785714 | 93 | 0.649376 |
ab4560b915cc2ffbcc041ba0bdd79610300bb576 | 3,457 | class User < ApplicationRecord
has_many :microposts, dependent: :destroy
has_many :active_relationships, class_name: "Relationship",
foreign_key: "follower_id",
dependent: :destroy
has_many :passive_relationships, class_name: "Relationship",
... | 29.547009 | 88 | 0.67978 |
acd0e1c7875ac42dbf4550be876e5f3ec3262cd0 | 328 | require 'fact_store'
class Ruleset
def initialize(*rules)
@rules = rules
end
def apply(factset)
transaction = FactStore::Transaction.new
rules.each do |rule|
rule.apply(factset).each do |entry|
transaction << entry
factset += entry.facts
end
end
transaction
e... | 14.26087 | 44 | 0.631098 |
edd7212991ed6fc5faedbcdf100e2adb352438e6 | 8,926 | # -*- coding: utf-8 -*- #
# frozen_string_literal: true
module Rouge
module Lexers
class Mosel < RegexLexer
tag 'mosel'
filenames '*.mos'
title "Mosel"
desc "An optimization language used by Fico's Xpress."
# https://www.fico.com/en/products/fico-xpress-optimization-suite
file... | 38.309013 | 224 | 0.574726 |
083bc00587fdac75a9e65ea207037b206a09a388 | 2,796 | # frozen_string_literal: true
require 'uri'
module BrickFTP
module RESTfulAPI
# Overview of uploading
#
# @see https://developers.files.com/#overview-of-uploading Overview of uploading
#
# ### Uploading files using the REST API is done in 3 stages:
#
# 1. {https://developers.files.com/#s... | 41.731343 | 169 | 0.682403 |
7aecc9d62f9b1e52f1498c45cad4f7988969e3ae | 438 | require 'pdk/config/namespace'
module PDK
class Config
class JSON < Namespace
def parse_data(data, _filename)
return {} if data.nil? || data.empty?
require 'json'
::JSON.parse(data)
rescue ::JSON::ParserError => e
raise PDK::Config::LoadError, e.message
end
... | 18.25 | 47 | 0.593607 |
bfc42684abad519515b0df3644b16133061f0f82 | 3,546 | module ControllerHelpers
include VCAP::CloudController
HTTPS_ENFORCEMENT_SCENARIOS = [
{ protocol: 'http', config_setting: nil, user: 'user', success: true },
{ protocol: 'http', config_setting: nil, user: 'admin', success: true },
{ protocol: 'https', config_setting: nil, user: 'user', success: tr... | 28.596774 | 106 | 0.642132 |
115b67d98fb25094af123205268827c4e48bc3f0 | 11,494 | # If you need to modify the existing seed repository for your tests,
# it is recommended that you make the changes on the `markdown` branch of the seed project repository,
# which should only be used by tests in this file. See `/spec/factories.rb#project` for more info.
class Spinach::Features::ProjectSourceMarkdownRen... | 37.685246 | 156 | 0.715591 |
f868cdbe544c445dce7cee5f350f8385e4648c8a | 3,518 | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with this
# work for additional information regarding copyright ownership. The ASF
# licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use... | 41.880952 | 146 | 0.744457 |
38b2d7fbbff8e64178ce5bacb149f5ac789fdbcc | 1,181 | require 'rspec'
RSpec.describe Deflate::HuffmanTable do
let(:table) { Deflate::HuffmanTable.new(bootstrap) }
describe "#initialize" do
# the example documented in 3.2.2 of RFC1951
# https://tools.ietf.org/html/rfc1951
context "with alphabet ABCDEFGH" do
let(:bootstrap) {
{(65..69) => 3, ... | 38.096774 | 85 | 0.577477 |
79b1ad645e562fbe9bf0e5698c66eb3d9726226f | 1,483 | class Sourcedocs < Formula
desc "Generate Markdown files from inline source code documentation"
homepage "https://github.com/eneko/SourceDocs"
url "https://github.com/eneko/sourcedocs/archive/1.2.0.tar.gz"
sha256 "edfbe37a267be4d5ddd795c74522dcbb72b6fd42e11a0922c3ad87f4bac0e55f"
bottle do
cellar :any_ski... | 38.025641 | 90 | 0.701955 |
2194b2c57f9d6a39d02bed6cceaa19660bf476dd | 2,689 | class Perkeep < Formula
desc "Lets you permanently keep your stuff, for life"
homepage "https://perkeep.org/"
license "Apache-2.0"
stable do
url "https://github.com/perkeep/perkeep.git",
tag: "0.10",
revision: "0cbe4d5e05a40a17efe7441d75ce0ffdf9d6b9f5"
# gopherjs doesn't tag relea... | 30.556818 | 120 | 0.663444 |
5de407bc533fef8510054a0a82783b671a846f79 | 1,013 | require 'ostruct'
require 'digest'
module CloudSesame
module Domain
module ClientModule
module Caching
class RailsCache < Base
def initialize(client, searchable)
ensure_environment_exists
super
end
def fetch(params)
Rails.cache.fet... | 23.022727 | 71 | 0.548865 |
61217affd75269607cf6ad08f44baf8db0534e99 | 1,407 | module FFaker
module PhoneNumberCH
extend ModuleUtils
extend self
COUNTRY_PREFIX = %w[+41 0041 0].freeze
AREA_PREFIX = %w[21 22 24 26 27 31 32 33 34 41 43 44 51 52 56 58 61 62 71 81 91].freeze
MOBILE_PREFIX = %w[74 75 76 77 78 79].freeze
FREE_PHONE_PREFIX = %w[800].freeze
SHARED_COST_PREF... | 31.266667 | 99 | 0.702914 |
28382fc45c51b47a4c96b20b43709af975ac56e1 | 704 | require 'rdb2spreadsheet/rdb_client'
module Rdb2spreadsheet
class DataAdapter
attr_reader :rdb_client, :spreadsheet_client
def initialize(db_configs, spreadsheet_configs)
@rdb_client = RdbClient.new(db_configs)
@spreadsheet_client = SpreadsheetClient.new(spreadsheet_configs)
end
def imp... | 29.333333 | 73 | 0.710227 |
799a65ac7c9acfa77e351213ae7b7cc3a4299ddc | 1,528 | class Abook < Formula
desc "Address book with mutt support"
homepage "http://abook.sourceforge.net/"
url "https://downloads.sourceforge.net/project/abook/abook/0.5.6/abook-0.5.6.tar.gz"
sha256 "0646f6311a94ad3341812a4de12a5a940a7a44d5cb6e9da5b0930aae9f44756e"
head "git://git.code.sf.net/p/abook/git"
bottle... | 29.384615 | 95 | 0.691754 |
03a9ebc243f2e4c0cf489581353ef75c59e00a74 | 3,906 | # typed: strict
# frozen_string_literal: true
require "time"
module Spoom
# Execute git commands
module Git
extend T::Sig
# Execute a `command`
sig { params(command: String, arg: String, path: String).returns(ExecResult) }
def self.exec(command, *arg, path: '.')
return ExecResult.new(
... | 31.248 | 94 | 0.614183 |
617a4d28e27f69dd0a03f5525b8cdb66cdf85f96 | 726 | # frozen_string_literal: true
require 'support'
require 'mustermann/equality_map'
RSpec.describe Mustermann::EqualityMap do
before { GC.disable }
after { GC.enable }
describe :fetch do
subject { Mustermann::EqualityMap.new }
specify 'with existing entry' do
next if subject.is_a? Hash
subject... | 26.888889 | 57 | 0.637741 |
7971eb8849db573eea34fe401a70e054b60251a5 | 9,559 | # frozen_string_literal: true
require 'spec_helper'
describe IssuablesHelper do
let(:label) { build_stubbed(:label) }
let(:label2) { build_stubbed(:label) }
describe '#users_dropdown_label' do
let(:user) { build_stubbed(:user) }
let(:user2) { build_stubbed(:user) }
it 'returns unassigned' do
... | 31.136808 | 141 | 0.646616 |
08c26364ffdce43bb270a1c4ff77053dd06fc3dc | 7,084 | require 'spec_helper'
describe Opendata::Dataset::ResourceDownloadReportsController, type: :feature, dbscope: :example do
let(:site) { cms_site }
let!(:node_search_dataset) { create(:opendata_node_search_dataset, cur_site: site) }
let!(:node) { create(:opendata_node_dataset, cur_site: site) }
let(:now) { Time... | 56.672 | 124 | 0.675748 |
f8b50efe0ef160a59fed8770b6d115aba521ed59 | 362 | module StashDatacite
module Resource
describe Subject do
it 'leaves out FOS items with .non_fos scope' do
items = [create(:subject), create(:subject), create(:subject, subject_scheme: 'fos')]
expect(Subject.all.length).to eq(items.length)
expect(Subject.all.non_fos.length).to eq(item... | 30.166667 | 93 | 0.668508 |
18d0537530d54296ab408b71cbf7844b4c02690d | 120 | $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "kaminari/rectify/query"
require "minitest/autorun"
| 24 | 58 | 0.758333 |
bb1b1ca8723f8d2e3b5c822bdb1d07c808d7813a | 1,347 | require_relative 'boot'
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "active_storage/engine"
require "action_controller/railtie"
require "action_mailer/railtie"
# require "action_mailbox/engine"
# require "action_tex... | 30.613636 | 82 | 0.749814 |
ab9911662a924a917ff1d30bc97eb51586543f04 | 487 | module DateTimeInput
module Model
extend ActiveSupport::Concern
module ClassMethods
def date_time_inputable(attribute)
define_method("#{attribute}=") do |input|
if input.is_a?(Hash)
super(FormData.from_param(input).to_time)
else
super(input)
... | 17.392857 | 55 | 0.593429 |
38d43597b0a6a1b472a3f50fda82ad301223cabe | 111 | # frozen_string_literal: true
# Full-stack web application framework.
# [https://rubyonrails.org]
gem "rails"
| 18.5 | 39 | 0.756757 |
6a3ef8aef905730d262c5c4e91ed3c1d86ea90f3 | 379 | # frozen_string_literal: true
require "weatherizableAPI"
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.... | 23.6875 | 66 | 0.759894 |
332e3b3ef6a259faf8cf08cf9e8b3aff7ed8b5f1 | 16,309 | require 'cli/ui'
require 'colorize'
require 'cli/ui'
class Jewstore
def self.go
res = ''
CLI::UI::Prompt.ask('JewelryStore v1.5.4') do |handler|
handler.option('list') { |selection| selection; res = 'list' }
handler.option('install') { |selection| selection; res =
gets.chomp }
end
if res ==... | 67.954167 | 611 | 0.817279 |
b9a0945075a2e8707fa8c6574ea4cd378bc4bbb0 | 2,667 | class Pdns < Formula
desc "Authoritative nameserver"
homepage "https://www.powerdns.com"
url "https://downloads.powerdns.com/releases/pdns-4.1.1.tar.bz2"
sha256 "08d388321c8a2c24ebe8d7e539f34a0ba2c0973313c168a1b5ecf507e4fb04ba"
bottle do
sha256 "470c9841912c8c2ef96c69c8426b4cfc17d10277c978c193015261d677c... | 28.677419 | 106 | 0.669666 |
21db165948e4c45dd91e39f56de4ac8e7ee596d6 | 608 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 38 | 74 | 0.763158 |
6282124880d77b1a02746b6ec928d8f5c5bdd9e8 | 1,014 | require_relative 'base'
module Biblionet
module Crawlers
class PublisherCrawler < Base
def initialize(options = {})
options[:folder] ||= 'lib/bookshark/storage/html_publisher_pages'
options[:base_url] ||= 'http://www.biblionet.gr/com/'
options[:page_type] ||= 'publisher'
... | 28.971429 | 105 | 0.601578 |
6a9c0b8b4443e9750fc427f3d2d0c36833ceb20f | 721 | # Capybara::Webkit.configure do |config|
# # Enable debug mode. Prints a log of everything the driver is doing.
# config.debug = true
# # By default, requests to outside domains (anything besides localhost) will
# # result in a warning. Several methods allow you to change this behavior.
# # Silently return ... | 28.84 | 79 | 0.718447 |
4ace0a6f0e9bc7e0bb058fc98b2a80edae2b0d1d | 116 | fail "ERROR: 'rake/gempackagetask' is obsolete and no longer supported. " +
"Use 'rubygems/packagetask' instead."
| 38.666667 | 75 | 0.741379 |
017e8cf6a1642063b2f2cef007a2084f6149710e | 414 | module DuckPuncher
class UniqueDuck < DelegateClass(Duck)
attr_accessor :punch_options
#
# Required to play nice in a Set
#
def eql?(other)
"#{target}-#{mod}" == "#{other.target}-#{other.mod}"
end
def hash
target.to_s.hash + mod.to_s.hash + punch_options.to_s.hash
end
... | 15.333333 | 64 | 0.574879 |
bfb72bb09e0d791d0d71199fae00e91f08d57b2d | 28,768 | # Defines classes to deal with issues, and message formatting and defines constants with Issues.
# @api public
#
module Puppet::Pops
module Issues
# Describes an issue, and can produce a message for an occurrence of the issue.
#
class Issue
# The issue code
# @return [Symbol]
attr_reader :issue_code
... | 40.066852 | 150 | 0.732481 |
fff781f3f3785e7d3699cbe54a74e2abee9c5775 | 2,176 | # frozen_string_literal: true
# This controller allows management of Device records.
class DevicesController < ApplicationController
before_action :authenticate_user!,
except: %i[index show build_config conf graph]
# Index action.
def index
redirect_to browse_path
end
# Show action.
d... | 21.76 | 80 | 0.680147 |
116c324c1e9af9cf9f8509165c947e1cbf0b95c1 | 148 | require 'test_helper'
class ServicosProfissionaisControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end
| 18.5 | 70 | 0.756757 |
38ebd8becf198a9bce3afb229d75b556c2fb50b6 | 172 | # frozen_string_literal: true
# Imported Workers model
class ImportedWorker < ActiveRecord::Base
validates :name, presence: true
validates :email, presence: true
end
| 21.5 | 41 | 0.77907 |
874cd9c8aece61362d87f68556067f34ccda6a98 | 194 | ENV['SINATRA_ENV'] ||= "development"
require 'bundler/setup'
Bundler.require(:default, ENV['SINATRA_ENV'])
ActiveRecord::Base.establish_connection(ENV['SINATRA_ENV'].to_sym)
require_all 'app' | 24.25 | 66 | 0.768041 |
ed774dee2b58429e8fe1298a04d9d4e61d4f7d63 | 5,204 | require "spec_helper"
describe Bunny::Channel do
after :each do
connection.close if connection.open?
end
let(:n) { 200 }
shared_examples "publish confirms" do
context "when publishing with confirms enabled" do
it "increments delivery index" do
ch = connection.create_channel
expe... | 27.104167 | 151 | 0.613374 |
03491bd927ce3103b0f9950591e57c1125948291 | 2,097 | require 'one_gadget/gadget'
# https://gitlab.com/libcdb/libcdb/blob/master/libc/libc0.3-i686-2.19-7/lib/i386-gnu/i686/cmov/libc-2.19.so
#
# Intel 80386
#
# GNU C Library (Debian GLIBC 2.19-7) stable release version 2.19, by Roland McGrath et al.
# Copyright (C) 2014 Free Software Foundation, Inc.
# This is free softw... | 52.425 | 158 | 0.58989 |
bfa0fe6ccc0ae342802698f24fd428045f9c9692 | 865 | require "rubygems"
require "bundler/setup"
Bundler.require(:default, :test)
require "minitest/autorun"
module Omise
class Test < Minitest::Test
def before_setup
Omise.test!
Omise.api_version = nil
Omise.public_api_key = "pkey_test_4yq6tct0llin5nyyi5l"
Omise.secret_api_key = "skey_tes... | 19.222222 | 60 | 0.669364 |
915cbdd6b46305c199155340cbdc51f065c3de9e | 156 | module Private
module Withdraws
class DgbsController < ::Private::Withdraws::BaseController
include ::Withdraws::Withdrawable
end
end
end
| 19.5 | 63 | 0.730769 |
ff14e5b22e410b0aa61d19882c19f78ef7a5d678 | 2,422 | require 'test_helper'
class Elasticsearch::Model::ResponseTest < Test::Unit::TestCase
context "Response" do
class OriginClass
def self.index_name; 'foo'; end
def self.document_type; 'bar'; end
end
RESPONSE = { 'took' => '5', 'timed_out' => false, '_shards' => {'one' => 'OK'}, 'hits' => { ... | 35.617647 | 112 | 0.677952 |
d50851ae5c2e6ca6a444dbe6008b70add1669d0e | 941 | require_dependency "short_message/application_controller"
module ShortMessage
class MessagesController < ApplicationController
def status
unless params[:id].blank? or params[:status].blank?
if message = ShortMessage::Message.where(message_key: params[:id]).first
message.status_code = para... | 31.366667 | 137 | 0.634431 |
21601d8a19ac1db6bfd92d47873d295726a280cc | 4,298 | module SparkApi
module Models
# =API Model Base class
# Intended to be a lot like working with ActiveResource, this class adds most of the basic
# active model type niceties.
class Base
extend Paginate
include Dirty
attr_accessor :attributes, :errors, :parent
# More familiar... | 24.843931 | 95 | 0.543741 |
e864ed42cf3186a1eb0deb15400e3dc4591d8fd2 | 1,111 | require "application_system_test_case"
class QuestionsTest < ApplicationSystemTestCase
setup do
@question = questions(:one)
end
test "visiting the index" do
visit questions_url
assert_selector "h1", text: "Questions"
end
test "creating a Question" do
visit questions_url
click_on "New Qu... | 23.145833 | 53 | 0.707471 |
bb4684b9dfcabf1da28885c1adcacf4a7dd1d922 | 6,344 | class PerconaServer < Formula
desc "Drop-in MySQL replacement"
homepage "https://www.percona.com"
url "https://www.percona.com/downloads/Percona-Server-8.0/Percona-Server-8.0.17-8/source/tarball/percona-server-8.0.17-8.tar.gz"
sha256 "0a96de68a71acce0c3c57cdd554b63a8f7c3026bd5aec88a384f76ce9ff4fced"
bottle d... | 33.21466 | 130 | 0.670082 |
b9e74f89cdff729cb893a9fb3f9e9e0d359e5ae5 | 824 | # 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::CognitiveServices::VisualSearch::V1_0
module Models
#
# Defines values for ErrorSubCode
#
module ErrorSubCode
Unexpect... | 31.692308 | 70 | 0.73301 |
1df5da5979785167ffbdbe90a033f8d9da187998 | 2,762 |
module Redcar
class Cocoa
class TreeController
include Redcar::Tree::Controller
include Redcar::Project::LocalFilesystem
def initialize(tree_mirror)
@mirror = tree_mirror
attach_listeners
end
# Open selected node path in default application
# on double-click
... | 33.682927 | 126 | 0.558653 |
ab9891b127bb0904f527d466e4cfc66ff023a8d8 | 3,659 | require 'mongrel'
require 'stringio'
require 'rack/content_length'
require 'rack/chunked'
module Rack
module Handler
class Mongrel < ::Mongrel::HttpHandler
def self.run(app, options={})
environment = ENV['RACK_ENV'] || 'development'
default_host = environment == 'development' ? 'localhost'... | 34.196262 | 109 | 0.534026 |
ac3481499df1e6f4ab02d705844db80cdc1ff282 | 1,552 | RSpec.describe Binary do
it "has a version number" do
expect(Binary::VERSION).not_to be nil
end
it "takes an integer and returns its binary representation" do
expect(Binary.binary(7)).to eq("111")
end
it "takes non-integer input and returns nil" do
expect(Binary.binary('hey')).to eq(nil)
end
... | 31.04 | 93 | 0.681057 |
610e6d081572c37c2af415b733af1a7665831927 | 2,939 | require 'spec_helper'
require 'hydra/file_characterization/characterizers/fits_servlet'
module Hydra::FileCharacterization::Characterizers
describe FitsServlet do
let(:fits) { Fits.new(filename) }
describe "#call", unless: ENV['TRAVIS'] do
subject { fits.call }
context 'validfile' do
le... | 42.594203 | 293 | 0.680504 |
1db66f25640646100721e7347420b6a2912d352f | 1,400 | #--
# Copyright (c) 2019 Fuyuki Academy
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | 37.837838 | 72 | 0.754286 |
61130b4196254dfc15894821ac4dc065d47b720b | 689 | require "chef/knife"
require_relative "helpers/base_vsphere_command"
# VspherePoolQuery extends the BaseVsphereCommand
class Chef::Knife::VspherePoolQuery < Chef::Knife::BaseVsphereCommand
banner 'knife vsphere pool query POOLNAME QUERY. See "https://pubs.vmware.com/vi3/sdk/ReferenceGuide/vim.ComputeResource.html" f... | 27.56 | 155 | 0.738752 |
017bf8b25007729610eeac3b418a2c7e57f981ec | 3,051 | require 'test_helper'
class UserTest < ActiveSupport::TestCase
test '#github_url returns github url' do
github_url = User.new(github: 'jroes').github_url
assert_equal 'https://github.com/jroes', github_url
end
test 'public scope should only return public users' do
user = users(:mockstar)
... | 28.514019 | 101 | 0.723697 |
181f04e02fbf7ee7882a6d9b2655ece104eeae9f | 3,714 | class Kubeseal < Formula
desc "Kubernetes controller and tool for one-way encrypted Secrets"
homepage "https://github.com/bitnami-labs/sealed-secrets"
url "https://github.com/bitnami-labs/sealed-secrets.git",
tag: "v0.16.0",
revision: "392b871249268519157abcb9cf8a162396f6e02e"
license "Apache-2... | 45.851852 | 122 | 0.756327 |
386c53d13184bacf31df0c6f41d9c76c3415a427 | 76 | require 'test_helper'
class AttendeesHelperTest < ActionView::TestCase
end
| 15.2 | 48 | 0.828947 |
d5ed514f9f6ee22b53f7ef0f5141985e985509a3 | 5,416 | require "language_pack"
require "pathname"
require "yaml"
require "digest/sha1"
Encoding.default_external = Encoding::UTF_8 if defined?(Encoding)
# abstract class that all the Ruby based Language Packs inherit from
class LanguagePack::Base
VENDOR_URL = "https://s3.amazonaws.com/heroku-buildpack-ruby"
attr_reader... | 25.54717 | 118 | 0.651957 |
7990bcf03d1538a6f0d851736552b03c502a9195 | 9,877 | #!/usr/bin/env ruby
###
### mdoc2man - mdoc to man converter
###
### Quick usage: mdoc2man.rb < mdoc_manpage.8 > man_manpage.8
###
### Ported from Perl by Akinori MUSHA.
###
### Copyright (c) 2001 University of Illinois Board of Trustees
### Copyright (c) 2001 Mark D. Roth
### Copyright (c) 2002, 2003 Akinori MUSHA... | 20.837553 | 79 | 0.552901 |
e2155bc68dffb6c39ed8f2e6051ab1edf8bd66ed | 3,278 | #!/usr/bin/env ruby
# Television show renaming/moving utility.
#
# Attempts (often very wrongly) to extract the show title, season number, and
# episode number from a file name, then copy it into a sorted location.
#
# TODO:
# * OptionParser for:
# * Destination directory
# * Dry run
# * Verbosity
# * ... | 26.435484 | 88 | 0.693411 |
f748047effb83d662f856ea9d2ee8d7c79f03eeb | 988 | require 'rest-client'
class Game < ApplicationRecord
# game.playlists returns a list of all playlists specific game belongs to
has_many :playlist_games
has_many :playlists, through: :playlist_games
# game.users returns a list of all users who have starred the game
has_many :user_game_stars
has_many :users... | 29.939394 | 109 | 0.681174 |
bbe86ab1e2767f548dc713d4344a42eb177a90e9 | 1,336 | # frozen_string_literal: true
require "active_support"
module InstStatsd
class DefaultTracking
def self.track_sql
return if @sql_tracker
@sql_tracker = InstStatsd::SqlTracker.new(blocked_names: ['SCHEMA'])
ActiveSupport::Notifications.subscribe(/sql\.active_record/) {|*args| update_sql_count(*... | 29.688889 | 115 | 0.717814 |
ab5c4544d6ae1cdbce9335151d4b4722924b43cd | 4,425 | require 'spec_helper'
require 'puppet/util/feature'
describe Puppet::Util::Feature do
before do
@features = Puppet::Util::Feature.new("features")
allow(@features).to receive(:warn)
end
it "should not call associated code when adding a feature" do
$loaded_feature = false
@features.add(:myfeature... | 34.038462 | 122 | 0.700565 |
620970f77d7a6e86f0261cb152d47baefd0cfb45 | 1,129 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'rubygems'
require 'bundler/setup'
require 'rspec'
require 'webmock/rspec'
if ENV['COVERAGE']
require 'coveralls'
require 'simplecov'
Coveralls.wear!
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLF... | 22.58 | 80 | 0.734278 |
030def99dc4ed969ffa91bd585f404fbb158d004 | 1,319 | require 'test_helper'
class NewExperimentWorkflowTest < ActionDispatch::IntegrationTest
fixtures :all
test "new workflow with new patient" do
get new_user_session_path
assert_response :success
# login
post_via_redirect new_user_session_path, :user => { :email => users(:user).email, :password => '... | 38.794118 | 223 | 0.721759 |
e25b36f295eb5d38356a403966143444b2685c29 | 938 | require 'proto/nyx_post_services_pb'
module NyxPost
module Service
class Post < Nyx::PostService::Service
# The method should match with Nyx::PostService::Service (rpc :GetPost, ...)
def get_post(post_req, _unused_call)
# Find by id, just hardcoded for the example
my_post = { id: '1'... | 30.258065 | 105 | 0.65565 |
bf8b83474ec6afd3d43fef0acc2e843232dae982 | 204 | # frozen_literal_string: true
# Load app_errors.rb here to include when testing without requiring additional
# `require` in spec file
require_relative 'app_errors'
def clear_screen
print `clear`
end
| 18.545455 | 78 | 0.794118 |
ab056c8ff4d46540fda5bd18edabc92e8c285009 | 2,255 | require 'rubygems'
require 'sequel'
require 'logger'
$: << '../lib'
DB = Sequel.connect(ENV['DATABASE_URL'] || 'sqlite:/')
CREATE_TABLES_FILE = File.join(File.dirname(__FILE__), 'create_tables.rb')
require CREATE_TABLES_FILE
Sequel::Model.plugin :defaults_setter
Sequel::Model.plugin :validation_helpers
Sequel::Model... | 44.215686 | 168 | 0.7051 |
210b9104ad89da2124d905cfbcca3ffdf2f8d4d6 | 772 | # frozen_string_literal: true
module Leftovers
module Processors
class Parameterize
include ComparableInstance
def initialize(then_processor)
@then_processor = then_processor
freeze
end
def process(str, current_node, matched_node, acc)
return unless str
... | 26.62069 | 137 | 0.69171 |
26a80ec4f1e4cea197d71d721edd69bc49ab8d24 | 113 | Dir['../lib/*.rb'].each { |f| require_relative f }
MATRIX_SIZE = 30
Life.new(MATRIX_SIZE, MATRIX_SIZE + 10).go
| 18.833333 | 50 | 0.672566 |
38c2ca138325699e5d689c33fbe6686392aa9a35 | 936 | # frozen_string_literal: true
def mock_pro_grammar(*args)
args.flatten!
binding = args.first.is_a?(Binding) ? args.shift : binding()
options = args.last.is_a?(Hash) ? args.pop : {}
input = InputTester.new(*args)
output = StringIO.new
redirect_pro_grammar_io(input, output) do
binding.pro_grammar(optio... | 19.914894 | 62 | 0.719017 |
ed3f03d2f29657a187cd6ce73ff081f4b783d76d | 2,734 | class Unity::EC2::VPC < Unity::EC2::Base
def list
list = []
# filter the collection to just nanobox instances
filter = [{'Name' => 'tag:Nanobox', 'Value' => 'true'}]
# query the api
res = manager.DescribeVpcs('Filter' => filter)
# extract the instance collection
vpcs = res["Describe... | 19.811594 | 80 | 0.537308 |
034da9ea5c083609fd2f3001234fb2131de0fdc0 | 94 | class StatiqueController < ApplicationController
def accueil
end
def contact
end
end
| 11.75 | 48 | 0.776596 |
62bb4c6acaf27fa979c4c3d77076469b46c70fd0 | 15,435 | #encoding: UTF-8
require File.expand_path("../helper", __FILE__)
class TestRakeApplication < Rake::TestCase
def setup
super
@app = Rake.application
@app.options.rakelib = []
end
def setup_command_line(*options)
ARGV.clear
options.each do |option|
ARGV << option
end
end
def t... | 23.350983 | 85 | 0.666537 |
f8e1d1df4f2df6e5f661a9a74122fa5d47b81335 | 586 | require 'octokit'
class GitHubIssues
def initialize
raise 'The GITHUB_ACCESS_TOKEN environment variable must be set to run this application.' unless ENV['GITHUB_ACCESS_TOKEN']
@client = Octokit::Client.new(access_token: ENV['GITHUB_ACCESS_TOKEN'])
@client.auto_paginate = true
end
def issues_list
... | 20.928571 | 127 | 0.663823 |
39144111da506ffd2405c9b700d117190f195613 | 299 | require 'yaml'
require 'dh_easy/core'
require 'dh_easy/config'
require 'dh_easy_override/core'
require 'dh_easy/router/version'
require 'dh_easy/router/plugin'
require 'dh_easy/router/parser'
require 'dh_easy/router/seeder'
require 'dh_easy/router/finisher'
module DhEasy
module Router
end
end
| 19.933333 | 33 | 0.799331 |
e95711d097892aa669b22fdafc80c90910bad67b | 887 | # -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'viaggiatreno/version'
Gem::Specification.new do |gem|
gem.name = "viaggiatreno"
gem.version = Viaggiatreno::VERSION
gem.authors = ["Michele Bologna"]
gem.em... | 42.238095 | 139 | 0.667418 |
396bf42a1848066ab6ed81de77f01a912bf5db66 | 1,968 | QueryGateway::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.a... | 37.132075 | 104 | 0.763211 |
f8d3ae4f2c3b16e11a271742c0a765e0c28d6326 | 893 | # frozen_string_literal: true
require 'rails_helper'
module Bulkrax
RSpec.describe ExporterJob, type: :job do
subject(:exporter_job) { described_class.new }
let(:exporter) { FactoryBot.create(:bulkrax_exporter) }
let(:bulkrax_exporter_run) { FactoryBot.create(:bulkrax_exporter_run, exporter: exporter) }... | 33.074074 | 95 | 0.717805 |
f7a4972225302a217824d2a40786a9e750ab58b2 | 160 | Rails.application.routes.draw do
root 'home#index'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
| 26.666667 | 101 | 0.76875 |
08f5ebd6e6cf53372cc812262469f88a3eaef70d | 814 | # This file is auto-generated by the code_generator
#
# Cookbook Name:: kernel-modules
# Spec:: default
#
# Copyright:: 2017, The Authors, All Rights Reserved.
require 'spec_helper'
describe 'kernel-modules::metadata' do
let(:metadata_file) do
File.join(File.dirname(__FILE__), '../../../metadata.rb')
end
i... | 22.611111 | 61 | 0.697789 |
e2e492057cbe5481c8495ecbb75777bf057ea363 | 190 | class QueryVersionSerializer < ActiveModel::Serializer
attributes :id, :body, :created_at, :updated_at, :parameters, :author_name, :query_id, :version, :comment, :commit_sha, :summary
end
| 47.5 | 130 | 0.773684 |
1ad2341f2fe38ebb5d0d197dd5eb55c3cd91a269 | 7,239 | class Spree::InvoiceMailer < Spree::BaseMailer
include AbstractController::Callbacks
include LiquidVarsHelper
add_template_helper(Spree::CurrencyHelper)
add_template_helper(DateHelper)
before_action :set_mail_type
def reminder_email(invoice, override_account_email_settings = false, dev_preview = false)
... | 43.608434 | 141 | 0.745545 |
382a6273460d094df66babf308018d954143b7b9 | 640 | cask "ueli" do
version "8.10.0"
sha256 "38e9b6f4558ba32350cd1bdf516e5e70fb04d06f2365420531781c1b09793c58"
# github.com/oliverschwendener/ueli/ was verified as official when first introduced to the cask
url "https://github.com/oliverschwendener/ueli/releases/download/v#{version}/ueli-#{version}.dmg"
appcast "... | 29.090909 | 99 | 0.732813 |
b9b6b1cd1604e4e1f20651c16c0bafa889a8e307 | 1,010 | require "rails_helper"
RSpec.describe Child, type: :model do
subject(:model) { build(:child) }
it { is_expected.to define_enum_for(:gender).with_values(male: 1, female: 2, other: 3) }
it { is_expected.to validate_presence_of(:date_of_birth) }
it { is_expected.to validate_presence_of(:gender) }
it_behaves_... | 26.578947 | 90 | 0.667327 |
28f21c5c062084dd57260d9412cbcd87794dc7f6 | 3,516 | module TLSTestKit
class TLSVersionTest < Inferno::Test
title 'Server supports TLS'
description %(
Verify that a server supports TLS.
)
id :tls_version_test
class << self
def versions
{
OpenSSL::SSL::SSL2_VERSION => 'SSL 2.0',
OpenSSL::SSL::SSL3_VERSION => '... | 32.555556 | 111 | 0.633675 |
87d90099e1b8cb37ddeb7fd3c30728b7411442c3 | 85 | class Patterns::ActivityFeedsController < ApplicationController
def index; end
end
| 21.25 | 63 | 0.835294 |
01e0fc9df5f1314ce1bd9d56aa870f16d8a3a3ff | 136 | # boolean_1 = !true
boolean_1 = false
# boolean_2 = !true && !true
boolean_2 = false
# boolean_3 = !(700 / 10 == 70)
boolean_3 = false | 17 | 31 | 0.647059 |
e28bf4468c9559f0688a3d9b2dd89520b2fd3bc8 | 136 | require_relative 'distance_conversions'
module FixnumExtension
refine Fixnum do
include ::Geodesy::DistanceConversions
end
end
| 17 | 42 | 0.808824 |
e2009146c91f37e0c9b93c130ec01b429f6b2d70 | 764 | begin
require 'rubygems'
require 'test/unit'
require 'active_support'
require 'active_support/inflector'
if RUBY_VERSION >= "1.9.0"
require 'csv'
else
require 'fastercsv'
end
require File.dirname(__FILE__) + '/../lib/to_csv'
rescue LoadError
puts 'to_csv tests rely on active_support, and faste... | 20.105263 | 97 | 0.683246 |
26bf5a4aa1aa2cb78f5fe11a80b6d7ab3dd57e49 | 800 | cask "expressvpn" do
version "10.8.0.2"
sha256 "31da59779c3e5e388ef84e5186791a81dab8c272c8d1d0809d633850d5f80fb9"
url "https://www.expressvpn.works/clients/mac/expressvpn_mac_#{version}_release.pkg"
name "ExpressVPN"
desc "VPN client for secure internet access and private browsing"
homepage "https://www.ex... | 32 | 87 | 0.6725 |
61bbf9bbcdead132e535175779d3abb7cfbeed6f | 128 | json.extract! helado, :id, :nombre, :precio, :sabor, :tipo, :created_at, :updated_at
json.url helado_url(helado, format: :json)
| 42.666667 | 84 | 0.726563 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.