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 |
|---|---|---|---|---|---|
2872626ed7b43e82dd6c58c31cb2be4c8f1f4746 | 5,038 | # Copyright 2021 Google LLC
#
# Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
# frozen_string_literal: true
require "test_helper"
require "models/singer"
require "models/album"
require "models/track"
module ActiveRecor... | 35.478873 | 118 | 0.654228 |
bf2b99c2990c0a6c68ce9e6c3da57cd63b1680c2 | 277 | class Proc
def memoized
already_run = false
result = nil
->{
if already_run
result
else
already_run = true
result = call()
end
}
end
def not
-> (*args, &blk) {
! self.(*args, &blk)
}
end
end
| 13.190476 | 26 | 0.465704 |
26630fea08c73d067e2c16b6485bfd9d215315e6 | 950 | require 'helper'
describe MtGox::OrderResult do
let(:json) { JSON.parse(File.read(fixture('order_result.json')))['return'] }
subject { described_class.new(json) }
describe '#total_spent' do
it 'returns a decimal' do
expect(subject.total_spent).to eq BigDecimal.new('10.08323')
end
end
describe... | 27.142857 | 78 | 0.676842 |
6acf611eba581c9a9e4322b3232db46553f8639c | 585 | class RedmineService < IssueTrackerService
validates :project_url, :issues_url, :new_issue_url, presence: true, url: true, if: :activated?
prop_accessor :title, :description, :project_url, :issues_url, :new_issue_url
def title
if self.properties && self.properties['title'].present?
self.properties['ti... | 22.5 | 97 | 0.690598 |
f731a5af59a16ddc8be3d5879fea9bac1e47744f | 1,128 | class PortfoliosController < ApplicationController
before_action :portfolio_find, only: [:show, :edit, :update, :destroy]
def index
@user = current_user
@portfolios = @user.portfolios
end
def new
@portfolio = current_user.portfolios.build
end
def create
@p... | 22.56 | 74 | 0.641844 |
28ab9afa92c3bc081ccccb6bddfbac32bed247cb | 13,021 | # The MIT License (MIT)
#
# Copyright (c) 2020 Manybrain, Inc.
#
# 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, m... | 35.002688 | 136 | 0.650795 |
1cff059527f929c03e400f89f56b9eda9fda7bc2 | 10,215 | # frozen_string_literal: true
require 'yaml'
module SCSSLint
# Loads and manages application configuration.
class Config
FILE_NAME = '.scss-lint.yml'.freeze
DEFAULT_FILE = File.join(SCSS_LINT_HOME, 'config', 'default.yml')
attr_reader :options, :warnings, :file
class << self
def default
... | 29.694767 | 93 | 0.638081 |
5d72e313042c71d1c28ae9597c28603cb14f0186 | 550 | # frozen_string_literal: true
if @offender.present?
json.array!([@offender]) do |offender|
json.extract! offender,
:mainOffence, :receptionDate,
:firstName, :lastName, :offenderNo, :dateOfBirth,
:imprisonmentStatus
json.latestBookingId offender.booking_id... | 30.555556 | 81 | 0.692727 |
620a33dae56e7d74aa4423f8e10f48905f0e752c | 168 | class Activity < ApplicationRecord
belongs_to :band
belongs_to :financial, optional: true
def self.current_activity
where('ends_at > ?', Time.now)
end
end
| 18.666667 | 39 | 0.732143 |
abdebd286b4970e6453e7bdd8855ca266282b3cb | 497 | # frozen_string_literal: true
class CampaignFinisherWorker < ProjectBaseWorker
include Sidekiq::Worker
sidekiq_options retry: false, queue: 'finisher'
def perform(id)
return if resource(id).skip_finish?
resource(id).payments.where('gateway_id IS NOT NULL').with_states(%w[paid pending pending_refund]).fi... | 29.235294 | 142 | 0.768612 |
33703ad9a77672fd013c78dd486772e8b6288534 | 539 | require 'nokogiri'
require 'htmltoooxml'
include Htmltoooxml::XSLTHelper
# def html_to_ooxml(html)
# source = Nokogiri::HTML(html.gsub(/>\s+</, '><'))
# result = Htmltoooxml::Document.new().transform_doc_xml(source, false)
# result.gsub!(/\s*<!--(.*?)-->\s*/m, '')
# result = remove_declaration(result)
# pu... | 22.458333 | 73 | 0.604824 |
016379c59344fddc24fa54bf7c920ede3238c6af | 1,493 | cask "jabra-direct" do
version "6.1.13901"
sha256 :no_check
url "https://jabraxpressonlineprdstor.blob.core.windows.net/jdo/JabraDirectSetup.dmg",
verified: "jabraxpressonlineprdstor.blob.core.windows.net/jdo/"
name "Jabra Direct"
desc "Optimise and personalise your Jabra headset"
homepage "https://w... | 31.765957 | 88 | 0.662425 |
011ca97381a915308a85300a9477b5282b2321b8 | 67 | class ProofingComponent < ApplicationRecord
belongs_to :user
end
| 16.75 | 43 | 0.835821 |
ab9b08eb72d41f9b886cd44fdc5955bf6a4b4d6c | 1,330 | # In this file init configuration
load_ok=true
if load_ok
begin
require 'rubygems' # for a few dependencies
rescue LoadError => e
load_ok=false
print <<EOL
----------------------------------------------
*** LOAD ERROR ***
----------------------------------------------
Arcadia require rubygems
... | 22.931034 | 59 | 0.43985 |
ab34d6e5c82062d17e72f75e40dfee59e2ba7ef8 | 2,050 | require 'spec_helper_acceptance'
require 'zone_util'
RSpec.context 'zone manages path' do
after(:all) do
solaris_agents.each do |agent|
ZoneUtils.clean(agent)
end
end
# inherit /sbin on solaris10 until PUP-3722
def config_inherit_string(agent)
if %r{solaris-10}.match?(agent['platform'])
... | 31.538462 | 100 | 0.58878 |
1a1213f7594ba6f9d2438c2b13ef037de629f9f3 | 141 | class RemoveStrFromEventLogs < ActiveRecord::Migration[5.2]
def change
remove_column :event_logs, :block_number_str, :string
end
end
| 23.5 | 59 | 0.780142 |
79b3d1f08d0ad102da923444f1a699120e6cc345 | 2,428 | # frozen_string_literal: true
module Split
class Metric
attr_accessor :name
attr_accessor :experiments
def initialize(attrs = {})
attrs.each do |key,value|
if self.respond_to?("#{key}=")
self.send("#{key}=", value)
end
end
end
def self.load_from_redis(name)
... | 23.803922 | 81 | 0.616969 |
bbb92ff1b875b818e2123d1f6c7c61510f6c0764 | 2,664 | #! /usr/bin/env ruby
# encoding: UTF-8
# check-process-restart
#
# DESCRIPTION:
# This will check if a running process requires a restart if a
# dependent package/library has changed (i.e upgraded)
#
# OUTPUT:
# plain text
# Defaults: CRITICAL if 2 or more process require a restart
# WARNING if 1... | 25.132075 | 147 | 0.650901 |
39a05729af817736bda440c1ad8e975dc638691c | 12,416 | =begin
#NSX-T Manager API
#VMware NSX-T Manager REST API
OpenAPI spec version: 2.5.1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.19
=end
require 'date'
module NSXT
class RAConfig
# The maximum number of hops through which packets can pass before being di... | 34.876404 | 236 | 0.656411 |
1cdd15b47bcb7dc8a991a79e637e27e765998b3e | 3,901 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# Source: google/firestore/v1beta1/firestore.proto for package 'google.firestore.v1beta1'
# Original file comments:
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance... | 44.329545 | 93 | 0.676493 |
4a42efbfbf2762c817545b108fb40ea9bc99dca1 | 1,767 | require 'shevy/version'
require 'fileutils'
require 'thor'
require 'pathname'
module Shevy
class Generator < Thor
map ["-v", "--version"] => :version
desc "install", "Install Shevy into your project"
method_options :path => :string, :force => :boolean
def install
if shevy_files_already_exist? ... | 21.54878 | 61 | 0.645161 |
1c3871bc1100083c6f02b845b6fad4c42b749764 | 1,239 | require File.dirname(__FILE__) + '/../../../spec_helper'
require 'cgi'
describe "CGI::TagMaker#nO_element_def when passed element" do
before(:each) do
@obj = Object.new
@obj.extend(CGI::TagMaker)
end
it "returns code for the passed element with optional start/end tags" do
@obj.nO_element_def("P").sh... | 25.285714 | 74 | 0.472155 |
5dba2a0d943d6a0e2517dfbb5eb12b63d06c4a3d | 92 | json.extract! meter, :id, :created_at, :updated_at
json.url meter_url(meter, format: :json)
| 30.666667 | 50 | 0.75 |
f763c714815a5d5582d7ab185e8233eaaa8cce36 | 509 | require "yaml"
require "fex/service_factory"
module Fex
class Client
attr_reader :globals
def initialize(globals)
@globals = globals
end
def service(name, locals = {})
config = service_configuration[name]
opts = globals.deep_merge(config).deep_merge(locals)
ServiceFactory.n... | 18.851852 | 94 | 0.683694 |
791268919d1834639d3dee37e2fe6b11ac9c8212 | 6,556 | # frozen_string_literal: true
require 'spec_helper'
require 'webmock/rspec'
module SimpleSauce
describe Session do
let(:valid_response) do
{status: 200,
body: {value: {sessionId: 0, capabilities: Selenium::WebDriver::Remote::Capabilities.chrome}}.to_json,
headers: {"content_type": 'applicati... | 36.831461 | 109 | 0.555217 |
21e19843e1496d215ac424065e768a17803b71f7 | 83,588 | # 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... | 55.064559 | 162 | 0.578923 |
f7ce62bd8b9fbaec5e957ea7c39b226926a27a41 | 1,392 | require "hammer/parser"
require "hammer/parsers/javascript"
require "test_helper"
class JSParserTest < Test::Unit::TestCase
# include AssertCompilation
context "A JS Parser" do
setup do
@parser = Hammer::JSParser.new()
@parser.stubs(:find_files).returns([])
@js_file = create_file('app.js', 't... | 27.84 | 120 | 0.609195 |
ff6092e85953bbaea6b60a7cb87ddfe040a2d42a | 2,576 | # frozen_string_literal: true
require 'benchmark/ips'
require File.expand_path('../../../../config/environment', __FILE__)
Benchmark.ips do |x|
x.report("redis setex string") do |times|
while times > 0
Discourse.redis.setex("test_key", 60, "test")
times -= 1
end
end
x.report("redis setex m... | 26.833333 | 87 | 0.649068 |
ac99df859ac0f1ebc68dbe04acacf8af2dc58a64 | 1,204 | require 'nokogiri'
class WellcomeEventsScraper < Tess::Scrapers::Scraper
def self.config
{
name: 'Wellcome Genome Campus scraper',
root_url: 'https://coursesandconferences.wellcomegenomecampus.org',
index_path: '/events.json'
}
end
def scrape
cp = add_content_provider(Tess::A... | 34.4 | 240 | 0.681894 |
f711df07efe58d8c51e9e10725154f8d5f986a42 | 2,793 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::DataShare::Mgmt::V2018_11_01_preview
module Models
#
# List response for get triggers
#
class TriggerList
include MsRestAzure
in... | 27.653465 | 80 | 0.50913 |
bf97de46b83f9f8a27066b356e07d51df4cfe085 | 256 | class Color2 < ActiveRecord::Migration
def self.up
change_column :areas, :color, :string, :limit => 255, :null => true, :default => nil
end
def self.down
change_column :areas, :color, :string, :default => "#FFFFFF", :null => false
end
end
| 25.6 | 88 | 0.652344 |
f886408920218c4cec8646a81122e649274a5393 | 5,912 | #! /usr/bin/env ruby
require 'spec_helper'
require 'oregano/file_serving/base'
describe Oregano::FileServing::Base do
let(:path) { File.expand_path('/module/dir/file') }
let(:file) { File.expand_path('/my/file') }
it "should accept a path" do
expect(Oregano::FileServing::Base.new(path).path).to eq(path)
... | 34.982249 | 123 | 0.685047 |
21dfa2581d6e87f60877bccb17762b319f5ee384 | 1,372 | #-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2017 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject,... | 37.081081 | 91 | 0.755831 |
87a0c4239c4a8ba961758d603106ea7e47c5af24 | 3,304 | require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe PgSearch::Multisearchable do
with_table "pg_search_documents", {}, &DOCUMENTS_SCHEMA
before { PgSearch.stub(:multisearch_enabled?) { true } }
describe "a model that is multisearchable" do
subject { ModelThatIsMultisearchable }
... | 30.311927 | 84 | 0.581719 |
1af71c146d2347025708017172e8cb357f5b2f46 | 747 | module Cryptoexchange::Exchanges
module Upbit
module Services
class Pairs < Cryptoexchange::Services::Pairs
PAIRS_URL = "#{Cryptoexchange::Exchanges::Upbit::Market::API_URL}/market/all"
def fetch
output = super
adapt(output)
end
def adapt(output)
... | 26.678571 | 85 | 0.48996 |
61b22ed6ff4a28cb885b88e03ec53a796a0a307c | 466 | require 'test_helper'
class MenuHelperTest < ActionView::TestCase
test 'menu item for' do
link = link_to User.model_name.human(count: 0), users_path
assert_equal content_tag(:li, link), menu_item_for(User, users_path)
end
test 'show board?' do
assert !show_board?
session[:board_issues] = [issu... | 19.416667 | 72 | 0.699571 |
e812d672a0b3e7de43ae84b2d147b4ebbb41d435 | 57,028 | require 'spec_helper'
module VCAP::CloudController
RSpec.describe ServiceBindingsController do
describe 'Query Parameters' do
it { expect(ServiceBindingsController).to be_queryable_by(:app_guid) }
it { expect(ServiceBindingsController).to be_queryable_by(:service_instance_guid) }
end
describ... | 40.880287 | 162 | 0.608438 |
d5a1f2fad08a540b87a50746551f0e3d1b898027 | 2,407 | # frozen_string_literal: true
require 'active_support/core_ext/integer/time'
Rails.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 any time
# it changes. This slows down response ti... | 35.397059 | 87 | 0.769838 |
ac46c5034379b7b8915d4a26d009d57c87e431a7 | 144 | class CreateReportingFacilities < ActiveRecord::Migration[5.2]
def change
create_view :reporting_facilities, materialized: true
end
end
| 24 | 62 | 0.798611 |
7a6bc2947d686ca43a6511f4e3159454ac4ac0cf | 117 | direction="east"
start=Room.current.id
dothistimeout "pedal #{direction}", 2, /pedal/ while Room.current.id == start | 39 | 78 | 0.74359 |
f7fe96a87abccbd7b20e29221e18e3eb5b919d60 | 4,100 | # frozen_string_literal: true
require File.join(File.expand_path('./../../../', __dir__), 'test_helper_for_routes')
class TestQaStandardTypeRoutes < RouteTester
INTERACTOR = MasterfilesApp::QaStandardTypeInteractor
def test_edit
authorise_pass! permission_check: MasterfilesApp::TaskPermissionCheck::QaStanda... | 36.936937 | 138 | 0.75122 |
798e723befa467380f84d950cc1a1ade8e1d8a2e | 88 | # encoding: utf-8
# copyright: 2019, Chef Software, Inc.
# license: All rights reserved
| 22 | 38 | 0.727273 |
7a1f42f8b589677a9d7fcc26127bf8b4d2556f47 | 5,130 | class Keg
def fix_dynamic_linkage
mach_o_files.each do |file|
file.ensure_writable do
if file.dylib?
@require_relocation = true
file.change_dylib_id(dylib_id_for(file))
end
each_install_name_for(file) do |bad_name|
# Don't fix absolute paths unless they... | 33.97351 | 102 | 0.678363 |
e22a7aaef46a248ab005081c170a44f04dce27be | 69 | # frozen_string_literal: true
module Unused
VERSION = '0.1.0'
end
| 11.5 | 29 | 0.724638 |
622ab38c2e773f9f34749b27e6f0eb99ab81089c | 10,871 | require "spec_helper"
RSpec.describe Lightrail::StripeLightrailSplitTenderCharge do
subject(:split_tender_charge) {Lightrail::StripeLightrailSplitTenderCharge}
let(:lightrail_connection) {Lightrail::Connection}
let(:lightrail_value) {Lightrail::LightrailValue}
let(:lightrail_charge) {Lightrail::LightrailCharg... | 48.748879 | 183 | 0.744458 |
33db34c0f62a3ceed00d7d0dece7b54d38c23f93 | 10,076 | require 'spec_helper'
describe MergeRequests::UpdateService, services: true do
let(:project) { create(:project) }
let(:user) { create(:user) }
let(:user2) { create(:user) }
let(:user3) { create(:user) }
let(:label) { create(:label, project: project) }
let(:label2) { create(:label) }
let(:merge_request) ... | 33.036066 | 122 | 0.625744 |
01668e8f7683a2a1113f16781ab987c30242b5d1 | 1,550 | #
# Be sure to run `pod lib lint XBAuthentication.podspec' to ensure this is a
# valid spec and remove all comments before submitting the spec.
#
# Any lines starting with a # are optional, but encouraged
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.n... | 37.804878 | 131 | 0.654194 |
28b4ad6da49141c2e10a62d0b2b65e826116306c | 229 | class CreateKeywords < ActiveRecord::Migration
def change
create_table :keywords do |t|
t.references :keyword_set, index: true, foreign_key: true
t.string :name
t.timestamps null: false
end
end
end
| 20.818182 | 63 | 0.689956 |
18b50f8af3ffdf074562045c4b0fbae6c0ce6f1e | 554 | class Accounts::UnlocksController < Devise::UnlocksController
# GET /resource/unlock/new
# def new
# super
# end
# POST /resource/unlock
# def create
# super
# end
# GET /resource/unlock?unlock_token=abcdef
# def show
# super
# end
# protected
# The path used after sending unlock p... | 19.103448 | 61 | 0.696751 |
bf75081bac1c379fcefbf5aeb41423be3fbae5dd | 2,157 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class MetasploitModule < Msf::Exploit::Remote
Rank = NormalRanking
include Msf::Exploit::Remote::Ftp
include Msf::Exploit::Seh
def initialize(info = {})... | 26.62963 | 107 | 0.585999 |
bb07070d25c6721fb4a0839905801828b8708b54 | 16,615 | # frozen_string_literal: true
require 'lib/color'
require 'lib/settings'
require 'lib/storage'
require 'view/link'
require 'view/game/bank'
require 'view/game/stock_market'
require 'view/game/actionable'
module View
module Game
class Spreadsheet < Snabberb::Component
include Lib::Color
include Lib::... | 34.54262 | 120 | 0.544267 |
611b3a1526ad3cdf4694e9b7aca423b4395c2ec1 | 190 | class Permission < ActiveRecord::Base
has_and_belongs_to_many :roles,dependent: :destroy
has_and_belongs_to_many :functionalities,dependent: :destroy
validates_uniqueness_of :name
end
| 23.75 | 61 | 0.836842 |
4a86476e09746b2edd64eced47534538cadc3c62 | 1,464 | #
# Be sure to run `pod lib lint podTest.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 http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'podTest'
s... | 35.707317 | 103 | 0.635929 |
187eb8f19fa26bd4b687c91d5611587a193c0cc9 | 247 | require 'verdict/storage/base_storage'
require 'verdict/storage/cookie_storage'
require 'verdict/storage/mock_storage'
require 'verdict/storage/memory_storage'
require 'verdict/storage/redis_storage'
require 'verdict/storage/legacy_redis_storage'
| 35.285714 | 46 | 0.854251 |
4a602f3a426f952a2b32d62e5162a6e9b4a37205 | 284 | # 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 end
module Azure::Network end
module Azure::Network::Mgmt end
module Azure::Network::Mgmt::V2016_09_01 end
| 28.4 | 70 | 0.778169 |
6178254e288352919a36144a189074ce76f1f17c | 1,409 | # frozen_string_literal: true
require 'aws_backend'
class AwsCloudwatchAnomalyDetector < AwsResourceBase
name 'aws_cloudwatch_anomaly_detector'
desc 'Lists the anomaly detection models that you have created in your account.'
example "
describe aws_cloudwatch_anomaly_detector(metric_name: 'METRIC_NAME') do
... | 24.719298 | 134 | 0.714691 |
ac4cf27b6ed57ecd33e105bfb7d6a358f20baa69 | 6,621 | require 'unit/whitehall/authority/authority_test_helper'
require 'ostruct'
class WorldEditorWorldwidePriorityTest < ActiveSupport::TestCase
def world_editor(world_locations, id = 1)
OpenStruct.new(id: id, gds_editor?: false,
departmental_editor?: false, world_editor?: true,
... | 42.716129 | 142 | 0.721945 |
e8d5011e1898e67f22adad75e3998699391f4981 | 1,684 | require 'test_helper'
class UsersSignupTest < ActionDispatch::IntegrationTest
def setup
ActionMailer::Base.deliveries.clear
end
test 'invalid signup information' do
get signup_path
assert_no_difference 'User.count' do
post users_path, params: { user: { name: '',
... | 34.367347 | 78 | 0.625891 |
018852aca7598ff53b6cc884dcf2dc5565c2b9b2 | 1,147 | require 'oauth/signature/base'
require 'openssl'
module OAuth::Signature::RSA
class SHA1 < OAuth::Signature::Base
implements 'rsa-sha1'
hash_class ::Digest::SHA1
def ==(cmp_signature)
public_key.verify(OpenSSL::Digest::SHA1.new, Base64.decode64(cmp_signature.is_a?(Array) ? cmp_signature.first : cm... | 24.404255 | 156 | 0.660854 |
f8990f523962c487a92ef690495995a1965bc17e | 10,066 | #!/usr/bin/ruby
# -------------------------------------------------------------------------- #
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); ... | 28.678063 | 105 | 0.484701 |
79f4248d68b41bc3f5caea3b57869819ec6a5040 | 2,585 | # 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_05_15
module Models
#
# The resource model definition for a ARM tracked top level resource
#
class Tracke... | 27.795699 | 72 | 0.441393 |
914d7c242485def7921d639bbe07584479d23aca | 4,086 | require 'spec_helper'
describe "Prototypes", type: :feature, js: true do
stub_authorization!
context "listing prototypes" do
it "should be able to list existing prototypes" do
create(:property, name: "model", presentation: "Model")
create(:property, name: "brand", presentation: "Brand")
crea... | 36.159292 | 112 | 0.671317 |
915a9375d1e0207c762a046ec944c6917fa5e5a9 | 1,001 | describe "Convert Image" do
before do
@object = Object.new
@object.extend Stalactoast::Conversions
@image = UIImage.imageNamed("motion-toast-card")
end
it "sets the right default" do
d = {}
@object.convert_image({}, d)
d[KCRToastImageKey].should == nil
end
it "sets the right value w... | 21.76087 | 70 | 0.623377 |
0162947f38c188706e50c8c8616e7a0d334cebc8 | 1,312 | 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_text/en... | 34.526316 | 82 | 0.776677 |
1a54822de193a44abf1870c55adea53c292bd7ef | 1,162 | ##################################################################
# Licensing Information #
# #
# The following code is licensed, as standalone code, under #
# the Ruby License, unless otherwise directed withi... | 43.037037 | 67 | 0.393287 |
616fa6df4bee114e8edae47f546ba308f011f407 | 127,751 | # frozen_string_literal: true
# Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/... | 47.721703 | 142 | 0.64297 |
b9aa132932e7023de7ffecc7b29fb3c93cd2db35 | 342 | require 'test/unit'
require "-test-/file"
class Test_FileStat < Test::Unit::TestCase
def test_stat_for_fd
st = open(__FILE__) {|f| Bug::File::Stat.for_fd(f.fileno)}
assert_equal(File.stat(__FILE__), st)
end
def test_stat_for_path
st = Bug::File::Stat.for_path(__FILE__)
assert_equal(File.stat(__F... | 22.8 | 62 | 0.704678 |
391495885cb89280d39cc50ccd114ab077db8158 | 498 | module HandleRest
# Handle URN Value
class UrnValue < Value
# Value Type
#
# @return [String] "URN"
def type
"URN"
end
# Deserialize
#
# @param format [String] "string"
# @param value [String] urn:<nid>:<nss></nss></nid>
# @return [UrnValue]
# @raise [RuntimeError]... | 21.652174 | 83 | 0.590361 |
38abceaef6c227e0ade607e4b3eedf1e36925283 | 1,026 | # frozen_string_literal: true
$LOAD_PATH.push File.expand_path("lib", __dir__)
# Maintain your gem's version:
require "publify_textfilter_code/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "publify_textfilter_code"
s.version = PublifyTextfilterCode::... | 34.2 | 77 | 0.691033 |
2897cb4860baffb1d5bcf50dd2c742c255d7c83d | 1,153 | # frozen_string_literal: true
module Resolvers
class ScanExecutionPolicyResolver < BaseResolver
include Gitlab::Graphql::Authorize::AuthorizeResource
calls_gitaly!
type Types::ScanExecutionPolicyType, null: true
alias_method :project, :object
def resolve(**args)
return [] unless valid?
... | 25.622222 | 121 | 0.707719 |
2813acfce0ae07da0e9cd9a1244a35900cda7375 | 1,450 | class Converter
module JsConversion
def process_javascript_assets
log_status 'Processing javascripts...'
save_to = @save_to[:js]
contents = {}
read_files('js', bootstrap_js_files).each do |name, name|
contents[name] = name
save_file("#{save_to}/#{name}", name)
end
... | 30.208333 | 86 | 0.557241 |
01ec8c68a7e05507ecd02ab84e653e031989dd5a | 136 | Rails.application.routes.draw do
devise_for :users
resources :messages do
resources :comments
end
root 'messages#index'
end
| 17 | 32 | 0.75 |
62a4d98f987f8a83c3a533a353c545ce2ebc0308 | 2,558 | module Geocoder::Store
module MongoBase
def self.included_by_model(base)
base.class_eval do
scope :geocoded, lambda {
where(geocoder_options[:coordinates].ne => nil)
}
scope :not_geocoded, lambda {
where(geocoder_options[:coordinates] => nil)
}
... | 29.744186 | 93 | 0.59226 |
614fc679aacc8403e939ea87e688ef1a15bec15b | 2,383 | # 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::PolicyInsights::Mgmt::V2019_10_01
module Models
#
# Query results.
#
class PolicyStatesQueryResults
include MsRestAzu... | 28.710843 | 79 | 0.491397 |
01b27cdfcaa67f42c00229d28b5d686bceec0be5 | 236 | module VirtualBox
module COM
module Interface
module Version_4_1_X
class ClipboardMode < AbstractEnum
map [:disabled, :host_to_guest, :guest_to_host, :bidirectional]
end
end
end
end
end
| 19.666667 | 73 | 0.652542 |
e9d215bf10f795ab5822e42a4a34d446f053c3da | 85,762 | # -*- ruby -*-
# encoding: utf-8
$LOAD_PATH.push File.expand_path('../src/ruby/lib', __FILE__)
require 'grpc/version'
Gem::Specification.new do |s|
s.name = 'grpc'
s.version = GRPC::VERSION
s.authors = ['gRPC Authors']
s.email = 'temiola@google.com'
s.homepage = 'https://git... | 63.339734 | 119 | 0.712682 |
d58c8fd59cf00dccfab631fb78de830530bb36dc | 2,952 | class Dovecot < Formula
desc "IMAP/POP3 server"
homepage "http://dovecot.org/"
url "http://dovecot.org/releases/2.2/dovecot-2.2.21.tar.gz"
mirror "https://fossies.org/linux/misc/dovecot-2.2.21.tar.gz"
sha256 "7ab7139e59e1f0353bf9c24251f13c893cf1a6ef4bcc47e2d44de437108d0b20"
bottle do
sha256 "e21b7c37c5... | 29.818182 | 115 | 0.64668 |
7a06f9047f7c4fcb62e75f0b031893777fa902b1 | 76 | json.partial! "battle_systems/battle_system", battle_system: @battle_system
| 38 | 75 | 0.842105 |
acd4153ce3acbabad87d266fd08075c8cf4c95b7 | 1,968 | #
# Be sure to run `pod spec lint ios-dynamsoft-camera-sdk.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see h... | 37.132075 | 379 | 0.664634 |
e232908fd3e4f5529f4e264839b5b4ecaa168f78 | 269 | require 'elasticsearch/dsl'
module Queries::Random
extend Elasticsearch::DSL::Search
def self.query
search do
query do
function_score do
functions << {random_score: {seed: Random.new_seed.to_s}}
end
end
end
end
end
| 16.8125 | 67 | 0.635688 |
03cff68cb81e7448fbda0b7ce9e3024c9b93965e | 20,363 | # 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... | 39.159615 | 324 | 0.706281 |
d512d2a3efc5c0677392591a33292300aa24f6de | 711 | Pod::Spec.new do |s|
s.name = 'AWSConnect'
s.version = '2.12.8'
s.summary = 'Amazon Web Services SDK for iOS.'
s.description = 'The AWS SDK for iOS provides a library, code samples, and documentation for developers to build connected mobile applications using AWS.'
s.homepage = 'http:... | 39.5 | 157 | 0.611814 |
872f0fdfde1c9cbfbf118c81c8c2e7084a1e641e | 28,727 | require_relative '../helper'
require 'fluent/test'
require 'fluent/plugin/in_tail'
require 'fluent/plugin/buffer'
require 'fluent/system_config'
require 'net/http'
require 'flexmock/test_unit'
class TailInputTest < Test::Unit::TestCase
include FlexMock::TestCase
def setup
Fluent::Test.setup
FileUtils.rm_r... | 28.669661 | 208 | 0.593553 |
ff7b065f159df5520de4ab19cae09f88b867c7a3 | 10,791 | # frozen_string_literal: true
# encoding: utf-8
module CommonShortcuts
module ClassMethods
# Declares a topology double, which is configured to accept summary
# calls as those are used in SDAM event creation
def declare_topology_double
let(:topology) do
double('topology').tap do |topology|
... | 29.727273 | 93 | 0.614494 |
915097515d891b56509db91e8a7edf902bf43cac | 617 | def tripple_step(n)
arr = [1, 2, 4]
if n < 1
raise ArgumentError, "should be > 0"
elsif n >= 4
(3..(n - 1)).each do |i|
arr << arr[i - 1] + arr[i - 2] + arr[i - 3]
end
end
arr[n - 1]
end
RSpec.describe 'tripple_step' do
subject { tripple_step(n) }
it do
expect { tripple_step(0) }... | 20.566667 | 60 | 0.60778 |
87c24126b248ce9af7e543299cd30222549f34ed | 1,511 | require File.dirname(__FILE__) + '/../../spec_helper.rb'
module Spec
module Matchers
describe "equal" do
def inspect_object(o)
"#<#{o.class}:#{o.object_id}> => #{o.inspect}"
end
it "should match when actual.equal?(expected)" do
1.should equal(1)
end
it ... | 26.051724 | 67 | 0.632694 |
3914a69e2b835560254417e22dfaf03b51912b25 | 80 | require 'webmock/rspec'
WebMock.disable_net_connect!(:allow_localhost => true)
| 20 | 54 | 0.8 |
08798c57fa55f8177d149e041a85bc1b5d0394d2 | 2,012 | require "puppet/parameter/boolean"
# Autogenic core type
Puppet::Type.newtype(:azure_certificate_order_certificate) do
@doc = "Class representing the Key Vault container for certificate purchased through Azure"
ensurable
validate do
required_properties = [
:location,
:certificate_order_name,
... | 20.530612 | 110 | 0.650596 |
0388e586730f2079566bd10a62b8c25aa33bcbae | 837 | Pod::Spec.new do |s|
s.name = "PDTSimpleCalendar"
s.version = "0.9.1"
s.summary = "A simple Calendar/Date Picker with a nice iOS7/iOS8 design."
s.description = <<-DESC
Inspired by Square's TimesSquare & Apple Calendar.
Simple Calendar is a simple Date ... | 38.045455 | 124 | 0.621266 |
620c18b1e7592a7b5d38b8c942b3e7545b2d3a7b | 2,150 | =begin
#SendinBlue API
#SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/or... | 44.791667 | 839 | 0.718605 |
abf57dce20649dcb2722b5ba9aa9adcfcfa60349 | 191,170 | # Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 40.93576 | 294 | 0.657441 |
fff7a2e27f2779b1a958aa6a8df0196a1acfe976 | 837 | require "oculus/version"
require "oculus/storage"
require "oculus/connection"
require "oculus/query"
module Oculus
extend self
DEFAULT_CONNECTION_OPTIONS = { :adapter => 'mysql', :host => 'localhost' }
attr_writer :cache_path
def cache_path
@cache_path ||= 'tmp/data'
end
attr_writer :data_store
... | 23.25 | 115 | 0.726404 |
ab17be5e221245090fed07204a724ed7e0264ffb | 1,200 | default['yum']['epel']['repositoryid'] = 'epel'
default['yum']['epel']['description'] = "Extra Packages for #{node['platform_version'].to_i} - $basearch"
case node['kernel']['machine']
when 's390x'
default['yum']['epel']['baseurl'] = 'https://kojipkgs.fedoraproject.org/rhel/rc/7/Server/s390x/os/'
default['yum']['ep... | 54.545455 | 146 | 0.675833 |
1c0911f69b4a0683ca0369284a1de4131e843056 | 2,861 | ##
# This file is part of WhatWeb and may be subject to
# redistribution and commercial restrictions. Please see the WhatWeb
# web site for more information on licensing and terms of use.
# http://www.morningstarsecurity.com/research/whatweb
##
# Version 0.2 # 2011-03-31 #
# Updated regex
##
# Version 0.2 # 2011-01-07 ... | 37.644737 | 173 | 0.68857 |
bb8ade52506bff47f8a7b2847bb0bbfe99025dd3 | 1,325 | # Theoretically, Capybara is clever enough to wait for asynchronous events to
# happen (e.g. AJAX). Sadly, this is not always true. For more, read:
#
# https://robots.thoughtbot.com/automatically-wait-for-ajax-with-capybara
#
# Therefore, we add some methods for waiting that will be used for these
# corner cases. All... | 33.974359 | 79 | 0.749434 |
913fea4365521d4f1e1db76cd723836c0124790f | 1,932 | class FixViewProjectDetailContributionPerDay < ActiveRecord::Migration
def up
execute <<-SQL
CREATE OR REPLACE VIEW "1".project_contributions_per_day AS
SELECT i.project_id,
json_agg( json_build_object('paid_at', i.created_at, 'created_at', i.created_at, 'total', i.total, 'total_amount', i... | 36.45283 | 154 | 0.64648 |
263453cad5dcf68da1fb32d57000697fba8fa9b1 | 910 | class Seq < Array
attr_accessor :merge_modes
def initialize(seq = [], merge_mode = nil)
replace(seq)
merge_mode = merge_mode.respond_to?(:tag) ? merge_mode_from(merge_mode.tag) : merge_mode
@merge_modes = { rgt: merge_mode }
end
def init_with(node)
initialize(node.seq, node)
end
Array.ins... | 23.947368 | 105 | 0.640659 |
1cee4cb9c7ce1a232f0fa461f05c66a2ca10d392 | 2,962 | require_relative 'spec_helper.rb'
require_relative '../lib/invoice_maker'
include InvoiceMaker
PDF_CONTENT_TYPE = 'application/pdf'
JSON_CONTENT_TYPE = 'application/json'
@test_uri = "invoice-generator.com"
# 200
def stub_request_success
pdf_response = File.open(File.join('fixtures', 'invoice.pdf'), 'r').read
... | 29.326733 | 134 | 0.664416 |
bf1679c1b46e3f903ce8d45ac478483079647d7c | 11,089 | # frozen_string_literal: true
require "active_model/attribute/user_provided_default"
module ActiveRecord
# See ActiveRecord::Attributes::ClassMethods for documentation
module Attributes
extend ActiveSupport::Concern
included do
class_attribute :attributes_to_define_after_schema_loads, instance_acce... | 37.846416 | 131 | 0.608982 |
1deaf823087085fa4d7f2b7ccf738d2bab650247 | 13,558 | module Sepa
# Contains utility methods that are used in this gem.
module Utilities
# Calculates a SHA1 digest for a given node. Before the calculation, the node is canonicalized
# exclusively.
#
# @param node [Nokogiri::Node] the node which the digest is calculated from
# @return [String] the ca... | 42.36875 | 100 | 0.708585 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.