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 |
|---|---|---|---|---|---|
33b15eab2bf804d5c6df3af46f0aafa8fee75b7b | 1,428 | module Selenium
module WebDriver
class Wait
DEFAULT_TIMEOUT = 5
DEFAULT_INTERVAL = 0.2
#
# Create a new Wait instance
#
# @param [Hash] opts Options for this instance
# @option opts [Numeric] :timeout (5) Seconds to wait before timing out.
# @option opts [Numeric... | 23.409836 | 78 | 0.567227 |
383f79beaa5dca28d50abd5bda612182d2c666df | 418 | class AddMetadataToSpreeOrders < ActiveRecord::Migration[5.2]
def change
change_table :spree_orders do |t|
if t.respond_to? :jsonb
add_column :spree_orders, :public_metadata, :jsonb
add_column :spree_orders, :private_metadata, :jsonb
else
add_column :spree_orders, :public_metad... | 29.857143 | 61 | 0.69378 |
bb0fcd4807093216f0b489207ce4402f16f8f2a3 | 674 | module ScaffoldParser
module Scaffolders
class XSD
class Parser
module Handlers
class Choice
include OrderElements
attr_accessor :elements
def initialize(elements = [])
@elements = [*elements]
end
def complex_type... | 21.0625 | 55 | 0.5 |
edbd434debf04ccc81ada0a5723c21ec59f42d26 | 1,003 | Gem::Specification.new do |gem|
gem.name = 'fpm-fry'
gem.version = '0.5.0'
gem.date = Time.now.strftime("%Y-%m-%d")
gem.summary = "FPM Fry"
gem.description = 'deep-fried package builder'
gem.authors = [
'Maxime Lagresle',
'Stefan Kaes',
'Sebastian Brandt',
'Hannes Georg',
'Juli... | 26.394737 | 62 | 0.63011 |
08e86ff30569abf13312d6a6093815f8430b7402 | 213 | object @device
attributes hardware_identifier: :id
attributes :name, :activation_token, :compressor_delay, :left_output_function, :left_output_state, :right_output_function, :right_output_state, :signal_strength
| 42.6 | 160 | 0.84507 |
61c519384a1727efa8f52b49d77bef1e70e8b610 | 1,638 | Hurl::Application.routes.draw do
get "play/index"
get "play/media"
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
root 'play#index'
# Example of regular r... | 26 | 84 | 0.644689 |
918e0eb83ac5f92b72e27cb43a1de49f92d0eeb9 | 1,422 | # frozen_string_literal: true
module OrgDateRangeable
# rubocop:disable Metrics/MethodLength, Metrics/LineLength
def monthly_range(org:, start_date: nil, end_date: Date.today.end_of_month, filtered: false)
# rubocop:enable Metrics/LineLength
query_string = "org_id = :org_id and filtered = :filtered"
q... | 29.020408 | 94 | 0.684248 |
6ae96fceb1040c4ba633544dc61e85c3dd187e63 | 3,896 | # encoding: utf-8
require 'spec_helper'
require 'support/service_common'
describe 'service for sysv init style' do
include_context 'service setup'
describe 'service kafka start' do
context 'when kafka is not already running' do
before do
backend.run_command 'service kafka stop 2> /dev/null || t... | 26.503401 | 78 | 0.647844 |
f786031c18defd15d73f614009eec477db6075e4 | 2,573 | require File.dirname(__FILE__) + "/spec_helper"
require File.dirname(__FILE__) + "/rest_dm_helper"
describe "REST DataMapper" do
before do
@app = Invisible.new do
rest :dproduct
end
end
it "should return a list of products to GET /products.xml" do
@app.mock.get("/dproducts.xml").body.should ==... | 41.5 | 158 | 0.650214 |
ed0eada92603309c785ebcdc040de88ebecd8f16 | 5,407 | # -*- encoding : utf-8 -*-
require 'spec_helper'
describe OCRSDK::Promise do
before do
OCRSDK.setup do |config|
config.application_id = 'app_id'
config.password = 'pass'
end
end
describe ".parse_response" do
context "correct response" do
subject { OCRSDK::Promise.new(nil).parse_res... | 31.805882 | 109 | 0.652672 |
7ad7460586587e17d91da41d99c960a058f8f69e | 285 | Британские женщины выиграли олимпийское золото в парах гребли
Британские женщины, Хелен Гловер и Хизер Стэннинг, завоевали олимпийское золото в парах гребли.
Новозеландцы, Ребекка Сконе и Женевьев Берен, взяли серебро, а Анн Андерсен и Хедвиг Расмуссен из Дании вышли на третье место.
| 71.25 | 126 | 0.831579 |
f8efc882b37cdd380cc437790b955b1faf98dd4a | 1,185 | # 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,... | 33.857143 | 85 | 0.741772 |
ff0f16bc3ed8aa6f3b0ab9e039c1dbb825b0ad56 | 367 | require 'bundler/setup'
require 'codebreaker'
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.expect_with ... | 24.466667 | 66 | 0.754768 |
abba00d9dbaff104c0c521e9b48e86ad00ec376a | 203 | class CreateFormImages < ActiveRecord::Migration[5.1]
def change
create_table :form_images do |t|
t.string :name
t.text :text
t.string :image
t.timestamps
end
end
end
| 18.454545 | 53 | 0.64532 |
6a6188c2e128dbc4bac2e79db04b3ed2730729de | 211 | # frozen_string_literal: true
class CreateCategories < ActiveRecord::Migration[6.1]
def change
create_table :categories do |t|
t.string :name, null: false, index: { unique: true }
end
end
end
| 21.1 | 58 | 0.696682 |
5dac1adc75212854d3d56fec299f560514848da4 | 664 | class Tool < ApplicationRecord
has_many :readme_tools, dependent: :destroy
has_many :readmes, through: :readme_tools
validates_presence_of :name # TODO: Add category
validates_uniqueness_of :name, case_sensitive: false
before_create :fetch_tool_data
scope :gems, -> { where(category: 'gem')}
scope :pack... | 30.181818 | 54 | 0.740964 |
7afcc2c6c0410be3a14f48c4656053f6b2e33809 | 8,009 | require 'spec_helper'
describe SVG do
describe '#new' do
it "sets default attributes" do
expect(subject.svg_attributes[:height]).to eq "100%"
expect(subject.svg_attributes[:width]).to eq "100%"
end
context "with attributes" do
subject { described_class.new height: '90%', width: '80%', ... | 28.200704 | 201 | 0.592334 |
6157a9468361939d28d4e6f0e5c45b2ddd618e90 | 439 | require 'spec_helper'
describe Blobsterix do
it "should allow_chunked_stream for backward comp. by default" do
Blobsterix.allow_chunked_stream.should == true
end
it "should set allow_chunked_stream" do
Blobsterix.allow_chunked_stream=false
Blobsterix.allow_chunked_stream.should == false
#set it back ... | 25.823529 | 66 | 0.790433 |
4a4bdb85e0b1567cb75da25abe5c5cd158a95af4 | 344 | class FontPollerOne < Cask
version '1.002'
sha256 '49c5128cb550156e9384453906b869b830aafacfc3a9332ccf989c8ed146d773'
url 'https://googlefontdirectory.googlecode.com/hg-history/67342bc472599b4c32201ee4a002fe59a6447a42/ofl/pollerone/PollerOne.ttf'
homepage 'http://www.google.com/fonts/specimen/Poller%20One'
f... | 34.4 | 130 | 0.822674 |
215586d10051e0744c64d3d5f4fc35a46d7dcc13 | 272 | # frozen_string_literal: true
module Bow
module Commands
class Ping < Command
def description
'Check connectivity to all given hosts.'
end
def run
@argv << 'echo pong'
Exec.new(@app, @argv).run
end
end
end
end
| 16 | 48 | 0.588235 |
bf780087e5d471a2de0b6dea2d0174ccac1e6f75 | 5,734 | require 'spec_helper'
RSpec::Matchers.define :eq_datetime do |*expected|
match do |actual|
actual.to_i == DateTime.new(*expected).to_i
end
end
describe Travis::API::V3::Models::Cron do
let(:subject) { FactoryBot.create(:cron, branch_id: FactoryBot.create(:branch).id) }
let!(:scheduler_interval) { Travis:... | 33.337209 | 181 | 0.681897 |
f7c42208b496a8f9c78ebf931864d9044aaf71ef | 80 | module Guard
module AnnotateGemVersion
VERSION = '0.1.0'.freeze
end
end
| 13.333333 | 28 | 0.7125 |
3365d4907d733e4bcbbb2d1e44b917ab5230d425 | 474 | class CreateCourseSkills < ActiveRecord::Migration[5.1]
def change
unless CourseSkill.table_exists?
create_table :course_skills do |t|
t.timestamps
t.references :course, foreign_key: { on_update: :cascade, on_delete: :cascade }
t.integer :priority, limit: 2, default: 1, null: false
... | 24.947368 | 87 | 0.664557 |
1dbf15fb5cef5bd272228f0818c388307c60df71 | 371 | require 'lite_spec_helper'
describe Mongo::Monitoring::Event::Cmap::PoolCleared do
describe '#summary' do
let(:address) do
Mongo::Address.new('127.0.0.1:27017')
end
let(:event) do
described_class.new(address)
end
it 'renders correctly' do
expect(event.summary).to eq('#<PoolC... | 19.526316 | 75 | 0.657682 |
61dd9283136a1e8804869e532cb5156ae869e9dd | 21,953 | # This file maps the files within `metasploit-framework.wiki/` to the navigational menu
# Modify this file to change the doc site's navigation/hierarchy
# @param path [String] the prefix to remove from a string
# @return [proc<String, String>] When called with a string, the returned string has the prefix removed
def w... | 29.270667 | 114 | 0.414249 |
b90c99051b4680ffb73187ab9ff3d7b702e5c397 | 1,451 | # frozen_string_literal: true
require 'dry-initializer'
module SpyAlleyApplication
module Results
class ProcessEliminatingPlayer
include Dry::Initializer.define -> do
option :get_eliminated_player_node, type: ::Types::Callable, reader: :private
option :get_game_over_node, type: ::Types::Ca... | 39.216216 | 97 | 0.698828 |
28d4a520ae88005784e59cb22d363f1ad926579f | 1,495 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::MixedReality::Mgmt::V2020_04_06_preview
module Models
#
# Developer Keys of account
#
class AccountKeys
include MsRestAzure
# @r... | 25.338983 | 70 | 0.514381 |
39346ca02fdcb13cc870925393339c5a30e2bae4 | 1,254 | module ExtractI18n
module HTMLExtractor
module Match
class ErbDirectiveMatch < NodeMatch
REGEXPS = [
[/^([ \t]*link_to )(("[^"]+")|('[^']+'))/, '\1%s', 2],
[/^([ \t]*link_to (.*),[ ]?title:[ ]?)(("[^"]+")|('[^']+'))/, '\1%s', 3],
[/^([ \t]*[a-z_]+\.[a-z_]+_field (.*),[ ... | 36.882353 | 104 | 0.431419 |
7a7dddf1751977b76002696b5f52841b8f5b3739 | 1,701 | require "json"
module Gcpc
module Interceptors
module Subscriber
# `DecodeInterceptor` decodes the message according to the strategy and
# sets it in the attributes.
class DecodeInterceptor < Gcpc::Subscriber::BaseInterceptor
class BaseStrategy
def decode(data, attributes, mes... | 30.927273 | 128 | 0.581423 |
3882bfda86d37b203cfa6aaf395fc6749f0b4e65 | 750 | class RegistrationsController < ApplicationController
skip_before_filter :authenticate!
def new
@user = User.new
end
def create
@user = User.new(user_params)
#gives "user" role to the newly created user
@user.add_role :user
if @user.save
warden.logout
flash[:notice] = t(... | 22.727273 | 86 | 0.646667 |
5d7d2fb9c007bd7fc91721f6f4a4bc16c4a073d0 | 491 | require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module KmPersonalPage
class Application < Rails::Application
# Settings in config/environments/* take precedence over thos... | 30.6875 | 82 | 0.765784 |
f83fe28286452185a2a55dd79e5194615d6891f3 | 1,427 | require File.expand_path("../Abstract/abstract-osquery-formula", __FILE__)
class Libxml2 < AbstractOsqueryFormula
desc "GNOME XML library"
homepage "http://xmlsoft.org"
license "MIT"
url "http://xmlsoft.org/sources/libxml2-2.9.5.tar.gz"
mirror "ftp://xmlsoft.org/libxml2/libxml2-2.9.5.tar.gz"
sha256 "4031c1... | 32.431818 | 94 | 0.644008 |
1cf6f0f3b58109869615e8a67cf814cfd9f2fc76 | 2,153 | # frozen_string_literal: true
RSpec.describe LAA::FeeCalculator do
it 'has a version number' do
expect(described_class::VERSION).not_to be_nil
end
describe '.client' do
subject(:client) { described_class.client }
it 'returns a client object' do
expect(client).to be_a described_class::Client
... | 26.256098 | 118 | 0.677659 |
ac1ffa412874a98124b630241e0c6a44f6be22fa | 2,445 | class Thread
LOCK = Mutex.new # :nodoc:
# Returns the value of a thread local variable that has been set. Note that
# these are different than fiber local values.
#
# Thread local values are carried along with threads, and do not respect
# fibers. For example:
#
# Thread.new {
# Thread.current.... | 30.5625 | 88 | 0.640082 |
ffdc0af3c4e3ea14ee6daba493a939d886628e70 | 264 | class RemoveAddressFromPersonAndTrip < ActiveRecord::Migration
def self.up
remove_column :people, :address
remove_column :trips, :address
end
def self.down
add_column :people, :address, :string
add_column :trips, :address, :string
end
end
| 22 | 62 | 0.731061 |
ff6a39e6e6086059f683f08319f4680461f82fa4 | 5,015 | # This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to explicitly require it in any
# file... | 45.18018 | 92 | 0.742373 |
4af66d94d65c9d608e4c88418b2ff4abc0fbb2fb | 9,833 | FactoryGirl.define do
sequence :name do |n|
"Foo bar #{n}"
end
sequence :bank_number do |n|
n.to_s.rjust(3, '0')
end
sequence :email do |n|
"person#{n}@example.com"
end
sequence :uid do |n|
"#{n}"
end
sequence :serial do |n|
n
end
sequence :permalink do |n|
"foo_page_#... | 25.020356 | 185 | 0.663582 |
7998e419d05eafb817160c16e1cdd5ebcb877849 | 840 | namespace :open_flash_chart_2 do
PLUGIN_ROOT = File.dirname(__FILE__) + '/../'
desc 'Installs required swf in public/ and javascript files to the public/javascripts directory.'
task :install do
FileUtils.cp "#{PLUGIN_ROOT}requirements/open-flash-chart.swf", "#{RAILS_ROOT}/public", :verbose => true
FileUt... | 52.5 | 115 | 0.727381 |
5d0421662f6a1c752e788ffdd5bd347ef9bdb70a | 276 | # frozen_string_literal: true
require_relative "setup"
Schema = Dry::Types["params.hash"].schema(
email?: "string",
age?: "coercible.integer"
).lax
ValidInput = { email: "jane@doe.org", age: "19" }.freeze
profile do
10_000.times do
Schema.(ValidInput)
end
end
| 16.235294 | 56 | 0.684783 |
4a58f734fa75cecc866e546998394d68e2f60211 | 5,295 | #
# Be sure to run `pod spec lint BLAPIManagers.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://gith... | 37.288732 | 120 | 0.603966 |
5d909855d500470b240ac777e422c4f2c6d58103 | 1,653 | require "rails_helper"
RSpec.describe "Subscription endpoints", type: :request do
let(:json_resp) { JSON.parse(response.body) }
let(:user) { create :user }
before { user.generate_spree_api_key! }
describe "#cancel" do
let(:subscription) do
create :subscription, :with_line_item, actionable_date: (Dat... | 37.568182 | 119 | 0.716273 |
e21f4c631e295f1549437bb3a17a39d5390bd5aa | 323 | GimmeABreak::Application.routes.draw do
resources :users, only: [:show]
match 'auth/:provider/callback', to: 'sessions#create', as: 'callback', via: [:get, :post]
get 'auth/failure', to: "sessions#failure"
get 'signout', to: 'sessions#destroy', as: 'signout', via: [:delete]
root to: "application#home"
e... | 32.3 | 92 | 0.671827 |
f74c9d1ef2691f146bb1d2b121b8d28075a86583 | 170 | class CreateBlorghTags < ActiveRecord::Migration
def change
create_table :blorgh_tags do |t|
t.string :name
t.timestamps null: false
end
end
end
| 17 | 48 | 0.688235 |
b99787b0b981b3b17e72e6cf9ab2dd304700c514 | 140 | # Sample code from Programing Ruby, page 645
require 'dbm'
DBM.open("/etc/aliases", nil) do |dbm|
p dbm.keys
p dbm["postfix\000"]
end
| 15.555556 | 44 | 0.678571 |
ffd4c6db5dc4856267d194a2b8b88eb132fcf1c7 | 1,950 | module SexyScopes
module ActiveRecord
module QueryMethods
# Adds support for blocks to ActiveRecord `where`.
#
# @example
# User.where { username =~ 'bob%' }
# # is equivalent to:
# User.where(User.username =~ 'bob%')
#
# The block is evaluated in the context ... | 29.104478 | 103 | 0.578462 |
bf275e8e7f1e9f32ff8eb19c99ea13ff84c4bd5f | 88 | # desc "Explaining what the task does"
# task :active_api do
# # Task goes here
# end
| 17.6 | 38 | 0.681818 |
e2ec4bad1d49be8502f7193f52f431badb7ff3b8 | 395 | class Uwucat < Formula
desc "A cat clone that translates to uwutext"
homepage "https://github.com/mckernant1/uwucat"
url "https://github.com/mckernant1/uwucat/archive/0.0.1.tar.gz"
sha256 "2d49473c9c1fca4465e2a61ea3e65df0ad15b5e4bca0b87d6c01b02e8babfa0d"
depends_on "rust" => :build
def install
system ... | 28.214286 | 75 | 0.716456 |
035f99af44aef7e1788dc8e458dd56a8d12c1a07 | 298 | class AddSkippableToAssessments < ActiveRecord::Migration
def change
add_column :course_assessments, :skippable, :boolean, default: false
# Set all autograded worksheet assessments to skippable
Course::Assessment.where(mode: 0, autograded: true).update_all(skippable: true)
end
end
| 37.25 | 83 | 0.778523 |
26ca248d23853ce996b2ba441d514f3f076f1414 | 325 | require 'ostruct'
module Rhouse::Models
class EventCategory < ActiveRecord::Base
set_table_name 'EventCategory'
set_primary_key "PK_#{Device.table_name}"
# relationships...
belongs_to :parent,
:foreign_key => "FK_EventCategory",
:class_name => "Rhouse::Models::EventCategory"
en... | 25 | 54 | 0.689231 |
393615d43c7d7b8501cc55a3ebcd824434b898ed | 534 | require 'rails_helper'
RSpec.describe Book, type: :model do
it { should validate_presence_of(:name) }
describe '#author' do
context 'when books belonging to different authors exist' do
let(:author) { create(:author) }
let(:other_author) { create(:author) }
let(:books) { create_list(:book, 3,... | 28.105263 | 71 | 0.657303 |
26a350f5a754f6fa25412ea9c333cd34d69f180f | 2,080 | require "fisk"
class TenderJIT
class ExitCode
attr_reader :stats_addr, :exit_stats_addr, :jit_buffer
def initialize jit_buffer, stats_addr, exit_stats_addr
@jit_buffer = jit_buffer
@stats_addr = stats_addr
@exit_stats_addr = exit_stats_addr
end
def make_exit exit_insn_na... | 29.714286 | 76 | 0.634615 |
ff14502bb5f157d2384d053fe4a6a79ad1abdd75 | 92 | module Cms
class Progression < ApplicationRecord
include Model::Progression
end
end
| 15.333333 | 39 | 0.771739 |
28fd0f236a5a28a7bc5cd6e6ebae228bb41f8721 | 5,532 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Boards::Lists::CreateService do
describe '#execute' do
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, group: group) }
let_it_be(:board, refind: true) { create(:board, project: project) }
let_it_be(:user) ... | 33.125749 | 106 | 0.606471 |
08449e111423b30efeb26b0ea9de14311df819e2 | 859 | require File.expand_path('../lib/em/warden/client/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["mpage"]
gem.email = ["mpage@vmware.com"]
gem.description = "EM/Fiber compatible client for Warden"
gem.summary = "Provides EventMachine compatible code for talking with Wa... | 34.36 | 85 | 0.672875 |
ac7672d1d2c4e0a2fe3b3c5c44b0d205eca03bce | 404 | class SessionController < ApplicationController
def create
user = User.find_by email:params[:email]
if user.present? && user.authenticate(params[:password])
session[:user_id]=user.id
redirect_to root_path
else flash[:error] = 'Invalid email or password'
redirect_to login_path
end
... | 22.444444 | 60 | 0.700495 |
08fae977a64d9caea26def942f2aa2994130e84e | 3,860 | module Rubinius
class ConfigurationVariables
def self.define
obj = new
yield obj.root
@instance = obj
end
def self.instance
@instance
end
def initialize
@root = Section.new(self, nil)
@variables = []
end
attr_reader :root, :variables
def write_vm_variables(io)
@variables.... | 20 | 80 | 0.538083 |
5de63ca5d69e65c1c4d7b9ddb2b5c575eaadbf76 | 1,177 | require "language/node"
class Typescript < Formula
desc "Language for application scale JavaScript development"
homepage "http://typescriptlang.org/"
url "https://registry.npmjs.org/typescript/-/typescript-2.1.5.tgz"
sha256 "ce5532a3bc58cfe756a7f7299d82588de80db13774751d6be6a48f8447d2caf7"
head "https://gith... | 30.179487 | 92 | 0.715378 |
39dfa5eccb77b93a14d41233c68330b022f76a15 | 204 | name 'build_cookbook'
maintainer 'Bryan L. Gay'
maintainer_email 'github@bryangay.com'
license 'all_rights'
version '0.1.0'
chef_version '>= 12.14' if respond_to?(:chef_version)
depends 'delivery-truck'
| 22.666667 | 53 | 0.769608 |
6118a2aff4c12ea6a6257afcb4fb34a755093e4a | 433 | class CreateJobRetries < ActiveRecord::Migration[5.0]
def change
create_table :job_retries, options: 'ENGINE=InnoDB ROW_FORMAT=dynamic DEFAULT CHARSET=utf8mb4' do |t|
t.string :message_id, null: false
t.integer :job_execution_id, null: false
t.integer :status, null: false, default: 0
t.dat... | 30.928571 | 105 | 0.706697 |
5d49201c9bfa6f0d1fcc34ca3e2d3c644908c300 | 292 | module Faker
class DumbAndDumber < Base
class << self
def actor
fetch('dumb_and_dumber.actors')
end
def character
fetch('dumb_and_dumber.characters')
end
def quote
fetch('dumb_and_dumber.quotes')
end
end
end
end
| 16.222222 | 43 | 0.582192 |
1a1774b2eac4b217765fcf96bdb414d7c107dd90 | 3,415 | require 'spec_helper'
describe Wongi::Engine::Network do
let( :engine ) { Wongi::Engine.create }
subject { engine }
it 'should assert facts' do
subject << [1,2,3]
expect( subject.select( :_, 2, :_) ).to have(1).item
end
it 'should retract facts' do
subject << [1,2,3]
subject.retract [1,2,3... | 18.661202 | 66 | 0.536164 |
edcfd055ec849f06b4a4eecc168b8f485620d97f | 410 | class UpdateAFewColumnDefaults < ActiveRecord::Migration[5.2]
def change
change_column_default(:firmware_configs, :encoder_enabled_x, from: 1, to: 0)
change_column_default(:firmware_configs, :encoder_enabled_y, from: 1, to: 0)
change_column_default(:firmware_configs, :encoder_enabled_z, from: 1, to: 0)
... | 45.555556 | 81 | 0.768293 |
334613ce929467b1d610eb3eb8073aada270a9f6 | 6,020 | #!/opt/puppetlabs/puppet/bin/ruby
require 'json'
require 'puppet'
require 'openssl'
def create_events_v1beta1_namespaced_event(*args)
header_params = {}
params=args[0][1..-1].split(',')
arg_hash={}
params.each { |param|
mapValues= param.split(':',2)
if mapValues[1].include?(';')
mapValues[1].g... | 33.444444 | 135 | 0.654651 |
1acb8e558f1f87b4afce4011ac86fd2d1ef90a1c | 18,646 | require 'spec_helper'
describe OracleConnection, :oracle_integration do
let(:data_source) { OracleIntegration.real_data_source }
let(:database_name) { data_source.db_name }
let(:account) { OracleIntegration.real_account }
let(:exception_class) { OracleConnection::DatabaseError }
let(:options) { { :logger =>... | 32.769772 | 578 | 0.624584 |
612d59a407dd2df4466d0a141eb114c848f659d6 | 3,142 | # encoding: utf-8
require 'spec_helper'
describe 'password input' do
include FormtasticSpecHelper
before do
@output_buffer = ''
mock_everything
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:title, :as => :password))
end)
end
it_should_have_bootstrap_horizontal... | 31.108911 | 92 | 0.735519 |
4a601edda50f093b0147301e364f97164d3fdf0f | 51 | class RequestFromUnknownDomain < StandardError
end
| 17 | 46 | 0.882353 |
87fcd8d66eba5d33027eafd50e622a32e2544635 | 3,500 | require 'net/http'
class PageIndexer
attr_accessor :page
def initialize(page)
@page = page
@repository_service = RepositoryService.new(nil)
end
def generate_solr_doc(issue_doc)
full_text = get_full_text(@page.page_identifier, @page.text_link)
solr_doc = {
id: @page.page_identifier, ... | 30.973451 | 111 | 0.674286 |
389fa1d9af47bb5666aa5c0359bdc990ccd90021 | 3,701 | VERSION = "1.0.2"
class Board
attr_accessor :board, :turn_counter, :winner
def initialize
@board = [[" ", " ", " "],[" ", " ", " "],[" ", " ", " "]]
@turn_counter = 0
@winner = 0
end
def print_board
puts " A B C"
puts "1 #{@board[0][0]} | #{@b... | 27.414815 | 145 | 0.415023 |
e93385d2663cb75a0ebcbac2eca04f0eb72bc0c8 | 457 | class CreateInstChapters < ActiveRecord::Migration[5.1]
def change
create_table :inst_chapters do |t|
t.integer "inst_book_id", null: false
t.string "name", limit: 100, null: false
t.string "short_display_name", limit: 45
t.integer "position", ... | 30.466667 | 67 | 0.588621 |
28d9edc09475acce49671946a2b0b0e3aecea000 | 1,202 | require_dependency "idp_app/application_controller"
module IdpApp
class SamlIdpController < SamlIdp::IdpController
def idp_authenticate(email, password)
email
end
def idp_make_saml_response(email)
encode_SAMLResponse(email, attributes_provider: attributes_provider(email))
end
prote... | 31.631579 | 98 | 0.746256 |
bb90f96821b43974392b4beaf87319d5ec26a10e | 1,171 |
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "blazer/version"
Gem::Specification.new do |spec|
spec.name = "sql-jarvis"
spec.version = Blazer::VERSION
spec.authors = ["ThanhKhoaIT"]
spec.email = ["thanhkhoait@gmail.com"... | 33.457143 | 138 | 0.672075 |
d52bad245232481760890b9d083c61d31daad5c3 | 1,006 | class Mg < Formula
desc "Small Emacs-like editor"
homepage "http://homepage.boetes.org/software/mg/"
url "http://homepage.boetes.org/software/mg/mg-20131118.tar.gz"
sha256 "b99fe10cb8473e035ff43bf3fbf94a24035e4ebb89484d48e5b33075d22d79f3"
depends_on "clens"
def install
# makefile hardcodes include pat... | 27.944444 | 91 | 0.683897 |
62181cf02d426f1e8123365827e7d7d3bf0b5a16 | 117 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'data_href_highlight'
require 'minitest/autorun'
| 23.4 | 58 | 0.769231 |
ab3c12762ecbbad281ff726205720999de6de711 | 579 | # frozen_string_literal: true
set :application, "nucore"
set :eye_config, "config/eye.yml.erb"
set :eye_env, -> { { rails_env: fetch(:rails_env) } }
set :repo_url, "git@github.com:tablexi/nucore-open.git"
set :rollbar_env, Proc.new { fetch :rails_env }
set :rollbar_role, Proc.new { :app }
set :rollbar_token, ENV["ROLL... | 34.058824 | 86 | 0.73057 |
e96b55b238a56292e7f304d982b706e9ad1ed5eb | 1,349 | class Abnfgen < Formula
desc "Quickly generate random documents that match an ABFN grammar"
homepage "http://www.quut.com/abnfgen/"
url "http://www.quut.com/abnfgen/abnfgen-0.20.tar.gz"
sha256 "73ce23ab8f95d649ab9402632af977e11666c825b3020eb8c7d03fa4ca3e7514"
livecheck do
url :homepage
regex(%r{href=... | 42.15625 | 120 | 0.722758 |
b9dc60341a4b128a7e1d30f50340996b8e4d97f3 | 452 | describe 'failing consumers', integration: true do
before(:context) { $consumer = FailingConsumer }
it 'report failures and sends to DLQ in the end' do
expect_nsq_topic_count $consumer.full_dlq_topic_name, 0
Tiki::Torch.publish $consumer.topic, 'failure'
$lines.wait_for_size 3
expect($lines.all).... | 34.769231 | 84 | 0.745575 |
abbee7765e2641249579e08f2780f1527b2ab233 | 178,612 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
module Aws::DatabaseMigrationService
# @api private
module ClientApi
... | 82.233886 | 234 | 0.791822 |
08ffc3c3a5300440d165b450adc58f2bfd92174b | 3,301 | # frozen_string_literal: true
require 'spec_helper'
require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../rubocop/cop/inject_enterprise_edition_module'
describe RuboCop::Cop::InjectEnterpriseEditionModule do
include CopHelper
subject(:cop) { described_class.new }
it 'flags the use of `p... | 24.634328 | 131 | 0.651318 |
ff880cdac44409c0ba07d0d3cfb43b1aa7d61516 | 523 | class SubscriptionNotifier < ActionMailer::ARMailer
# send an email alert to the subscriber
def email_alert(subscription, html, plaintext, email_promo)
@from = "Communications of the ACM <do-not-reply@cacm.acm.org>"
@subject = "CACM Content Alert: #{Date.today.to_s :date}"
@reci... | 43.583333 | 81 | 0.650096 |
1db7f56172abd6329aa849fe2e390436a897936b | 186 | class CreateDefinitions < ActiveRecord::Migration[5.0]
def change
create_table :definitions do |t|
t.references :rfp, foreign_key: true
t.timestamps
end
end
end
| 18.6 | 54 | 0.693548 |
2649049f524ecc60f7009459b133a3a4b84122d9 | 5,518 | # frozen_string_literal: true
# Statistics about AMO decision reviews
class ClaimReviewAsyncStatsReporter
include Reporter
attr_reader :stats
def initialize(start_date: Constants::DATES["AMA_ACTIVATION"].to_date, end_date: Time.zone.tomorrow)
@start_date = start_date
@end_date = end_date
@stats = ... | 35.146497 | 110 | 0.734868 |
ff8113f2cf30140de59dc8cac3192c6ea4ac5a15 | 519 | require 'spec_helper'
pod = Puppet::Type.type(:rkt_pod)
describe pod do
let :params do
[
:uuid,
:provider,
]
end
let :properties do
[
:app,
:image_name,
:ensure,
]
end
it 'should have expected properties' do
properties.each do |property|
expect(pod.p... | 15.727273 | 64 | 0.61657 |
7a03e6fb24fe52816a617ff9fa4d7d4514ebefdc | 534 | class UpdatePeriodicReportWorker
include Sidekiq::Worker
sidekiq_options queue: 'messaging', retry: 0, backtrace: false
# attrs:
# token
# read_at
def perform(attrs)
report = PeriodicReport.find_by(token: attrs['token'])
return if report.nil? || report.read?
if report.created_at < Time.zon... | 25.428571 | 64 | 0.659176 |
26a0ce2c536c623c9a704271d26d63a8be383ee6 | 121 | class AddPhotoToProducts < ActiveRecord::Migration[5.2]
def change
add_column :products, :photo, :string
end
end
| 20.166667 | 55 | 0.743802 |
1afd006e2401c180282fd25dca51c9b84b5d2ac1 | 1,804 | require 'ci/common'
def hdfs_namenode_version
ENV['FLAVOR_VERSION'] || 'latest'
end
def hdfs_namenode_rootdir
"#{ENV['INTEGRATIONS_DIR']}/hdfs_namenode_#{hdfs_namenode_version}"
end
namespace :ci do
namespace :hdfs_namenode do |flavor|
task before_install: ['ci:common:before_install']
task :install do... | 27.333333 | 102 | 0.633038 |
083cd43e8cf4296eedd0dc6638c174d2635ecf43 | 12,713 | #==============================================================================
# ■ Add-On 物品选择框扩展 by 老鹰(http://oneeyedeagle.lofter.com/)
# ※ 本插件需要放置在【对话框扩展 by老鹰】之下
#==============================================================================
$imported ||= {}
$imported["EAGLE-ItemChoiceEX"] = true
#==================... | 37.391176 | 98 | 0.389444 |
e22696d60f91ee20216f9d2771323fe7af5af1ca | 34,515 | # This file was automatically generated, any manual changes will be lost the
# next time this file is generated.
#
# Platform: rbx 2.2.3.n18
RubyLint.registry.register('IRB') do |defs|
defs.define_constant('IRB') do |klass|
klass.inherits(defs.constant_proxy('Object', RubyLint.registry))
klass.define_method... | 27.902183 | 93 | 0.723656 |
33d7ab5df98587b7129b268451c15536c76dec73 | 1,766 | Reliveradio::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 tes... | 39.244444 | 99 | 0.772933 |
7ae7916baccca70ed94b4a20572773a86af7e669 | 1,828 | # -*- encoding: utf-8 -*-
# stub: rubyzip 1.2.2 ruby lib
Gem::Specification.new do |s|
s.name = "rubyzip".freeze
s.version = "1.2.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Alexander Simonov... | 40.622222 | 112 | 0.644967 |
bb12b2d3b2cc9828e61c34c2e704174bbfe1096d | 189 | require 'heb412_gen/concerns/models/campoplantillahcr'
module Heb412Gen
class Campoplantillahcr < ActiveRecord::Base
include Heb412Gen::Concerns::Models::Campoplantillahcr
end
end
| 23.625 | 58 | 0.814815 |
012e3beced4d7039caa4c4da02afb0001e80ac27 | 1,802 | # -*- encoding: utf-8 -*-
# stub: rb-fsevent 0.10.2 ruby lib
Gem::Specification.new do |s|
s.name = "rb-fsevent".freeze
s.version = "0.10.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "source_code_uri" => "https://github.com/th... | 41.906977 | 112 | 0.656493 |
f81a16eaa1a359871c7e2d60e22078b6927dae4f | 1,804 | require 'test/unit'
require File.dirname(__FILE__) + '/template_handler_test_mocks'
require File.dirname(__FILE__) + '/../lib/prawnto'
require File.dirname(__FILE__) + '/../init'
#TODO: ruby1.9: pull same testing scheme from Raw once we're on 1.9
class BaseTemplateHandlerTest < Test::Unit::TestCase
include Template... | 30.576271 | 84 | 0.721729 |
0882a22fdd10b4111bf2804e598e2bcbd24c90ea | 4,606 | # -*- encoding : ascii-8bit -*-
require 'digest'
require 'digest/sha3'
require 'openssl'
require 'rlp'
module Web3::Eth::Abi
module Utils
extend self
include Constant
##
# Not the keccak in sha3, although it's underlying lib named SHA3
#
def keccak256(x)
Digest::SHA3.new(256).digest... | 20.471111 | 131 | 0.580764 |
1da84292c56c90d47c0fcc964b8e475b72802619 | 3,772 | require 'rubygems'
require 'active_record'
class RequestLogAnalyzer::Database
autoload :Connection, 'request_log_analyzer/database/connection'
autoload :Base, 'request_log_analyzer/database/base'
autoload :Request, 'request_log_analyzer/database/request'
autoload :Source, 'request_log_analyzer/da... | 35.92381 | 120 | 0.757688 |
621f86c0efb234979297a61e4921e65190c7fe75 | 5,803 | ##
# Copyright (c) 2016, salesforce.com, inc.
# All rights reserved.
# Licensed under the BSD 3-Clause license.
# For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
##
##
# A single vulnerability found as part of a {Test}
class Vulnerability
include DataMapp... | 41.156028 | 146 | 0.733241 |
1c2250aa3f6236d0afed0f14c9087f138b8d9b1a | 845 | require 'json'
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
Pod::Spec.new do |s|
s.name = 'ABI31_0_0EXFaceDetector'
s.version = package['version']
s.summary = package['description']
s.description = package['description']
s.license = package['license']... | 30.178571 | 67 | 0.649704 |
6169c1276f268d8fb28b9ccf12ef88a30a073d56 | 660 | require 'rails_helper'
RSpec.describe PostFollowPolicy do
let(:user) { token_for build(:user) }
let(:follow) { build(:post_follow, user: user.resource_owner) }
let(:other) { build(:post_follow) }
subject { described_class }
permissions :update? do
it('should not allow users') { should_not permit(user, f... | 33 | 72 | 0.692424 |
bbd26b497f8959bc7a74f4f4e7d29dd4a81d8b95 | 9,393 | require 'net/ssh'
require 'tempfile'
require 'tmpdir'
require 'stringio'
module GitHosting
TEMP_DATA_DIR = "/tmp/redmine_git_hosting" # In case settings not migrated (normally from settings)
SCRIPT_DIR = "" # In case settings not migrated (normally from settings)
SCRIPT_PARENT = "bin"
... | 37.722892 | 202 | 0.617694 |
91d6ccf13f60ddabf126a7e0df96f63a4ede4174 | 430 | require 'formula'
class BoostBcp < Formula
homepage 'http://www.boost.org/doc/tools/bcp/'
url 'https://downloads.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.tar.bz2'
sha1 'cef9a0cc7084b1d639e06cd3bc34e4251524c840'
head 'http://svn.boost.org/svn/boost/trunk/'
depends_on 'boost-build' => :build
... | 22.631579 | 89 | 0.693023 |
b9a65405f7b7028480da0babaffc65c3da16c53d | 32 | module Manager::UsersHelper
end
| 10.666667 | 27 | 0.84375 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.