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 |
|---|---|---|---|---|---|
08b4489a6e3203c9b94554914266f8e24121f565 | 7,612 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe API::HelmPackages do
include_context 'helm api setup'
using RSpec::Parameterized::TableSyntax
let_it_be_with_reload(:project) { create(:project, :public) }
let_it_be(:deploy_token) { create(:deploy_token, read_package_registry: true, write_pa... | 42.288889 | 147 | 0.673016 |
f87056506c1dc712bbab76d02d3b3537caf409c4 | 1,462 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'slather/version'
Gem::Specification.new do |spec|
spec.name = 'slather'
spec.version = Slather::VERSION
spec.authors = ['Mark Larsen']
spec.email = ['mark@ven... | 39.513514 | 74 | 0.664159 |
61a3faceac1da8409ccd6493995e59c35ba58b0f | 351 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Learning::Books::Contracts::CreateContract do
let(:input) do
{
attributes: {
title: 'My Book',
status: 'new_book',
feeling: 'good'
}
}
end
include_examples 'it validates contract'
include_examples... | 17.55 | 60 | 0.652422 |
3372bac40f328a72673c8d9903177c1b4f2ab4fe | 4,827 | # frozen_string_literal: true
module GraphQL8
# This type exposes fields on an object.
#
# @example defining a type for your IMDB clone
# MovieType = GraphQL8::ObjectType.define do
# name "Movie"
# description "A full-length film or a short film"
# interfaces [ProductionInterface, DurationIn... | 33.992958 | 137 | 0.689662 |
f75fe58af21547426b64cf04f95f876fb8ecbf23 | 3,730 | # frozen_string_literal: true
require 'spec_helper'
describe Pseudonymizer::Dumper do
let!(:project) { create(:project) }
let(:base_dir) { Dir.mktmpdir }
let(:options) do
Pseudonymizer::Options.new(
config: YAML.load_file(Gitlab.config.pseudonymizer.manifest)
)
end
subject(:pseudo) { describe... | 27.835821 | 119 | 0.631903 |
bf72ebc5d279ed1f23b7bb6898fc4cd28f8732f6 | 1,051 | module BootstrapForm
module Helpers
module Bootstrap4
def submit(name = nil, options = {})
options.reverse_merge! class: 'btn btn-secondary'
super(name, options)
end
# TODO check upstream - append tag options
def prepend_and_append_input(name, options, &block)
op... | 37.535714 | 158 | 0.663178 |
7a4c7f586e72a0f214572b8261e8027d70d31a74 | 467 | module Spree
module Cart
class Create
prepend Spree::ServiceModule::Base
def call(user:, store:, currency:, order_params: nil)
order_params ||= {}
default_params = {
user: user,
store: store,
currency: currency,
token: GenerateToken.new.call(Sp... | 21.227273 | 72 | 0.5803 |
620b0c4144ebf6263a0b69cb28cde5a9570b9687 | 5,315 | Pod::Spec.new do |s|
s.name = 'NSD_LFImagePicker'
s.version = '0.0.4'
s.summary = 'A clone of UIImagePickerController, support picking multiple photos、 video and edit photo'
s.homepage = 'https://github.com/NeeSDev/NSD_LFImagePicker'
s.license = 'MIT'
s.author = { 'NeeSDev' ... | 57.771739 | 500 | 0.759172 |
1cfdbe9963c7f5686a283faab25b3335bd464ce7 | 718 | require "spec_helper"
feature "Signing up for an account" do
scenario "from the sign up page" do
user = login_as_tenant(
password: "password",
password_confirmation: "password"
)
visit edit_user_registration_path
fill_in "First name", with: "Oscar"
fill_in "Last name", with: "#{user.... | 29.916667 | 73 | 0.681058 |
1152f1abfc8305109d41f7a5e93846da1df9331f | 175 | require 'bundler/setup'
Bundler.require(:default)
ActiveRecord::Base.establish_connection(
:adapter => "sqlite3",
:database => "db/database.sqlite"
)
require_all 'app'
| 17.5 | 40 | 0.731429 |
bf79a9f7c8939afdbb1beaafb87d9e24dd7647d2 | 566 | require 'rails_helper'
RSpec.describe 'UsersFollowers', type: :request do
let(:user) { create(:user) }
describe 'GET /users/:id/followers' do
describe 'ユーザーがログインしていない場合' do
it '/users/:id/followersの取得は有効' do
get followers_user_path(user)
expect(request.fullpath).to eq '/users/1/followers... | 24.608696 | 59 | 0.655477 |
1da52d6a6b9b1bc1b8c7d6bf633d8e22c89bd8a9 | 3,912 | require File.dirname(__FILE__) + '/../test_helper'
require 'user_notifier'
require 'hpricot'
class UserNotifierTest < ActiveSupport::TestCase
FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures'
CHARSET = "utf-8"
include ActionMailer::Quoting
fixtures :users, :friendships, :friendship_statuses, :comments,... | 34.619469 | 168 | 0.753067 |
bf990e087c8ae926d2762c810521870b312e3c6a | 313 | class User < ApplicationRecord
before_save :downcase_name
has_many :articles, foreign_key: 'author_id', dependent: :destroy
has_many :votes
validates :name, presence: true, length: { minimum: 5 },
uniqueness: true
private
def downcase_name
self.name = name.downcase
end
end
| 22.357143 | 67 | 0.693291 |
39ce6bbc9b2a545a6eaa203b8621b977c95b9038 | 1,154 | require_relative 'automated_init'
context "Log" do
context "Telemetry" do
context "Logged" do
logger = Log::Controls::Log.example
time = Log::Controls::Time::Raw.example
logger.clock.now = time
logger.add_level :some_level
logger.level = :some_level
logger.tag = :some_tag
... | 24.553191 | 86 | 0.644714 |
1c913273578222295128499ea60f54d7a298fd84 | 1,375 | class FontBh75dpi < Formula
desc "X.Org Fonts: font bh 75dpi"
homepage "https://www.x.org/"
### http://www.linuxfromscratch.org/blfs/view/svn/x/x7font.html
url "https://www.x.org/pub/individual/font/font-bh-75dpi-1.0.3.tar.bz2"
mirror "https://xorg.freedesktop.org/archive/individual/font/font-bh-75dpi-1.0.3.t... | 31.976744 | 91 | 0.696727 |
389e6a3588aa3772da2ee9cbad3e03a0dda0483a | 198 | # frozen_string_literal: true
require 'spec_helper'
describe Billogram::DomesticBankAccount do
it { is_expected.to respond_to(:account_no) }
it { is_expected.to respond_to(:clearing_no) }
end
| 22 | 48 | 0.782828 |
28c89a0a50c8a5a5e9dabeef6474dfc80d4c5666 | 1,143 | # 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
Gem::Specification.new do |spec|
spec.name = 'aws-sdk-worklink'
spec.version = File.read(Fil... | 38.1 | 120 | 0.660542 |
18c9d93ab4c9020c09c8211352a2138ccb167e83 | 1,891 | module Fog
module Compute
class VcloudDirector
class Real
# Delete an OrgVdcNetwork
#
# This operation is asynchronous and returns a task that you can
# monitor to track the progress of the request.
#
# @param [String] id Object identifier of the OrgVdcNetwork... | 29.092308 | 124 | 0.5156 |
ff7188b0de14307a3a554c6fb30dccdd29e74f52 | 1,583 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::ContainerService::Mgmt::V2018_08_01_preview
module Models
#
# The list of credential result response.
#
class CredentialResults
include... | 27.77193 | 70 | 0.516109 |
ab10ce068bf589bfe1b7275fdf32ca17ddfc4bf8 | 3,824 | Pod::Spec.new do |s|
s.name = "libextobjc"
s.version = "0.4"
s.summary = "A Cocoa library to extend the Objective-C programming language."
s.homepage = "https://github.com/jspahrsummers/libextobjc"
s.author = { "Justin Spahr-Summers" => "jspahrsummers@github.com" }
s.source ... | 49.662338 | 482 | 0.691946 |
18e9eafd91b6c79658478390407753f0f177288c | 404 | module APN
module BeforeUnregisterSupport
def before_unregister_worker(&block)
block ? (@before_unregister_worker = block) : @before_unregister_worker
end
def before_unregister_worker=(before_unregister_worker)
@before_unregister_worker = before_unregister_worker
end
end
end
# Add this... | 26.933333 | 77 | 0.777228 |
1a8661d4063583a0e8174d8e0ef900ab56139b5c | 1,566 | require 'test_helper'
module Coinmarketcap
module Api
module Config
class ClientTest < Minitest::Test
def setup
CoinMarketCap::Api.config.reset!
CoinMarketCap::Api.configure.logger.reset!
end
def test_default_end_point
assert_equal CoinMarketCap::Api.c... | 30.705882 | 97 | 0.667305 |
87a6e5be6d9213990e084401850926c283ec34bd | 1,228 | module RedisBrowser
module WebHelpers
def root_path
"#{env['SCRIPT_NAME']}/"
end
def js_env
jsEnv = {
root_path: root_path,
connections: settings.connections,
connection: params[:connection] || settings.connections.keys.first
}
"jsEnv = #{MultiJson.dump(js... | 20.131148 | 74 | 0.606678 |
6a3a81732b05ee98b46ff047408a29d57b6542f3 | 2,273 | module RubyJmeter
module Plugins
class TransactionsPerSecond
attr_accessor :doc
include Helper
def initialize(params={})
testname = params.kind_of?(Array) ? 'TransactionsPerSecond' : (params[:name] || 'TransactionsPerSecond')
@doc = Nokogiri::XML(<<-EOF.strip_heredoc)
<... | 44.568627 | 239 | 0.600528 |
62d71d756ea37cf7213191dadbef179265242219 | 531 | require 'test_helper'
require 'omniauth-cube7'
require 'openssl'
require 'base64'
class StrategyTest < StrategyTestCase
include OAuth2StrategyTests
end
class ClientTest < StrategyTestCase
test 'has correct baio site' do
assert_equal 'https://www.cube7.com', strategy.client.site
end
test 'has correct auth... | 23.086957 | 76 | 0.760829 |
ff6311bfdc43d2c9bc60f089c8c4c3be56bd0dd1 | 422 | cask 'keyboard-maestro6' do
version '6.4.8'
sha256 '74276c1bbb2f3b6f188e3883519c6f94cca333b40dd5a38ef79af37c3d6c5c06'
# stairways.com was verified as official when first introduced to the cask
url "https://files.stairways.com/keyboardmaestro-#{version.no_dots}.zip"
name 'Keyboard Maestro'
homepage 'https:/... | 30.142857 | 76 | 0.770142 |
ffe6b8ee5535704524a0289b83a55277547312c8 | 1,635 | cask "microsoft-edge" do
version "91.0.864.71"
if Hardware::CPU.intel?
url "https://officecdn-microsoft-com.akamaized.net/pr/C1297A47-86C4-4C1F-97FA-950631F94777/MacAutoupdate/MicrosoftEdge-#{version}.pkg",
verified: "officecdn-microsoft-com.akamaized.net/pr/C1297A47-86C4-4C1F-97FA-950631F94777/MacAuto... | 36.333333 | 139 | 0.727217 |
0879697919861be7b72f2d7669936c6acb812fe7 | 133 | class RemoveStyleForeignKeyFromCheese < ActiveRecord::Migration[6.1]
def change
remove_foreign_key :cheeses, :styles
end
end
| 22.166667 | 68 | 0.789474 |
1a892498ede05a14cce8c941d4f5205354ed07b8 | 881 | # frozen_string_literal: true
Sidekiq.configure_server do |config|
# Logs are consumed by Splunk via STDOUT. To easily differentiate between rails logs
# and sidekiq logs, we append `process -> sidekiq-server` to every sidekiq log message
# NOTE: This can be removed if/when sidekiq server is moved to its own con... | 38.304348 | 115 | 0.711691 |
ac0076332ded4d9dc29049cee6c84c3cc2d78cc8 | 8,127 | # Copyright (c) 2009-2012 VMware, Inc.
require File.expand_path("../../../spec_helper", __FILE__)
describe Bosh::Director::DeploymentPlan::Job do
def make_spec
{
"name" => "foobar",
"template" => "foo",
"release" => "appcloud",
"resource_pool" => "dea"
}
end
def make_deployment... | 27.737201 | 80 | 0.5921 |
ab28d16e4da722c7d88e68dde47df76c10fcdf68 | 596 | module ContentfulLite
module Validations
# @api private
class IncludedAssetValidator < ActiveModel::EachValidator
include IncludedChildValidator
add_options_keys :type
def validate_child(record, attr_name, value, idx = nil)
record_error(record, attr_name, "value#{idx} is not a publi... | 39.733333 | 182 | 0.713087 |
b987b6cc2d212a8a8ae42459edc727780e4233c3 | 705 | require 'spec_helper_acceptance'
RSpec.context 'ZPool: Should Create' do
before(:all) do
# ZPool: setup
solaris_agents.each do |agent|
zpool_setup agent
end
end
after(:all) do
# ZPool: cleanup
solaris_agents.each do |agent|
zpool_clean agent
end
end
solaris_agents.each d... | 22.741935 | 94 | 0.635461 |
1a704fcaf225f248c2862a12b96ef18ba885eb74 | 5,812 | =begin
#DocuSign Admin API
#An API for an organization administrator to manage organizations, accounts and users
OpenAPI spec version: v2.1
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end
require 'date'
module DocuSign_Admin
class AddDSGroupUsersResponse
... | 28.490196 | 107 | 0.615279 |
e97e961771c0a689e72c37f7bc86f325c0680728 | 2,522 | # frozen_string_literal: true
module Gitlab
# JobWaiter can be used to wait for a number of Sidekiq jobs to complete.
#
# Its use requires the cooperation of the sidekiq jobs themselves. Set up the
# waiter, then start the jobs, passing them its `key`. Their `perform` methods
# should look like:
#
# ... | 32.753247 | 84 | 0.633228 |
d514e5c9d711fe1266fd11c8ba194db84b297ed1 | 6,680 | # ----------------------------------------------------------------------------
# <copyright company="Aspose" file="storage_exist.rb">
# Copyright (c) 2018-2020 Aspose Pty Ltd. All rights reserved.
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of... | 32.115385 | 98 | 0.620659 |
ffc7a836c37a4d8725c5b264e69fbdc4f398c9e8 | 1,005 | require "test_helper"
class ScrabbleWordTest < Minitest::Test
def test_empty_word_scores_zero
skip
assert_equal 0, ScrabbleWord.new('').score
end
def test_whitespace_scores_zero
skip
assert_equal 0, ScrabbleWord.new(" \t\n").score
end
def test_nil_scores_zero
skip
assert_equal 0, Sc... | 20.510204 | 62 | 0.746269 |
bfe3d184a2382dc00b83d097627a0299a35819e3 | 15,536 | # -*- coding: utf-8 -*-
#!/usr/bin/env ruby
require 'test/unit'
require 'hpricot'
require 'load_files'
class TestParser < Test::Unit::TestCase
def test_set_attr
@basic = Hpricot.parse(TestFiles::BASIC)
@basic.search('//p').set('class', 'para')
assert_equal 4, @basic.search('//p').length
assert_equal... | 36.214452 | 134 | 0.646048 |
265b8a7d9bed8ff3c49bcf7504d9d41eb67e61b0 | 15,945 | # Copyright 2011 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" file acc... | 28.221239 | 99 | 0.52449 |
e8ecb3ea5e02e88c1929172af1a5701953ac37a4 | 5,031 | module FindOrderSqlSyntax
include Treetop::Runtime
def root
@root || :sqlFindOrderString
end
include FindConditionsSqlSyntax
module SqlFindOrderString0
def sqlFindOrder
elements[1]
end
end
module SqlFindOrderString1
def code; sqlFindOrder.code; end
end
def _nt_sqlFindOrderS... | 19.885375 | 67 | 0.518585 |
260c8d1ff3172a7bcdce04e702e6d57ed58c4802 | 1,731 | module Telapi
# Wraps TelAPI SMS Message functionality
class Message < Resource
class << self
MAX_BODY_LENGTH = 160
# Returns a resource collection containing Telapi::Message objects
# See http://www.telapi.com/docs/api/rest/sms/list/
#
# Optional params is a hash containing:
... | 36.0625 | 133 | 0.627383 |
33326e23b204d535cbc4e5f726595fae0ad9fb7f | 201 | object @line_item
attributes *line_item_attributes
child :variant do
extends "spree/api/variants/variant"
attributes :product_id
child(:images => :images) { extends "spree/api/images/show" }
end
| 25.125 | 63 | 0.766169 |
385fa5f6a525cc4617b2c732ef3d230b98e195a9 | 209 | module UrlResolver
module CacheImplementations
module NilClassCache
def set_url(url, destination, ttl = 0)
nil
end
def get_url(url)
nil
end
end
end
end
| 14.928571 | 44 | 0.593301 |
6289d5f0c4494e9562ae317f54d78fd6feb39d82 | 428 | class DeveloperOpenGraphTagsComponent < OpenGraphTagsComponent
def initialize(developer:)
@developer = developer
end
def title
@developer.hero
end
def description
@developer.bio
end
def url
developer_url(@developer)
end
def image
rails_blob_url(@developer.avatar) if @developer.... | 16.461538 | 68 | 0.71729 |
ff1f965687d05d261d0c9e467121f5197b6e45d7 | 3,906 | # frozen_string_literal: true
module UsersHelper
def website_for(user)
"#{user.name}'s website " + (link_to user.website.to_s, ('http://' + h(user.website)))
end
def website_for_simple(user)
(link_to user.website.to_s, ('http://' + h(user.website)))
end
def itunes_link_for(user)
link_to "Open #... | 31 | 116 | 0.684844 |
e8bb6e68943d0158e43fcf9d29069200ad40c588 | 1,511 | describe Arel::Transformer::ReplaceTableWithSubquery do
let(:next_middleware) { ->(new_arel) { new_arel } }
it 'works as middleware' do
# Make sure ActiveRecord is loaded
Post.create!
Post.where(id: 0).load
transformer =
Arel::Transformer::ReplaceTableWithSubquery.new(
->(_) { Post.w... | 29.627451 | 89 | 0.652548 |
e86717e05433386ea0018285303e50768f9d935b | 978 | module Oversight
module Concerns::Models::User
extend ActiveSupport::Concern
included do
has_many :memberships, dependent: :destroy, inverse_of: :user
has_many :teams, through: :memberships, inverse_of: :users
scope :active, -> { where active: true }
scope :inactive, -> { where act... | 36.222222 | 120 | 0.709611 |
087220d6b67f03c96dd8afaf71ce323e18d15b38 | 1,095 | FactoryGirl.define do
factory :accounting_profile, class: 'Accounting::Profile' do
authnet_id { SecureRandom.uuid[0..19] }
authnet_email { FFaker::Internet.email }
authnet_description { FFaker::Lorem.sentence(2) }
trait :with_all_cards do
transient do
card_numbers ['370000000000002', '6... | 30.416667 | 126 | 0.657534 |
1d14a0b0f4194c58e0d0b5ddbf2a5abbb79bff8e | 37 | module Store
VERSION = "0.1.0"
end
| 9.25 | 19 | 0.648649 |
d579c464c13f98966ec38cd74bd87b4725db97e5 | 299 | # Commonly occurring user actions in tests.
# This takes a username and by default assumes the password is 'password'.
def log_in_as(login, plaintext_password = 'password')
visit '/'
fill_in 'username_or_email', with: login
fill_in 'password', with: plaintext_password
click_on 'Login'
end
| 29.9 | 74 | 0.759197 |
017ab16a4764b41df1aa1b8f18a83f43362f72a2 | 2,166 | # Author:: Miron Cuperman (mailto:miron+cms@google.com)
# Copyright:: Google Inc. 2011
# License:: Apache 2.0
# Handle Google Docs integration
class DocumentController < ApplicationController
include GdataHelper
include DocumentHelper
# access_control :acl do
# allow :superuser
#
# actions :index do
# ... | 26.096386 | 99 | 0.655125 |
bb76e23831bec2c226c77528401f0c1125aa39cb | 1,481 | Rails.application.config.after_initialize do
if Settings.application.fake_proxies_enabled
# Go through fixtures/pretty_vcr_recordings/*.json and substitute current datetime values where we find tokens. Save
# the processed files in fixtures/vcr_cassettes for use by FakeableProxy.
processed_dir = Rails.r... | 37.974359 | 120 | 0.675219 |
f87066ccd79056da62789e437f14d0be8c5a1c9f | 308 | class CreateCollectionFeeds < ActiveRecord::Migration[5.0]
def change
create_table :collection_feeds do |t|
t.integer :collection_id, null: false
t.integer :feed_id, null: false
t.timestamps
end
add_index :collection_feeds, [:collection_id, :feed_id], unique: true
end
end
| 25.666667 | 73 | 0.707792 |
79d9af30c820190e9d1cad1b9e8b84e4d123fcd0 | 123 | class AddSkillIdToProjects < ActiveRecord::Migration
def change
add_column(:projects, :skill_id, :integer)
end
end
| 20.5 | 52 | 0.764228 |
bf17b3330a5bd025d554f1363b3211143843e78b | 3,851 | # show file extensions
registry_key 'HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' do
values [{
name: 'HideFileExt',
type: :dword,
data: 0,
}]
end
# show hidden files
registry_key 'HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' do
values [{
name: 'Hidden',
... | 22.005714 | 87 | 0.699039 |
26aeca9b06cd209371f6e3aa99412ba24f012217 | 325 | module Core
module SocialWorkCadastre
class CadastreMailer < ApplicationMailer # :nodoc:
default from: 'nao-responda@codhab.df.gov.br'
def password_reset(user)
@user = user
mail to: user.email, subject: 'Alteração de senha (credenciamento 01-2018 CODHAB)'
end
end
end... | 25 | 90 | 0.661538 |
26dfc3e91a4aecaf740f5f44d208bc0adab256c0 | 652 | module Api
class EventsController < ApplicationController
def index
render json: Event.all
end
def search
query = params[:query]
events = Event.where('name LIKE ? OR place LIKE ? OR description LIKE ?',
"%#{query}%", "%#{query}%", "%#{query}%")
render j... | 21.032258 | 79 | 0.582822 |
6152db2c77362ce1186cf3637ff75c76495b3604 | 775 | cask 'mongodb-compass' do
version '1.6.2'
sha256 '59b9b10c61e21055b93102825945670e5d0434ae44ffcc382aa5ad5fc8f61ba3'
url "https://downloads.mongodb.com/compass/mongodb-compass-#{version}-darwin-x64.dmg"
name 'MongoDB Compass'
homepage 'https://www.mongodb.com/products/compass'
app 'MongoDB Compass.app'
... | 40.789474 | 151 | 0.691613 |
edcc4055b6f8a1cb0e8c86600ccf99f2c2fc37a7 | 783 | # frozen_string_literal: true
module Facturama
class Resource
attr_reader :id
def initialize(params = {})
@id ||= params[:id]
raise ArgumentError, 'Id must be specified!' if @id.blank?
set_instance_variables
params.each do |k, v|
send(k.to_s.underscore + '=', v)
end
... | 20.605263 | 64 | 0.601533 |
62977f7a14a555f01d23fdc78663f591ce41266e | 46 | require 'test/unit'
require 'rfm_test_errors'
| 15.333333 | 25 | 0.804348 |
ab3ace59f37d3f940acdf37492b56bf2717e1e9a | 3,539 | # frozen_string_literal: true
class TeamsController < ApplicationController
before_action :set_team, only: [:show, :edit, :update, :destroy]
before_action :set_users, only: [:new, :edit]
before_action :set_display_roles, only: :index
load_and_authorize_resource except: [:index, :show]
def index
directi... | 30.773913 | 165 | 0.663464 |
6274d2d7ae8eb97d6776eac85d55437fb0b2bc9e | 50 | module WebmockRbsExamples
VERSION = "0.1.0"
end
| 12.5 | 25 | 0.74 |
e26fac7ed3184743aa92dc257a7738237ab1ece7 | 1,374 | # frozen_string_literal: true
module Codebreaker
RSpec.describe Sorter do
data = []
subject(:sorter) { described_class.new(data) }
describe '#call' do
it 'sort by hints' do
data = [{ user: 'Ivan', difficulty: :hell, attempts_total: 5, attempts_used: 2, hints_total: 1, hints_used: 1 },
... | 42.9375 | 120 | 0.637555 |
1c26a5d0f4f897dd7d2dcf25bf2968eea02a5a77 | 1,218 | class UserNotAuthorised < StandardError; end
module Auth
extend ActiveSupport::Concern
included do
helper_method :current_user
helper_method :authenticated?
rescue_from(UserNotAuthorised, Pundit::NotAuthorizedError) do |exception|
error_message = if exception.respond_to?(:policy)
t("#{ex... | 27.066667 | 117 | 0.706897 |
f8c61cadd844ee8ed797c6cc56649d36438f32bb | 505 | Pod::Spec.new do |s|
s.name = "EDSemver"
s.version = "0.2.2"
s.summary = "Semantic versioning for Objective-C."
s.homepage = "https://github.com/thisandagain/semver"
s.license = "MIT"
s.authors = { "Andrew Sliwinski" => "andrewsliwinski@acm.org", "Sam Soffes" => "sam@soff.es"... | 42.083333 | 101 | 0.588119 |
26d6bb86e8b396a5f108d0fd258faf326b8b51e0 | 591 | # === COPYRIGHT:
# Copyright (c) North Carolina State University
# Developed with funding for the National eXtension Initiative.
# === LICENSE:
#
# see LICENSE file
class RefererTrack < ActiveRecord::Base
attr_accessible :ipaddr, :referer, :expires_at, :user_agent, :load_count
def self.expired
where("expir... | 21.888889 | 74 | 0.695431 |
6a7d431e41608128e3eb0889e6707d2ff6f0d12d | 123 | class Review < ApplicationRecord
belongs_to :user
belongs_to :book
validates :content, presence: true
end
| 17.571429 | 38 | 0.707317 |
5d362eb0942ef62bc4f4dab205c3d70fbde7e7b1 | 826 | require 'rails_helper'
RSpec.describe BrowserCache do
let(:chrome_user_agent) do
'Mozilla/5.0 (X11; CrOS x86_64 8172.45.0) AppleWebKit/537.36 (KHTML, like Gecko) \
Chrome/51.0.2704.64 Safari/537.36'
end
before { BrowserCache.clear }
describe '.parse' do
it 'parses a user agent using Browser gem... | 27.533333 | 86 | 0.68523 |
613e6be68ae2782fc82b8ec2644664c89cf191ce | 1,092 | # Encoding: utf-8
#
# This is auto-generated code, changes will be overwritten.
#
# Copyright:: Copyright 2016, Google Inc. All Rights Reserved.
# License:: Licensed under the Apache License, Version 2.0.
#
# Code generated by AdsCommon library 0.12.4 on 2016-09-30 10:57:39.
require 'ads_common/savon_service'
require ... | 28 | 75 | 0.742674 |
08f3733ad6e43aa333023b6490b6276b6d2eb00f | 1,378 | module Mocktail
class RecreatesMessage
def recreate(signature)
req_args = signature.positional_params.required.size
allowed_args = signature.positional_params.allowed.size
rest_args = signature.positional_params.rest?
req_kwargs = signature.keyword_params.required
if signature.posit... | 45.933333 | 207 | 0.671263 |
87fcfe1d1e6ad3d0a5e4d159ed46e16068b8fff3 | 22 | { "ruby" => "ruby" }
| 11 | 21 | 0.363636 |
e8f2713e4449ab47296645294076636cadedce3d | 650 | module Fog
module Compute
class Cloudstack
class Real
# Prepares a host for maintenance.
#
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/prepareHostForMaintenance.html]
def prepare_host_for_maintenance(*args)
options = {}... | 25 | 129 | 0.573846 |
1c1cc2a3ac2099d5479c9e42dd9c1b2d7da75bdf | 1,585 | ActionController::Routing::Routes.draw do |map|
# The priority is based upon order of creation: first created -> highest priority.
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action
# ... | 40.641026 | 89 | 0.679495 |
03bcf336e505366ba75cdb7dcb7c1b8b181ab3ce | 2,087 | module Canvas
require 'ims/lti'
require 'ims/lti/extensions'
require 'oauth/request_proxy/rack_request'
class Lti
extend Cache::Cacheable
include ClassLogger
LTI_SELECTION_DIRECTIVES = {
'embed_content' => %w(image iframe link basic_lti oembed),
'select_link' => ['basic_lti'],
's... | 34.213115 | 112 | 0.598467 |
1aa378185263fd3fff21cb29e81caa0d38b9ea92 | 513 | name "tiamat-10"
description "Master role applied to tiamat-10"
default_attributes(
:networking => {
:interfaces => {
:internal_ipv4 => {
:interface => "enp1s0.2801",
:role => :internal,
:family => :inet,
:address => "10.0.0.44"
},
:external_ipv4 => {
:in... | 19 | 46 | 0.508772 |
d50ef6888c49be378c583785963c84229a285010 | 402 | cask 'hype' do
version '3.6.1'
sha256 '5f8437a60234137fde4a1a22039f648175d26e29c858abc8ab6c75dde9e1e905'
url 'https://tumult.com/hype/download/Hype.zip'
appcast 'https://tumult.com/hype/appcast_hype2.xml',
checkpoint: 'bd7c36fbc7696f1dd57d2121e6b0d6d051d811a0693c0c92f170f55b04201b00'
name 'Tumult H... | 30.923077 | 88 | 0.761194 |
e878a67c326a9f8acd095c3d89f63604ea6f68f2 | 885 | module Twitterland
class Twinfluence
include HTTParty
base_uri 'twinfluence.com'
format :xml
def initialize(username, password)
@username = username
@password = password
end
# Get Twinfluence analysis of a user
#
# Twitterland::Twinfluence.new(username,password)
... | 27.65625 | 142 | 0.630508 |
eda1662471a476059b0ada49be570ad00f720dfa | 105 | class HelloWorldController < ApplicationController
def index
render plain: "Hello World!"
end
end | 21 | 50 | 0.771429 |
e2b47ca5e89bd93d74c312cb12037a468674579f | 768 | # encoding: utf-8
# frozen_string_literal: true
Gem::Specification.new do |s|
s.name = 'essay-carrierwave'
s.version = '1.0.2'
s.authors = ['Yaroslav Konoplov']
s.email = ['eahome00@gmail.com']
s.summary = 'essay-carrierwave'
s.description = 'essay-carrierwa... | 34.909091 | 89 | 0.5625 |
08356f225ebbc4f9dd853290d89edc1ac8117b8a | 846 | 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_to... | 24.171429 | 65 | 0.712766 |
626f36717488a8180b996b2093eb03894a7892b5 | 1,619 | require 'sinatra'
require_relative 'maven_central'
require_relative 'shields'
DEFAULT_SUBJECT = 'maven central'
DEFAULT_STYLE = 'default'
PROJECT_SITE = 'https://github.com/jirutka/maven-badges'
configure :production do
disable :static
before { cache_control :public, :max_age => 3600 }
end
get '/' do
content_t... | 27.440678 | 82 | 0.752316 |
91808a98f6671bc4e3596c38c822114a50ada9f6 | 13,990 | # encoding: utf-8
require "spec_helper"
require "logstash/plugin"
require "logstash/outputs/base"
require "logstash/codecs/base"
require "logstash/inputs/base"
require "logstash/filters/base"
require "support/shared_contexts"
class CustomFilterDeprecable < LogStash::Filters::Base
config_name "simple_plugin"
conf... | 29.206681 | 116 | 0.612509 |
1162b5427d60899750010a05896b2a74e2f39875 | 444 | cask "iota-wallet" do
version "2.5.7"
sha256 "dfb4219c68e97a0056df6a59c5ba98684086c4f5347357c14143842eb33ecea9"
url "https://github.com/iotaledger/wallet/releases/download/v#{version}/IOTA.Wallet-#{version}.dmg",
verified: "github.com/iotaledger/wallet/"
name "IOTA Wallet"
homepage "https://iota.org/"
... | 24.666667 | 102 | 0.734234 |
ac14735c6ebc167701fbd821bf1f55f553d066e7 | 12,243 | # encoding: UTF-8
require 'pathname'
module Spontaneous
class Loader
attr_reader :use_reloader, :load_paths
alias_method :use_reloader?, :use_reloader
def initialize(load_paths, use_reloader)
@load_paths = load_paths
@use_reloader = use_reloader
end
def reloader
@reloader ||... | 30.379653 | 117 | 0.591195 |
79d9fd8fcfac08d15949e34bf6393cf3bd809bc7 | 964 | class UsersController < ApplicationController
def index
@users = User.paginate(page: params[:page])
end
def show
@user= User.find params[:id]
@inactive_sponsors = @user.inactive_sponsors.paginate(:page => params[:inactive_sponsor])
@active_sponsors = @user.active_sponsors.paginate(:page => params... | 20.083333 | 93 | 0.659751 |
03c220ae0bc5e9ee3dc85e63fd43ed62466cc1be | 1,712 | require 'spec_helper'
RSpec.describe NotificationHub::Channels::Sqs do
let(:uuid) {SecureRandom.uuid}
let(:sms) { attributes_for(:notification_hub_sms) }
let(:messages) { [sms] }
let(:envelope) {NotificationHub::Envelope::Base.new(messages: messages, options: {})}
let(:queue_url) { 'http://test/notificatio... | 28.065574 | 102 | 0.679322 |
218df81b4608ee59c92238a39eab7880bf69c7c8 | 576 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe ReservationForm do
subject(:form) { described_class.new(work_version: work_version, work: work) }
let(:work) { work_version.work }
let(:work_version) { build(:work_version) }
describe 'title validation' do
before do
form.validate(... | 19.862069 | 80 | 0.657986 |
392de4e0a78ecfadd671de8619c7eb8fda36c2a6 | 2,273 | module ApplicationHelper
# General check_paging resource
def check_paging(collection, collection_array, resource, context, is_new)
if is_new
@collection_hash = Hash.new { |hash, key| hash[key] = Array.new }
end
unless collection.empty?
@page += 1
collection = context.get(resource.to... | 32.471429 | 122 | 0.674439 |
4a1f570c3f0e92dd35b171b648afecf8ff1932df | 332 | # frozen_string_literal: true
module API
module Entities
class User < UserBasic
expose :created_at, if: ->(user, opts) { Ability.allowed?(opts[:current_user], :read_user_profile, user) }
expose :bio, :location, :public_email, :skype, :linkedin, :twitter, :website_url, :organization, :job_title
en... | 30.181818 | 113 | 0.701807 |
1a6c36bef0b9f33ef25e1f1e75f8cce367f4936a | 18,260 | ################################################################################
# Copyright (c) 2014 IBM Corp.
#
# 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/li... | 27.5 | 88 | 0.600821 |
875bedeedb1282814f36b1ec28e765841d944367 | 5,223 | #!/opt/puppetlabs/puppet/bin/ruby
require 'json'
require 'puppet'
def iot_hub_resource_test_route(*args)
header_params = {}
argstring = args[0].delete('\\')
arg_hash = JSON.parse(argstring)
# Remove task name from arguments - should contain all necessary parameters for URI
arg_hash.delete('_task')
operat... | 32.849057 | 207 | 0.664944 |
615a7175a5bba0c04ae868696df3d83f235a495b | 3,365 | module Easemob
autoload(:GroupMessage, File.expand_path('message/group_message', __dir__))
module Groups
def create_group(groupname, description, owner, members: nil, is_public: true, maxusers: 200, is_approval: false, custom: nil)
jd = { groupname: groupname, desc: description, public: is_public, owner: ... | 37.388889 | 145 | 0.692125 |
792de1d9388ec9696435872eabd9507d07e81a8a | 1,620 | require "test_helper"
class RubygemFsTest < ActiveSupport::TestCase
context "s3 filesystem" do
should "use default bucket when not passing as an argument" do
fs = RubygemFs::S3.new
assert_equal "test.s3.rubygems.org", fs.bucket
end
should "use bucket passed" do
fs = RubygemFs::S3.new(b... | 24.179104 | 76 | 0.6 |
ab09aa915c95a9aba91adb0887fe2dbc9d5852e4 | 4,999 | require 'ddtrace/contrib/support/spec_helper'
require 'ddtrace'
RSpec.describe Datadog::Contrib::Patchable do
include_context 'tracer logging'
describe 'implemented' do
subject(:patchable_class) do
Class.new.tap do |klass|
klass.include(described_class)
end
end
describe 'class be... | 29.579882 | 140 | 0.563913 |
115b892f8db16d569988c8151b6832b3d25b273b | 34,496 | # frozen_string_literal: true
require 'parser'
require 'rainbow'
require 'English'
require 'set'
require 'forwardable'
require 'powerpack/array/butfirst'
require 'powerpack/enumerable/drop_last'
require 'powerpack/hash/symbolize_keys'
require 'powerpack/string/blank'
require 'powerpack/string/strip_indent'
require 'u... | 52.907975 | 121 | 0.874072 |
1d8cb4c3b17363318b510c1497eeb1c7e171c066 | 1,508 | # Copyright 2011-2020, The Trustees of Indiana University and Northwestern
# University. 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
#
# ... | 35.904762 | 84 | 0.704907 |
fff1abe2dfb454fa386b988ab2c663a992d74d2d | 855 | Rails.application.routes.draw do
resources :users do
member do
get :following, :followers
end
end
resources :password_resets, only: [:new, :edit, :create, :update]
resources :account_activations, only: [:edit]
resources :microposts, only: [:create, :destroy]
res... | 27.580645 | 101 | 0.638596 |
62809a2e813fb3639ea4ab4e039781022a64cafa | 832 | # frozen_string_literal: true
module V4
class PageInfoEntity < V4::ApplicationEntity
attribute? :start_cursor, Types::String.optional
attribute? :end_cursor, Types::String.optional
attribute? :has_next_page, Types::Bool
attribute? :has_previous_page, Types::Bool
def self.from_node(page_info_node... | 25.212121 | 64 | 0.679087 |
08af8b12f04bd04b9d520a339da548f4b80968f2 | 372 | cask 'tupitube' do
version '0.2.11'
sha256 'c31f859081746c75e867b16bbedb6118e8c774a6c931852855094c40126598a1'
url "https://downloads.sourceforge.net/tupi2d/tupitube_desk_#{version}.dmg"
appcast 'https://sourceforge.net/projects/tupi2d/rss?path=/Mac%20OSX'
name 'TupiTube Desk'
name 'Tupi2d'
homepage 'http... | 28.615385 | 77 | 0.763441 |
1a7ceb69d57635964546b874eeb4e2e8cf7e90e2 | 6,699 | =begin
#Selling Partner API for Fulfillment Inbound
#The Selling Partner API for Fulfillment Inbound lets you create applications that create and update inbound shipments of inventory to Amazon's fulfillment network.
OpenAPI spec version: v0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Co... | 30.870968 | 239 | 0.63099 |
117cc31c7db2333b87e46f97e6569cf25d978d41 | 1,304 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'neganil/version'
Gem::Specification.new do |spec|
spec.name = "neganil"
spec.version = Neganil::VERSION
spec.authors = ["mehdi_farsi"]
spec.date = Time.now.s... | 31.047619 | 104 | 0.642638 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.