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 |
|---|---|---|---|---|---|
e86b6a4393548768903bcc6e93409bd6a708a692 | 3,210 | module AudioStream
module Fx
class ConvolutionReverb
# @param impulse [AudioStream::AudioInput] Impulse input
# @param dry [AudioStream::Decibel | Float] Dry gain
# @param wet [AudioStream::Decibel | Float] Wet gain
def initialize(impulse, dry: -6, wet: -6)
impulse_bufs = impulse.t... | 31.470588 | 141 | 0.574143 |
e8f8ef76400602b64bb3d09ee94a84b17fa7405a | 82 | Dir[File.dirname(__FILE__) + '/active_japanese/*.rb'].each do |f|
require f
end
| 20.5 | 65 | 0.695122 |
39240d5dc62e0126fbb97dacbe82c11fca57edc8 | 138 | class AddFormattedAddressesToRoutes < ActiveRecord::Migration
def change
add_column :routes, :formatted_addresses, :text
end
end
| 19.714286 | 61 | 0.789855 |
261747c6d09898fc27a8d882559e06708a5f8798 | 2,332 | module IceCube
class WeeklyRule < ValidatedRule
include Validations::HourOfDay
include Validations::MinuteOfHour
include Validations::SecondOfMinute
# include Validations::DayOfMonth # n/a
include Validations::DayOfWeek
include Validations::Day
include Validations::MonthOfYear
# in... | 31.513514 | 92 | 0.697256 |
e9eb0c8b62344a8771195554a304af0efc3a93fd | 229 | module Mongoid
module Contextual
module Aggregable
module Commands
class Match < Base
def initialize(*args)
super('$match', *args)
end
end
end
end
end
end
| 14.3125 | 34 | 0.532751 |
3833fa30b3e0dfb914a4c573fbfd6049b54b216b | 254 | class CreateCocoaPodDependencies < ActiveRecord::Migration
def change
create_table :cocoa_pod_dependencies do |t|
t.references :cocoa_pod, index: true
t.references :dependent_cocoa_pod, index: true
t.timestamps
end
end
end
| 23.090909 | 58 | 0.732283 |
b9fc35e32d982e987d99da42868dc983297f261e | 705 | 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 Stardate
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails ... | 30.652174 | 79 | 0.737589 |
ff5482e58338ddd3932ed81020e5ace81d0169bd | 1,645 | require 'spec_helper'
describe TaskManager do
describe '.generate_tasks' do
let(:tasks) { TaskManager.generate_tasks }
let(:enabled_at) { 1.hour.ago }
context 'when having an enabled plan' do
before do
@plan = FactoryGirl.create(:plan_with_assignees, assignees_count: assignees_count, enabl... | 25.307692 | 114 | 0.633435 |
085530affb4373b46c60ed8f322a4469955e8a2c | 1,828 | require 'minitest'
Minitest.autorun
require 'terminal-table'
require 'ap'
AwesomePrint.defaults = {
indent: -2,
}
module Minitest::Assertions
def is subject, predicate
assert_equal predicate, subject
end
def assert_response response, expected_output, expected_status
expected_body = expected_output.to... | 23.139241 | 92 | 0.654814 |
61f7febc98ce2a717e0181def4f6b1fc66dac784 | 1,659 | # frozen_string_literal: true
require 'virtus'
require 'droplet_kit/utils'
module DropletKit
class BaseModel
DO_NAMESPACE = 'do'
UNSUPPORTED_COLLECTIONS = ['space']
include Virtus.model
include Virtus::Equalizer.new(name || inspect)
def inspect
values = Hash[instance_variables.map { |nam... | 24.397059 | 95 | 0.653406 |
edcbabbb6682619370354be33e82dd9dbb827cfa | 1,256 | require 'rubygems'
require 'bundler/setup'
Bundler.require
require 'open-uri'
require 'yaml'
require 'csv'
module RefreshList
SOURCE_URI = 'https://www.currency-iso.org/dam/downloads/lists/list_one.xml'.freeze
RESULT_FILE_PATH = 'currencies.csv'.freeze
SYMBOLS = YAML.load_file('currency_symbols.yml').freeze
H... | 25.12 | 99 | 0.672771 |
33d2b76e09ffb60b363b0a192fa5b94ff55450ed | 8,851 | =begin
#OpenAPI Petstore
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.0.0-SNAPSHOT
=en... | 29.019672 | 191 | 0.604338 |
033453c469904ccfcd6c7abddf9120b85ba3a571 | 21,552 | require 'puppet'
require 'puppet/util/tagging'
require 'puppet/parameter'
# The simplest resource class. Eventually it will function as the
# base class for all resource-like behaviour.
#
# @api public
class Puppet::Resource
include Puppet::Util::Tagging
include Puppet::Util::PsychSupport
include Enumerable
... | 32.167164 | 187 | 0.652932 |
189c8d7a51832f57638b4f63db2cb02123821051 | 177 | class CreateTerms < ActiveRecord::Migration[5.0]
def change
create_table :terms do |t|
t.string :name
t.text :definition
t.timestamps
end
end
end
| 16.090909 | 48 | 0.644068 |
b98b82e7e91dc3562bdf5404dd436c94e19d9be1 | 1,644 | # -*- encoding: utf-8 -*-
# stub: unicode-display_width 1.3.0 ruby lib
Gem::Specification.new do |s|
s.name = "unicode-display_width".freeze
s.version = "1.3.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.a... | 42.153846 | 162 | 0.683698 |
87367d26244134bc7df3cbe2025521b8075f5ba2 | 4,625 | require_relative 'mixins/group_validate_mixin'
class RequestUpdateService
include GroupValidateMixin
attr_accessor :request
def initialize(request_id)
self.request = Request.find(request_id)
end
def update(options)
return if options[:state] == request.state
send(options[:state], options)
en... | 28.726708 | 139 | 0.747027 |
28be364e080eb4d47212ecc30137d052781f47ac | 122 | class TCuv < Verse
self.table_name = 't_cuv'
has_many :cuv_pericopes, class_name: 'CuvPericope', foreign_key: :id
end
| 24.4 | 70 | 0.745902 |
87e96836b52f83c5cd4c7155093539d9fde0d704 | 1,169 | =begin
#Datadog API V1 Collection
#Collection of all Datadog Public endpoints.
The version of the OpenAPI document: 1.0
Contact: support@datadoghq.com
Generated by: https://openapi-generator.tech
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
This product... | 29.225 | 110 | 0.733105 |
f8d37934763dbb73c93b429962cece50323ccaf6 | 119 | # frozen_string_literal: true
class EnvironmentStatusSerializer < BaseSerializer
entity EnvironmentStatusEntity
end
| 19.833333 | 50 | 0.865546 |
62d633c15ed6574368a3ba138258b8676b3c7019 | 51 | module ActionAuthorization
VERSION = '1.1.2'
end
| 12.75 | 26 | 0.745098 |
b9f14a98574cf38ea0eacb66aa74349709251b8c | 8,576 | =begin
#Argo Workflows API
#Argo Workflows is an open source container-native workflow engine for orchestrating parallel jobs on Kubernetes. For more information, please see https://argoproj.github.io/argo-workflows/
The version of the OpenAPI document: VERSION
Generated by: https://openapi-generator.tech
OpenAPI Ge... | 32 | 296 | 0.63736 |
ff8145b216c96c365227eb1d39486094b408a2e7 | 141 | class RenamePictureString < ActiveRecord::Migration
def up
rename_column :store_pictures, :picture, :image
end
def down
end
end
| 15.666667 | 51 | 0.744681 |
d55901d126301080b84208a893036040e357a909 | 803 | require 'pony'
require 'io/console'
puts 'Введите имя почтового ящика gmail.com'
my_mail = "#{$stdin.gets.chomp}'@gmail.com"
puts "Введите пароль от вашей почты #{my_mail} для отправки письма:"
password = $stdin.noecho(&:gets).chomp
puts 'Кому отправить письмо? Введите адрес:'
send_to = $stdin.gets.chomp
puts 'Что ... | 22.305556 | 68 | 0.65878 |
113077ab6fa0815fb958fda56da2b4d4f31a599b | 126 | class AddImageToOrganizations < ActiveRecord::Migration
def change
add_column :organizations, :image, :string
end
end
| 21 | 55 | 0.777778 |
03866de03ed3f7e9fd2e453821bdb208ede5bb84 | 674 | module Fog
module Compute
class OpenStack
class Real
def delete_volume(volume_id)
request(
:expects => 202,
:method => 'DELETE',
:path => "os-volumes/#{volume_id}"
)
end
end
class Mock
def delete_volume(volum... | 23.241379 | 80 | 0.507418 |
38f90d58300f5a15ae4f4a9d77db860f79c571f2 | 590 | require_relative '../../spec_helper'
describe "Thread#thread_variable_get" do
before :each do
@t = Thread.new { }
end
after :each do
@t.join
end
it "returns nil if the variable is not set" do
@t.thread_variable_get(:a).should be_nil
end
it "returns the value previously set by #[]=" do
... | 22.692308 | 79 | 0.705085 |
b9cc0cc17ffede21a0c6ba9a09ed70a9e2cdbc60 | 46,239 | # frozen_string_literal: true
require './spec/spec_helper'
require 'engine'
require 'engine/game/g_1846'
require 'engine/game/g_1889'
require 'engine/game/g_18_chesapeake'
require 'engine/phase'
require 'engine/round/operating'
require 'engine/action/place_token'
RSpec::Matchers.define :be_assigned_to do |expected|
... | 39.792599 | 120 | 0.605333 |
110857cc36e29d280f7e496eb77cd94606e1f5f6 | 169 | class AddDiscardedAtToThings < ActiveRecord::Migration[6.1]
def change
add_column :things, :discarded_at, :datetime
add_index :things, :discarded_at
end
end
| 24.142857 | 59 | 0.757396 |
79f56907282024f06d150a78ef21b7f13fb47158 | 684 | require 'spec_helper'
describe Monza::RenewalInfo do
context 'pending renewal info' do
let(:response) { JSON.parse File.open("#{Dir.pwd}/spec/response.json", 'rb').read }
let(:renewal_info) { described_class.new(response['pending_renewal_info'].first) }
it { expect(renewal_info.product_id).to eq "produc... | 42.75 | 87 | 0.73538 |
e9d6818d4078085ba293aaf1c69c1c4a2568813b | 1,912 | module Support
module ScanMatcher
extend RSpec::Matchers::DSL
def scan(pattern, **options)
give_scan_result(:scan, pattern, **options)
end
def check(pattern, **options)
give_scan_result(:check, pattern, **options)
end
def scan_until(pattern, **options)
give_scan_result(:sc... | 30.349206 | 102 | 0.623431 |
1aeb24d1e9ed4f2da79a1b643a5e8bddad315d09 | 4,423 | 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 s... | 35.669355 | 80 | 0.738865 |
f73f27140aceea867b413834cd68e44a262645b1 | 14,578 | require 'spec_helper'
describe 'cis_hardening::logaudit::accounting' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }
# Check for default class
it { is_expected.to contain_class('cis_hardening::logaudit::accounting') }
# Ensure Auditing is enabled... | 34.301176 | 182 | 0.534367 |
e83efa66ea6990f219d33c46485307966152f491 | 1,039 | @DATA_PIN = 2
@RATCH_PIN = 3
@CLOCK_PIN = 4
class SN74HC595N
attr_accessor :data_pin, :ratch_pin, :clock_pin, :mode
def initialize(data_pin, ratch_pin, clock_pin)
@data_pin = data_pin
@ratch_pin = ratch_pin
@clock_pin = clock_pin
@mode = MSBFIRST
# ピンを初期化
[@dat... | 17.913793 | 58 | 0.615014 |
38777c516f2f488cfaa95617d2ceefbd02315716 | 560 | # frozen_string_literal: true
module Ouranos
module Jobs
# A job for unlocking the environment
class EnvironmentLock
@queue = :locks
def self.perform(lock_params)
lock_params.symbolize_keys!
locker = EnvironmentLocker.new(lock_params)
locker.lock!
status = ::Depl... | 25.454545 | 107 | 0.680357 |
334bf10c72cd68d3892810e9a60e475adc0c50c7 | 3,494 | class Api::V0::ApiController < ApplicationController
# Returns the top most-cited violations.
#
# @param params [Hash]
# @option params [Hash] limit A positive integer number of records to return. Corresponds to a SQL LIMIT clause value. Default is 50.
#
# @example [{"violation_id":"1", "violation_code":"4... | 44.794872 | 954 | 0.684888 |
26852cf599dfea46326496d2165a2fb852f706e9 | 202 | ActiveModelSerializers.config.tap do |c|
# c.adapter = :json_api //introduces too much uneeded info in the JSON object
# c.jsonapi_include_toplevel_object = true
# c.jsonapi_version = "1.0"
end
| 33.666667 | 81 | 0.742574 |
e2f53d72400a0c7bee36836f00cb7b9ab822377c | 42 | module Targetdata
VERSION = "0.3.1"
end
| 10.5 | 19 | 0.690476 |
38c0192e67579d592df0889753b714b23897ef89 | 1,584 | class ArticleCoverageCurated < Source
# include common methods for Article Coverage
include Coverable
def get_related_works(result, work)
Array(result.fetch('referrals', nil)).map do |item|
timestamp = get_iso8601_from_time(item.fetch('published_on', nil))
type = item.fetch("type", nil)
typ... | 32.326531 | 72 | 0.559975 |
0157802703194d67f629b1988d3a6b523ddca676 | 403 | set :host, "144.76.4.166"
set :stage, :production
set :env, :production
set :user, "rbdev"
set :deploy_to, "/home/#{fetch :user}/#{fetch :application}"
set :branch, "master"
set :rvm_type, :user
set :rvm_ruby_version, '2.1.3'
server fetch(:host), user: fetch(:user), roles: %w{web app db}, primary: ... | 22.388889 | 77 | 0.647643 |
1a3b2087569a3bf404fcb8f1e81dae344332c5e8 | 1,088 | # frozen_string_literal: true
RSpec.describe Codebreaker::Game do
let(:game_with_invalid_user) { described_class.new 228, Codebreaker::Difficulty.new('hell') }
let(:game_with_invalid_difficulty) { described_class.new Codebreaker::User.new('Daniil'), 'hell' }
describe '#valid?' do
context 'when first passed p... | 36.266667 | 107 | 0.735294 |
26117cb4185a368ad4bdde5d522fc6f8cdc0f9fb | 3,915 | 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.210526 | 102 | 0.761941 |
f7d2ad62cd7281a873521ce684a9e0104e4f11c4 | 71 | require "bundler"
Bundler.require
require_all './lib/beer_o_clock_cli' | 17.75 | 36 | 0.816901 |
ff05d991456d673f42e956618092ef4b4242f0dd | 222 | # Load the Rails application.
require File.expand_path('../application', __FILE__)
require "jquery-rails"
require 'coffee-rails'
require 'bootstrap-sass'
# Initialize the Rails application.
Rails.application.initialize!
| 22.2 | 52 | 0.788288 |
4a1eb58134587781d3045d437c9062f70224bfe1 | 919 | # frozen_string_literal: true
require 'test_helper'
class TestSelector::HTMLHelperTest < ActionDispatch::IntegrationTest
test 'the test method should return the right input in html' do
get '/some/path'
puts response.body
assert_includes response.body, '<span test-selector="_app_views_some_path__partial... | 41.772727 | 128 | 0.78346 |
bf349e2b6f6258634fedd508b6ead34ad3051700 | 1,943 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
config.debug_exception_response_format = :api
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
... | 35.327273 | 86 | 0.763767 |
e28d858d71b3fdb12a8888eff0dbc939b8223c7e | 564 | class Flash < Formula
desc "Command-line script to flash SD card images of any kind"
homepage "https://github.com/hypriot/flash"
url "https://github.com/hypriot/flash/releases/download/2.7.1/flash"
sha256 "879057fea97c791a812e5c990d4ea07effd02406d3a267a9b24285c31ea6db3f"
bottle :unneeded
def install
b... | 29.684211 | 85 | 0.716312 |
7aa4829f58dba2fc3b79bfd9525e02e4c2a9cd00 | 1,033 | module Dice
class RollList
include Dice::HasValues
attr_reader :list
def initialize *args
@list = []
args.each do |v|
if v.is_a?(Array)
@list += v
else
@list << v
end
end
end
def roll!
@list.each(&:roll!)
end
def resul... | 18.781818 | 91 | 0.522749 |
bb4460784aecf591737a6cfc3f5c8455a3f935a3 | 5,017 | 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... | 44.39823 | 114 | 0.762607 |
9116fb157f52475d802d93bab886507dab4d44f3 | 495 | class PasswordsController < Devise::PasswordsController
protected
def after_resetting_password_path_for(resource)
root_path
end
##
# Override Devise default behaviour by sending user to the home page
# after the password reset email has been sent
#
# @resource_name [String] The user's email add... | 26.052632 | 73 | 0.660606 |
ffb17fd3259d3bbb4f0810d1619db131a3a5dead | 2,613 | # == Schema Information
#
# Table name: services
#
# id :integer not null, primary key
# type :string(255)
# title :string(255)
# project_id :integer
# created_at :datetime
# updated_at :datetime
# active ... | 28.714286 | 77 | 0.590126 |
f7cec0a6c6c516a6004420687fbfd152b3410ecc | 142 | class AddShopToShopType < ActiveRecord::Migration
def change
add_reference :shop_types, :shop, index: true, foreign_key: true
end
end
| 23.666667 | 68 | 0.767606 |
e82b722705595908b873a59dd00f16373fe499ba | 3,676 | #! /usr/bin/env ruby
#
# check-mesos-lost-tasks
#
# DESCRIPTION:
# This plugin checks that there are less or same number of lost tasks than provided on a Mesos cluster
#
# OUTPUT:
# plain text
#
# PLATFORMS:
# Linux
#
# DEPENDENCIES:
# gem: sensu-plugin
# gem: rest-client
# gem: json
#
# USAGE:
# #YELLO... | 25.006803 | 109 | 0.61235 |
f7f9cfadbc59639090115c52c211dc4e8fea663d | 1,553 | #
# Cookbook:: dmca
# Recipe:: default
#
# Copyright:: 2018, OpenStreetMap Foundation
#
# 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
#
# U... | 26.775862 | 95 | 0.735995 |
e2dfc9cca2a6fed76e0d1e4384c78ac2fe376bc7 | 3,861 | class Link < ApplicationRecord
before_update :set_link_check_results_on_updated_link, if: :url_changed?
before_create :set_link_check_results_on_new_link
belongs_to :local_authority, touch: true
belongs_to :service_interaction, touch: true
has_one :service, through: :service_interaction
has_one :interacti... | 29.7 | 94 | 0.691013 |
610c68f2eee70f425c107781b0657af2acd56ede | 41 | class Activity < ActiveRecord::Base
end
| 10.25 | 35 | 0.780488 |
28e4a923e2cc7c5bb960e0a2afc25e8310a3052e | 126 | class RemoveUserToIdFromInvites < ActiveRecord::Migration[5.1]
def change
remove_column :invites, :user_to_id
end
end
| 21 | 62 | 0.777778 |
f8859a5a645083a7a9ef074c67f3703071ff3878 | 1,011 | cask 'postbox' do
version '5.0.5'
sha256 'b87f775fc40fc626980c468cfea9ef397529792e4b2e4d5eeac1a16aac637791'
# amazonaws.com/download.getpostbox.com was verified as official when first introduced to the cask
url "https://s3.amazonaws.com/download.getpostbox.com/installers/#{version}/1_348aedfb4d5afd22e43adecbdd... | 40.44 | 150 | 0.673591 |
0100a480be607cd99e1900259aa19048737dc643 | 2,909 | require 'spec_helper'
describe Icalendar2::Parser do
let(:test_file) { File.open(File.join(File.dirname(__FILE__), 'fixtures', 'single_event.ics')) }
let(:test_file_2) { File.open(File.join(File.dirname(__FILE__), 'fixtures', 'multiple_events.ics')) }
describe "initialization" do
it "does not accept inval... | 34.630952 | 104 | 0.680303 |
1d7229cbd1a1f073c86c1b73e373c24faebb541b | 1,262 | # Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
require 'cloudconfig_test'
class SubscribeFromUnknownHost < CloudConfigTest
def initialize(*args)
super(*args)
@num_hosts = 2
end
def can_share_configservers?(method_name=nil)
false
end... | 31.55 | 157 | 0.750396 |
62cec409cc67dea2f01ee433f8ea9a34a21419ce | 2,155 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... | 31.691176 | 97 | 0.662181 |
01bdd55dea426e848fc54cfa4f25950756c32d41 | 4,393 | require 'test_helper'
class Edition::ImagesTest < ActiveSupport::TestCase
class EditionWithImages < Edition
include ::Edition::Images
end
include ActionDispatch::TestProcess
test "editions can be created with multiple images" do
edition = EditionWithImages.create!(valid_edition_attributes.merge(
... | 33.534351 | 102 | 0.72183 |
2699d4460323f889fc576609b5f694a2ca86c24d | 2,961 | # frozen_string_literal: true
module Baw
module ActiveRecord
# Helper methods for incrementing counters
module Upsert
# We've added custom Arel nodes, extend the ToSql visitor class so that our
# nodes can be translated to SQL.
::Arel::Visitors::ToSql.prepend(Baw::Arel::Visitors::ToSqlExten... | 50.186441 | 106 | 0.678487 |
ac891012c1325af8978b354de6eb51dc3e3808fd | 487 | require 'spec_helper'
describe NewsRelease, type: :model do
it 'returns the formatted date and title as a string' do
news_release = described_class.new(
released_on: '2013-07-31',
title: 'BigCo hires new CEO'
)
expect(news_release.title_with_date).to eq '2013-07-31: BigCo hires new CEO'
end... | 30.4375 | 80 | 0.726899 |
ff734a50b5b38402b191dc26a5b5c73121e70b9a | 500 | module Spree
class OrderStockLocation < Spree::Base
belongs_to :variant, class_name: "Spree::Variant"
belongs_to :stock_location, class_name: "Spree::StockLocation"
belongs_to :order, class_name: "Spree::Order"
def self.fulfill_for_order_with_stock_location(order, stock_location)
where(order_id... | 31.25 | 95 | 0.75 |
79851f807607b5fcd5d753cec53f876d9f1f56dc | 331 | require 'rubygems'
require 'bundler/setup'
require 'devise_crowd_authenticatable'
::Devise.crowd_config = Proc.new() {{
'url' => 'http://localhost:4567/rest',
'username' => 'foo',
'password' => 'bar'
}}
conn = Devise::Crowd::Connection.new(username: 'user', password: 'xxx')
puts conn.auth... | 20.6875 | 71 | 0.640483 |
7a2b63cf6b0c45bf257df1ed257aafd85f3a4a19 | 13,135 | require 'rails_helper'
describe UserGroupsController do
fixtures :all
def valid_attributes
FactoryBot.attributes_for(:user_group)
end
describe 'GET index' do
before(:each) do
FactoryBot.create(:user_group)
end
describe 'When logged in as Administrator' do
login_fixture_admin
... | 29.583333 | 88 | 0.633346 |
b96d4d8dc85375542a1d442ca46edec0a1e776ff | 440 | $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "bundler/setup"
require "numbers_to_kurdish_words"
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 `Mo... | 25.882353 | 66 | 0.754545 |
b9903e37f40640d9a1110e41a01818bc93b7b937 | 3,775 | # frozen_string_literal: true
module Gitlab
module Kubernetes
module Helm
class Api
def initialize(kubeclient)
@kubeclient = kubeclient
@namespace = Gitlab::Kubernetes::Namespace.new(Gitlab::Kubernetes::Helm::NAMESPACE, kubeclient)
end
def install(command)
... | 30.443548 | 105 | 0.651656 |
1819f969bb5d55683b5d63f92a0262d961ef4bf3 | 1,013 | require 'happyco/inspect/inspection/v1/inspection_pb'
require 'happyco/inspect/inspection/v1/inspection_services_pb'
require 'happyco/inspect/report/v1/report_pb'
require 'happyco/inspect/report/v1/report_services_pb'
require 'happyco/inspect/template/v1/template_pb'
require 'happyco/inspect/template/v1/template_servic... | 48.238095 | 81 | 0.846989 |
39995a6050d231487211a0ad9ba9e57b8f02b969 | 325 | cask :v1 => 'today-scripts' do
version '1.1'
sha256 'e9e1136e787347f257e9554efdd546c4fd92a6b2a6ae28d23f0065b3d7b96bc4'
url 'https://github.com/SamRothCA/Today-Scripts/releases/download/v1.1/Today-Scripts.tar.gz'
homepage 'https://github.com/SamRothCA/Today-Scripts'
license :unknown
app 'Today Scripts.app'... | 29.545455 | 94 | 0.772308 |
d52e31a96d00e7511ded63df2265620d47472dee | 229 | include SendGrid
class ErrorNotifier < ApplicationMailer
def send_error_email
puts "send_error_email"
mail( :to => 'dannyhernandez+pledge_errors@gmail.com',
:subject => "You got an error!"
)
end
end
| 22.9 | 58 | 0.681223 |
e92d02f6b9a9a603d81dd370be3ebceecfb190a0 | 509 | # frozen_string_literal: true
module Sidekiq
module Statistic
class Middleware
def call(worker, message, queue)
class_name = message['wrapped'] || worker.class.to_s
metric = Metric.for(class_name: class_name, arguments: message['args'])
metric.queue = message['queue'] || queue
... | 19.576923 | 79 | 0.603143 |
ac6c645f81b5440c2c3dd5ede36edb311251b6b1 | 272 | module SpreeEcs
class Base
class << self
def cache(key, options = { :expires_in => 1.day })
Rails.cache.fetch("#{Digest::SHA1.hexdigest(key)}",options){ yield }
end
def log(msg)
Rails.logger.debug(msg)
end
end
end
end
| 18.133333 | 76 | 0.573529 |
f8a54946077c2b010413d665b55b0546f0a2770c | 232 | class CreateNotes < ActiveRecord::Migration
def change
create_table :notes do |t|
t.timestamps null: false
t.text :note, null: false
t.references :noteable, index: true, polymorphic: true
end
end
end
| 19.333333 | 60 | 0.672414 |
bf9d6d22ce5649387b05969606ab3a56e4bd5c77 | 12,543 | require 'fileutils'
require "cgi"
module Prometheus
module Client
module DataStores
# Stores data in binary files, one file per process and per metric.
# This is generally the recommended store to use to deal with pre-fork servers and
# other "multi-process" scenarios.
#
# Each proc... | 35.332394 | 104 | 0.547317 |
d5f2d4dcb0c92d55245562dca4e9b852db5a6543 | 517 | # == Schema Information
#
# Table name: events
#
# id :integer not null, primary key
# type :string(255)
# org_handle :string(255)
# dxuser :string(255)
# param1 :string(255)
# param2 :string(255)
# param3 :string(255)
# created_at :datetime not null
# param4 ... | 20.68 | 53 | 0.622824 |
fffd9300c8c17747d7e8f6a77128c13fd4edeb8d | 11,136 | require_relative "chunk"
require_relative "scanner"
require_relative "opcode"
require_relative "token"
require_relative "object"
require_relative "local"
module Lr
class Compiler
# Precedence
PREC_NONE = 0
PREC_ASSIGNMENT = 1 # =
PREC_OR = 2 # or
PREC_AND = 3 ... | 25.309091 | 78 | 0.596713 |
7a7ba8ecbfe3f0d48e7776f4e26adc1dd3d6a89e | 596 | module CanTango
class PermissionEngine < Engine
module Parser
class Regex < Rule
attr_reader :regex
def parse
target.gsub!(/\/(.*)\//, '\1')
@regex = /#{target}/
build_statement
end
private
def targets
config_models.by_reg_ex... | 16.555556 | 50 | 0.501678 |
f8a06486cec7e90fd6141ac1819a4b5f9bc1d703 | 747 | Pod::Spec.new do |s|
s.name = 'SteviaLayout'
s.version = "4.5.0"
s.summary = "Elegant view layout for iOS"
s.homepage = "https://github.com/s4cha/Stevia"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = 'S4cha'
s.source = { :g... | 41.5 | 110 | 0.574297 |
03f3702054ad9de811ea41aeb4895816fad49fd6 | 95 | require 'rails_helper'
RSpec.describe Front::SubscribersController, type: :controller do
end
| 15.833333 | 65 | 0.810526 |
e842cb0ee7f83e443ff8eb855e626361eeba6e0a | 899 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'dvm/version'
Gem::Specification.new do |spec|
spec.name = 'dvm'
spec.version = Dvm::VERSION
spec.authors = ['Xingjian Xu']
spec.email = ['dotswing@gmail.com'... | 34.576923 | 74 | 0.638487 |
26b91dd964337d33bad60b5daf1fb523b6695ad7 | 130 | class AddEncryptedPinToUsers < ActiveRecord::Migration[4.2]
def change
add_column :users, :encrypted_pin, :string
end
end
| 21.666667 | 59 | 0.761538 |
d573148413a05bb4b38de75312c0c5e00713de33 | 968 | require 'spec_helper'
require 'support/test_application_helper'
require 'rack/test'
describe Redshift::Rails::Middleware do
include Rack::Test::Methods
let(:test_app) { TestApplicationHelper::TestApplication.new }
let(:app) { Redshift::Rails::Middleware.new(test_app) }
describe "GET '/'" do
it 'should re... | 24.2 | 67 | 0.646694 |
bfece53b4bdfa2c46e885ac5b71ce64b4f51b213 | 8,738 | # Provides full CRUD+ for Distributions, which are the primary way for inventory to leave a Diaperbank. Most
# Distributions are given out through community partners (either via Partnerbase, or to Partners-on-record). It's
# technically possible to also do Direct Services by having a Partner called "Direct Services" an... | 38.493392 | 207 | 0.742733 |
d5de14f6890fb85b8c0b66ffef5f4ccda2515cdf | 1,318 | # frozen_string_literal: true
module GraphQL
module Relay
class ConnectionResolve
def initialize(field, underlying_resolve)
@field = field
@underlying_resolve = underlying_resolve
@max_page_size = field.connection_max_page_size
end
def call(obj, args, ctx)
# in a... | 29.954545 | 124 | 0.628983 |
6a1dc0bf6403f7d841b8339019a213e7345c1e07 | 2,975 | require_relative "spec_helper"
describe "pg_inet extension" do
ipv6_broken = (IPAddr.new('::1'); false) rescue true
before do
@db = Sequel.connect('mock://postgres')
@db.extend_datasets{def quote_identifiers?; false end}
@db.extension(:pg_array, :pg_inet)
end
it "should literalize IPAddr v4 instan... | 40.753425 | 130 | 0.674622 |
ac2cd7e5f4d1a287aefb0eece92c81143f8a85e5 | 2,706 | # seed data를 생성하기 위해 존재하는 service입니다.
module Sellers
class OrderCreateService
attr_accessor :order_info, :ship_info, :payment, :cart, :seller
attr_reader :errors
def initialize(seller, order_info_source, ship_info_source, payment_source)
@seller = seller
@order_info = OrderInfo.new(order_info... | 23.946903 | 79 | 0.616408 |
ed31f2b142bff1704e993e02e4b3e7bc2b91aae5 | 83 | require "active_job_resque_solo/version"
require 'active_job/plugins/resque/solo'
| 20.75 | 40 | 0.843373 |
3322b30eab35357ecccace14b8d8891f308c38c5 | 338 | class LandingController < Catherine::ApplicationController
def index
if @current_user
if @current_user.super_admin? || @current_user.has_role?("Site Admin")
redirect_to catherine.admin_dashboard_url
else
redirect_to catherine.user_dashboard_url
end
else
redirect_to usman.sign_in_url
... | 19.882353 | 74 | 0.745562 |
38a29b3a10fba455d06dea1fd5ad3526685c8f6e | 1,404 | # encoding: utf-8
Gem::Specification.new do |s|
s.name = "twitter-text"
s.version = "1.14.3"
s.authors = ["Matt Sanford", "Patrick Ewing", "Ben Cherry", "Britt Selvitelle",
"Raffi Krikorian", "J.P. Cummins", "Yoshimasa Niwa", "Keita Fujii", "James Koval"]
s.email = ["matt@twitter.com", "patrick.... | 45.290323 | 114 | 0.654558 |
911d41a1d6b28789578c1253a7de9eafab1f8216 | 1,092 | # coding: us-ascii
require File.expand_path('../lib/struct/alias_member/version', __FILE__)
Gem::Specification.new do |gem|
# specific
gem.description = %q{Struct will be able to alias the members name.}
gem.summary = gem.description.dup
gem.homepage = 'http://kachick.github.com/struct-alias_mem... | 31.2 | 75 | 0.639194 |
b988a92718251f21105a2e1d57942bcaacd0bb22 | 415 | module Nurego
class Offering < APIResource
def self.retrieve(id, api_key = nil)
raise NotImplementedError.new("Offering cannot be retrieved with ID. Retrieve an offering using Offering.current")
end
def self.current(params = {}, api_key = nil)
response, api_key = Nurego.request(:get, self.u... | 25.9375 | 120 | 0.710843 |
61b7b3dbaae1b05b9fb61a4e14a02f3b48ce83fb | 1,692 | ['../dispatchresponsepayload', '../dispatcherrorpayload'].each do |f|
path = File.absolute_path(File.dirname(__FILE__) + '/' + f)
puts "Requiring: #{path}."
require path
end
Thread.abort_on_exception = true
class Dispatcher
def initialize(extra_plugin_dir = nil)
puts "Loading jar-file plugins."
direc... | 32.538462 | 97 | 0.651891 |
618faa9fbdac90543ac69c2e05b788bfc34eef33 | 1,567 | #
# Be sure to run `pod lib lint MyTools.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 = 'MyTools'
... | 36.44186 | 105 | 0.6388 |
032283736e96e67f37dde63f3b6a3aa4cfbc88fc | 2,200 | # Copyright © 2020 MUSC Foundation for Research Development~
# All rights reserved.~
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:~
# 1. Redistributions of source code must retain the above copyright notice, this list o... | 55 | 308 | 0.730909 |
6a3f0990070b9816791916f9c6d77a162bd57a88 | 1,636 | class ZonesController < ApplicationController
before_action { params[:id] && @zone = Zone.find(params[:id]) }
before_action { @active_nav = :zones }
def index
@zones = Zone.order(:updated_at => :desc).includes(:pending_changes)
end
def show
@records = @zone.ordered_records.to_a
end
def zone_fi... | 23.371429 | 149 | 0.655868 |
38cec53916bc6948a502fc2bf88606a856619fda | 1,340 | require 'json'
module Sprue::Serializer
# == Module Methods =======================================================
def hash_to_list(hash)
hash.to_a.flatten.collect(&:to_s)
end
def list_to_hash(list)
hash = { }
list.each_with_index do |k, i|
next if (i % 2 == 1)
hash[k] = list[i + 1... | 18.873239 | 77 | 0.55 |
1c8093fcfa9cd1dd1c05be94ca163c5464e9ab7e | 932 | module Datadog
module Contrib
# Base provides features that are shared across all integrations
module Patchable
def self.included(base)
base.send(:extend, ClassMethods)
base.send(:include, InstanceMethods)
end
# Class methods for integrations
module ClassMethods
... | 21.674419 | 103 | 0.575107 |
08bffc0a7094564d137d893bed1b91adbf168417 | 1,321 | module Spree
class User < Spree::Base
include UserAddress
include UserMethods
include UserPaymentSource
devise :database_authenticatable, :registerable, :recoverable,
:rememberable, :trackable, :validatable, :encryptable, :encryptor => 'authlogic_sha512'
devise :confirmable if Spree::A... | 26.42 | 98 | 0.67676 |
7947f29295efa76cbc905d749d6f6b6acb3a8358 | 1,043 | Pod::Spec.new do |s|
s.name = 'GoogleTagManager'
s.version = '3.02'
s.summary = 'Google Tag Manager SDK.'
s.description = 'Google Tag Manager enables developers to change configuration values in their mobile applications using the Google Tag Manager interface without having to rebuild and resubmit application b... | 45.347826 | 237 | 0.722915 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.