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 |
|---|---|---|---|---|---|
1c58074cbd0cfb7aa404a0d550b08b1849b0a659 | 16,526 | require 'spec_helper'
module Bosh::Cli
describe Command::Stemcell do
let(:director) { double(Bosh::Cli::Client::Director) }
let(:stemcell_archive) { spec_asset("valid_stemcell.tgz") }
let(:stemcell_manifest) { {'name' => 'ubuntu-stemcell', 'version' => 1} }
let(:stemcell) { double('stemcell', :manife... | 38.166282 | 152 | 0.584231 |
e9aa299945affa416d7e34d6ae911002b237c5f1 | 241 | module Api
class BaseController < ActionController::API
include ActionController::Serialization
private
def current_user
@current_user ||= User.find(doorkeeper_token.resource_owner_id) if doorkeeper_token
end
end
end | 21.909091 | 88 | 0.767635 |
26b78c8c98b5e94422ca5cd6181bb274b29c3036 | 4,356 | require 'actions/process_create'
require 'actions/process_scale'
require 'actions/process_update'
require 'actions/service_binding_create'
require 'actions/manifest_route_update'
require 'cloud_controller/strategies/manifest_strategy'
require 'cloud_controller/app_manifest/manifest_route'
require 'cloud_controller/rand... | 36.605042 | 146 | 0.743802 |
03c0ca2f0378b4490e8a6a9d1c39e681f1ec873a | 1,251 | # encoding: utf-8
module ArraySpecs
def self.array_with_usascii_and_7bit_utf8_strings
[
'foo'.force_encoding('US-ASCII'),
'bar'
]
end
def self.array_with_usascii_and_utf8_strings
[
'foo'.force_encoding('US-ASCII'),
'báz'
]
end
def self.array_with_7bit_utf8_and_usascii... | 17.871429 | 56 | 0.619504 |
38d9b2a696054368b227e748d69cc4a957268d22 | 138 | module Furnace::AVM2::ABC
class AS3Lshift < Opcode
instruction 0xa5
write_barrier :memory
consume 2
produce 1
end
end | 15.333333 | 26 | 0.695652 |
91291b81d5fc0c74ce15a4f978282e46de60a5c1 | 2,349 | # -*- coding: utf-8 -*-
=begin
This script was written by Takashi SUGA on February 2017
You may use and/or modify this file according to the license described in the MIT LICENSE.txt file https://raw.githubusercontent.com/suchowan/watson-api-client/master/LICENSE.
Usage:
ruby crawl.rb <root> (<filter>)
... | 27.313953 | 177 | 0.603235 |
7a087ed75595d8d0ad574ebe8640b7160cbac511 | 1,595 | # frozen_string_literal: true
require 'noid'
module Noid
module Rails
module Minter
# A file based minter. This is a simple case.
class File < Base
attr_reader :statefile
def initialize(template = default_template, statefile = default_statefile)
@statefile = statefile
... | 24.166667 | 96 | 0.552351 |
1a15fc075674027612248603b3fb4d997ef1e7ab | 13,423 | #!/usr/bin/env rspec
require 'spec_helper'
require 'puppet/application/apply'
require 'puppet/file_bucket/dipper'
require 'puppet/configurer'
require 'fileutils'
describe Puppet::Application::Apply do
before :each do
@apply = Puppet::Application[:apply]
Puppet::Util::Log.stubs(:newdestination)
end
afte... | 33.982278 | 126 | 0.646204 |
117c62bceae3bc654a4352a9e31d5791ccb1e6d2 | 1,070 | # Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
require 'indexed_search_test'
class ImplitictIndexPhrase < IndexedSearchTest
def nightly?
true
end
def setup
set_owner("arnej")
set_description("Check implicit phrasing when querying for ... | 29.722222 | 111 | 0.71215 |
38cde48ae22ec05b0ed4944701db4eb17b7e06d1 | 530 | require 'bundler'
module NightWatch
module Utilities
module ScriptRunner
def sh(command, return_std_out = false)
to_run = command.dup
to_run << ' 1>&2' unless return_std_out
$stderr.puts "run: #{command}"
$stderr.puts "in: #{`pwd`}"
output = Bundler.with_clean_env ... | 20.384615 | 99 | 0.596226 |
b969e17adacf4d2b39d8a5beab158d09a4e5e1d2 | 4,923 | #-- 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, which is a fork of ... | 30.57764 | 92 | 0.680479 |
abfbdaa45fc015ad9f42c324ed877e5e94880697 | 2,870 | module Grape
module Middleware
# Class to handle the stack of middlewares based on ActionDispatch::MiddlewareStack
# It allows to insert and insert after
class Stack
class Middleware
attr_reader :args, :block, :klass
def initialize(klass, *args, &block)
@klass = klass
... | 25.855856 | 120 | 0.573519 |
1d23457e9ae31036e8cf92ede356d9d7f4244426 | 64 | module GoogleFinance
class Resource < Hashie::Trash
end
end
| 12.8 | 32 | 0.765625 |
91a681e8038c6e8a50413a7b403e675ae1192755 | 3,706 | # Copyright (c) 2012 RightScale, 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, modify, merge, publish,
# ... | 34.314815 | 80 | 0.658662 |
622cf23f86caa13fe5e1f13363c2e843a8d97f4f | 774 | $:.push File.expand_path("../lib", __FILE__)
require "backtrail/version"
Gem::Specification.new do |s|
s.name = "backtrail"
s.version = Backtrail::VERSION
s.authors = ["Daniel Ferraz"]
s.email = ["d.ferrazm@gmail.com"]
s.homepage = "https://github.com/dferrazm/backtrail"
s.summary ... | 33.652174 | 76 | 0.640827 |
793a2864310f546ebf5bf2ad2f5c41717dd480a8 | 792 | class UsersController < ApplicationController
get '/signup' do
if !logged_in?
erb :'users/signup'
else
flash[:message] = "Signed in as #{current_user.username}."
redirect to '/ideas'
end
end
post '/signup' do
@user = User.new(username: pa... | 23.294118 | 82 | 0.527778 |
5df4fd3e1779aee16086c7b73f93fcbc1840d337 | 1,085 | StartUp::Application.routes.draw do
resources :posts do
resources :comments
end
namespace :admin do
root :to => 'home#index'
end
mount RailsAdmin::Engine => '/rails_admin', :as => 'rails_admin'
match 'district/:id' => 'district#show'
mount UeditorRails::Engine => '/ueditor'
post 'ueditor/fil... | 31 | 112 | 0.639631 |
18673e21119ed958a9e9c6fe22b801a85ac5b4e6 | 4,354 | # frozen_string_literal: true
require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")
describe Vk::Wall do
describe 'Basic' do
before :each do
@wall = FactoryBot.create(:wall, id: 1, domain: '1')
end
it 'should provide needed attributes' do
# Database fields
expect(@wa... | 29.221477 | 103 | 0.634589 |
5d4af6b56e01ae7ca91f9fa846c88c51ffcf89a8 | 67 | module Capybara
module Mechanize
VERSION = '1.1.0'
end
end
| 11.166667 | 21 | 0.671642 |
e87e33fa4e17d50a6fe3b9badc45bb66f0621cc6 | 792 | module Intrigue
module Ident
module SshCheck
class Dropbear < Intrigue::Ident::SshCheck::Base
def generate_checks
[
{ # SSH-2.0-dropbear_2016.74
:type => "fingerprint",
:category => "application",
:tags => ["SSHServer"],
:vendor => "Dropbe... | 28.285714 | 108 | 0.489899 |
bb0a63f0fa2f609e41e5878b02409456a4c555f5 | 1,597 | require 'net/http'
require 'net/https'
require 'uri'
require 'rubygems'
require 'hpricot'
#
# Make it east to use some of the convenience methods using https
#
module Net
class HTTPS < HTTP
def initialize(address, port = nil)
super(address, port)
self.use_ssl = true
end
end
end
module GData
... | 20.74026 | 84 | 0.595492 |
6a91d5fc11e8cba3d5ceb4633c5c3f6f5244946b | 2,118 | # 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.517241 | 86 | 0.720491 |
7ac8defef34532b92fdb65a6a8c92eddd55a6e6b | 12,317 | require "and_feathers"
require "and_feathers/gzipped_tarball"
require "spec_helper"
require "tempfile"
describe CookbookUpload do
describe "#finish(user)" do
before do
create(:category, name: "Other")
end
let(:cookbook) do
JSON.dump("category" => "Other")
end
let(:user) do
cre... | 35.909621 | 106 | 0.672323 |
62be1e5b4cdbd3f985dad3f6eb78647784dd7b7e | 1,988 | require 'forwardable'
module Billy
class RequestHandler
extend Forwardable
include Handler
def_delegators :stub_handler, :stub, :unstub
def_delegators :request_log, :requests
def handlers
@handlers ||= { stubs: StubHandler.new,
cache: CacheHandler.new,
... | 25.487179 | 151 | 0.64336 |
62b04c18da8b79c2d8b5f5ed7c7c6f7753312e2b | 18,840 | module GeoGeo
class Shape2D
# @return [Float]
attr_reader :left, :right, :bottom, :top, :width, :height
# @param [Float, Integer] left
# @param [Float, Integer] right
# @param [Float, Integer] bottom
# @param [Float, Integer] top
# @return [GeoGeo::Shape2D]
def initialize(left, right,... | 29.074074 | 153 | 0.562049 |
4a8ca070190839e8304a28fce5c0a1c793442e0e | 622 | class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version %>
def change
create_table :<%= model_underscored %>_snapshots do |t|
# model to be snapshoted
t.references :<%= model_underscored %>, index: true, null: false, foreign_key: true
# snapshoted attributes
t.jso... | 36.588235 | 89 | 0.660772 |
6150078cbb1b524e6ca9692fb8e8ab2d996f9f91 | 1,099 | # 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::Reservations::Mgmt::V2017_11_01
module Models
#
# Model object.
#
#
class Error
include MsRestAzure
# @ret... | 22.428571 | 70 | 0.517743 |
79bbef9fa5612b019ad5fafd3de3ca8991986b9a | 30,394 | # Author:: Ezra Pagel (<ezra@cpan.org>)
# Contributor:: Jesse Campbell (<hikeit@gmail.com>)
# Contributor:: Bethany Erskine (<bethany@paperlesspost.com>)
# Contributor:: Adrian Stanila (https://github.com/sacx)
# Contributor:: Ryan Hass (rhass@chef.io)
# License:: Apache License, Version 2.0
#
require "chef/knife"
req... | 35.056517 | 230 | 0.691551 |
4a45e395aad2af67cd3e29ec8115f4246a6fa07e | 728 | class FixSlipExpiresAt < ActiveRecord::Migration[4.2]
def up
execute <<-SQL
CREATE OR REPLACE FUNCTION public.slip_expires_at(payments)
RETURNS timestamp without time zone
LANGUAGE sql
STABLE
AS $function$
SELECT weekdays_from(public.slip_expiration_weekdays(), public.zone_timestamp($1.... | 29.12 | 131 | 0.696429 |
628a87c2ef4f4dc8d59c56be0e14628b8984ef97 | 2,842 | # -*- encoding: utf-8 -*-
# stub: rubocop 1.1.0 ruby lib
Gem::Specification.new do |s|
s.name = "rubocop".freeze
s.version = "1.1.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "bug_tracker_uri" => "https://github.com/rubocop-hq... | 53.622642 | 368 | 0.668543 |
18c33ac55806260d54b319c8a0ee279b42b9e298 | 1,407 | # == Schema Information
#
# Table name: projects
#
# id :integer not null, primary key
# title :string not null
# description :string
# created_at :datetime not null
# updated_at :datetime not ... | 33.5 | 80 | 0.567875 |
1ce6ba2251bcad7fe3da63406a90578e2fe1df7f | 158 | describe command('curl http://localhost:9093/metrics') do
its('exit_status') { should eq 0 }
its('stdout') { should match(/go_gc_duration_seconds/) }
end
| 31.6 | 58 | 0.71519 |
e99c5c2089a5a28a9026384ea38c77d88246483d | 1,459 | Pod::Spec.new do |spec|
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
spec.name = "EthosText"
spec.version = "0.1.9"
spec.summary = "A collection of useful building blocks to help rapidly develop iOS apps using Swift"
spec.description = <<-DESC
A col... | 37.410256 | 107 | 0.446196 |
799bb33edbf5e14b86b550bd76ef8ab7202d252b | 139 | class AddHstore < ActiveRecord::Migration
def up
enable_extension :hstore
end
def down
disable_extension :hstore
end
end | 15.444444 | 43 | 0.726619 |
ab59a1bfca1c5699aedf99ec36674892a74b09ad | 1,203 | # 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,... | 31.657895 | 80 | 0.727348 |
033121bb1f70e282990189ec3a520b93c62f84b3 | 2,848 | class Metricbeat < Formula
desc "Collect metrics from your systems and services"
homepage "https://www.elastic.co/beats/metricbeat"
url "https://github.com/elastic/beats.git",
tag: "v7.13.1",
revision: "2d80f6e99f41b65a270d61706fa98d13cfbda18d"
license "Apache-2.0"
head "https://github.com/el... | 30.297872 | 122 | 0.63132 |
bbb27f895418dca3b1e31e69f6957c84a03510e6 | 466 | require 'mustache'
module RspecApiDocumentation
module Views
class MarkupIndex < Mustache
def initialize(index, configuration)
@index = index
@configuration = configuration
self.template_path = configuration.template_path
end
def api_name
@configuration.api_name... | 21.181818 | 86 | 0.678112 |
26b82610e62e00bd682c8789591202099a5cccf1 | 1,185 | # frozen_string_literal: true
require 'test_helper'
require 'skippy/library'
class SkippyLibraryTest < Skippy::Test
def test_that_it_can_load_library_info
lib_path = fixture('my_lib')
library = Skippy::Library.new(lib_path)
assert_equal(lib_path, library.path)
assert_equal('my-lib', library.name)
... | 26.333333 | 59 | 0.731646 |
26492db99a875fc9a2d835ef5fd948aa77e8b894 | 797 | ##
# 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... | 37.952381 | 76 | 0.742785 |
6aaeaa96058158f0d2aa3d44f817000f650d3cd7 | 2,240 | # frozen_string_literal: true
class IdeasController < ApplicationController
before_action :authenticate_user!
before_action :set_idea, only: %i[show edit update destroy submit]
# GET /ideas
# GET /ideas.json
def index
@ideas = case params[:view]
when 'assigned'
Idea.where(ass... | 21.132075 | 86 | 0.603125 |
3300839f7d028a8819da0ca6741a4522c38b8296 | 764 | #!/usr/bin/ruby
# STEPS TO RUNNING BULK-EXTRACT FROM SCRATCH
#start mongod
#run sli/config/scripts/resetAllDbs.sh to clean database
#start activemq
#start api to bootstrap database
#start search indexer
#bundle exec rake realmInit
#bundle exec rake importSandboxData
#run ./compile_local_extract_jar.rb
#then run this ... | 28.296296 | 132 | 0.769634 |
035e8916166481692f95c6efbb3ee6cf15fcdab0 | 1,117 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Audit::Events::Preloader do
describe '.preload!' do
let_it_be(:audit_events) { create_list(:audit_event, 2) }
let(:audit_events_relation) { AuditEvent.where(id: audit_events.map(&:id)) }
subject { described_class.preload!(audit... | 30.189189 | 80 | 0.652641 |
b93bc6f65dea3f1bce856c6be3c57164165c9319 | 359 | class ContactsController < ApplicationController
def new
@contact = Contact.new
end
def create
@contact = Contact.new(params[:contact])
if @contact.valid?
ContactMailer.message_from_user(@contact).deliver_now
flash[:info] = "Thank you for your message!"
redirect_to root_path
els... | 21.117647 | 59 | 0.679666 |
876db06a2b9eafe093adffc1cefdc1307c6808d9 | 5,980 | require 'pathname'
require 'json'
require_relative '../../../puppet_x/puppetlabs/dsc_lite/powershell_hash_formatter'
Puppet::Type.type(:base_dsc_lite).provide(:powershell) do
confine feature: :pwshlib
confine operatingsystem: :windows
defaultfor operatingsystem: :windows
commands powershell: (if File.exist?("... | 38.580645 | 151 | 0.714548 |
08a3d6179f7529c90df44cdcebafa7096ade53f2 | 1,078 | # This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.jo... | 35.933333 | 96 | 0.734694 |
390de5543004af96efde84a001e5251778ae742f | 2,136 | require 'singleton'
module JSRailsRoutes
class Generator
COMPARE_REGEXP = %r{:(.*?)(/|$)}
PROCESS_FUNC = <<-JAVASCRIPT.freeze
function process(route, params, keys) {
var query = [];
for (var param in params) if (params.hasOwnProperty(param)) {
if (keys.indexOf(param) === -1) {
query.push(param... | 29.666667 | 116 | 0.594569 |
f8efcbd6a849ec3187f008a8923756354effaabf | 853 | Gem::Specification.new do |s|
s.name = 'jekyll-theme-merlot'
s.version = '0.1.1'
s.license = 'CC0-1.0'
s.authors = ['Cameron McEfee', 'GitHub, Inc.']
s.email = ['opensource+jekyll-theme-merlot@github.com']
s.homepage = 'https://github.com/stage/merlot'
s.summary ... | 40.619048 | 97 | 0.622509 |
7a9d8a5c50338d3eeade5cc868e86e46dc365d83 | 48 | module OpenBadges
module TagsHelper
end
end
| 9.6 | 19 | 0.791667 |
e2e4793b42e7bd7753fdd979420a184eb25ca7dc | 1,536 | require 'puppet/util/agentil'
Puppet::Type.type(:agentil_landscape).provide(:agentil) do
def self.instances
instances = []
Puppet::Util::Agentil.parse unless Puppet::Util::Agentil.parsed?
Puppet::Util::Agentil.landscapes.each do |index, landscape|
instances << new(:name => landscape.name, :ensure ... | 28.444444 | 110 | 0.69987 |
793854f26848d0fbb959969ff5bec80e610a3308 | 7,510 | # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic... | 38.316327 | 245 | 0.679095 |
5d064f5df070f703128893be29ea7e39e14606eb | 503 | WillPaginate.per_page = 10
class Question < ActiveRecord::Base
# This is Sinatra! Remember to create a migration!
self.per_page = 10
UP_VOTE = 'Upvote'
belongs_to :user
has_many :answers, :dependent => :destroy
has_many :votes, :foreign_key => "question_id", :class_name => "QuestionVote", :dependent => :destroy... | 23.952381 | 102 | 0.67992 |
21eba7919d3efa7f04a80a2e73b70129cba31260 | 1,771 | 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 on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... | 38.5 | 85 | 0.763411 |
392ddbdbc48156e56c1cc30dd5e2d8ca179b72f3 | 1,619 | module Cryptoexchange::Exchanges
module Btcsquare
module Services
class Market < Cryptoexchange::Services::Market
class << self
def supports_individual_ticker_query?
false
end
end
def fetch
output = super(ticker_url)
adapt_all(outp... | 31.745098 | 100 | 0.560222 |
e241ef01b5d514b44dd5de6c21c2457633d1c685 | 2,464 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe GameToolsService, type: :http do
subject { described_class.new }
describe '#get_server' do
let(:server_name) { 'Battlefield da Depressao - LOCKER 24/7 50Hz - i3D.net' }
let(:endpoint) { 'https://api.gametools.network/bf4/servers/' }
l... | 28 | 87 | 0.601055 |
f76cc0ed3e135b57240e3d1b026bb9e62ad521af | 1,696 | # 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::Network::Mgmt::V2019_08_01
module Models
#
# List of virtual network gateway vpn client connection health.
#
class VpnClient... | 29.241379 | 84 | 0.549528 |
1a3164379e6520b24de396d8e96004f42dacbed1 | 152 | class CreateProjects < ActiveRecord::Migration
def change
create_table :projects do |t|
t.string :name
t.timestamps
end
end
end
| 16.888889 | 46 | 0.677632 |
039a0c6383ef29100176f30c9ddfb18bad4950c2 | 1,055 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... | 31.969697 | 67 | 0.754502 |
7a99bb2d0dcc6e59c66165ec4128f74de77d9afc | 7,449 | # frozen_string_literal: true
# encoding: utf-8
module Unified
module CrudOperations
def find(op)
collection = entities.get(:collection, op.use!('object'))
use_arguments(op) do |args|
opts = {
let: args.use('let'),
}
if session = args.use('session')
opts[... | 28.54023 | 99 | 0.558464 |
381f8d3717b28d0de4648f73f4a7df262c26fa41 | 1,298 | # Encoding: utf-8
#
# This is auto-generated code, changes will be overwritten.
#
# Copyright:: Copyright 2013, Google Inc. All Rights Reserved.
# License:: Licensed under the Apache License, Version 2.0.
#
# Code generated by AdsCommon library 0.9.6 on 2014-08-12 14:23:05.
require 'ads_common/savon_service'
require '... | 27.617021 | 71 | 0.724961 |
ed7d04bf4a801559e8012f17709dc9f4b7a8d523 | 8,884 | =begin
#BillForward REST API
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file e... | 32.903704 | 191 | 0.633949 |
627241dfd5c3332b3cb856dc3d4e417f80bf7ec9 | 627 | class PublishingApiRedirectWorker < PublishingApiWorker
def perform(content_id, destination, locale, allow_draft = false)
Services.publishing_api.unpublish(
content_id,
type: "redirect",
locale: locale,
alternative_path: destination.strip,
allow_draft: allow_draft,
discard_draf... | 33 | 87 | 0.727273 |
bfe5e7553d67c211766af79a31f40a8a6ef3094a | 859 | require_relative "spec_helper"
describe "current_datetime_timestamp extension" do
before do
@ds = Sequel.mock[:table].extension(:current_datetime_timestamp)
end
after do
Sequel.datetime_class = Time
end
it "should have current_timestamp respect Sequel.datetime_class" do
t = Sequel::Dataset.new(n... | 30.678571 | 81 | 0.746217 |
91738a59a6bc4f5e44778b5ed24e670e7cd9a743 | 2,658 | ##
## Copyright (c) 2015 SONATA-NFV [, ANY ADDITIONAL AFFILIATION]
## 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/licenses/LICEN... | 33.225 | 115 | 0.706546 |
0359fae6450ee6ccc6d2ec975034905f30a2612a | 8,338 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe MovesController, type: :controller do
# This should return the minimal set of attributes required to create a valid
# Move. As you add validations to Move, be sure to
# adjust the attributes here as well.
let(:valid_attributes) do
{
... | 26.469841 | 96 | 0.573399 |
1abe89444b0c5e25a100f55aa0f9016a8cc70061 | 705 | module Haversack
class ItemCollection < Array
def initialize(data, &block)
if !block_given?
raise ArgumentError, "expected #{data} to contain only elements of class Haversack::Item" unless data.is_a?(Array) && ItemCollection.only_items?(data)
end
@size = self.size
@weight = sel... | 20.735294 | 158 | 0.624113 |
03e0954e5ab3f2c05c5adee6d4689d59628ec6c3 | 45,609 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe API::Releases do
let(:project) { create(:project, :repository, :private) }
let(:maintainer) { create(:user) }
let(:reporter) { create(:user) }
let(:developer) { create(:user) }
let(:guest) { create(:user) }
let(:non_project_member) { creat... | 34.292481 | 152 | 0.613651 |
e20e83bafdd6e116dc7120db514e57fe5a347385 | 1,481 | # Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'spec_helper'
describe Devise::PasswordsController do
include Devise::TestHelpers
before do
@request.env["devise.mapping"] = Devise.mappings[:... | 32.911111 | 101 | 0.625928 |
e96d4c631b65c0d66f2d0901bb5e903c0a1f2bc3 | 358 | require_relative 'cuda_model'
require_relative 'gen_probe_base.rb'
provider = :lttng_ust_cuda
puts <<EOF
#define __CUDA_API_VERSION_INTERNAL 1
#include <cuda.h>
EOF
$cuda_commands.each { |c|
next if c.parameters && c.parameters.length > LTTNG_USABLE_PARAMS
$tracepoint_lambda.call(provider, c, :start)
$tracepoi... | 21.058824 | 67 | 0.77095 |
e92cfb66fe02b7155ffec8ff6d02b7713ba5131c | 11,709 | # frozen_string_literal: true
require 'aws-sdk-autoscaling'
require 'aws-sdk-cloudtrail'
require 'aws-sdk-cloudwatch'
require 'aws-sdk-cloudwatchlogs'
require 'aws-sdk-configservice'
require 'aws-sdk-core'
require 'aws-sdk-ec2'
require 'aws-sdk-ecs'
require 'aws-sdk-eks'
require 'aws-sdk-elasticloadbalancing'
require ... | 34.037791 | 173 | 0.702024 |
e9779b68e1c9385cd7ed643ecd52a2884a2f1e9b | 1,975 | require 'test_helper'
module Elasticsearch
module Test
class IndicesSegmentsTest < ::Test::Unit::TestCase
context "Indices: Segments" do
subject { FakeClient.new }
should "perform correct request" do
subject.expects(:perform_request).with do |method, url, params, body|
... | 30.384615 | 88 | 0.601013 |
0889033412081d5a0acfad4346e4c47c03832dfb | 3,883 | require 'rspec/expectations/expectation_target'
require 'active_support/core_ext/string/strip'
require 'active_support/core_ext/string/filters'
require 'active_support/concern'
require 'appraisal/utils'
require "./spec/support/dependency_helpers"
module AcceptanceTestHelpers
extend ActiveSupport::Concern
include D... | 22.707602 | 84 | 0.677311 |
3849e341fefe9d6961cabcd20a7ec39f43e48660 | 557 | cask "quarto" do
version "0.9.449"
sha256 "080dbaafbb1426b28354ed6e50f735d87e4ec45c4c8dbdd029281f9d7b319bf5"
url "https://github.com/quarto-dev/quarto-cli/releases/download/v#{version}/quarto-#{version}-macos.pkg",
verified: "github.com/quarto-dev/quarto-cli/"
name "quarto"
desc "Scientific and technic... | 29.315789 | 107 | 0.736086 |
3893e89f59c365a03d10073945ae1db8eac69352 | 6,723 | require "action_dispatch/http/request"
require "active_support/core_ext/hash/slice"
require "active_support/core_ext/string/strip"
require "uri"
require "erb"
require "pathname"
module Autodoc
class Document
DEFAULT_DOCUMENT_PATH_FROM_EXAMPLE = ->(example) do
example.file_path.gsub(%r<\./spec/[^/]+/(.+)_sp... | 24.270758 | 113 | 0.607021 |
f8e26ba7e4fd14919fedea05af6ad9ef7a555ad0 | 4,092 | # frozen_string_literal: true
require 'spec_helper'
require 'generators/bounded_context/bounded_context_generator'
module BoundedContext
module Generators
RSpec.describe BoundedContextGenerator do
RSpec::Matchers.define :match_content do |expected|
match do |actual|
@matcher = ::RSpec::M... | 28.027397 | 95 | 0.640518 |
33922862630b368ea61f2663ff886316cdd96069 | 312 | test_cask 'invalid-gpg-missing-key' do
version '1.2.3'
sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
url TestHelper.local_binary_url('caffeine.zip')
homepage 'http://example.com/invalid-gpg-missing-keys'
gpg 'http://example.com/gpg-signature.asc'
app 'Caffeine.app'
end
| 28.363636 | 75 | 0.778846 |
ff9c8cf9252bc152b5cd7baae2f9f6908e0437e5 | 1,248 | # frozen_string_literal: true
##
# 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
##
WhatWeb::Plugin.define "Kajona" do
@author... | 32.842105 | 125 | 0.659455 |
6262ef25d1fedc7261bea5c25fab36dae71d0da6 | 653 | require "spec_helper"
describe "authentication homepage" do
it "allows registered and confirmed user to log in" do
# Creates a dummy user
user = User.create!(:email => "user@foo.bar",
:first_name => "Test",
:last_name => "User",
:passwor... | 28.391304 | 58 | 0.601838 |
91966b04a1a0525c8f172445a71db9d832425fa1 | 1,627 | require "json"
require "faraday"
require "eth"
require "bip44"
require 'bigdecimal'
module TokenAdapter
class << self
attr_accessor :logger
end
class JSONRPCError < RuntimeError; end
class TxHashError < StandardError; end
class ConnectionRefusedError < StandardError; end
class TransactionError < Stand... | 29.053571 | 51 | 0.822372 |
618f9a462d1d4572228ffc1602b4bc5aa8fa2485 | 8,654 | ##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##
require 'msf/core'
require 'rex'
require 'msf/core/post/comm... | 32.656604 | 113 | 0.618096 |
03483bffbe2fe632840d9b1998d3ba00e7345faa | 9,250 | require 'set'
require 'digest'
module Licensee
module ContentHelper
DIGEST = Digest::SHA1
START_REGEX = /\A\s*/.freeze
END_OF_TERMS_REGEX = /^[\s#*_]*end of terms and conditions\s*$/i.freeze
ALT_TITLE_REGEX = License::ALT_TITLE_REGEX
REGEXES = {
hrs: /^\s*[=\-\*]{3,}\s*$/,
... | 31.144781 | 80 | 0.571784 |
ac33a63edcf1f95184063da205511a7ec5ad2053 | 234 | set_name 'ProductInterest'
set_fields(
product: :belongs_to,
owner: :'references{polymorphic}'
)
set_view_schema :single_page_manager
describe_belongs_to_field :product, :Product, :product, :name, :link_to
describe_owner_field
| 19.5 | 71 | 0.799145 |
9116943bc5032f6cd52fcf2a72e8ac79f7bf49da | 335 | class Company < ActiveRecord::Base
belongs_to :industry
has_many :managers, :foreign_key => :manages_company_id
belongs_to :parent, :class_name => 'Company', :foreign_key => 'parent_id'
has_many :children, :class_name => 'Company', :foreign_key => 'parent_id'
counter_culture :parent, :column_name => :child... | 27.916667 | 75 | 0.734328 |
4ab07be989bd1ff1bcd86c0862519e19a6842cbf | 378 | class UseVdaysVpositionsDefaults < ActiveRecord::Migration
def up
change_column :conferences, :use_vpositions, :boolean, default: false
change_column :conferences, :use_vdays, :boolean, default: false
end
def down
change_column :conferences, :use_vpositions, :boolean, default: nil
change_column :... | 31.5 | 73 | 0.759259 |
1a0555be67d8d81207a77612a316aac2eac61f6e | 1,667 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... | 32.057692 | 139 | 0.656269 |
38e19bfb4010476f92009207c0adc1345cc9626b | 2,139 | #-- encoding: UTF-8
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2020 the OpenProject GmbH
#
# 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 ChiliProj... | 28.905405 | 91 | 0.713885 |
e97657c6612ca704bf656183d32afec7e4c225de | 977 | # 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 u... | 36.185185 | 62 | 0.746162 |
7ab53da39875aaec41d9223df1230f880a010fdd | 125 | class Category < ApplicationRecord
has_many :ad_has_categories
has_many :ads , :throught => :ad_has_categories
end
| 20.833333 | 52 | 0.752 |
f75e01d9d048367be0b37b2108efa24cd7fd4f4b | 905 | shared_examples "a protected admin controller" do |controller|
let(:args) do
{
host:Rails.application.config.baukis2[:admin][:host],
controller: controller
}
end
describe "#index" do
example "ログインフォームにリダイレクト" do
get url_for(args.merge(action: :index))
expect(response).to redir... | 23.815789 | 71 | 0.679558 |
0388dea5adb39d665cda59c41ce80d3616e25fa0 | 6,349 | class Admin2::TransactionsPresenter
include Collator
private
attr_reader :service
public
def initialize(params, service)
@params = params
@service = service
end
delegate :transactions, :transaction, :community, to: :service, prefix: false
FILTER_STATUSES = %w[free confirmed paid canceled p... | 24.049242 | 135 | 0.735076 |
7a22bced12009480ffb8c5e143cc914769e8cdf6 | 1,283 | # frozen_string_literal: true
module ReleaseTools
module TraceSection
def self.collapse(summary, icon: nil)
title =
if icon
"#{icon} #{summary}"
else
summary
end
section = section_name(summary)
puts "section_start:#{Time.now.to_i}:#{section}[collaps... | 26.183673 | 85 | 0.624318 |
5db14bd19cd351e4b937c82881ce2728b701054f | 1,458 | module Pokotarou
module RegistrationConfigMaker
class ConfigDomain
class << self
def has_dush_import_syntax? all_content
return false if all_content.blank?
return all_content.has_key?(:"import'")
end
def has_dush_template_syntax? all_content
return ... | 30.375 | 58 | 0.635802 |
1cabd5de2379ab624e7b1ef368ee5ad0d3c65603 | 88 | json.partial! 'operating_systems/operating_system', operating_system: @operating_system
| 44 | 87 | 0.863636 |
ed93be34f67f0e7a6375b98aff47ce4d79fd2aac | 2,201 | INPUT = 'input.txt'
@numbers = Array.new
@boards = Array.new
file_lines = File.readlines(INPUT)
@numbers = file_lines.shift.chomp.split(',').collect(&:to_i)
board = nil
row = 0
file_lines.each do |line|
if line.chomp == ''
@boards << board if board
board = Hash.new
row = 0
next
end
board[:cols] ... | 25.593023 | 82 | 0.632894 |
7967ff81075feae78126269ff1c2693c19582752 | 1,188 | # frozen_string_literal: true
require 'spec_helper'
describe ProtectedBranches::UpdateService do
let(:protected_branch) { create(:protected_branch) }
let(:project) { protected_branch.project }
let(:user) { project.owner }
let(:params) { { name: 'new protected branch name' } }
describe '#execute' do
sub... | 29.7 | 102 | 0.695286 |
ac1956275c79351118b7ef9715b535a61a38e8fa | 456 | RSpec.shared_examples 'new record attributes' do
it 'has a name' do
expect(object.name).to eq attributes[:name]
end
it 'has a description' do
expect(object.description).to eq attributes[:description]
end
it 'has a short description' do
expect(object.short_description).to eq attributes[:short_des... | 25.333333 | 75 | 0.743421 |
bb671c4ae4dbcaa5922ab5942b031c99ae829574 | 7,673 | #
# Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
#
# This program is distributed under the terms of the MIT license.
# See the included MIT-LICENSE file for the terms of this license.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARR... | 29.398467 | 89 | 0.726443 |
b95112f9f3abd824e3fb76a5b57ce43bb6ee9e75 | 39 | module DaFace
VERSION = "0.0.12"
end
| 9.75 | 20 | 0.666667 |
ac479222b1062be6ae0160795e0b61526acedc32 | 153 | # frozen_string_literal: true
require 'test_helper'
class AttendeeTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 15.3 | 44 | 0.72549 |
5d8b29acb98531ae5286abceb541b738e355903d | 998 | module ActionDispatch
module Routing
class Mapper
def initialize(route_set)
@route_set = route_set
end
# 解析生成路径
# 并加入路径列表中
# 一开始把 as赋值为 nil
def get(path, to:, as: nil)
# to => "controller#index"
# 这里的 to 是键值对的 key
# 直接取它的 value
controlle... | 26.972973 | 79 | 0.519038 |
0359868c3aa90b99c8da8c73a4006f4a0038a88e | 1,418 | require "metanorma/processor"
module Metanorma
module M3AAWG
class Processor < Metanorma::Generic::Processor
def configuration
Metanorma::Ribose.configuration
end
def initialize
@short = [:m3d, :m3aawg]
@input_format = :asciidoc
@asciidoctor_backend = :m3aawg
... | 24.877193 | 104 | 0.565585 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.