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 |
|---|---|---|---|---|---|
7a502641f56d78c18bf1544c7cd8ddbf9e54fe36 | 466 | require 'rails_helper'
RSpec.describe "affiliates/show", :type => :view do
before(:each) do
@affiliate = assign(:affiliate, Affiliate.create!(
:name => "Name",
:adv => "MyText",
:display_count => 1,
:view_count => 2
))
end
it "renders attributes in <p>" do
render
expect(r... | 22.190476 | 54 | 0.609442 |
61a2b98379334902e5fd0f5078a9f15cfd43419a | 108 | # lib/tasks/run_migrations.rake
Rake::Task['assets:clean'].enhance do
Rake::Task['db:migrate'].invoke
end
| 21.6 | 37 | 0.740741 |
2167bd822ab14a544feef1c772cc0cc20c558056 | 236 | class MoveFeedbackIntoQuestions < ActiveRecord::Migration
def up
add_column :questions, :feedback_en, :text
add_column :questions, :feedback_fr, :text
add_column :questions, :feedback_es, :text
end
def down
end
end
| 21.454545 | 57 | 0.737288 |
1d8f3af7a4d855949b3bbf63f9cc60ec355bf392 | 315 | class CreateJoinTableDefectDefintionsElementDefinition < ActiveRecord::Migration[5.2]
def change
create_join_table :defect_definitions, :element_definitions do |t|
t.index [:element_definition_id, :defect_definition_id],
name: 'idx_defect_defintions_element_definitions'
end
end
end
| 35 | 85 | 0.771429 |
5d61110278f26971b56a3096d96c8043fb26a815 | 180 | class CreateClans < ActiveRecord::Migration[5.2]
def change
create_table :clans do |t|
t.string :name
t.string :symbol_link
t.timestamps
end
end
end
| 18 | 48 | 0.65 |
7ab1f4e01030629e4800c6f2f343c3ba32b6c16d | 156 | # browser/setup/base: Setup only the base requires
require 'browser/version'
require 'browser/utils'
require 'browser/form_data'
require 'browser/support'
| 22.285714 | 50 | 0.794872 |
014280cd612fefa8af85b78d6e569fbef1994544 | 420 | # see https://github.com/ruby-grape/grape/issues/1348
require 'spec_helper'
def namespace
raise
end
describe Grape::API do
subject do
Class.new(Grape::API) do
format :json
get do
{ ok: true }
end
end
end
def app
subject
end
context 'with a global namespace function... | 14 | 53 | 0.619048 |
010c4c45b5fe360f3f3257344945a1edca0ed32a | 1,330 | require "fddb/version"
require 'net/http'
require 'rexml/document'
require 'nori'
require_relative 'fddb/item'
require_relative 'fddb/items'
module FDDB
class API
def initialize (api_key, lang = 'de', format= :json)
@api_key = api_key
@lang = lang
@base_url = 'http://fddb.info/api/v8'
@f... | 23.333333 | 56 | 0.599248 |
62c22a42e4fabb86af51809e4e1dd1358356bb2a | 135 | class AddProtocolToServer < ActiveRecord::Migration
def change
add_column :servers, :protocol, :string, default: 'udp'
end
end
| 22.5 | 59 | 0.748148 |
b9e9576a593a7fc57acf0ba32b17c13476706d0b | 3,306 | # frozen_string_literal: true
require "shellwords"
require "dip/cli/dns"
require "dip/commands/dns"
describe Dip::Commands::DNS do
let(:cli) { Dip::CLI::DNS }
describe Dip::Commands::DNS::Up do
let(:volume) { "--volume /var/run/docker.sock:/var/run/docker.sock:ro" }
let(:net) { "--net frontend" }
let... | 29 | 119 | 0.615245 |
28effdaf46623f262fcbf8711054425753b2c7e9 | 2,270 | require 'rails_helper'
describe Api::V2::AccountListsController, type: :controller do
let(:factory_type) { :account_list }
let!(:user) { create(:user_with_account) }
let(:account_list) { user.account_lists.order(:created_at).first }
let!(:second_account_list) { create(:account_list, users: [user], created_at: ... | 31.971831 | 112 | 0.662115 |
5db530b12a696d34e2a35210e12aa8e9077a65c8 | 1,644 | class Nco < Formula
desc "Command-line operators for netCDF and HDF files"
homepage "https://nco.sourceforge.io/"
url "https://downloads.sourceforge.net/project/nco/nco-4.7.6.tar.gz"
sha256 "c7926163b204573b7bf7b6e3c9bcfa15b2cc04c0f494dbc0c6829ee8c2f015b3"
bottle do
cellar :any
sha256 "d9565e4d3bb351... | 32.235294 | 93 | 0.708029 |
bf682c25bfadf3fb92ca4abfb71080db9aa19a04 | 251 | require 'sinatra'
get '/symbols/window.html' do
redirect "http://emberjs.com/api/"
end
get '/symbols/:class.html' do |klass|
redirect "http://emberjs.com/api/classes/#{klass}.html"
end
get '*' do |path|
redirect "http://emberjs.com/api/"
end
| 17.928571 | 57 | 0.681275 |
3358b7e7836f41c1356e62d0e6a748bb304f1ac3 | 1,428 | module Network::Technologies
module CongestionBattery
class SubPath < Network::SubPath
# The subpath which includes the parent of the node containing the
# congestion battery. We will try to solve congestion problems on that
# path
attr_accessor :solver_path
def mandatory_consumptio... | 30.382979 | 79 | 0.64916 |
ff51473c2bf72d0ffb60e782d995765dd41b4910 | 1,423 | # frozen_string_literal: true
require 'spec_helper'
describe 'cis_hardening::setup::sudo' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }
# Section 1.3 - Configure sudo
# Ensure sudo is installed - Section 1.3.1
it {
is_expected.... | 26.849057 | 87 | 0.531272 |
117a92ea789dfee23c3447ca3771615d95ae08ca | 199 | class CreateCategories < ActiveRecord::Migration
def change
create_table :categories do |t|
t.string :name, null: false, uniqueness: true
t.timestamps null: false
end
end
end
| 22.111111 | 51 | 0.698492 |
d5087c4d16d70c3094230a548792856466363eac | 359 | class UsersController < ApplicationController
def create
user = User.new(user_params)
if user.save
session[:user_id] = user.id
redirect_to root_path
else
redirect_to '/signup'
end
end
def new
end
private
def user_params
params.require(:user).permit(:name, :email, :pass... | 19.944444 | 82 | 0.685237 |
5d4b6d3b0bf6a9fddcc0635ecfc25652e314efbd | 9,456 | # frozen_string_literal: true
describe PubmedSourceRecord, :vcr do
let(:pmid_created_1999) { 10_000_166 }
def author_doc(xml)
Nokogiri::XML(xml).at_xpath('/Author')
end
describe 'parses valid <Author> examples' do
# Example <Author> records from No. 20 at https://www.nlm.nih.gov/bsd/licensee/elements... | 44.603774 | 229 | 0.681472 |
1a6f6421e50c7bc69eceb844cfe63d5fb7a04e13 | 167 | class CreateCharacters < ActiveRecord::Migration[6.1]
def change
create_table :characters do |t|
t.string :name
t.integer :game_id
end
end
end
| 18.555556 | 53 | 0.676647 |
7966fb187df4d0e98913b5d0d7c8d0b30c69bc7c | 378 | class Tag < ActiveRecord::Base
belongs_to :repository
belongs_to :author, class_name: "User", foreign_key: "user_id"
validates :name,
presence: true,
uniqueness: { scope: "repository_id" },
format: {
with: /\A[A-Za-z0-9_\.\-]{1,128}\Z/,
mes... | 31.5 | 70 | 0.547619 |
bbf6bfb14f48ffc54d453c4e3fc0e67b7d207cf2 | 1,261 | # frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'avataaars/version'
Gem::Specification.new do |spec|
spec.name = 'avataaars'
spec.version = Avataaars::VERSION
spec.required_ruby_version = ['>= 2.5.0', '< 3.2.0']
s... | 37.088235 | 104 | 0.683584 |
396d94423de86942964fb4a3c8b77c213c0eab7c | 4,265 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... | 41.009615 | 102 | 0.742087 |
bfc60199182bac99e48e0521acc30c93ccaa49d4 | 127 | class AddUsernameToComments < ActiveRecord::Migration[5.0]
def change
add_column :comments, :username, :string
end
end
| 21.166667 | 58 | 0.755906 |
38ba1f91ec839614e45a48079082eb93125634fe | 1,777 | require 'test_helper'
class UserTest < ActiveSupport::TestCase
def setup
@user = User.new(name: "Example User", email: "user@example.com",
password: "foobar", password_confirmation: "foobar")
end
test "should be valid" do
assert @user.valid?
end
test "name should be present"... | 25.753623 | 74 | 0.652786 |
1c89ffd400348826eac9e4cb2cadb45221f63be9 | 1,634 | class Bgpq3 < Formula
desc "bgp filtering automation for Cisco, Juniper, BIRD and OpenBGPD routers"
homepage "http://snar.spb.ru/prog/bgpq3/"
url "https://github.com/snar/bgpq3/archive/v0.1.33.tar.gz"
sha256 "f3a58d547368c4396e5bc2b6189fe968567f1afde47245220b1ba9486b26fb39"
head "https://github.com/snar/bgpq3... | 34.041667 | 92 | 0.706854 |
381d923c1c0feb3acd9e8c76be6e687ddb494384 | 164 | String.class_eval do
def cap_first
"#{self[0].chr.upcase}#{self[1..(self.length - 1)]}"
end
def classify
split('_').map(&:cap_first).join
end
end | 18.222222 | 56 | 0.621951 |
62c9d367f39ee95ecb4281e9e0b4e3525a46b213 | 88,132 | # encoding: UTF-8
unless defined? ASCIIDOCTOR_PROJECT_DIR
$: << File.dirname(__FILE__); $:.uniq!
require 'test_helper'
end
context "Blocks" do
context 'Line Breaks' do
test "ruler" do
output = render_string("'''")
assert_xpath '//*[@id="content"]/hr', output, 1
assert_xpath '//*[@id="conten... | 29.544754 | 556 | 0.650377 |
bfcf6f78a3b82685cd863a6adebaa39e218aaed4 | 501 | require 'formula'
class Eventlog < Formula
desc "Replacement for syslog API providing structure to messages"
homepage 'http://www.balabit.com/downloads/files/eventlog/'
url 'http://www.balabit.com/downloads/files/syslog-ng/sources/3.4.3/source/eventlog_0.2.13.tar.gz'
sha1 '113e54ef2c4d0d4b23ee65fa502915ceea18b... | 33.4 | 100 | 0.704591 |
bff199f7a898346de7c48ae7abf995edbc10dc86 | 347 | require_relative '../../../../../test_helper'
module Keybase::Core
module Request
class KeyRevokeTest < Minitest::Test
def setup
@response = { }
end
def test_key_revoke_returns_true
Base.stub :post, @response do
assert Request::Key.revoke('foo')
end
en... | 17.35 | 45 | 0.573487 |
ff174bae28faa36ceb5d3545ca7f05c2f08dffec | 159 | require 'spec_helper'
describe '/api' do
it 'should load with a valid 200 status code' do
visit '/api'
expect(page.status_code).to eq(200)
end
end | 19.875 | 50 | 0.691824 |
f794f2d398f8a3f17bf83f52f57fe49709dac4e1 | 27,697 | # 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
#
# ExpressRouteGateways
#
class ExpressRouteGateways
include MsRestAzure
#
# Creates and init... | 46.008306 | 170 | 0.716937 |
5da063b5927c277338daca45ff4fc77b11d7ea3f | 1,521 | # -*- encoding: utf-8 -*-
# stub: jekyll-theme-architect 0.1.1 ruby lib
Gem::Specification.new do |s|
s.name = "jekyll-theme-architect".freeze
s.version = "0.1.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s... | 40.026316 | 112 | 0.679158 |
bb2bfb1cf85e432095d3274b2be504edb28953eb | 32,591 | # WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
require 'seahorse/client/plugins/content_length.rb'
require 'aws-sdk-core/plugins/credentials_configuration.rb'
... | 38.118129 | 199 | 0.646375 |
f7b499c765df07567983e3c6cb5181d029367507 | 773 | class Resources::TaskResource < Resources::ApplicationResource
attributes :created_at, :finished, :id, :name, :project_id, :user_id, :custom_id
collection_commands :command_serialize, :test_collection
member_commands :test_member
relationships :account, :project, :user
USER_TASK_ABILITIES = [
:accessible... | 24.935484 | 82 | 0.72445 |
1db71fd488d1b9b9f9d316784182b23461e92887 | 269 | require 'spec_helper'
describe Puppet::Type.type(:multipkg) do
before do
Puppet::Util::Storage.stubs(:store)
end
it "should have an :packages property that is an array" do
Puppet::Type.type(:multipkg).attrtype(:packages).should == :property
end
end
| 19.214286 | 72 | 0.710037 |
5dcb822fd27d773970cae870757e0f1dd990c6cb | 2,354 | #
# Cookbook:: push-jobs
# resource:: service_runit
#
# Author:: Tim Smith <tsmith@chef.io>
# Copyright:: 2009-2019, Chef Software, 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
#
# ... | 24.778947 | 81 | 0.710705 |
f7672c9834719c38034e4e9b4efc1ee442fa6c95 | 541 | # frozen_string_literal: true
module HamlLint
class Linter
class InlineJavaScript < Linter
include ::HamlLint::LinterRegistry
MSG = 'Inline JavaScript is discouraged (https://docs.gitlab.com/ee/development/gotchas.html#do-not-use-inline-javascript-in-views)'
def visit_filter(node)
ret... | 22.541667 | 138 | 0.672828 |
28a562d83b9b30b5163636ec05cb443323887fc7 | 6,783 | # frozen_string_literal: true
require 'rom/sql/type_serializer'
module ROM
module SQL
module Migration
# @api private
class SchemaDiff
extend Initializer
param :database_type
option :type_serializer, default: -> { ROM::SQL::TypeSerializer[database_type] }
class Tab... | 26.6 | 99 | 0.557128 |
91e364241e4ff8176305b5425a72e37a631f53c8 | 89 | a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
a.each_slice(4) { |a| p a }
| 22.25 | 59 | 0.438202 |
e839f755c81a5864e72ab12a1790355d0bb8fb78 | 1,015 | require 'formula'
class Qwt < Formula
homepage 'http://qwt.sourceforge.net/'
url 'http://downloads.sourceforge.net/project/qwt/qwt/6.1.0/qwt-6.1.0.tar.bz2'
sha1 '48a967038f7aa9a9c87c64bcb2eb07c5df375565'
depends_on 'qt'
def install
inreplace 'qwtconfig.pri' do |s|
# change_make_var won't work bec... | 29.852941 | 95 | 0.670936 |
013145864ded5fde8cc2ba48ba8cc3579dca164d | 831 | #
# Cookbook Name:: coopr
# Recipe:: provisioner
#
# Copyright © 2013-2014 Cask Data, 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
#
... | 27.7 | 74 | 0.756919 |
87d8ad957b428d002c068e986239e7177e7b202c | 31,101 | # Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License;
# you may not use this file except in compliance with the Elastic License.
require "spec_helper"
require "logstash/json"
require "logstash/runner"
require "config... | 45.804124 | 370 | 0.625575 |
6178ba4557535ca9864636ab2e0c32e81c080d79 | 3,150 | class ModifiedSixteenManMatchGeneration
def initialize( tournament )
@tournament = tournament
@number_of_placers = @tournament.number_of_placers
end
def generate_matches
@tournament.weights.each do |weight|
generate_matches_for_weight(weight)
end
end
def generate_mat... | 34.615385 | 153 | 0.677778 |
61d90a7bd259391ec1231f17bf2d5f8881b44dbe | 48 | module MongoTransaction
VERSION = "0.0.1"
end
| 12 | 23 | 0.729167 |
3384d15838bc1ffd413980aea9269ddd50f693c2 | 1,219 | require File.expand_path(File.dirname(__FILE__) + '/../../test_helper' )
# TODO continue
module IntegrationTests
class AdminCustomTemplatesTest < ActionController::IntegrationTest
def setup
super
@section = Page.find_by_title 'a page'
@site = @section.site
use_site! @site
end
test... | 29.02381 | 73 | 0.657916 |
ed82b33eaee338540a1a308f6c256c55778166f0 | 1,264 | module Raven
class Breadcrumb
attr_accessor :category, :data, :message, :level, :timestamp, :type
def initialize
@category = nil
@data = {}
@level = nil
@message = nil
@timestamp = Time.now.to_i
@type = nil
end
def to_hash
{
:category => @category,
... | 16.415584 | 71 | 0.547468 |
3864d130b9ee551a813ef4876d6409027a60155d | 1,673 | #
# Cookbook Name:: openldap
# Recipe:: auth
#
# Copyright 2008-2009, Opscode, 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
#
# Unle... | 23.56338 | 105 | 0.711895 |
e28f6ea1dcff308a5536372cd72f6841ccfa4e7c | 1,583 | # frozen_string_literal: true
module Common
module Client
module Middleware
module Response
class BackendUnhandledException < StandardError; end
class RaiseError < Faraday::Response::Middleware
attr_reader :error_prefix, :body, :status
def initialize(app, options = {})... | 26.830508 | 116 | 0.546431 |
d5be4e3c921f9a0ecfd587e7892cbde3365bbea0 | 1,590 | require 'test_helper'
class FollowingTest < ActionDispatch::IntegrationTest
def setup
@user=users(:michael)
@other=users(:archer)
log_in_as(@user)
end
test "folloing page" do
get following_user_path(@user)
assert_not @user.following.empty?
assert_match @user.following.count.to_s,respons... | 27.413793 | 75 | 0.707547 |
33250e9f935e8fc71b5122f1dd3a5e71efda1faa | 1,106 | # -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'ldap/server/version'
Gem::Specification.new do |s|
s.name = %q{ruby-ldapserver}
s.version = LDAP::Server::VERSION
s.authors = ["Brian Candler", "Juha-Pekka Laiho"]
s.descriptio... | 39.5 | 117 | 0.691682 |
e8ec57e2960b0c5354e69ecc77cda56e49b1713a | 6,853 | require File.expand_path('base_test_case', File.dirname(__FILE__))
class TestComunicationProperties < Test::Unit::TestCase
include BaseTestCase
def config_test_all_authorized
@authorized_channels_only = "off"
@header_template = "connected"
end
def test_all_authorized
channel = 'ch_test_all_author... | 40.076023 | 412 | 0.638115 |
4aaec459abfaf611e54851074ebf10a25ae0a332 | 1,415 | class AccountMailer < ApplicationMailer
include ActionView::Helpers::UrlHelper
include Devise::Controllers::UrlHelpers
def send_email(message, user)
subject = 'Приглашение на регистрацию'
full_name = user&.profile&.full_name
email_with_name = "#{full_name}" + "<#{user.email}>"
user = Accou... | 56.6 | 307 | 0.720848 |
2667cf351d1610f6d4dc96d228b058d75c418f04 | 2,044 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require *Rails.groups(:assets => %w(development test))
# If you want your assets lazily compiled in production, use this line
# Bundler.requir... | 41.714286 | 99 | 0.722114 |
d523805dbe95622df5a4e50be02e1113b50b2fd3 | 339 | require 'nested_wishlist_context'
class AmazonSearchPolicy
def initialize(context, amazon_search)
@user = context.user
@wishlist = context.wishlist
@amazon_search = amazon_search
end
def show?
new?
end
def new?
user.can_manage? wishlist
end
private
attr_reader :user, :wishlist, ... | 15.409091 | 46 | 0.716814 |
d57148f79323d41b87ac44e2e4cc77a5497b9056 | 93 | class PigCI::Metric; end
require 'pig_ci/metric/current'
require 'pig_ci/metric/historical'
| 18.6 | 34 | 0.795699 |
6a3395020dd305f9634b3024246b555dea060400 | 1,060 | module Magentwo
class SalesRule < Base
Attributes = %i(rule_id name store_labels description website_ids customer_group_ids uses_per_customer is_active condition action_condition stop_rules_processing is_advanced sort_order simple_action discount_amount discount_step apply_to_shipping times_used is_rss coupon_typ... | 33.125 | 338 | 0.74717 |
26f22d7875762501651c0e45fe3633028ebe570b | 3,171 | # encoding: utf-8
# A simple Password generator. Central parts are based on a DZone snippet and its comments:
# https://web.archive.org/web/20090204082442/http://snippets.dzone.com/posts/show/2137
class Password
module CharacterSets
SAFE_CHARS = ("A".."Z").to_a | ("a".."z").to_a | ("0".."9").to_a | "-_.,;+!*()[... | 28.3125 | 108 | 0.631031 |
1d152ecd689fe1bf0c2e5f987664a5a38ec3fb06 | 1,104 | class Definition
attr_reader :id
attr_accessor :definition, :word_id
@@definitions = {}
@@total_count = 0
def initialize(definition, word_id, id)
@definition = definition
@word_id = word_id
@id = (id || @@total_count += 1)
end
def self.clear
@@definitions = {}
end
def self.all
... | 20.444444 | 108 | 0.67029 |
e8e053e0565b37cd04efcdd4305ed0c528723a1e | 4,797 | #
# Copyright (C) 2013 Panagiotis Papadomitsos
# Modified for Facter - James Turnbull
#
# 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
#
# Unl... | 31.768212 | 103 | 0.675214 |
1da139b74f8ca92b96627e42c76ea9e19386af14 | 21,025 | #-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2018 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,... | 36.950791 | 137 | 0.657741 |
0125c1b8148215dec54b23e9951c4d78301a11a9 | 360 | module FlattenRecord
module Meta
class MethodColumn < Column
def initialize(parent, method, type, target_model, model, options={})
@column = Struct.
new(:name, :default, :type, :null).
new(method, options[:default], type, options[:null])
super(parent, @column, target_mod... | 25.714286 | 75 | 0.619444 |
bf2e23eafb67b25f350b39f37289b6fe1255f1cb | 7,885 | =begin
#Ory Kratos API
#Documentation for all public and administrative Ory Kratos APIs. Public and administrative APIs are exposed on different ports. Public APIs can face the public internet without any protection while administrative APIs should never be exposed without prior authorization. To protect the administa... | 30.800781 | 429 | 0.63272 |
e23f41dbfb4b0d14f005018a03b7d8978b060b55 | 3,741 | require_relative "../../../spec_helper"
require "kontena/cli/apps/common"
describe Kontena::Cli::Apps::Common do
include ClientHelpers
include FixturesHelpers
let(:subject) do
Class.new { include Kontena::Cli::Apps::Common}.new
end
let(:kontena_yml) do
fixture('kontena.yml')
end
let(:kontena_n... | 33.401786 | 124 | 0.67228 |
b9f119a83e917e7606cbbfceb13017b75ff256f7 | 2,668 | module Ziffers
module Common
@@degree_based = false
def set_degree_based(degrees=!@@degree_based)
@@degree_based = degrees
end
# Gets note from degree. Degree can also be negative or overflow to next octave
def get_note_from_dgr(dgr, zkey, zscale, zoct=nil)
scaleLength = s... | 26.68 | 175 | 0.606822 |
211205fc547920023b4086d6da57f00666498bf3 | 880 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require(*Rails.groups)
require "coauth"
module Dummy
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/ini... | 36.666667 | 99 | 0.718182 |
e94a98442c306476b478da1bedfb1bd796653109 | 255 | class ForceCreateGraphdbModelActiveNodeBaseUuidConstraint < Neo4j::Migrations::Base
def up
add_constraint :"Graphdb::Model::ActiveNodeBase", :uuid, force: true
end
def down
drop_constraint :"Graphdb::Model::ActiveNodeBase", :uuid
end
end
| 25.5 | 83 | 0.760784 |
ab5e5ddc6466cd62ac95a67dd848e856bdfbbbdb | 206 | # frozen_string_literal: true
class SpamDetectorJob < ApplicationJob
queue_as :default
def perform(*posts)
posts.detect do |post|
post.title.include?('Buy watches cheap!')
end
end
end
| 17.166667 | 47 | 0.708738 |
39085a1175f1c36029474e2b07eceb6a97e570ba | 138 | class AddStartUrlToImportConfig < ActiveRecord::Migration[6.0]
def change
add_column :import_configs, :start_url, :string
end
end
| 23 | 62 | 0.775362 |
1de10281647fa4b2dbd77eb6da4f2acbc61d77b6 | 681 | transcripts = {}
File.open("../annotation/simulator_config_geneinfo_mm9-ensembl-stdchr_GTF_score.gtf").each do |line|
line.chomp!
next unless line =~ /exon/
line =~ /\"(ENSMUST\d*)\"/
trans_id = $1
line =~ /(chr\w+)/
chr = $1
#next if transcripts.include?(trans_id)
transcripts[chr] ||= {}
transcripts... | 21.967742 | 100 | 0.654919 |
7abb24ae12f0f2ea2fa017715b3e10d19a5b294e | 721 | describe "duplicable?" do
before do
@raise_dup = [nil, false, true]
@yes = ['1', Object.new, /foo/, [], {}, Time.now, Class.new, Module.new]
@no = []
end
it "should return false for non-duplicable objects" do
(@raise_dup + @no).each do |v|
v.should.not.be.duplicable
end
end
it "sho... | 22.53125 | 76 | 0.621359 |
33a0dde3e75902feae552c5f924a9e1dda22e064 | 91 | #!/usr/bin/env ruby
WEBrick::HTTPServer.new(:Port => 3000, :DocumentRoot => Dir.pwd).start
| 30.333333 | 70 | 0.703297 |
79aeed9423ce008cfe632ca6ff82a1d381f190d9 | 1,195 | class Cl
class Help
class Table
include Wrap
attr_reader :data, :padding
def initialize(data)
@data = data
end
def any?
data.any?
end
def format(padding = 8)
@padding = padding
rows.join("\n")
end
alias to_s format
de... | 20.254237 | 91 | 0.502929 |
33a7c1e94e3d8469ec804ab8c4f312326d28720d | 758 | # frozen_string_literal: true
module LearnTest
module Dependencies
class Ant < LearnTest::Dependency
def missing?
if win?
`where ant`.empty?
else
`which ant`.empty?
end
end
def install
if win? || !mac?
die('Please install Ant.')
... | 19.435897 | 72 | 0.538259 |
bb77a5d7854fd9886dbed11b41e705fece6db862 | 2,757 | require 'tmpdir'
require 'fileutils'
require 'kramdown'
def path_handler_multi_open(root, destination, source, &block)
open(File.join(root, destination), "r") do |dest_io|
open(File.join(File.dirname(__FILE__), "../", source), "r") do |source_io|
block.call(dest_io, source_io)
end
end
end
Given /a... | 34.037037 | 106 | 0.68045 |
1d2a096f03ab12f36a4aedcac70365b7dea23089 | 8,037 | =begin
#Selling Partner APIs for Fulfillment Outbound
#The Selling Partner API for Fulfillment Outbound lets you create applications that help a seller fulfill Multi-Channel Fulfillment orders using their inventory in Amazon's fulfillment network. You can get information on both potential and existing fulfillment orde... | 30.558935 | 268 | 0.625109 |
6a17d982cb0d9f890e1c70f31d7a0f8c3ad904d8 | 157 | # Load the rails application.
require File.expand_path('../application', __FILE__)
# Initialize the rails application.
PhonelyFeud::Application.initialize!
| 26.166667 | 52 | 0.796178 |
182de5f18b4220e1672ec46e7f82a729fc1a12bf | 3,661 | module Helpers
def options
{
uuid: /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i,
datacenter: {
name: 'Ruby SDK Datacenter',
description: 'SDK test environment',
location: 'de/fkb'
},
datacenter_composite: {
name:... | 26.15 | 288 | 0.383229 |
61166f91c6d771d5a036ae3cc105fa01bcc248b1 | 1,959 | class Siril < Formula
desc "Astronomical image (pre-)processing application"
homepage "http://free-astro.org/index.php/Siril"
url "https://free-astro.org/download/siril-0.9.4.tar.bz2"
sha256 "3c90111faac63f2d0f17f1a05891ef9e97a2819e5073db2d26e8c3ab7072d91e"
head "https://free-astro.org/svn/siril/"
bottle d... | 28.808824 | 92 | 0.707504 |
e9690f5b8140305f60fe52256c946f3182c77df5 | 1,406 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'mailgun/version'
Gem::Specification.new do |spec|
spec.name = 'mailgun-ruby'
spec.version = Mailgun::VERSION
spec.homepage = 'http://www.mailgun.com'
spec.pl... | 37 | 93 | 0.652205 |
91effec0ce85ead93d7ca3f9b2224b5f603b7616 | 664 | require 'travis/api/v3/access_control/generic'
require 'travis/api/v3/log_token'
module Travis::API::V3
class AccessControl::LogToken < AccessControl::Generic
auth_type('log.token')
attr_accessor :token
def self.for_request(type, token, env)
new(token)
end
def initialize(token)
sel... | 16.195122 | 57 | 0.64006 |
28bf528091edccbb63b79de408f6d97326f2d3cf | 819 | class Streamlined::ReloadableRegistry
# unloadable is needed so that we do not lose validation_reflection when
# reloading in development mode
unloadable
@ui_by_name = {}
@context_hashes_by_name = {}
class <<self
attr_accessor :ui_by_name
# Returns the UI class for a given model class or name
... | 29.25 | 82 | 0.648352 |
ab70f8778fd51eefe3f4879f8114a801f1ee4742 | 3,842 | require 'capybara/rspec'
Capybara.default_driver = :selenium
Capybara.default_wait_time = 10
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_... | 40.020833 | 92 | 0.741801 |
acacc9906d1dd37936f5736b8eb904cae537dee7 | 1,050 | # encoding: utf-8
require File.expand_path('../lib/tremendous/version', __FILE__)
Gem::Specification.new do |spec|
spec.name = 'tremendous_ruby'
spec.version = Tremendous::VERSION
spec.summary = "Rewards and Incentives as a service"
spec.summary = 'Tremendous API SDK'
spec.licenses... | 38.888889 | 70 | 0.662857 |
21258280f9ca46b947b6909fc1de4ab9553f9964 | 6,268 | require "rails_helper"
RSpec.describe ReferentialCopy do
let(:stop_area_referential){ create :stop_area_referential }
let(:line_referential){ create :line_referential }
let(:company){ create :company, line_referential: line_referential }
let(:workbench){ create :workbench, line_referential: line_referential, s... | 37.987879 | 164 | 0.716337 |
e22886a3a59b6a4614c6ee33cc0cbacc7885b9cb | 62 | # frozen_string_literal: true
require_relative 'unity/utils'
| 15.5 | 30 | 0.822581 |
e88d8d23c43a8e9eb47c89ab220fc4c944542dd0 | 165 | # frozen_string_literal: true
require 'spec_helper'
describe Ruby::Overload do
it 'has a version' do
expect(Ruby::Overload::VERSION).not_to be_nil
end
end
| 16.5 | 49 | 0.745455 |
f839915f599578c21a775df645ebf6ec8c6f8b68 | 6,697 | module Jekyll
class Collection
attr_reader :site, :label, :metadata
attr_writer :docs
# Create a new Collection.
#
# site - the site to which this collection belongs.
# label - the name of the collection
#
# Returns nothing.
def initialize(site, label)
@site = site
... | 29.244541 | 87 | 0.637898 |
39d50f8908ba3d34c1a2c12816f7f26b5cd3adc6 | 2,410 | require 'sendgrid/api/service'
require 'sendgrid/api/entities/response'
module Sendgrid
module API
module Web
module Mail
def mail
Services.new(resource)
end
class Services < Sendgrid::API::Service
# Send email.
#
# @see http://sendgrid.com... | 54.772727 | 160 | 0.641909 |
e2a68714a6243dee9ad26c6a2bf38af45be40b8b | 3,602 | module BootstrapForm
module Helpers
module Bootstrap
def button(value=nil, options={}, &block)
setup_css_class "btn btn-secondary", options
super
end
def submit(name=nil, options={})
setup_css_class "btn btn-secondary", options
layout == :inline ? form_group { su... | 27.287879 | 93 | 0.598834 |
036a226bd59cc726ef82cf2e3791b87ebd141a03 | 411 | module LogManager
class Utils
def self.human_file_size(bytes)
size_unity = 'B'
if bytes > 1024
bytes /= 1024.to_f
size_unity = 'KB'
end
if bytes > 1024
bytes /= 1024.to_f
size_unity = 'MB'
end
if bytes > 1024
bytes /= 1024.to_f
si... | 19.571429 | 46 | 0.527981 |
acbbd51362aefdddd569087bdb0d60b46bf30559 | 943 | #
# Copyright (C) 2011 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the ... | 32.517241 | 80 | 0.769883 |
18beed7c250897a44c8431d53aeb6586e1e0f6cb | 783 | require File.expand_path('../../../../spec_helper', __FILE__)
require 'complex'
require File.expand_path('../shared/log10', __FILE__)
describe "Math#log10" do
it_behaves_like :complex_math_log10, :_, IncludesMath.new
it "is a private instance method" do
IncludesMath.should have_private_instance_method(:log10)... | 24.46875 | 66 | 0.735632 |
91cbbd24c4781eebb22314901eff3700e6dbd603 | 9,576 | # typed: true
require 'yaml'
require 'sord/logging'
require 'sord/resolver'
module Sord
# Contains methods to convert YARD types to Sorbet types.
module TypeConverter
# A regular expression which matches Ruby namespaces and identifiers.
# "Foo", "Foo::Bar", and "::Foo::Bar" are all matches, whereas "Foo.B... | 41.634783 | 146 | 0.617377 |
bf85e640d8e1bde46ada379aa64e2626dd1c733e | 475 |
Pod::Spec.new do |s|
s.name = "HMGoodDemo18"
s.version = "0.0.2"
s.summary = "牛逼的框架"
s.homepage = "http://itcast.cn"
s.license = "MIT"
s.author = { "ITManager" => "zhangjiesharp@163.com" }
s.platform = :ios, "8.0"
s.source = { :git => "https://gith... | 20.652174 | 103 | 0.555789 |
bfc777bae4e2cacebcfc41f6f8ebc547e8c09e12 | 834 | class Graph
attr_reader :ops
def initialize(config)
@config = config
@ops = []
@nodes = Set.new
end
def add_node(name)
log("node: #{name}")
uniquely_add(@ops, :node, name) {
[:node, name]
}
end
def add_edge(from, to, opts)
log("edge: #{from} -> #{to}")
add_node(from)... | 18.130435 | 47 | 0.580336 |
3325406b183b6d950ebb6e175c5435bd7c4b5c37 | 188 | class CreateSlots < ActiveRecord::Migration
def change
create_table :slots do |t|
t.integer :game_id
t.integer :team_id
t.timestamps null: false
end
end
end
| 17.090909 | 43 | 0.664894 |
b9cc62a481bde8a47d962f4319a877bf5fe20340 | 1,862 | # -*- encoding: utf-8 -*-
# stub: mini_portile2 2.6.1 ruby lib
Gem::Specification.new do |s|
s.name = "mini_portile2".freeze
s.version = "2.6.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Luis ... | 44.333333 | 186 | 0.691192 |
336a5f38f07a63b74025248ff8b163b7ada5e0d8 | 1,637 | require 'selenium-webdriver'
require 'logger'
require_relative 'result-notify.rb'
logger = Logger.new(STDOUT)
hostname = ENV["Hostserver_Hostname"]
twitterID = ENV["TwitterID"]
password = ENV["Password"]
apply_comment = "香風智乃さん"
logger.info("Initializing")
driver = Selenium::WebDriver.for :remote, :url => "http:/... | 26.836066 | 117 | 0.724496 |
4a2dc011eb812c9fbee0d40189672c49947714a7 | 1,880 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suit... | 42.727273 | 85 | 0.77234 |
e80a2df4730c7ecda90b2a8bef4b5f421fa4a409 | 2,281 | # 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.
#
# This file is the source Rails uses to define your schema when running `bin/rai... | 34.044776 | 86 | 0.708023 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.