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 |
|---|---|---|---|---|---|
aba6e84b94e7b240ad56c43295a5a12a22abf45c | 1,869 | class Vimpager < Formula
desc "Use ViM as PAGER"
homepage "https://github.com/rkitover/vimpager"
url "https://github.com/rkitover/vimpager/archive/2.06.tar.gz"
sha256 "cc616d0840a6f2501704eea70de222ab662421f34b2da307e11fb62aa70bda5d"
head "https://github.com/rkitover/vimpager.git"
bottle do
sha256 cell... | 44.5 | 135 | 0.779026 |
337ca88a3325365dcc7e02708c8cbc1f4c2933cd | 1,183 | # rails_admin-1.0 ready
require 'rails_admin/adapters/mongoid'
module RailsAdmin
module Adapters
module Mongoid
StatementBuilder.class_eval do
def build_statement_for_type
case @type
when :boolean
build_statement_for_boolean
when :integer, :decimal, :float
... | 31.131579 | 104 | 0.617075 |
26021e7154e0193e06a57d877f4b732b39fde7c0 | 569 | class Object
define_method :singleton_class, instance_method(:metaclass) unless respond_to?(:singleton_class)
def to_bson(*args)
{MongoDoc::BSON::CLASS_KEY => self.class.name}.tap do |bson_hash|
instance_variables.each do |name|
bson_hash[name[1..-1]] = instance_variable_get(name).to_bson(args)
... | 28.45 | 98 | 0.681898 |
bbf9eeccc3ae868c1a970e56e5a1d174bba8ef3e | 160 | class Docear < Cask
version 'latest'
sha256 :no_check
url 'http://docear.org/download/docear.dmg'
homepage 'http://docear.org'
app 'Docear.app'
end
| 16 | 45 | 0.69375 |
01c7079cb0ed2189416deccd1b055b633f21e4eb | 1,210 | # encoding: UTF-8
module CSKit
module Readers
Reading = Struct.new(:texts, :citation, :chapter, :verse) do
def params
@params || {}
end
def to_annotated_reading
AnnotatedReading.new(texts, citation, chapter, verse)
end
def annotated?
false
end
... | 19.516129 | 107 | 0.57438 |
11534dd596ed47f2deeb992f9240b3bc0ea43ffe | 131 | require 'test_helper'
class McqsControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end
| 16.375 | 53 | 0.725191 |
bf57c3db9f53688655f1dfe5081c20222d88cc28 | 427 | module Sass
module Tree
class DebugNode < Node
def initialize(expr, options)
@expr = expr
super(options)
end
protected
def _perform(environment)
res = @expr.perform(environment)
if filename
STDERR.puts "#{filename}:#{line} DEBUG: #{res}"
... | 18.565217 | 57 | 0.529274 |
2152f4df8254a19aefa0c46708b8bf2b454b03ac | 158 | # frozen_string_literal: true
class CreateGroupLessonSummaries < ActiveRecord::Migration[5.2]
def change
create_view :group_lesson_summaries
end
end
| 19.75 | 63 | 0.803797 |
01770c728fac924502780b465eec107d26cd56eb | 926 | require 'tweetstream/configuration'
require 'tweetstream/client'
require 'tweetstream/daemon'
module TweetStream
extend Configuration
class ReconnectError < StandardError
attr_accessor :timeout, :retries
def initialize(timeout, retries)
self.timeout = timeout
self.retries = retries
super... | 25.027027 | 80 | 0.691145 |
7a76b3f390667ce4aadb4805e8bb5b76ae1dd6d8 | 9,476 | class Electrum < Formula
include Language::Python::Virtualenv
desc "Bitcoin thin client"
homepage "https://electrum.org"
url "https://download.electrum.org/3.3.8/Electrum-3.3.8.tar.gz"
sha256 "e2adf191847609d5bd850320f647db6347952b170364a463276db27a836400bc"
revision 1
bottle do
root_url "https://dl... | 46 | 147 | 0.824821 |
e8c68cb0e4490d30f83ceab64b486334c9989b50 | 402 | require 'rails_helper'
RSpec.describe FormsController do
describe '#check_household' do
controller do
def index
head :ok
end
end
it 'redirects to the homepage if no household is set on the session' do
get :index, params: { locale: I18n.default_locale }, session: { current_house... | 23.647059 | 97 | 0.68408 |
033db2e0fbb4160e79e9ae7252d5db77c04d5325 | 488 | module Quickbooks
module Service
class SalesReceipt < BaseService
def delete(sales_receipt)
delete_by_query_string(sales_receipt)
end
def pdf(sales_receipt)
url = "#{url_for_resource(model::REST_RESOURCE)}/#{sales_receipt.id}/pdf"
response = do_http_raw_get(url, {}, {'A... | 21.217391 | 81 | 0.639344 |
08a65e894e26dae9ae4302915a40f92eccc2364c | 1,362 | # -*- encoding: utf-8 -*-
# stub: formatador 0.2.5 ruby lib
Gem::Specification.new do |s|
s.name = "formatador".freeze
s.version = "0.2.5"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["geemus (Wes... | 34.923077 | 112 | 0.668135 |
d55e81216afd3d3639bc1bdd3bfe590155691f4e | 678 | #encoding: utf-8
module PostProcessors
# Turns references to options into links.
#
# While we should do our best to link to options we are not always consistent
# with it. This processor ensure that we are.
class OptionLinker
class << self
def link!(content)
content.scan(/ `([a-zA-Z][a-zA-Z... | 27.12 | 85 | 0.575221 |
1a3b405329942b38355bc93365bc27b2730e45c8 | 408 |
# Time complexity: O(n)
# Space Complexity: O(n)
# P(n) = P(P(n - 1)) + P(n - P(n - 1)
def newman_conway(num)
if num < 1
raise ArgumentError.new
end
return "1" if num == 1
return "1 1" if num == 2
result = [0,1,1]
for i in (3..num) do
answer = result[result[i - 1]] + result[i - result[i - 1... | 18.545455 | 62 | 0.563725 |
39a95f8294ef7d2e09dd41667dbb2da4a7618035 | 9,974 | require 'date'
require 'faraday'
require 'multi_xml'
module CTA
class BusTracker
class VehiclesResponse < CTA::API::Response
# @return [Array<CTA::Bus>] An array with a full {CTA::Bus} object for each vehicle returned in the API, augmented
# with live details
attr_reader :vehicles
def ... | 41.045267 | 160 | 0.645378 |
62bfe80ad4eba43e219014c3236308ab8f6db827 | 3,997 | require "digest/sha3"
class StatsApiThread < Thread
attr_reader :stats
CONTRACT_ADDR = "0x341e09f0Aa71Cb742537Aa4B946621E2d458a1E9"
DEFAULT_STATS = {}
def initialize(every:, on_change: nil, parity:)
@on_change = on_change
@parity = parity
@stats = DEFAULT_STATS
super(every) do |every|
... | 34.456897 | 93 | 0.534401 |
33c9f50e5aa14438c1780a0be14bf15c8188610c | 3,521 | require 'spec_helper'
require 'rack/test'
module Bosh::Director
module Api
describe Extensions::Scoping do
include Rack::Test::Methods
let(:config) do
config = Config.load_hash(SpecHelper.spec_get_director_config)
identity_provider = Support::TestIdentityProvider.new(config.get_uuid_... | 32.601852 | 88 | 0.559784 |
01a3a3b0fa41c0aac48b81ffaa3235aa0bd3f307 | 1,084 | require 'stringio'
module FSR
class FakeSocket
def initialize(remote_host, remote_port)
@remote_host, @remote_port = remote_host, remote_port
@input = StringIO.new('')
@buffer = []
end
def hostname
'localhost'
end
def address
'127.0.0.1'
end
def eof?
... | 16.179104 | 59 | 0.607934 |
4a39e96972170740ccc14ac244e21cc399baf9cf | 822 | require 'coveralls'
Coveralls.wear!
$: << "#{File.dirname(__FILE__)}/../lib"
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each {|f| require f}
require 'pry'
require 'vcr'
require 'gather_content'
require 'climate_control'
# require 'figs'
# Figs.load()
VCR.configure do |c|
c.filter_sensitive_data('api-id... | 30.444444 | 87 | 0.749392 |
397226bfd8c0270d9cfaa2ec49eb50766bd393f9 | 4,685 | require 'rails_helper'
RSpec.describe 'API Error', type: :request do
let!(:person) { Person.create! first_name: 'Test', last_name: 'Person' }
let!(:email) { person.emails.create(address: 'test@example.com') }
subject { JSON.parse(response.body) }
describe 'Onsi::Errors::UnknownVersionError' do
before { ... | 34.19708 | 119 | 0.576307 |
ffca3a80b4af6fbf7e726516f9b77bf19729b6bd | 728 | cask 'toggldesktop-beta' do
version '7.4.18'
sha256 'e0e6a2a44e91fb34fba9d7cb1e3a41a288ec55da9415efae18a83b396ab88287'
# github.com/toggl/toggldesktop was verified as official when first introduced to the cask
url "https://github.com/toggl/toggldesktop/releases/download/v#{version}/TogglDesktop-#{version.dots_... | 38.315789 | 123 | 0.707418 |
6260dd98bf22a1d55de5be1ad628e9cfdcc17d6f | 1,684 | class Cgvg < Formula
desc "Command-line source browsing tool"
homepage "https://uzix.org/cgvg.html"
url "https://uzix.org/cgvg/cgvg-1.6.3.tar.gz"
sha256 "d879f541abcc988841a8d86f0c0781ded6e70498a63c9befdd52baf4649a12f3"
license "GPL-2.0-or-later"
bottle do
rebuild 1
sha256 cellar: :any_skip_relocat... | 52.625 | 122 | 0.779691 |
e2b23e183b428c157dfb72583763a28784977233 | 12,724 | require 'sinatra'
require 'zip'
config_options = JSON.parse(File.read('./config.json'))
######
# Admin Interfaces
######
get '/admin/' do
redirect to("/no_access") if not is_administrator?
@admin = true
haml :admin, :encode_html => true
end
get '/admin/add_user' do
redirect to("/no_access") if not ... | 26.900634 | 140 | 0.627161 |
ab70d65f50a62a315cc3ee849686ec1b17ef5e42 | 10,546 | # -*- coding: BINARY -*-
here = File.expand_path('../lib', __dir__)
$:.unshift(here) unless $:.include?(here)
require 'z80'
require 'zxlib/gfx/draw'
require 'zxlib/basic'
class Stars
include Z80
include Z80::TAP
import ZXLib::Sys, macros: true, code: false, labels: true
macro_import Stdlib
macro_impo... | 34.24026 | 127 | 0.351318 |
0342ef661050391e7ec85b74924c7f8088204e9c | 766 | # frozen_string_literal: true
require 'bundler/setup'
require 'polyphony'
require 'polyphony/fs'
def raw_read_file(x)
t0 = Time.now
x.times { IO.orig_read(__FILE__) }
puts "raw_read_file: #{Time.now - t0}"
end
def threaded_read_file(x, y)
t0 = Time.now
threads = []
y.times do
threads << Thread.new { ... | 19.641026 | 60 | 0.660574 |
e9748f997a5c11a62ac5509f992fc21189b2fa88 | 115 | module AuthHelper
def http_login
basic_authorize(CONFIG["auth_username"], CONFIG["auth_password"])
end
end
| 19.166667 | 69 | 0.765217 |
e254b60dbf1873baeb5e8b6cf1b3dffd603ef6cd | 621 | # We are eval'd in the scope of the acceptance framework's option-parsing
# code, so we can't use __FILE__ to find our location. We have access to
# a variable 'options_file_path', though.
require File.expand_path(File.join(File.dirname(options_file_path), 'common.rb'))
common_options_hash.tap do |my_hash|
my_has... | 41.4 | 81 | 0.697262 |
1a31ad2108ac9e06541185eab145336fef69a2e0 | 464 | # frozen_string_literal: true
module ElasticQueryStringQuery
def filtered_query_query(json)
return if @q.blank?
json.must do
json.child! { query_string(json, highlighted_fields, @q, query_string_options) }
end
end
def query_string(json, fields, query, options = {})
json.query_string do
... | 21.090909 | 86 | 0.676724 |
1cc7d15a3a47db00f9e5be804896df793a8de1fd | 1,612 | # Frozen-string-literal: true
# Copyright: 2012 - 2018 - MIT License
# Author: Jordon Bedwell
# Encoding: utf-8
module Jekyll
module Assets
module Plugins
class Liquid
TYPES = {
"text/liquid+sass" => %w(.sass.liquid .liquid.sass),
"application/liquid+javascript" => %w(.liquid.j... | 33.583333 | 75 | 0.585608 |
ab7639a4f6f6645a39d62f3d46547f4648143337 | 10,886 | require_relative '../../helpers/avatar_helper'
require_dependency 'carto/controller_helper'
module Carto
module Api
class UsersController < ::Api::ApplicationController
include OrganizationUsersHelper
include AppAssetsHelper
include MapsApiHelper
include SqlApiHelper
include CartoDB... | 41.234848 | 157 | 0.681701 |
ab00a92d881ca9d31663f188d76862d86730d27d | 988 | require 'spec_helper'
describe Confetti::Config::Author do
before do
@author = Confetti::Config::Author.new
end
it "should have a readable and writable name field" do
lambda { @author.name = "Andrew Lunny" }.should_not raise_error
@author.name.should == "Andrew Lunny"
end
it "should have a read... | 26.702703 | 72 | 0.65081 |
abbe04edf6910920fbbe259932b36eb9eacd5d5a | 296 | require File.expand_path('../fantasy-irc/irc', __FILE__)
require File.expand_path('../fantasy-irc/events', __FILE__)
require File.expand_path('../fantasy-irc/plugins', __FILE__)
require File.expand_path('../fantasy-irc/rooms', __FILE__)
require File.expand_path('../fantasy-irc/users', __FILE__)
| 49.333333 | 60 | 0.763514 |
5db5b98b069d2ccfd4f5e7b89d39f589b396dbbc | 32,533 | RSpec.describe RelationshipMixin do
let(:test_rel_type) { "testing" }
# 0
# 1 2
# 3 4 5 6 7
# 8 9
let(:vms_rel_tree) { {0 => [{1 => [3, 4]}, {2 => [5, 6, {7 => [8, 9]}]}]} }
let(:vms) { build_relationship_tree(vms_rel_tree) }
# host with no tree
let(:host) { FactoryBot.cr... | 35.594092 | 165 | 0.582424 |
1dfa710ecccb2aab879904764dedc352c54dd12d | 115 | require 'active_json/version'
require 'active_json/query'
require 'active_json/filter'
require 'active_json/pluck'
| 23 | 29 | 0.826087 |
013187fcf57e5895ed3a56c4995583eebc5ec8c0 | 363 | module Preact
module FunctionComponent
module Mixin
def self.included(base)
base.include(::Preact::Component::Elements)
base.include(::Preact::FunctionComponent::Initializer)
base.include(::Preact::FunctionComponent::Api)
base.extend(::Preact::FunctionComponent::NativeCompone... | 27.923077 | 76 | 0.694215 |
28d0bd987e009872e52fa856475413864fab0d3a | 826 | class FacebookBot
def send_message(data)
url = URI.parse("https://graph.facebook.com/v2.6/me/messages?access_token=#{ENV['ACCESS_TOKEN']}")
http = Net::HTTP.new(url.host, 443)
http.use_ssl = true
begin
request = Net::HTTP::Post.new(url.request_uri)
request["Content-Type"] = "application/... | 22.944444 | 102 | 0.613801 |
79d332c0f7bbf024db24e2ca0a170d0c8b4ed594 | 371 | # 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::Kusto::Mgmt::V2019_11_09
module Models
#
# Defines values for IdentityType
#
module IdentityType
None = "None"
S... | 21.823529 | 70 | 0.698113 |
d5c96de0f1b248c94d76ac1f81c133ba8732c46a | 101 | require 'bundler/setup'
require File.expand_path "../../spec/rails_app/config/environment", __FILE__
| 33.666667 | 76 | 0.782178 |
e9a518eec01d0f649c3a450597debeda35951ab7 | 2,695 | require 'spec_helper'
require 'fixtures/pubsub'
describe Blather::Stanza::PubSub::Subscribe do
it 'registers itself' do
Blather::XMPPNode.class_from_registration(:subscribe, 'http://jabber.org/protocol/pubsub').should == Blather::Stanza::PubSub::Subscribe
end
it 'can be imported' do
Blather::XMPPNode.pa... | 43.467742 | 139 | 0.70167 |
18ebc7ad87f628d301ad81ccd6cddc4520082f50 | 978 | require 'spec_helper'
describe Squall::Transaction do
before(:each) do
@transaction = Squall::Transaction.new
@keys = ["pid", "created_at", "updated_at", "actor", "priority",
"parent_type", "action", "id", "user_id", "dependent_transaction_id",
"allowed_cancel", "parent_id", "params", "log_output... | 22.227273 | 83 | 0.623722 |
b938fc139c9285f901ca9ec3d68c023b5e7087f5 | 319 | require 'spec_helper'
describe name_from_filename do
include_examples 'module'
def self.targets
%w(Generic)
end
def self.elements
[ Element::COOKIE ]
end
def issue_count
2
end
easy_test { issues.map { |i| i.var }.sort.should == %w(cookie cookie2).sort }
end
| 15.95 | 81 | 0.61442 |
d5ec7763f1e129301e1a6e612934d06522332f5f | 1,371 | # == Schema Information
#
# Table name: referentials
#
# id :bigint(8) not null, primary key
# man_day_duration_in_seconds :integer
# work_per_day_duration_in_seconds :integer
# mission_id :bigint(8)
# created_at :datetime ... | 26.365385 | 168 | 0.687819 |
0142706d140039b54b98fa3e3e1e713713bfac3e | 16,560 | require 'spec_helper'
describe Discussion, model: true do
subject { described_class.new([first_note, second_note, third_note]) }
let(:first_note) { create(:diff_note_on_merge_request) }
let(:second_note) { create(:diff_note_on_merge_request) }
let(:third_note) { create(:diff_note_on_merge_request) }
descri... | 27.878788 | 92 | 0.61401 |
4a82eacd5380b821609df2efed5bb91d93cd25ff | 1,114 | Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web ser... | 37.133333 | 85 | 0.771095 |
e9ea54a5966f54f92ad86748a7c2ba544695b592 | 526 | module AssetCloud
class InvalidBucketError < StandardError
end
class InvalidBucket < Bucket
Error = "No such namespace: %s".freeze
def ls(namespace)
raise InvalidBucketError, Error % namespace
end
def read(key)
raise InvalidBucketError, Error % key
end
def write(key, data)
... | 18.137931 | 49 | 0.663498 |
1d9faa32a2b4e2968b837cec85430375bfebe396 | 1,544 | require 'rescue_unique_constraint/version'
require 'rescue_unique_constraint/index'
require 'rescue_unique_constraint/rescue_handler'
require 'rescue_unique_constraint/adapter/mysql_adapter'
require 'rescue_unique_constraint/adapter/postgresql_adapter'
require 'rescue_unique_constraint/adapter/sqlite_adapter'
require '... | 35.090909 | 88 | 0.751943 |
79d22a506b11b3c50306e04fa2af86fbbac1a0ed | 2,927 | require_relative '../../spec_helper'
require_relative 'fixtures/classes'
describe "Module#class_variable_get" do
it "returns the value of the class variable with the given name" do
c = Class.new { class_variable_set :@@class_var, "test" }
c.send(:class_variable_get, :@@class_var).should == "test"
c.send(... | 38.012987 | 100 | 0.696959 |
e9c7aa69a122dcb1b45bec9e7ae40d48f96694b5 | 7,416 | module Bosh::Cli
module Command
class Base
extend Bosh::Cli::CommandDiscovery
include Bosh::Cli::DeploymentHelper
attr_accessor :options, :out, :args
attr_reader :work_dir, :exit_code, :runner
DEFAULT_DIRECTOR_PORT = 25555
# @param [Bosh::Cli::Runner] runner
def initia... | 28.197719 | 113 | 0.612325 |
1d89430cc5cdc68d7a502c9739626d21b6cd7100 | 2,255 | # frozen_string_literal: true
module Geo
module BlobReplicatorStrategy
extend ActiveSupport::Concern
include Delay
include Gitlab::Geo::LogHelpers
included do
event :created
end
class_methods do
end
def handle_after_create_commit
publish(:created, **created_params)
... | 24.51087 | 88 | 0.711308 |
1c16a6a65413aece10018c469e6dbe3ac6dc7315 | 724 | require 'rubygems'
require 'sinatra'
require 'sinatra/json'
require "sinatra/reloader" if development?
require 'net/http'
require 'net/https'
require 'uri'
require 'json'
require 'time'
require_relative './places'
require_relative './weather'
require_relative './google_maps'
DIRECTIONS_URI = URI("https://maps.google... | 24.133333 | 85 | 0.741713 |
e27abf6091242afa7359d144811b1ee4ce8fc41f | 1,009 | name 'openstack-object-storage'
maintainer 'ATT, Inc.'
license 'Apache 2.0'
description 'Installs and configures Openstack Swift'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '9.0.3'
recipe 'openstack-object-storage::account-... | 43.869565 | 101 | 0.667988 |
ff308c34dfc5adf53666eb423a90921e4e909ed6 | 1,064 | # coding: utf-8
require File.dirname(__FILE__) + '/spec_helper.rb'
describe ONIX::Subject do
before(:each) do
data_path = File.join(File.dirname(__FILE__),"..","data")
file1 = File.join(data_path, "subject.xml")
@doc = Nokogiri::XML::Document.parse(File.read(file1))
@root = @doc.root
end
... | 28 | 100 | 0.697368 |
1a46e64bd6b334b7d2c0ce0f42ac7983af340577 | 1,169 | Given(/^the following documents exist:$/) do |table|
table.hashes.each do |hash|
project = Document.create(hash)
project.save
end
end
When(/^I click the "([^"]*)" button for document "([^"]*)"$/) do |button, document_name|
document = Document.find_by_title(document_name)
if document
within("tr##{do... | 27.833333 | 88 | 0.596236 |
4a6fd2c02a86ffe407275025cf2bf889fb16dbb9 | 2,855 | # -*- encoding: utf-8 -*-
# stub: rails 5.1.5 ruby lib
Gem::Specification.new do |s|
s.name = "rails"
s.version = "5.1.5"
s.required_rubygems_version = Gem::Requirement.new(">= 1.8.11") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"]
s.authors = ["David Heinemeier Hansson"]
s.date =... | 44.609375 | 200 | 0.629772 |
f78112f701beda2167004393e2e41165a8118aa6 | 1,227 | require 'spec_helper'
describe Travis::Build::Script::C, :sexp do
let(:data) { payload_for(:push, :c) }
let(:script) { described_class.new(data) }
subject { script.sexp }
it { store_example }
it_behaves_like 'a bash script'
it_behaves_like 'compiled script' do
let(:code) { ['TRAVIS_L... | 26.673913 | 92 | 0.629177 |
21b1fd2c2eac2260bf7639845ed8ad1fdd7532a5 | 848 | control 'cis-docker-benchmark-2.7' do
impact 1.0
title 'Set default ulimit as appropriate'
desc 'ulimit provides control over the resources available to the shell and to processes started by it. Setting system resource limits judiciously saves you from many disasters such as a fork bomb. Sometimes, even friendly ... | 60.571429 | 327 | 0.751179 |
d5b4cae49227128ee34dcde26ad2cf77bacf135d | 326 | class FixFeedbackStringSearchCriteria < ActiveRecord::Migration[6.1]
def change
Feedback.find_each do |f|
next unless f.search_criteria.is_a?(String)
f.update_columns(search_criteria: JSON.parse(f.search_criteria))
rescue JSON::ParserError
f.update_columns(search_criteria: nil)
end
en... | 27.166667 | 70 | 0.742331 |
e225c42891bde45ad9d62bdae3f9e95b6d192c43 | 546 | require 'rails_helper'
RSpec.describe Point::Info, type: :model do
ginza = ::StationFacility::Info.find_by( same_as: "odpt.StationFacility:TokyoMetro.Ginza" )
kanda = ::StationFacility::Info.find_by( same_as: "odpt.StationFacility:TokyoMetro.Kanda" )
point_infos_in_ginza = ginza.point_infos
point_infos_in_kan... | 32.117647 | 99 | 0.760073 |
f8210265ef2afd296514cfb461fd08c21ee28be4 | 1,776 | module Fog
module Network
class OpenStack
class Real
def get_port(port_id)
request(
:expects => [200],
:method => 'GET',
:path => "ports/#{port_id}"
)
end
end
class Mock
def get_port(port_id)
response ... | 34.153846 | 123 | 0.413288 |
f89b91eae2ca1709fc8d83f4dbe70a523b565cff | 550 | require 'spec_helper'
module Opbeat
RSpec.describe Filter do
let(:config) { Configuration.new filter_parameters: [/password/, 'passwd'] }
subject do
Filter.new config
end
describe "#apply" do
it "filters a string" do
filtered = subject.apply "password=SECRET&foo=bar"
exp... | 22.916667 | 80 | 0.621818 |
01bed77fcdfe3420d66c989218c0060a84a997ed | 1,385 | # frozen_string_literal: true
require_relative '../lib/aspose-email-cloud'
require 'securerandom'
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_... | 30.108696 | 89 | 0.745848 |
e919ac761de333f03cd90d45403db4bfa58b819c | 966 | require 'spec_helper'
describe MetaTags::ViewHelper, 'displaying Open Search meta tags' do
subject { ActionView::Base.new }
it 'should display meta tags specified with :open_search' do
subject.set_meta_tags(open_search: {
title: 'Open Search Title',
href: '/open_search_path.xml'
})
su... | 28.411765 | 68 | 0.628364 |
089cb32f5a26a04ed2fc47a9bdb647c14b7b5486 | 6,017 | #
# Cookbook Name:: L7-mongo
# Provider:: db
#
# Copyright 2016, Gabor Szelcsanyi <szelcsanyi.gabor@gmail.com>
def whyrun_supported?
true
end
action :remove do
service new_resource.name do
action [:stop, :disable]
end
directory "#{new_resource.home}/mongodb-#{new_resource.name}" do
action :delete
... | 24.262097 | 74 | 0.646335 |
6a4ec8f75c5b626b5a6405b5099b2398dee5d309 | 459 | cask 'eclipse-installer' do
version '4.7.0,oxygen:R'
sha256 '610b28ad30fc9ba044c87cca87ef66abdbe938d3ea50d112a81e36f953a72c0e'
url "https://eclipse.org/downloads/download.php?file=/oomph/epp/#{version.after_comma.before_colon}/#{version.after_colon}/eclipse-inst-mac64.tar.gz&r=1"
name 'Eclipse Installer'
hom... | 27 | 155 | 0.755991 |
bfe761e85a99998e9dfe20948ff50df724bf4928 | 1,899 | describe Spaceship::Portal::Persons do
before { Spaceship.login }
let(:client) { Spaceship::Persons.client }
it "should factor a new person object" do
joined = "2016-06-20T06:30:26Z"
attrs = {
"personId" => "1234",
"firstName" => "Helmut",
"lastName" => "Januschka",
"email" => "hel... | 31.131148 | 70 | 0.627172 |
186681d3cd3b4524ca385dd78ff8c71ef19092ce | 5,334 | # require 'geo_ruby/simple_features/point'
# require 'geo_ruby/simple_features/line_string'
# require 'geo_ruby/simple_features/linear_ring'
# require 'geo_ruby/simple_features/polygon'
# require 'geo_ruby/simple_features/multi_point'
# require 'geo_ruby/simple_features/multi_line_string'
# require 'geo_ruby/simple_fea... | 39.80597 | 113 | 0.546494 |
21d929077adb1c3653b1e4e1c2629cbfd54e2aee | 14,536 | =begin
#The Plaid API
#The Plaid REST API. Please see https://plaid.com/docs/api for more details.
The version of the OpenAPI document: 2020-09-14_1.31.1
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.1.0
=end
require 'date'
require 'time'
module Plaid
# Defines the request schema for... | 33.416092 | 219 | 0.633255 |
ede8c246d942661f5933bb02c8362021479c5fce | 307 | class Article < ApplicationRecord
belongs_to :user
has_many :article_categories
has_many :categories, through: :article_categories
validates :title, presence: true, length: { minimum: 5 }
validates :description, presence: true, length: { minimum: 100 }
validates :user_id, presence: true
end
| 30.7 | 66 | 0.752443 |
6a2da372709ff8ecab5934399fcbed4e1c34695d | 922 | # frozen_string_literal: true
require_relative '../dictionary_key'
require_relative '../services/dictionary_metadata_service'
require_relative 'dictionary_cache_validatable'
require_relative 'dictionary_metadata_validatable'
module LittleWeasel
module Modules
# This module defines methods and attributes to cons... | 30.733333 | 115 | 0.793926 |
087a7446be6d46972931c8169a23c056c9228fb4 | 149 | class AddPublicFlgagToAccount < ActiveRecord::Migration[5.2]
def change
add_column :accounts, :public_site, :boolean, default: false
end
end
| 24.833333 | 64 | 0.765101 |
e9ba32b3306ac5e4a59d14ecae41923fc07130dd | 1,281 | =begin
#Selling Partner API for Catalog Items
#The Selling Partner API for Catalog Items helps you programmatically retrieve item details for items in the catalog.
OpenAPI spec version: v0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 3.0.24
=end
require 'spec_helper'
req... | 27.255319 | 117 | 0.746292 |
38b38f4be5d41f33e42feeac36af45b603b96f58 | 3,409 | describe "NRSER.transform" do
subject { NRSER.transform tree, source }
describe_section "Simple Examples" do
# ========================================================================
describe "value swap in {x: 'ex', y: 'why?'}" do
let( :tree ) {
{
x: [ :y ].to_proc,
... | 21.713376 | 76 | 0.315928 |
d5076ec283f0aad509e48f47b0134d4050be7a3f | 294 | require 'test_queue'
require 'test_queue/runner/minitest'
class SleepyTestRunner < TestQueue::Runner::MiniTest
def after_fork(num)
if ENV['SLEEP_AS_RELAY'] && relay?
sleep 5
elsif ENV['SLEEP_AS_MASTER'] && !relay?
sleep 5
end
end
end
SleepyTestRunner.new.execute
| 19.6 | 52 | 0.704082 |
26bf529738fda38e264640cc1b800318752f4a7d | 2,808 | require 'gli'
require 'yaml'
require 'colorize'
require 'meetup-cli/api'
require 'meetup-cli/version'
APP_NAME = File.basename $0, File.extname($0)
CONFIG_FILE = File.join(ENV['HOME'], ".#{APP_NAME}rc")
# Use the GLI command line parser to create this CLI app
# https://github.com/davetron5000/gli
#
include GLI::... | 24.206897 | 186 | 0.691952 |
f7a50e4225af78ce4c11c3019f96a3fd03708d69 | 709 | require 'spec_helper'
describe Rounders::Stores::Memory do
let(:described_class) { Rounders::Stores::Memory }
let(:described_instance) { described_class.new(*args) }
let(:args) { [] }
describe '#initialize' do
subject { described_instance }
it { is_expected.to be_a described_class }
end
describe ... | 25.321429 | 57 | 0.688293 |
f7efd8be045ea606d6fcd9a7f0a5b676ff924f4c | 861 | require "spec_helper"
describe Rrserver::Server do
let(:server) { Rrserver::Server.new(application, sockets) }
let(:application) { double(:application) }
let(:socket) { double(:socket) }
let(:sockets) { [socket] }
describe "#run" do
it "handles interrupt" do
expect(server).to receive(:monitor) { raise Inter... | 25.323529 | 77 | 0.684088 |
4a2d9e1325a96b835349ad4c9cb002b52de086dc | 5,607 | # 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
#------------------------------------------------------------------------------
class AccountsController < Ent... | 35.264151 | 105 | 0.502229 |
7a93847ec8abd8f757d58ddf99733f6063a5e39e | 387 | require 'rails'
require 'sprockets/railtie'
require 'jquery/rails'
require 'gl-matrix'
require 'jax/core/shader_processor'
require 'jax/core/generators/all'
require 'jax/core/matchers'
module Jax
module Core
class Railtie < Rails::Engine
initializer 'jax.shaders' do |app|
app.assets.register_engine ... | 21.5 | 73 | 0.715762 |
393fb19628d25560dd5e5199bc50195f74895378 | 4,922 | require 'spec_helper'
describe 'puppet_enterprise::profile::controller' do
it { should contain_package("pe-client-tools") }
[
"/etc/puppetlabs/client-tools",
"/etc/puppetlabs/client-tools/ssl",
"/etc/puppetlabs/client-tools/ssl/certs"
].each do |path|
it { should contain_file(path)
.wit... | 37.287879 | 100 | 0.624137 |
088005c388df47d63fec366b26b606a91db22f47 | 2,794 | # -*- encoding: utf-8 -*-
# stub: autoprefixer-rails 9.8.6.1 ruby lib
Gem::Specification.new do |s|
s.name = "autoprefixer-rails".freeze
s.version = "9.8.6.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "bug_tracker_uri" => "htt... | 50.8 | 270 | 0.665354 |
1a624b001d4be8da2f7ea7337670c98200b26f81 | 5,507 | #
# Author:: Adam Jacob (<adam@chef.io>)
# Author:: Benjamin Black (<nostromo@gmail.com>)
# Author:: Bryan McLellan (<btm@loftninjas.org>)
# Author:: Daniel DeLeo (<dan@kallistec.com>)
# Author:: Doug MacEachern (<dougm@vmware.com>)
# Author:: James Gartrell (<jgartrel@gmail.com>)
# Author:: Isa Farnik (<isa@chef.io>)
... | 28.832461 | 96 | 0.660614 |
33cbd74dce0dca44316e19012e1311b64304ce8a | 1,021 | require 'benchmark'
module Dsm
class Time
attr_accessor :total_duration, :recent_duration, :overall_average, :recent_average, :estimate
def initialize
@recent_durations = []
@total_duration = 0.0
end
def measure(iteration, iterations_remaining)
@recent_duration = Benchmark.realti... | 30.029412 | 102 | 0.666993 |
1124055e135390c420e7bd3753bed6cde62e01e7 | 2,538 | # 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... | 36.782609 | 126 | 0.718676 |
bfe72bffd23f1ac7793d94f179b1eb1be10bb6db | 284 | maintainer "Opscode, Inc."
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Updates package list for pacman and has LWRP for pacman groups"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "1.0.2"
| 40.571429 | 81 | 0.704225 |
18e7e0a8202d29bd4c0d791a1127ad2d807344d4 | 5,899 | =begin
#DocuSign REST API
#The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign.
OpenAPI spec version: v2.1
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end
require 'date'
module DocuSign_eSign... | 28.497585 | 123 | 0.615867 |
7a7292a62fa00d6f9a4b39579b3faf03c5d58565 | 2,613 | # frozen_string_literal: true
describe Facter::Resolvers::Xen do
subject(:xen_resolver) { Facter::Resolvers::Xen }
let(:proc_xen_file) { false }
let(:xvda1_file) { false }
let(:log_spy) { instance_spy(Facter::Log) }
let(:domains) { '' }
before do
xen_resolver.instance_variable_set(:@log, log_spy)
... | 29.033333 | 118 | 0.652507 |
bf3c9b5efb698217e08e973c94d9b1fc50cdf3a5 | 869 | ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require "minitest/reporters"
Minitest::Reporters.use!
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
include Applicati... | 26.333333 | 82 | 0.659379 |
3837b115402c4ab4ced5a7d7d1ad816c250f2d0f | 1,769 | class Libspnav < Formula
desc "Client library for connecting to 3Dconnexion's 3D input devices"
homepage "https://spacenav.sourceforge.io"
url "https://downloads.sourceforge.net/project/spacenav/spacenav%20library%20%28SDK%29/libspnav%200.2.3/libspnav-0.2.3.tar.gz"
sha256 "7ae4d7bb7f6a5dda28b487891e01accc856311... | 34.686275 | 128 | 0.716224 |
1cf13983e625397c7dc4434901a667efd1600599 | 1,623 | # typed: false
# frozen_string_literal: true
# This file was generated by GoReleaser. DO NOT EDIT.
class GoreleaserWork < Formula
desc "show version info only."
homepage "https://github.com/reiki4040/goreleaser-work"
version "0.2.4"
on_macos do
if Hardware::CPU.intel?
url "https://github.com/reiki40... | 30.622642 | 118 | 0.728281 |
5db145ddfff38bcb2f8b4f7d6b4f0a830630c366 | 284 | class Product < ActiveRecord::Base
acts_as_superclass
belongs_to :store
belongs_to :organization
validates_presence_of :name, :price
attr_accessible :name, :price
def parent_method
"#{name} - #{price}"
end
def dummy_raise_method(obj)
obj.dummy
end
end
| 14.2 | 37 | 0.714789 |
188119a768b60dd7112e549f7dbab7abfbb94fc8 | 3,627 | # frozen_string_literal: true
require "test_helper"
class Rus3EvaluatorTranslatorfTest < Minitest::Test
def setup
@parser = Rubasteme.parser
@translator = Rus3::Evaluator::Translator.new
end
def test_it_can_translate_boolean
tcs = { "#f" => "false", "#false" => "false",
"#t" => "true",... | 28.335938 | 135 | 0.554177 |
6a171b6b36eb9824beb334a9b592a6082e46e9e5 | 3,096 | require 'formula'
class Glib < Formula
homepage 'http://developer.gnome.org/glib/'
url 'http://ftp.gnome.org/pub/gnome/sources/glib/2.36/glib-2.36.4.tar.xz'
sha256 'f654d2542329012d8475736a165dfbf82fadf3ee940c2e0e6ddd4b2fde5cad7e'
option :universal
option 'test', 'Build a debug build and run tests. NOTE: No... | 32.93617 | 125 | 0.651163 |
e91e5e8582c3f35ce1e0066e336784ca503f87b0 | 1,221 | class Tag < ActiveRecord::Base
has_many :taggables, :through => :taggings
has_many :taggings
attr_accessible :name
attr_accessor :highlighted_attributes, :search_result_notes
validates_uniqueness_of :name, :case_sensitive => false
validates_length_of :name, :maximum => 100, :minimum => 1
validate :no_co... | 24.918367 | 79 | 0.718264 |
f88ce18c806e676c94e8dfcabc4e3a2f99ece26e | 1,940 | RSpec.describe PreventGo::Base do
describe '.initialize' do
subject { described_class.new(file) }
let(:file) { test_file_path_for('test.pdf') }
context 'when PreventGo respond with a code 400', cassette: '400' do
it 'should raise a PreventGo::ResponseError' do
expect { subject }.to raise_er... | 28.955224 | 72 | 0.607732 |
e8271ab989b9be2b3935615145c687dea2bcd8e4 | 1,558 | # Model class for blog posts
class BlogPost < ApplicationRecord
belongs_to :blog
belongs_to :author, class_name: 'User',
foreign_key: :user_id,
inverse_of: :blog_posts
has_one :discussion, as: :resource, dependent: :destroy
delegate :hidden, to: :discussion, allow_n... | 26.862069 | 79 | 0.65982 |
21396ddeec91566b9834c8f683a5a9247b0c4ce3 | 479 | # frozen_string_literal: true
module Gadget
module Generators
#
# generate type
#
class TypeGenerator < Rails::Generators::NamedBase
source_root File.expand_path('templates', __dir__)
def check_model_existance
raise "Cannot find model #{name}" unless Module.const_defined?(name)
... | 23.95 | 94 | 0.668058 |
399ea6639f76f6ef717d0c57797a8655493946f1 | 587 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require "json"
require "active_support/core_ext/hash/keys"
require "active_support/inflector"
require "rack/test"
require 'camel_patrol'
require "rails/version"
require 'minitest/autorun'
require "minitest/reporters"
Minitest::Reporters.use!(
[
Minitest... | 29.35 | 76 | 0.754685 |
ab04e803e4f06d740fea5c7b87fc5e64c85dd6e2 | 4,506 | require 'set'
module Aws
module Api
module Docs
module Utils
include Seahorse::Model
include Seahorse::Model::Shapes
def tag(string)
YARD::DocstringParser.new.parse(string).to_docstring.tags.first
end
def summary(string)
if string
Y... | 33.626866 | 264 | 0.56569 |
08ba2fc5866a32b5e146848ac1f1c3364e6a3ede | 2,067 | class Libusbmuxd < Formula
desc "USB multiplexor library for iOS devices"
homepage "https://www.libimobiledevice.org/"
url "https://github.com/libimobiledevice/libusbmuxd/archive/2.0.2.tar.gz"
sha256 "8ae3e1d9340177f8f3a785be276435869363de79f491d05d8a84a59efc8a8fdc"
license all_of: ["GPL-2.0-or-later", "LGPL-... | 43.0625 | 123 | 0.688921 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.