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 |
|---|---|---|---|---|---|
030d65a000b5b994eb2ac164f3a08ac9aed513e7 | 144 | # Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_bier-to-bier_session'
| 36 | 82 | 0.798611 |
1d99e8080501e7df31a56f755c8b6fdedbc9771a | 774 | class RenameOldCategorizationColumns < ActiveRecord::Migration[4.2]
def up
# This is done in order to not accidentally read the old values anymore,
# but to keep them still safe in the DB as backup for a while if bugs found in the news system
rename_column :listings, :category, :category_old
... | 43 | 100 | 0.739018 |
e94bd2e7165b7da4b9d9ca8203fb0f1d10168e39 | 510 | class LeaveWordsController < ApplicationController
before_action :must_be_admin!, except: [:create]
layout false
def create
lw = LeaveWord.new params.require(:leave_word).permit :content
if lw.save
flash[:notice] = t 'messages.success'
else
flash[:alert] = lw.errors.full_messages
en... | 19.615385 | 66 | 0.690196 |
5df342105603912d37711701b3827b0e4c2ace9e | 6,112 | # frozen_string_literal: true
require "test_helper"
# Since the goal is to check only against the records that would be returned by the association,
# we need to follow the expected behavior for limits, offset and order.
describe "wa" do
let(:s0) { LimOffOrdS0.create! }
it "Count with belongs_to handles (ignore... | 28.560748 | 121 | 0.680137 |
ed1ec0ce29c9cdc0803bfa63435026ac01ffcc2d | 1,434 | # frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'listen/version'
Gem::Specification.new do |gem| # rubocop:disable Metrics/BlockLength
gem.name = 'listen'
gem.version = Listen::VERSION
gem.license = 'MIT'
gem.... | 35.85 | 86 | 0.660391 |
ed8a78f64293fa85efd86f8ac13f6905d0a6ca7d | 1,851 | module Oriented
module Core
#
# Class to encapsulate the transaction for OrientDB
#
# Currently, if anything fails, it will rollback the connection
# and then CLOSE it. This means any existing objects in your
# context will be hosed and you'll have to go get them from the db
# with a new ... | 29.380952 | 118 | 0.592653 |
5d78549dfcb7cc6f861de45095f18b0573b79525 | 5,790 | # Copyright (c) 2016, 2022, 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... | 36.878981 | 245 | 0.683938 |
01b7bc5addd37496ac6cb496aa8da4ac25ce5d41 | 3,936 | # frozen_string_literal: true
describe ActiveRecord::Migration, "#drop_materialized_view" do
before_all do
run_migration <<~RUBY
create_table "users", force: :cascade do |t|
t.string "name"
t.boolean "admin"
end
create_table "weird"
RUBY
end
before { run_migration(snipp... | 26.958904 | 83 | 0.629573 |
38b525802c64994026d806665f0dba6807ca33fe | 451 | # frozen_string_literal: true
module DbBlaster
# PORO for source-table-configuration fields
class SourceTableConfiguration
attr_reader :source_table_name, :batch_size, :ignored_column_names
def initialize(params)
params.each_key do |key|
instance_variable_set("@#{key}", params[key])
en... | 22.55 | 70 | 0.711752 |
115d3d00923955e3ff7692ab136a043177aa2bc5 | 1,747 | require File.join(File.dirname(__FILE__), "helpers")
require "sensu/extension"
describe "Sensu::Extension::Bridge" do
include Helpers
it "inherits Base" do
expect(Sensu::Extension::Bridge.superclass).to eq(Sensu::Extension::Base)
extension = Sensu::Extension::Bridge.new
expect(extension).to respond_to... | 32.962264 | 116 | 0.715512 |
628b026ba7d6c8b93a9ea3e617b42a4d64b9e342 | 59,958 | # 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::VMwareCloudSimple::Mgmt::V2019_04_01
#
# Description of the new service
#
class VirtualMachines
include MsRestAzure
#
# C... | 45.18312 | 209 | 0.710281 |
e208b6850a98fe2c8258849e4ed08bc581592605 | 1,604 | #
# Be sure to run `pod lib lint JHKPushMsgSDK.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 https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'JHKPu... | 37.302326 | 109 | 0.648379 |
b993b420f389bd6f9206b5daeaefe2df1c39be41 | 2,955 | # frozen_string_literal: true
require "byebug/frame"
require "byebug/helpers/path"
require "byebug/helpers/file"
require "byebug/processors/command_processor"
module Byebug
#
# Mantains context information for the debugger and it's the main
# communication point between the library and the C-extension through t... | 18.702532 | 77 | 0.61692 |
6a19bdf4ad0baf8946d54be21c965f9b2d783ebd | 11,198 | require 'test_helper'
class Arvados::V1::LinksControllerTest < ActionController::TestCase
['link', 'link_json'].each do |formatted_link|
test "no symbol keys in serialized hash #{formatted_link}" do
link = {
properties: {username: 'testusername'},
link_class: 'test',
name: 'encodin... | 30.679452 | 99 | 0.641186 |
915556084a21ce0adfa4311659eaafb39d14cab7 | 461 | # frozen_string_literal: true
module StatsLite
DEFAULT_COMMANDS = {
host: {
hostname: "hostname",
ip: {
public: "curl -s ifconfig.me"
}
},
cpu: {
model: "lscpu | grep 'Model name' | cut -f 2 -d \":\" | awk '{$1=$1}1'",
cores: "nproc",
usage: <<-CMD
(grep 'cpu '... | 23.05 | 128 | 0.492408 |
d516d504eefdbabaaab0431060ba13df8ff50b13 | 3,383 | 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... | 39.337209 | 104 | 0.758794 |
618854d8cdcb3db389d9f13a4424400d86912739 | 3,590 | class User < ApplicationRecord
has_many :microposts, dependent: :destroy
has_many :active_relationships, class_name: "Relationship",
foreign_key: "follower_id",
dependent: :destroy
has_many :passive_relationships, class_name: "Relationship",
... | 30.168067 | 78 | 0.682173 |
28312fff299d8ab37a74176e0625fa9b09ef61f8 | 6,702 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 44.979866 | 186 | 0.641152 |
bb7983c348b4263ce4959734944712735e30802b | 3,352 | # frozen_string_literal: true
class BappsController < ApplicationController
include Reports
respond_to :html
respond_to :pdf, :odf, :xml, :json, only: :index
helper_method :sort_column, :sort_direction
before_action :set_app, only: %i[show destroy update edit new]
before_action :authenticate_user!, only: %... | 29.663717 | 118 | 0.624105 |
01beb49c5e8c7b1ddaa855e5cceb1a489c385111 | 3,018 | class Orders::ItemAdder
# timed services default to 1 minute (arbitrary)
DEFAULT_TIMED_SERVICES_DURATION = 1
def initialize(order)
@order = order
end
def add(product, quantity = 1, attributes = {})
check_for_mixed_facility! product
quantity = quantity.to_i
# Only TimedServices care about du... | 30.795918 | 126 | 0.682571 |
1c96f0a776bfa0d89b0ae0c0acf5cf8a495496c7 | 685 | #
# Copyright 2019 ThoughtWorks, 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 ... | 32.619048 | 74 | 0.748905 |
183a94e7e083cd0a630390fd0e1a5bbba9080dd6 | 871 | class MicropostsController < ApplicationController
before_action :logged_in_user, only: [:create, :destroy]
before_action :correct_user, only: :destroy
def create
@micropost = current_user.microposts.build(micropost_params)
if @micropost.save
flash[:success] = "Micropost created!"
redirect_... | 26.393939 | 67 | 0.695752 |
acc368027d9ff196b62a1384b5b29da92656d9ae | 388 | require 'test_helper'
class NavigationTest < ActionDispatch::IntegrationTest
include IntegrationTestSupport
test 'can render default landing page' do
visit '/'
assert page.has_text? "Welcome to Ember on Rails!"
end
test 'can using simple "ember magic"' do
visit '/'
fill_in 'sampleInput', with... | 22.823529 | 54 | 0.71134 |
f708e041b9a58466f3d0c01c36fd90975588d0ef | 41 | module Sendcloud
VERSION = "0.0.4"
end
| 10.25 | 19 | 0.682927 |
e945d6f04e14f3b15c3034212f75c27229e49dd8 | 1,137 | module TweetValidator
require "active_model"
require "uri"
class TweetLengthValidator < ActiveModel::EachValidator
TWEET_MAX_LENGTH = 140
def validate_each(record, attribute, value)
record.errors.add(attribute, :invalid_tweet) unless TweetLengthValidator.valid_tweet?(value)
end
def self.v... | 25.840909 | 111 | 0.693052 |
389b2b562bcf5c1a1ee8b870403561a12d598ecb | 1,793 | module MmsIntegration
class Medium < MediaManagementResource
self.element_name = 'media_object'
PER_PAGE = 20 # Number of elements displayed on grid
# Just expected to be called by the descendants of Medium
# Expected options: page, per_page
def self.search_by_kmapid(uid, options = {})
opt... | 29.883333 | 109 | 0.625209 |
e2217031f69b71eee5b8bd487a198a4330b2c3b7 | 1,734 | module Membership
module Admin
class MembershipFeesController < ::Admin::BaseController
include EitherMatcher
append_view_path 'app/components'
def unpaid
@profile_unpaid_this_year = Db::Profile.where(accepted: true)
.where.not('position @> array[?]', 'honorable_kw').where.not... | 39.409091 | 170 | 0.644175 |
1d3d25a0a1eeb0c2bcce954b458cb59ca9606fd9 | 507 | describe :net_ftp_last_response_code, :shared => true do
before(:each) do
@socket = mock("Socket")
@ftp = Net::FTP.new
@ftp.instance_variable_set(:@sock, @socket)
end
it "returns the response code for the last response" do
responses = [ "200 Command okay.", "212 Directory status." ]
@socket.... | 25.35 | 64 | 0.656805 |
b95a9df7512a7ad9c7cf0d83eac4d74906c3b572 | 141 | # frozen_string_literal: true
class FailingJob < BasicJob
def self.perform(*args)
super(*args)
raise "This job failed"
end
end
| 14.1 | 29 | 0.702128 |
b9556bad5fdf7f005baa8ca4c5733fcae8869c6f | 913 | Pod::Spec.new do |s|
s.name = 'SGSScanner'
s.version = '0.1.2'
s.summary = '二维码、条形码工具'
s.homepage = 'https://github.com/CharlsPrince/SGSScanner'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'CharlsPrince' => '961629701@qq.com' }
... | 31.482759 | 107 | 0.595838 |
6ac164d8e121e9caeb55ed54c032738c10114092 | 423 | # http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings
default[:mongodb][:ulimit][:fsize] = "unlimited" #file_size
default[:mongodb][:ulimit][:cpu] = "unlimited" #cpu_time
default[:mongodb][:ulimit][:as] = "unlimited" #virtual memory
default[:mongodb][:ulimit][:nofile] = 64000 #number_files
default[:mo... | 52.875 | 71 | 0.732861 |
878bd543176c96b59e34dc1a29cef4484896d7f6 | 483 | module ApexParser
ApexClassCreator.new do |c|
c.add_class(:Id, %i[public])
c.add_instance_method(:addError, [:public], :String, [[:String, :string_to_integer]]) do |local_scope|
end
c.add_instance_method(:getSObjectType, [:public], :String, [[:String, :string_to_integer]]) do |local_scope|
end
... | 32.2 | 112 | 0.677019 |
61a996ec31c6575f498dc8aaf9f33f6f5e21e8db | 477 | # frozen_string_literal: true
require 'minitest/autorun'
require_relative '../rgb'
# rgb.rbのテスト
class RgbTest < Minitest::Test
def test_to_hex
assert_equal '#000000', to_hex(0, 0, 0)
assert_equal '#ffffff', to_hex(255, 255, 255)
assert_equal '#043c78', to_hex(4, 60, 120)
end
def test_to_ints
as... | 23.85 | 52 | 0.677149 |
2125222250e318e97f5794978bb960ff65fbfd8d | 120 | class AddPostIdToPictures < ActiveRecord::Migration
def change
add_column :pictures, :post_id, :integer
end
end
| 20 | 51 | 0.766667 |
28e25beb58139d4cb94cb344d356062a89f2f551 | 1,753 | # 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::EventGrid::Mgmt::V2020_04_01_preview
module Models
#
# NumberLessThan Advanced Filter.
#
class NumberLessThanAdvancedFilter ... | 25.042857 | 70 | 0.50599 |
622214197308e6201923085b48e97355e5185ab5 | 903 | module Tilia
module VObject
module Splitter
# VObject splitter.
#
# The splitter is responsible for reading a large vCard or iCalendar object,
# and splitting it into multiple objects.
#
# This is for example for Card and CalDAV, which require every event and vcard
# to e... | 28.21875 | 84 | 0.603544 |
1a074bbdc703b476761340a3b33ba985d8b32244 | 2,606 | class CodeServer < Formula
desc "Access VS Code through the browser"
homepage "https://github.com/cdr/code-server"
url "https://registry.npmjs.org/code-server/-/code-server-3.8.1.tgz"
sha256 "0838c6a844695126a780915eab4e4b7864016bee6fc17f58ab19998573000c9b"
license "MIT"
livecheck do
url :stable
end
... | 32.987342 | 122 | 0.66769 |
f849315ffb8b3931638fb3077ef92289e2210a5e | 1,116 | Pod::Spec.new do |s|
s.name = 'FirebaseAnalyticsSwift'
s.version = '8.13.0-beta'
s.summary = 'Swift Extensions for Firebase Analytics'
s.description = <<-DESC
Firebase Analytics is a free, out-of-the-box analytics solution that inspires actionable insight... | 32.823529 | 137 | 0.570789 |
212a1c756951a8faa1d3d109059020cf6807f9be | 161 |
lambda { |stdout,stderr,status|
output = stdout + stderr
return :red if /AssertionError:/.match(output)
return :green if status === 0
return :amber
}
| 20.125 | 50 | 0.677019 |
bf40b0c246a49b1df9f61579f9e15e2bf703d95e | 2,283 | # 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... | 33.573529 | 87 | 0.650898 |
03d2424405ae7a1595c9900f3249d1f7d044e427 | 1,490 | require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/fixtures/classes'
describe "Module#private_instance_methods" do
it "returns a list of private methods in module and its ancestors" do
methods = ModuleSpecs::CountsMixin.private_instance_methods
methods.should_include('pr... | 43.823529 | 93 | 0.778523 |
f7c0ff9a1a4ae72575841b410777818d5a33c48b | 67 | # frozen_string_literal: true
module MASH
VERSION = '0.1.0'
end
| 11.166667 | 29 | 0.716418 |
87a8a60512c96e90e7ba43c5771d3bfa8f99b805 | 7,646 | =begin
#Selling Partner API for FBA Small And Light
#The Selling Partner API for FBA Small and Light lets you help sellers manage their listings in the Small and Light program. The program reduces the cost of fulfilling orders for small and lightweight FBA inventory. You can enroll or remove items from the program and... | 31.991632 | 427 | 0.633011 |
ed38c91702d6be60490cb0a48f921977671d0e8a | 516 | # This migration comes from active_storage (originally 20191206030411)
class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0]
def change
create_table :active_storage_variant_records do |t|
t.belongs_to :blob, null: false, index: false
t.string :variation_digest, null: false
t.in... | 36.857143 | 83 | 0.748062 |
ff7e28917aa06331baa0b9fd7adaf15d2ac49a82 | 5,744 | module Oec
class ReportDiffTask < Task
include Validator
attr_accessor :diff_report
def run_internal
@diff_report = Oec::DiffReport.new @opts
Oec::CourseCode.by_dept_code(@course_code_filter).keys.each { |dept_code| analyze dept_code }
update_remote_drive
log_validation_errors
... | 40.167832 | 151 | 0.632138 |
0369357f05fd8037155b06804cc5c725dd321a9e | 579 | module LanguageServer
module Protocol
module Interface
class UnregistrationParams
def initialize(unregisterations:)
@attributes = {}
@attributes[:unregisterations] = unregisterations
@attributes.freeze
end
# @return [Unregistration[]]
def unre... | 18.677419 | 59 | 0.583765 |
036f87aee312e71f387b6b6f4b4c0c72adae892d | 6,511 | require 'spec_helper'
describe 'Pkg::Platforms' do
describe '#by_package_format' do
it 'should return an array of platforms that use a given format' do
deb_platforms = ['debian', 'ubuntu']
rpm_platforms = ['aix', 'el', 'fedora', 'redhatfips', 'sles']
expect(Pkg::Platforms.by_package_format('deb... | 36.374302 | 139 | 0.6681 |
3991321dabefece5de3e75adac5b37ffaff70a7b | 543 | module Fog
module Compute
class Google
class Mock
def delete_snapshot(snapshot_name)
Fog::Mock.not_implemented
end
end
class Real
def delete_snapshot(snapshot_name)
api_method = @compute.snapshots.delete
parameters = {
'proje... | 17.516129 | 60 | 0.565378 |
bfac041de82c1c91b758490ba5d1dd063ae9b845 | 1,871 | class UsersController < ApplicationController
before_action :logged_in_user, only: [:index, :edit, :update, :destroy,
:following, :followers]
before_action :correct_user, only: [:edit, :update]
before_action :admin_user, only: :destroy
def index
@users = User.paginat... | 22.011765 | 73 | 0.6248 |
91de15e50036113ba1e1226c7090d38363b1f572 | 1,231 | module Net
class Response
# @!visibility private
attr_accessor :options, :mock
# @!visibility private
def initialize(options = {})
@options = options
@headers = options[:headers]
@mock = false
end
# Returns the HTTP status code of the response
# @return [Fixnum]
# @... | 20.864407 | 75 | 0.585703 |
1cbed6e2b571c79ba37fb2b6b75b3683cb8af12f | 38,578 | # Copyright 2011-2013 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fil... | 33.870061 | 104 | 0.558168 |
212f909b4a46858ae03e43234621a870a8676f77 | 175 | class User < ActiveRecord::Base
has_secure_password
has_many :bookmarks
has_many :categories, through: :bookmarks
validates_presence_of :email, :password_digest
end
| 19.444444 | 48 | 0.794286 |
e88aa1da35d83f360c3826d96df8e44b84be27c5 | 1,673 | #
# Be sure to run `pod lib lint ZZVCAnimateTransition.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 https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name ... | 38.906977 | 112 | 0.654513 |
ac82f45589b3daec0ea92f76900d4079aa5aa44e | 2,377 | #-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2015 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,... | 32.561644 | 91 | 0.72907 |
4a6f37597ab680921d2afdc272eee8a4c5673567 | 1,662 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'cucumber-messages'
s.version = '10.0.3'
s.authors = ["Aslak Hellesøy"]
s.description = "Protocol Buffer messages for Cucumber's inter-process communication"
s.summary = "cucumber-messages-#{s.version}"
s.email = 'cuke... | 41.55 | 116 | 0.599278 |
b9f38d59a187035ed03579516fcc25826a58cb33 | 599 | require 'erb'
require 'yaml'
class DatabaseConfig
class NoConfigFound < StandardError ; end
def self.for(environment)
config = YAML.load(database_config)[environment.to_s]
if config.nil?
raise NoConfigFound, "No config found for environment '#{environment}'"
end
{ host: config["host"],
... | 21.392857 | 77 | 0.677796 |
9160d049653720588d54529e6e984445a2015133 | 1,076 | # -*- encoding: utf-8 -*-
# stub: netrc 0.11.0 ruby lib
Gem::Specification.new do |s|
s.name = "netrc".freeze
s.version = "0.11.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Keith Rarick".freez... | 34.709677 | 129 | 0.704461 |
3910ada1c7049af0cc904f2b0ed1c864e0d0dbfd | 11,115 | # -*- coding: utf-8 -*-
require 'shellwords'
require ENV['TM_SUPPORT_PATH'] + '/lib/osx/plist'
require ENV["TM_SUPPORT_PATH"] + "/lib/tm/executor"
require ENV['TM_SUPPORT_PATH'] + '/lib/ui'
require ENV["TM_BUNDLE_SUPPORT"] + "/lib/defaults.rb"
require ENV["TM_BUNDLE_SUPPORT"] + "/lib/ledger/html5.rb"
module Ledger
c... | 37.298658 | 145 | 0.581017 |
1acbd8e76e03d13818618e752156485be3a8a443 | 135,139 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 48.698739 | 336 | 0.722782 |
11713c13eb117b32f57b36a0d0655e0d1306a6a7 | 1,717 | Pod::Spec.new do |spec|
spec.name = "ESPProvision"
spec.version = "2.0.11"
spec.summary = "ESP-IDF provisioning in Swift"
spec.description = "It provides mechanism to provide network credentials and/or custom data to an ESP32, ESP32-S2 or ESP8266 devices"
spec.homepage = "https://githu... | 44.025641 | 136 | 0.5894 |
e873c456a4d48ddf797362fe23c164af1e2a26db | 1,619 | # 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::MediaServices::Mgmt::V2018_07_01
module Models
#
# Base class for content key ID location. A derived class must be used to
# rep... | 32.38 | 174 | 0.700432 |
26789a93651db4ade22b0b1f8c3887e0b25b9c7b | 4,255 | require 'spec_helper'
require 'dentaku/token'
require 'dentaku/tokenizer'
require 'dentaku/parser'
describe Dentaku::Parser do
it 'parses an integer literal' do
node = parse('5')
expect(node.value).to eq(5)
end
it 'performs simple addition' do
node = parse('5 + 4')
expect(node.value).to eq(9)
... | 25.479042 | 137 | 0.612691 |
f79f5ce473adf86e7057959a086bff578ab6a81b | 2,452 | require File.join(File.dirname(File.expand_path(__FILE__)), "spec_helper")
describe Sequel::Model, "BooleanReaders plugin" do
before do
@db = Sequel.mock
def @db.supports_schema_parsing?() true end
def @db.schema(*args)
[[:id, {}], [:z, {:type=>:integer, :db_type=>'tinyint(1)'}], [:b, {:type=>:bool... | 26.085106 | 112 | 0.615824 |
03c3a78e698e031f64d13e1268bf421ed560cd82 | 4,178 | require 'spec_helper'
describe 'gws_presence_users', type: :request, dbscope: :example do
let!(:site) { gws_site }
let!(:user) { gws_user }
let!(:custom_group) { create :gws_custom_group, member_ids: [user.id] }
let(:auth_token_path) { sns_auth_token_path(format: :json) }
let(:users_path) { gws_presence_apis... | 37.63964 | 106 | 0.674246 |
28854508763233fc0a3750ad1ba29f4bc494bad3 | 143 | # encoding: utf-8
# frozen_string_literal: true
# author: Dominik Richter
# author: Christoph Hartmann
module Inspec
VERSION = '3.0.52'
end
| 15.888889 | 29 | 0.741259 |
f8c8aa4f58b999d645e61aa00013963c6f1d27fd | 293 | module RailsMarketplace
module SellerHelper
# Logs in the given seller.
def seller_log_in(seller)
session[:seller_id] = seller.id
end
def seller_logged_in?
!session[:seller_id].nil?
end
def seller_log_out
session.delete(:seller_id)
end
end
end | 18.3125 | 37 | 0.675768 |
03b524218131133e3d2ac391baa812ea5bb10d17 | 232 | # = Database
#
# Load the database configuration for the current environment.
Halcyon.db = Halcyon::Runner.load_config(Halcyon::Runner.config_path('database'))
Halcyon.db = Halcyon.db[(Halcyon.environment || :development).to_sym]
| 33.142857 | 81 | 0.767241 |
f7a4bf1a9f90d575cc6671354d8d9d59ca42f65d | 1,716 | # frozen_string_literal: true
module Admin
class PropagateIntegrationService
include PropagateService
def propagate
if integration.instance_level?
update_inherited_integrations
create_integration_for_groups_without_integration
create_integration_for_projects_without_integration... | 30.105263 | 102 | 0.778555 |
2682cd8a9340a69599bbd31e7861109297ae9e73 | 116 | class AddPageToLevels < ActiveRecord::Migration[4.2]
def change
add_column :levels, :page, :integer
end
end
| 19.333333 | 52 | 0.732759 |
2151ecf0135c722176ff528d00f40a0995bd4703 | 4,107 | class GraphTool < Formula
include Language::Python::Virtualenv
desc "Efficient network analysis for Python 3"
homepage "https://graph-tool.skewed.de/"
url "https://downloads.skewed.de/graph-tool/graph-tool-2.33.tar.bz2"
sha256 "f07025160a8cb376551508c6d8aa5fd05a146c67c4706ea4635d2766aa5c9fcb"
license "GPL-... | 37 | 145 | 0.750426 |
edf1abe9675e33f8aa0a6b4eb2b5b0a2bb8ccdc5 | 918 | require 'sinatra/flash/hash'
module Sinatra
module Flash
# Provides a helper for accessing the flash storage.
module Storage
# The main Sinatra helper for accessing the flash. You can have multiple flash collections (e.g.,
# for different apps in your Rack stack) by passing a symbol to it.
... | 35.307692 | 104 | 0.662309 |
ab57249e0795b83adcaeb83370851b898746a06a | 19,473 | # frozen_string_literal: true
# rubocop:disable Lint/RedundantCopDisableDirective, Layout/LineLength, Layout/HeredocIndentation
module Engine
module Config
module Game
module G18LosAngeles
JSON = <<-'DATA'
{
"filename": "18_los_angeles",
"modulename": "18LosAngeles",
"certLimit": {
"2": ... | 26.208614 | 296 | 0.4687 |
1d94c7d3c53c98676e3206b4891bc1c37461aedb | 157 | class CreateFeatureds < ActiveRecord::Migration
def change
create_table :featureds do |t|
t.string :wtp_id
t.timestamps
end
end
end
| 15.7 | 47 | 0.681529 |
6a64499dfc75c4e3bfc74430a878e5fcfa8a63a5 | 39,141 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 38.98506 | 136 | 0.629519 |
2630d74c2c36520406ea22ac7175c254fa5be8ea | 2,618 | require "spec_helper"
RSpec.describe Search::BaseRegistry do
before do
@index = double("elasticsearch index")
@base_registry = described_class.new(@index, sample_field_definitions, "example-format")
end
def example_document
{
"content_id" => "example-content-id",
"slug" => "example-docum... | 34.447368 | 108 | 0.713522 |
b95a51600b69ef5bffa5328f5b11dbc5ba90efb5 | 131 | require 'test_helper'
class MaterialMediaTypeTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 16.375 | 53 | 0.725191 |
e8ccb703ed98f42bc7ec85833f8d76aa71a1295e | 1,734 | require 'test_helper'
class EPaymentPlansHelperTest < Test::Unit::TestCase
include ActiveMerchant::Billing::Integrations
def setup
@helper = EPaymentPlans::Helper.new('order-500','cody@example.com', :amount => 500, :currency => 'USD')
end
def test_basic_helper_fields
assert_field 'order[account]', 'c... | 30.421053 | 107 | 0.624567 |
abfeb66d229515515cf2c6e2d1d88b199627bc04 | 661 | # frozen_string_literal: true
require "yaml"
require "ht_sip_validator/validator_config"
module HathiTrust # rubocop:disable Style/ClassAndModuleChildren
# Represents a configuration for a set of Validators
class Configuration
attr_reader :config
def initialize(config_file_handle)
@config = YAML.lo... | 20.65625 | 64 | 0.712557 |
62407ca021f0307e9052e5586f72aa0da6ebc2eb | 2,019 | # frozen_string_literal: true
require 'spec_helper'
feature Sponsor do
let!(:conference) { create(:conference) }
let!(:organizer_role) { Role.find_by(name: 'organizer', resource: conference) }
let!(:organizer) { create(:user, role_ids: [organizer_role.id]) }
shared_examples 'sponsors' do
scenario 'adds a... | 34.810345 | 103 | 0.684993 |
bf507d1aead0e2440f38f45d2ed3be49fc11eda9 | 540 | class Zone
INVALID = -1
CREATED = 0
PLAY = 1
DECK = 2
HAND = 3
GRAVEYARD = 4
REMOVEDFROMGAME = 5
SETASIDE = 6
SECRET = 7
class << self
def parse(value)
values.fetch(value, value)
end
def values
{
'INVALID' => INVALID,
'CREATED' => CREATED,
'PLAY' => ... | 16.875 | 45 | 0.507407 |
621628b5097589fcdc82c94ff7c72e47696ec3e7 | 3,787 | # 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::V2016_06_01
module Models
#
# Path rule of URL path map of application gateway
#
class ApplicationGatewayPath... | 30.788618 | 78 | 0.493795 |
bf7ffec628135548f9b8bc28af76379a7d4d433e | 1,641 | module Blazer
class Engine < ::Rails::Engine
isolate_namespace Blazer
initializer "blazer" do |app|
# use a proc instead of a string
app.config.assets.precompile << proc { |path| path =~ /\Ablazer\/application\.(js|css)\z/ }
app.config.assets.precompile << proc { |path| path =~ /\Ablazer\/.... | 49.727273 | 111 | 0.69287 |
79f98547705f3f7a970a423fa73ca9bae4f93218 | 110 | class AddIndexToGroupsName < ActiveRecord::Migration[6.0]
def change
add_index :groups, :name
end
end
| 18.333333 | 57 | 0.745455 |
086962be6b0eaf8a816e0632310d16ad4d500338 | 7,342 | require 'spec_helper'
module Aws
module Partitions
describe 'Partitions' do
describe '.partition' do
%w(aws aws-cn aws-us-gov).each do |p|
it "can return a partition by name: #{p.inspect}" do
partition = Aws.partition(p)
expect(partition).to be_kind_of(Partition)... | 32.061135 | 84 | 0.565377 |
030b3e74101c8809e13517421f486617e8479b0f | 1,057 | require_relative '../test_helper'
module SmartAnswer
class PostcodeQuestionTest < ActiveSupport::TestCase
def setup
@initial_state = State.new(:example)
@question = Question::Postcode.new(nil, :example) do
save_input_as :my_postcode
next_node { outcome :done }
end
end
t... | 27.815789 | 65 | 0.683065 |
d50b27b27549f69b06c2c18a0b3dcab1ee2d2f2b | 315,524 | # 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'
... | 46.190016 | 235 | 0.674868 |
1d8fb07886275ace1396a19940e9eb017c17ce78 | 485 | require 'test_helper'
class InfoControllerTest < ActionController::TestCase
include Devise::TestHelpers
test 'should redirect to select project' do
sign_in(User.first)
sign_out(User.first)
get :index
assert_response :redirect
end
test 'should show info content' do
sign_in(User.first)
si... | 25.526316 | 59 | 0.731959 |
33bae45eca8abafb3f30ea66d55f488a5e5b701b | 1,189 | require "language/node"
class Typescript < Formula
desc "Language for application scale JavaScript development"
homepage "https://www.typescriptlang.org/"
url "https://registry.npmjs.org/typescript/-/typescript-3.1.6.tgz"
sha256 "2cc76f3321bcdce70bdc7d8691e8d40b88a622902f8eeafbda3984ba7a9ed125"
head "https:/... | 30.487179 | 93 | 0.71741 |
f811821b3524db68a9bcdb09fa8ef90f74422f30 | 801 | module Fluent
class AccesslogFilter < Filter
Plugin.register_filter('accesslog', self)
config_param :remove_fields, :string, :default => ''
def configure(conf)
super
@remove_fields_list = @remove_fields.split(',')
end
def filter(tag, time, record)
# elim no_data
begin
... | 22.885714 | 91 | 0.589263 |
e25fb8214e3dc401f7e93c0feb86fca03493d487 | 126 | require 'test_helper'
class CurrencyRateTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 15.75 | 48 | 0.714286 |
6a5f5a1bdbe56982e2431aad834257d387d39b85 | 4,115 | ##
# 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 = GreatRanking
include Msf::Exploit::Remote::Tcp
def initialize(info = {})
super(update_info(info,
... | 27.433333 | 114 | 0.589793 |
39cedd8bc70fd83ba583b5c73e49fb68e791fad9 | 162 | class Createtweets < ActiveRecord::Migration
def change
create_table :tweets do |t|
t.string :content
t.integer :user_id
end
end
end
| 13.5 | 44 | 0.654321 |
26ae071f90b2e83409221de3af2d5d6a59a16bf4 | 1,612 | require_relative '../../world_gadgets/configuration_engine'
require_relative '../../world_gadgets/oz_logger'
require_relative '../../world_gadgets/ledger'
require_relative '../../world_gadgets/validation_engine'
require_relative '../../world_gadgets/router/router'
require_relative '../../world_gadgets/browser_engine'
r... | 24.8 | 137 | 0.633995 |
1d314bd7e519894f2c9d8a2a99147bf2cb471aa5 | 552 | # frozen_string_literal: true
module Ops
module Author
# With this action the author becomes an active user of the system.
# He will be able to visit dashboard and view the progress of his idea.
class Activate < BaseOperation
step :change_state!
step :send_notification!
private
... | 23 | 75 | 0.65942 |
38d67b6b8c2f0c81e41f938cade1ac56f00f28cb | 32,513 | module Searchkick
class Query
extend Forwardable
@@metric_aggs = [:avg, :cardinality, :max, :min, :sum]
attr_reader :klass, :term, :options
attr_accessor :body
def_delegators :execute, :map, :each, :any?, :empty?, :size, :length, :slice, :[], :to_ary,
:records, :results, :suggestions, :ea... | 32.709256 | 239 | 0.548488 |
4a04fef639e68c8d0c075c042e44057138a1b9c7 | 395 | require 'base_kde_formula'
class Kgeography < BaseKdeFormula
homepage 'http://www.kde.org/'
url 'http://download.kde.org/stable/4.10.2/src/kgeography-4.10.2.tar.xz'
sha1 '14cd9d3d788a9f0068af3e10f26f0375b5c7251a'
devel do
url 'http://download.kde.org/stable/4.10.2/src/kgeography-4.10.2.tar.xz'
sha1 '1... | 26.333333 | 76 | 0.751899 |
01276b2aa0a68937598e673f9117e390c472f514 | 7,537 | module Authlogic
module ActsAsAuthentic
# Handles everything related to the login field.
module Login
def self.included(klass)
klass.class_eval do
extend Config
add_acts_as_authentic_module(Methods)
end
end
# Confguration for the login field.
... | 53.453901 | 226 | 0.682234 |
1c3188e16221f3f34c062947034dd893173f6af0 | 494 | class Widget < Mongomatic::Base
def self.populate_sample_data(data_file)
raw_data = JSON.parse(File.read(data_file))
raw_data["widgets"].each do |id, data|
widget = Widget.new(:_id => id, :name => data["name"])
sprockets = {}
data["sprockets"].each do |sprocket_id, sprocket_data|
spr... | 32.933333 | 60 | 0.653846 |
4a2e2b3c0a5db9e09df8c041c515561197afe544 | 1,174 | require 'nokogiri'
require 'open-uri'
require 'time'
class Api::V10::FlightsController < ApplicationController
require_dependency 'flights_parser'
def departures
@title = 'Departures'
if Rails.cache.exist? 'departures'
@flights = Rails.cache.fetch('departures')
else
@flights = FlightsParse... | 26.681818 | 118 | 0.650767 |
6a0f99ecfcbcf069fe32f3bfe95d01f347e0f40b | 283 | # frozen_string_literal: true
require_relative "band2mopidy/version"
module Band2Mopidy
class Error < StandardError; end
end
require_relative "band2mopidy/gnoosic"
require_relative "band2mopidy/discogs"
require_relative "band2mopidy/bandcamp"
require_relative "band2mopidy/mpd"
| 21.769231 | 39 | 0.840989 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.