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 |
|---|---|---|---|---|---|
f843dd11ce0db515712eab205949f9411a5dd971 | 9,253 | module Grape
module Validations
##
# All validators must inherit from this class.
#
class Validator
attr_reader :attrs
def initialize(attrs, options, required, scope)
@attrs = Array(attrs)
@required = required
@scope = scope
if options.is_a?(Hash) && !opti... | 29.944984 | 118 | 0.602399 |
612701344d26dd7faadd85879ece12ee72fe54c5 | 350 | FactoryBot.define do
factory :link_tracking do
ip_address { Faker::Internet.ip_v4_address }
factory :link_tracking_database_association do
association :database, factory: :database_default_values
end
factory :link_tracking_rspec do
association :database, factory: :database_basic, s... | 25 | 65 | 0.728571 |
21cde1cfd7ceb7af18301ccc600dd6411c348488 | 1,201 | rbx = defined?(RUBY_ENGINE) && 'rbx' == RUBY_ENGINE
def already_installed(dep)
!Gem::DependencyInstaller.new(:domain => :local).find_gems_with_sources(dep).empty? ||
!Gem::DependencyInstaller.new(:domain => :local,:prerelease => true).find_gems_with_sources(dep).empty?
end
if rbx
require 'rubygems'
require 'r... | 27.295455 | 105 | 0.670275 |
086d92b8851acbf11b8c330894dfc139833896b8 | 1,426 | # frozen_string_literal: true
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 31.688889 | 89 | 0.732819 |
d5c5458ad9ce3116fec8e7ddfb11a3eb97a1bac6 | 6,361 | # typed: false
# frozen_string_literal: true
require "formula"
require "keg"
require "cli/parser"
require "cask/cmd"
require "cask/caskroom"
module Homebrew
module_function
def outdated_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`outdated` [<options>] [<formula>|<cask>]
List... | 31.029268 | 108 | 0.612482 |
337b3444243cb819f59cfcc88f323a2cb05321f7 | 1,261 | # WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
require 'aws-sdk-core'
require 'aws-sigv4'
require_relative 'aws-sdk-directoryservice/types'
require_relative '... | 26.270833 | 89 | 0.760508 |
7957571fa39dfaf8cfb09248e5353aea2265ac01 | 1,046 | # frozen_string_literal: true
module Jekyll
module Diagrams
class BasicRenderer
include Rendering
class << self
def render(context, content, diagram = nil)
new(context, content, diagram).render
end
end
def initialize(context, content, diagram = nil)
@co... | 22.73913 | 67 | 0.567878 |
7ad1b8c827fcd6f54ce4a2813545fdf333f201c0 | 3,071 | #
# Copyright 2012-2014 Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | 31.989583 | 78 | 0.736894 |
2800cf41c91baacb036c693470516ea64a762183 | 1,734 | require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)
describe "Array#reverse" do
it "returns a new array with the elements in reverse order" do
[].reverse.should == []
[1, 3, 5, 2].reverse.should == [2, 5, 3, 1]
end
it "properly handles rec... | 29.389831 | 88 | 0.67474 |
8707308ea2aa349c2ce0799c35c89d21be8dcadd | 1,722 | =begin
#Selling Partner API for Retail Procurement Orders
#The Selling Partner API for Retail Procurement Orders provides programmatic access to vendor orders data.
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.26
=end
require 'spec_helper'
r... | 29.689655 | 111 | 0.731707 |
03dcaa372fd3929148a4d8f88a9ed75d855f77a4 | 263 | # encoding: utf-8
class IntegrationWithFormsController < ApplicationController
def index
@archived = params[:archived] == '1' ? true : false
@tasks_grid = initialize_grid(Task,
conditions: { archived: @archived },
name: 'g'
)
end
end
| 21.916667 | 60 | 0.661597 |
acb112ba85c99c2901d7f21f452f90298913a545 | 117 | class User < ApplicationRecord
has_many :notifications, as: :recipient
def phone_number
"8675309"
end
end
| 14.625 | 41 | 0.735043 |
036163bb475a243da26a42f1171c8225a52cde6a | 757 | module Aws
module Stubbing
class StubData
def initialize(operation)
@rules = operation.output
@pager = operation[:pager]
end
def stub(data = {})
stub = EmptyStub.new(@rules).stub
remove_paging_tokens(stub)
apply_data(data, stub)
stub
end
... | 21.628571 | 75 | 0.573316 |
b953e31a4f6a457e18e82683dc96a2c48b0059f3 | 1,691 | require 'test_helper'
class UsersEditTest < ActionDispatch::IntegrationTest
def setup
@user = users(:michael)
end
test "unsuccessful edit" do
log_in_as(@user)
get edit_user_path(@user)
assert_template 'users/edit'
patch user_path(@user),params: { user: {name: "",
... | 31.90566 | 75 | 0.524542 |
87373ea64aed81b619c9179b4adbf51a6831cf00 | 75 | module CircuitBreaker
class CircuitBrokenError < StandardError ; end
end
| 18.75 | 48 | 0.826667 |
5d6043e03fc7deedc0e181eb46654f9536328592 | 374 | class Deck
VALUES = %w(2⃣ 3⃣ 4⃣ 5⃣ 6⃣ 7⃣ 8⃣ 9⃣ 🔟 👨 👰 🤴 🅰).freeze
SUITS = %w(♠ ♥ ♦ ♣).freeze
attr_reader :cards
def initialize
@cards = []
VALUES.each do |value|
SUITS.each do |suit|
cards << Card.new(value, suit)
end
end
2.times { cards << Card.new(nil, nil, true) }
... | 15.583333 | 55 | 0.529412 |
01995e28043a0afb2c232986d03fce127b5c240a | 61 | module PG
module Pglogical
VERSION = "0.1.0"
end
end
| 10.166667 | 21 | 0.639344 |
4afdf04016e8aeb50d15a6445ae7e75b538bad62 | 547 | module WhiteTail
module DSL
module Commands
class Attribute < Base
REQUIRED_OPTIONS = [:node_class, :attribute]
ALLOWED_OPTIONS = [:locator, :required]
def execute(execution_context)
Helpers.with_element(execution_context, options) do |element|
value = element[... | 26.047619 | 105 | 0.625229 |
1dcd61de16aeb345f5c2f2f4ea289d39bb7f2a3d | 2,667 | require 'optparse'
module VagrantPlugins
module CommandBox
module Command
class Outdated < Vagrant.plugin("2", :command)
def execute
options = {}
opts = OptionParser.new do |o|
o.banner = "Usage: vagrant box outdated [options]"
o.separator ""
... | 29.633333 | 83 | 0.500187 |
26631482e900e0cc74c01ff6719a630be12fc9d2 | 233 | module HighLineTestHelpers
def prepare_highline
@input = instance_double(IO, eof?: false, gets: "q\n")
@output = StringIO.new
Imap::Backup::Setup.highline = HighLine.new(@input, @output)
[@input, @output]
end
end
| 25.888889 | 64 | 0.682403 |
5dc454122a505bd74099c85e3068b19ff6eab7c2 | 1,776 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Network::Mgmt::V2020_04_01
module Models
#
# IPv6 Circuit Connection properties for global reach.
#
class Ipv6CircuitConnect... | 28.645161 | 78 | 0.569257 |
1c4775b703f5b59bbe884702fe267e18f1ae9e78 | 993 | class Buildapp < Formula
desc "Creates executables with SBCL"
homepage "http://www.xach.com/lisp/buildapp/"
url "https://github.com/xach/buildapp/archive/release-1.5.4.tar.gz"
sha256 "8a3918d740f21fd46c18b08e066fec7525dad790b1355a1e3e5950f2d3ca4291"
head "https://github.com/xach/buildapp.git"
bottle do
... | 34.241379 | 95 | 0.683787 |
3983b5f2f485ef45a68fd7e0cae3af47bebb7a5e | 648 | Pod::Spec.new do |s|
s.name = "GVMusicPlayerController"
s.version = "0.2.0"
s.summary = "The power of AVPlayer with the simplicity of MPMusicPlayerController."
s.homepage = "https://github.com/gangverk/GVMusicPlayerController"
s.license = 'MIT'
s.author = { "Kevin Renskers" ... | 46.285714 | 112 | 0.648148 |
2800670782a6ed96e9cbc7540ea0cd6c87591b84 | 187 | require 'minitest/autorun'
describe_recipe 'template-cookbook::default' do
include MiniTest::Chef::Assertions
include MiniTest::Chef::Context
include MiniTest::Chef::Resources
end
| 23.375 | 47 | 0.791444 |
1c4b079ad1cb05b1df58558945092aa883849f63 | 1,302 | require "resolv"
require File.expand_path( '../item', File.dirname(__FILE__) )
require File.expand_path( '../utils', File.dirname(__FILE__) )
module Simp; end
class Simp::Cli; end
module Simp::Cli::Config
class Item::RemoveLdapFromHiera < ActionItem
attr_accessor :dir
def initialize
super
@key ... | 27.125 | 114 | 0.586022 |
1173ee534357df9bd5c8386f07da1291bd2bf7f2 | 1,287 | # encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative sou... | 34.783784 | 86 | 0.748252 |
6a0ab1873f8cb2ed0043958673e3d5a539b6ab45 | 273 | module ActionClient
class ParseError < ActionClient::Error
attr_reader :body, :cause, :content_type
def initialize(cause, body, content_type)
super(cause.message)
@cause = cause
@content_type = content_type
@body = body
end
end
end
| 21 | 45 | 0.673993 |
1c804c8d5e32763db5055a54e9c983288d39c0b9 | 1,623 | class Libproxy < Formula
desc "Library that provides automatic proxy configuration management"
homepage "https://libproxy.github.io/libproxy/"
url "https://github.com/libproxy/libproxy/archive/0.4.15.tar.gz"
sha256 "18f58b0a0043b6881774187427ead158d310127fc46a1c668ad6d207fb28b4e0"
head "https://github.com/lib... | 33.8125 | 107 | 0.732594 |
5d957fb3d47c059a2e7025180d2189dae05f732c | 3,029 | #!/opt/puppetlabs/puppet/bin/ruby
require_relative '../lib/puppet/util/task_helper'
require 'json'
require 'puppet'
require 'openssl'
# require 'pry-remote'; binding.remote_pry
# class PowerstoreX509CertificateInstanceQueryTask
class PowerstoreX509CertificateInstanceQueryTask < TaskHelper
def task(arg_hash)
hea... | 34.816092 | 134 | 0.648399 |
1a4013b7a55386b276dee208cf807eede6127524 | 1,442 | #-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2017 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of ... | 37.947368 | 91 | 0.763523 |
7920dc699686650ae8a2a52f139182fae84941d8 | 233 | class AddLocationToTours < ActiveRecord::Migration[4.2]
def change
add_column :tours, :latitude, :float, null: true
add_column :tours, :longitude, :float, null: true
add_index :tours, [:latitude, :longitude]
end
end
| 29.125 | 55 | 0.708155 |
261be9780f944cb3b9bd728d88304d1b207a5795 | 596 | module Erp::Products
class ProductsPart < ApplicationRecord
belongs_to :product
belongs_to :part, class_name: 'Erp::Products::Product'#, optional: true
def self.search(params)
query = self.all
query = query.where(product_id: params[:product_id])
return query
end
... | 22.074074 | 76 | 0.57047 |
38f105e88b2719d8a789b4746914e4df50cffb5c | 1,201 | module TestGame
module Jumpable
include TestGame::Fallable
def jump
@jump_held = true
if can_jump?
@jumping = true
@falling = false
@jumping_countdown = 0
@velocity_y = -320
end
end
def release_jump
@jump_held = false
end
def stop_jum... | 17.661765 | 72 | 0.55204 |
79a3552bfb6a201e4cad332e20acebc85c98cd18 | 728 | # frozen_string_literal: true
RSpec.describe Conflow::Redis::FieldBuilder, redis: true do
let(:test_class) { Struct.new(:key) }
let(:instance) { test_class.new("test_key") }
let(:builder) { described_class.new(:params, Conflow::Redis::HashField) }
describe "#call" do
before { builder.call(test_class) }... | 28 | 99 | 0.657967 |
6a840b1317ea9ebcb4ca8158b54559cf3d04b180 | 1,465 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe CoinMarketPro::Endpoint::Base do
let(:api_key) { 'CoinMarketCap-Api-Key' }
let(:client) { CoinMarketPro::Client::Base.new(api_key: api_key) }
let(:subject) { described_class.new(client: client, logger: client.logger) }
describe '#valid_params... | 29.3 | 88 | 0.640956 |
91142c2de0e1ef3a4651c744a13f8124084be4fb | 1,088 | require 'test_helper'
class MicropostsInterfaceTest < ActionDispatch::IntegrationTest
def setup
@user = users(:michael)
end
test "micropost interface" do
log_in_as(@user)
get root_path
assert_select 'div.pagination'
# Invalid submission
assert_no_difference 'Micropost.count' do
pos... | 31.085714 | 71 | 0.706801 |
261e54da6a81fb789b0f02f01f86ebfdddfb8b2c | 39,100 | # frozen_string_literal: true
require 'spec_helper'
describe API::Runners do
let_it_be(:admin) { create(:user, :admin) }
let_it_be(:user) { create(:user) }
let_it_be(:user2) { create(:user) }
let_it_be(:group_guest) { create(:user) }
let_it_be(:group_reporter) { create(:user) }
let_it_be(:group_developer)... | 34.817453 | 133 | 0.631355 |
edd9bea7bdab0f805abd2aeb0604ef9c5a2ad840 | 259 | require 'test_helper'
class ApplicationHelperTest < ActionView::TestCase
test "full title helper" do
assert_equal full_title, "Ruby on Rails Tutorial Sample App"
assert_equal full_title("Help"), "Help | Ruby on Rails Tutorial Sample App"
end
end | 28.777778 | 79 | 0.760618 |
1c61f7e56c07f5b279868e416ea5d305159c402c | 2,315 | # frozen_string_literal: true
require_relative '../../spec_helper'
require 'minitest/hooks/default'
require 'message_bus'
require 'message_bus/distributed_cache'
describe MessageBus::DistributedCache do
before :all do
@bus = MessageBus::Instance.new
@bus.configure(backend: :memory)
@manager = MessageBus... | 17.537879 | 62 | 0.580994 |
e2e9ac200122cda4ce09d4da0e034345cbb5d49f | 359 | # Foo class is very foo
#
# Attributes:
# * id [integer, primary, not null] - primary key
# * body [text] - whatever
# * created_at [foobar] - creation time
# * random_number [integer] - We still haven't found what this actually means, WTF
# * title [octopus] - yellow
# * updated_at [datetime, not null] - last update t... | 29.916667 | 82 | 0.696379 |
016c56987a2e5a13a3cd27efe8324249a6981aeb | 342 | cask "bloomrpc" do
version "1.5.3"
sha256 "9ddc4d9b85af745a5f5e49a55e9dd4d57e09855aee721f77e2a3151744cbc3ad"
url "https://github.com/uw-labs/bloomrpc/releases/download/#{version}/BloomRPC-#{version}.dmg"
name "BloomRPC"
desc "GUI Client for GRPC Services"
homepage "https://github.com/uw-labs/bloomrpc"
a... | 28.5 | 96 | 0.75731 |
ac06cc9aa97170add90e6270aa3f9d7c021685e3 | 365 | require 'serverspec'
# Required by serverspec
set :backend, :exec
describe command('dig +short crackhackforum.com') do
its(:stdout) { should match /10\.0\.6\.66/ }
end
describe command('dig +short ogrean.com') do
its(:stdout) { should match /10\.0\.6\.66/ }
end
describe command('host register.science') do
its(:... | 22.8125 | 52 | 0.684932 |
b90cc38aaa8f351dfa78dd7d5290790f1f7007ce | 96 | json.extract! @message_route, :id, :to_exchange_id, :from_exchange_id, :created_at, :updated_at
| 48 | 95 | 0.791667 |
3873b021ab2f4a26d3e623beb79af36cda87887a | 350 | class CreateSubmissions < ActiveRecord::Migration[4.2]
def change
create_table :submissions do |t|
t.belongs_to :exercise
t.belongs_to :student_registration
t.datetime :submitted_at
t.timestamps null: false
end
add_index :submissions, :exercise_id
add_index :submissions, :stud... | 25 | 54 | 0.725714 |
f7cc44316596dd38828cfef339cf3843b5be2b1f | 1,846 | Merb.logger.info("Compiling routes...")
Merb::Router.prepare do
# RESTful routes
namespace :locomotive, :path => '', :name_prefix => nil do
resources :service_types, 'Locomotive::ServiceType'
resources :dependencies, 'Locomotive::Dependency'
resources :roles, 'Locomotive::Role'
resources :system... | 31.827586 | 88 | 0.715601 |
08fdf00c421b0e5b8855f56a333c3f8c49a9f3e2 | 560 | require_relative 'boot'
require 'rails/all'
Bundler.require(*Rails.groups)
require "tax_jp"
module Dummy
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.2
# Settings in config/environments/* take precedence over ... | 28 | 82 | 0.764286 |
bbe43b2dd37edfe22ab20024719782e52eea7c0a | 3,751 | #
# Codec to provide for MySQL string support
# http://mirror.yandex.ru/mirrors/ftp.mysql.com/doc/refman/5.0/en/string-syntax.html for details
module Owasp
module Esapi
module Codec
class MySQLCodec < BaseCodec
MYSQL_MODE = 0 # MySQL standard mode
ANSI_MODE = 1; # ANSI escape mode
... | 28.416667 | 96 | 0.506798 |
79521660c522265b70451724a6da640c7e88e4d3 | 300 | class CreateAddresses < ActiveRecord::Migration[5.0]
def change
create_table :addresses do |t|
t.string :loc
t.string :label
t.text :memo
t.float :balance
t.float :total_rec
t.float :total_sent
t.float :total_fees
t.timestamps
end
end
end
| 18.75 | 52 | 0.623333 |
1dec7eff673198452447175181061d70f2939043 | 304 | # frozen_string_literal: true
module FedaPay
module APIOperations
module Delete
def delete(params = {}, opts = {})
opts = Util.normalize_opts(opts)
resp, opts = request(:delete, resource_url, params, opts)
initialize_from(resp.data, opts)
end
end
end
end
| 21.714286 | 65 | 0.644737 |
61b401350306ab71c4b98a4303c0d8c17a192140 | 155 | require 'spec_helper'
RSpec.describe Emittance::Sidekiq do
it 'has a version number' do
expect(Emittance::Sidekiq::VERSION).not_to be nil
end
end
| 19.375 | 53 | 0.748387 |
5d0eaa70d62176b5f714b791c6a00eb72ee195c6 | 1,069 | module OverrideOrder
def create_proposed_shipments
shipments = super
create_handling_charge! if needs_handling_charge?
shipments
end
end
Spree::Order.class_eval do
def display_handling_total
Spree::Money.new(handling_total, { currency: currency })
end
# Override if you want to create custo... | 25.452381 | 85 | 0.695042 |
4a3914531a7c2c64c39af11a8873ce14b71d3334 | 1,178 | platform_is_not :windows do
require File.expand_path('../../../spec_helper', __FILE__)
require 'syslog'
describe "Syslog.options" do
platform_is_not :windows do
before :each do
Syslog.opened?.should be_false
end
after :each do
Syslog.opened?.should be_false
end
... | 24.541667 | 67 | 0.618846 |
33a59fa767435111b1191e5730c18cbe72bc87cb | 151 | class ChangePartnerIdToUserIdReservations < ActiveRecord::Migration[4.2]
def change
rename_column :reservations, :partner_id, :user_id
end
end
| 25.166667 | 72 | 0.794702 |
62d4efee27d9c7b81cd34d96eb1432fc3248df3e | 362 | require "gerencianet"
require_relative "../../credentials"
options = {
client_id: CREDENTIALS::CLIENT_ID,
client_secret: CREDENTIALS::CLIENT_SECRET,
sandbox: CREDENTIALS::SANDBOX
}
params = {
id: 1000
}
body = {
email: 'oldbuck@gerencianet.com.br'
}
gerencianet = Gerencianet.new(options)
puts gerencianet.... | 18.1 | 58 | 0.737569 |
bf53c61601b9c80ad4b613f276ed15cc6b813901 | 1,941 | # frozen_string_literal: true
# This returns an app descriptor for use with Jira in development mode
# For the Atlassian Marketplace, a static copy of this JSON is uploaded to the marketplace
# https://developer.atlassian.com/cloud/jira/platform/app-descriptor/
class JiraConnect::AppDescriptorController < JiraConnect... | 29.861538 | 97 | 0.630603 |
e21f8d0ce7fa54ff67b44f2ae6bf0d3adf455011 | 356 | cask 'freedom' do
version '2.2.5'
sha256 'c10d7a8a95387237a30eeba889f9ee0570efc75da783dd117704c9f1e635929e'
url "https://cdn.freedom.to/installers/updates/mac/#{version}/Freedom.zip"
appcast 'https://cdn.freedom.to/installers/updates/mac/Appcast.xml'
name 'Freedom'
homepage 'https://freedom.to/'
auto_up... | 25.428571 | 76 | 0.755618 |
ab4078f5de06af4392f5945d764821bd97ecdb51 | 137 | # Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_spree_session'
| 34.25 | 75 | 0.80292 |
013fd403292519900ccddebed9267c9d44907101 | 965 | module Gorilla
module Middleware
class SignatureAuth < Faraday::Middleware
SIGNATURE_METHOD = 'Signature'.freeze
SIGNATURE_ALGO = 'HS256'.freeze
def initialize(app, opts={})
[:key, :secret].each do |key|
raise ArgumentError, "#{key.inspect} is required" if !opts[key]
... | 23.536585 | 73 | 0.572021 |
0344a7b5e60560570f00d1625cb909fab2ca8f4f | 7,720 | require "sequel"
require "pact_broker/project_root"
require "pact_broker/pacts/latest_tagged_pact_publications"
require "pact_broker/logging"
require "pact_broker/db/clean/selector"
module PactBroker
module DB
class Clean
include PactBroker::Logging
class Unionable < Array
def union(other)
... | 39.793814 | 189 | 0.716321 |
18b62191957c6fa6e77b5ddd6478f0387de3aa09 | 3,761 | require 'spec_helper'
require 'gocardless/paginator'
describe GoCardless::Paginator do
let(:resource_class) { GoCardless::Resource }
let(:path) { '/test' }
let(:query) { { :status => 'active' } }
let(:per_page) { 10 }
let(:page_number) { 1 }
let(:headers_p1) {{
'X-Pagination' => '{"records":15,"pages"... | 27.859259 | 86 | 0.629354 |
1db9bc002ae91b486e6b52668d6c941d7215adef | 1,578 | # encoding: utf-8
require 'spec_helper'
require Rails.root.join('db', 'post_migrate', '20170324160416_migrate_user_activities_to_users_last_activity_on.rb')
describe MigrateUserActivitiesToUsersLastActivityOn, :redis do
let(:migration) { described_class.new }
let!(:user_active_1) { create(:user) }
let!(:user_ac... | 31.56 | 134 | 0.752218 |
ff4e543d941477004d5782438a8b7bba3066f2f0 | 1,100 | class Buildozer < Formula
desc "Rewrite bazel BUILD files using standard commands"
homepage "https://github.com/bazelbuild/buildtools"
url "https://github.com/bazelbuild/buildtools.git",
:tag => "3.3.0",
:revision => "ce0cf814cb03dddf546ea92b3d6bafddb0b9eaf8"
license "Apache-2.0"
head "https://gi... | 33.333333 | 93 | 0.744545 |
624f255eaf73c6a40143208761b56eda7f3c58ef | 526 | class Launch4j < Formula
desc "Cross-platform Java executable wrapper"
homepage "https://launch4j.sourceforge.io/"
url "https://downloads.sourceforge.net/project/launch4j/launch4j-3/3.12/launch4j-3.12-macosx-x86.tgz"
version "3.12"
sha256 "754e557036ff4a469b4a24443c809113f85b9a0689a5ffdcf35a8a6e986c458f"
b... | 27.684211 | 103 | 0.730038 |
1a16f1c34e5326fba1d2122be1cbde1088af927d | 368 | cask 'farrago' do
version '1.2.0'
sha256 '67fd873285aa2b698d159d419a567504676984ab6d7de64dcc7e91461cbf8ac7'
url 'https://rogueamoeba.com/farrago/download/Farrago.zip'
appcast 'https://rogueamoeba.net/ping/versionCheck.cgi?format=sparkle&bundleid=com.rogueamoeba.Farrago'
name 'Farrago'
homepage 'https://rog... | 30.666667 | 105 | 0.782609 |
188d1b4683fc1cc8608fc911bb5ce279c58fa38e | 141 | class AddRoomToEvents < ActiveRecord::Migration[5.2]
def change
add_reference :events, :room, index: true, foreign_key: true
end
end
| 23.5 | 64 | 0.744681 |
f85d5d9c37b1554367d9ad0037b652145793baac | 1,346 | cask "blender" do
arch = Hardware::CPU.intel? ? "x64" : "arm64"
version "2.93.6"
url "https://download.blender.org/release/Blender#{version.major_minor}/blender-#{version}-macos-#{arch}.dmg"
if Hardware::CPU.intel?
sha256 "db703fbd60713f0b4270fc406b7a270d136bb6ae22a649b733fad4f61177b58d"
else
sha256... | 29.911111 | 111 | 0.697623 |
014767dd08ebcfdd8e06ac40f2b45b10ec1be3eb | 654 | require 'charyf/utils/generator/base'
module Facebook
module Interface
module Generators
class InstallGenerator < ::Charyf::Generators::Base
source_root File.expand_path('templates', __dir__)
def initializer
template 'config/initializers/facebook.rb.tt'
end
def ... | 26.16 | 95 | 0.633028 |
ffdbdcbabad17f8d67a87cd9131cdf77077584bb | 22,910 | #
# Author:: Adam Jacob (<adam@chef.io>)
# Author:: Seth Falcon (<seth@chef.io>)
# Author:: Kyle Goodwin (<kgoodwin@primerevenue.com>)
# Copyright:: Copyright (c) Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file ex... | 40.477032 | 224 | 0.711174 |
f75fd180f4ef5cccd09ce5c28a96d0c4315addd6 | 4,563 | class NationBuilder::Client
def initialize(nation_name, api_key, opts = {})
@nation_name = nation_name
@api_key = api_key
@name_to_endpoint = {}
@base_url = opts[:base_url] || 'https://:nation_name.nationbuilder.com'
@retries = opts[:retries] || 8
@http_client = opts[:http_client] || HTTPClie... | 24.934426 | 75 | 0.667324 |
910a104e72d4567e09c092498612390179a124de | 1,169 | class Program < ApplicationRecord
include Codeable
include Nameable
include FinanceSpendable
include FinancePlannable
include BudgetItemDuplicatable
include PermaIdable
belongs_to :spending_agency
belongs_to :parent_program, class_name: 'Program'
has_many :child_programs,
class_name: 'Pro... | 21.648148 | 67 | 0.740804 |
e88549bc6bec781221c7d4a4c9b1726fb52bb356 | 931 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 32.103448 | 74 | 0.729323 |
182222e453212848c0882f9a685001c6298c8bfd | 617 | # Bundler monkey patches
module ::Bundler
# Patch bundler to write a .lock file specific to the version of ruby.
# This keeps MRI/JRuby/RBX from conflicting over the Gemfile.lock updates
module SharedHelpers
def default_lockfile
ruby = "#{LogStash::Environment.ruby_engine}-#{LogStash::Environment.ruby_a... | 29.380952 | 93 | 0.692058 |
39207e0b8dc3eeb757d437b3c3d8fd9478f4cd5a | 663 | require File.dirname(__FILE__) + '/../integration_helper'
$setup_loader.each_setup do |setup|
context "Basic Operation for #{setup.name}" do
setup do
setup.setup_test
end
teardown do
setup.teardown_test
end
specify "should execute async operation" do
BasicOperationWorker.as... | 24.555556 | 100 | 0.689291 |
bb61cd527491a9ad4f98a4050bb98fe6ddfbe8f3 | 37 | module Mpesa
VERSION = '0.1.0'
end
| 9.25 | 19 | 0.648649 |
1a0328daa1ce8ad5f21cbb05a928fbb0f268cd03 | 462 | module Webspicy
class Tester
class Result
class PostconditionMet < Check
def initialize(result, post)
super(result)
@post = post
end
attr_reader :post
def behavior
post.to_s
end
def must?
true
end
def... | 16.5 | 36 | 0.532468 |
f7f89ddee0a48acf58a3bc847c83ba46cedc2621 | 2,901 | # Encoding: utf-8
# IBM WebSphere Application Server Liberty Buildpack
# Copyright 2013 the original author or authors.
#
# 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.apa... | 41.442857 | 138 | 0.717684 |
87eed9c760b5bcc247751350c59e23aa5fd7f75f | 219 | class Candidate < ActiveRecord::Base
has_many :skills, dependent: :destroy
validates :name, :email, presence: true
validates :email, uniqueness: true
validates_associated :skills
def to_s
name
end
end
| 18.25 | 41 | 0.73516 |
f8a0596a39e6abf5edbe91e5408b0bf9a7e290a9 | 268 | if Rails.env.development? || Rails.env.test?
ActiveRecordQueryTrace.enabled = false
ActiveRecordQueryTrace.level = :app
ActiveRecordQueryTrace.ignore_cached_queries = true
ActiveRecordQueryTrace.colorize = 'light purple'
ActiveRecordQueryTrace.lines = 5
end
| 33.5 | 53 | 0.80597 |
6af307cebddb6e52cb80fbb1c349f72c957c43f1 | 760 | # frozen_string_literal: true
require "rails_helper"
RSpec.describe "PreferredNames", type: :request do
let(:user) { create(:user, account_created: false) }
before do
sign_in user
end
describe "GET /preferred-name/edit" do
it "renders edit template" do
get "/preferred-name/edit"
expect(r... | 24.516129 | 73 | 0.671053 |
d5c0783cb8539e6888810c1763f5556c9ba7ba93 | 256 | module Cms
module Articles
module ActionControllerExtensions
module ClassMethods
def tracks_articles
end
end
end
end
end
ActionController::Base.send(:extend, Cms::Articles::ActionControllerExtensions::ClassMethods) | 19.692308 | 93 | 0.722656 |
268a859dc61a3026849d77b3fb87354bafa04bf5 | 2,560 | require File.dirname(__FILE__) + '/test_helper'
DIR = '/tmp/bdb_deadlock_test'
Bdb::Environment.config :path => DIR, :cache_size => 1 * 1024 * 1024, :page_size => 512
class DeadlockTest < Test::Unit::TestCase
def setup
FileUtils.rmtree DIR
FileUtils.mkdir DIR
Bdb::Environment[DIR].close
@db =... | 20.31746 | 87 | 0.533203 |
1852ae108ee320688df606f30176136ce1bbe6a9 | 1,688 | class FlintChecker < Formula
desc "Check your project for common sources of contributor friction"
homepage "https://github.com/pengwynn/flint"
url "https://github.com/pengwynn/flint/archive/v0.1.0.tar.gz"
sha256 "ec865ec5cad191c7fc9c7c6d5007754372696a708825627383913367f3ef8b7f"
bottle do
cellar :any_skip... | 41.170732 | 93 | 0.75 |
f7c072cfcf2500807647ef4e1cb18efb244c4196 | 283 | RSpec.shared_examples_for 'Msf::DBManager::Note' do
unless ENV['REMOTE_DB']
it { is_expected.to respond_to :each_note }
end
it { is_expected.to respond_to :find_or_create_note }
it { is_expected.to respond_to :notes }
it { is_expected.to respond_to :report_note }
end | 28.3 | 55 | 0.742049 |
87bd03f6eb7e7d8fda3f5b635911174df3269c58 | 934 | # encoding: UTF-8
require_relative '../core/lib/spree/core/version.rb'
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'spree_backend'
s.version = Spree.version
s.summary = 'backend e-commerce functionality for the Spree project.'
s.description = 'Required dependency... | 31.133333 | 78 | 0.656317 |
79e621145258d098abc2b8931a0d106029666f09 | 864 | # name: SCEMOJI
# about: adds an evil trout emoji
# version: 0.2.5
# authors: DJShaneypup, DanTheDak
# url: https://github.com/DJShaneypup/scfemoji
register_asset "javascripts/biblethump.js", :server_side
register_asset "javascripts/coolcat.js", :server_side
register_asset "javascripts/datsheffy.js", :server_side
regi... | 39.272727 | 58 | 0.815972 |
1a7e9dce59ecb335783085d5432aef9c0ecacf55 | 3,445 | module Lint
module Hashes
def test_hset_and_hget
r.hset("foo", "f1", "s1")
assert_equal "s1", r.hget("foo", "f1")
end
def test_hsetnx
r.hset("foo", "f1", "s1")
r.hsetnx("foo", "f1", "s2")
assert_equal "s1", r.hget("foo", "f1")
r.del("foo")
r.hsetnx("foo", "f... | 21.134969 | 79 | 0.501887 |
28f63fb55520401773b4e17928a71b31cd400885 | 11,181 | # encoding: UTF-8
require File.expand_path(File.dirname(__FILE__)) + '/helper'
# Random tests for specific issues.
#
# The test suite will be cleaned up at some point soon.
class TestMisc < Premailer::TestCase
# in response to http://github.com/alexdunae/premailer/issues#issue/4
#
# NB: 2010-11-16 -- after reve... | 29.895722 | 125 | 0.63912 |
395e92324fb412b323458b85ed918ce74599f547 | 3,046 | FROM ruby:2.5.1
RUN apt-get update && apt-get install -y \
wget \
python-pip
RUN pip install --upgrade pip anchorecli
# java required for updatebot
RUN apt-get update && apt-get install -y openjdk-8-jre
# chrome
RUN apt-get install -y libappindicator1 fonts-liberation libasound2 libnspr4 libnss3 libxss1 lsb-rel... | 35.011494 | 179 | 0.736376 |
5dcb4a1dd528bcbe6135de5d6a2741ec5f0d2366 | 1,016 | Pod::Spec.new do |s|
s.name = 'AlipaySDK_No_UTDID-Mirror'
s.version = '15.8.00'
s.summary = 'A Mirror For AlipaySDK_No_UTDID'
s.homepage = 'https://github.com/Dwarven/AlipaySDK_No_UTDID-Mirror'
s.ios.deployment_target = '7.0'
s.license ... | 53.473684 | 168 | 0.587598 |
d59d9a3f920e7a8457296441376195fadda074cc | 140 | class FixUserIndexes < ActiveRecord::Migration[6.0]
def change
remove_index :users, name: 'index_users_on_uid_and_provider'
end
end
| 23.333333 | 64 | 0.778571 |
617b3bf977303bdeca218d1e97900034fc28aa75 | 847 | # frozen_string_literal: true
module SpecSupport
module Helpers
def build_cache_store
case
when Testing.test_redis_cache?
Cache::Redis.build
when Testing.test_redis_store_cache?
Cache::RedisStore.build
when Testing.test_dalli_cache?
Cache::Dalli.build
when Te... | 29.206897 | 51 | 0.716647 |
389b96d3c488740aa7860230b83c6ff677000837 | 338 | # frozen_string_literal: true
namespace :db do
namespace :mongoid do
desc "Drop all collections in all databases, including indexes."
task purge_all: :environment do
Mongoid::Clients.default.database.collections.each(&:drop)
Mongoid::Clients.with_name("users").database.collections.each(&:drop)
... | 24.142857 | 75 | 0.727811 |
ffc23d882b695a8ac801feeda47513b5a5f2bde1 | 9,035 | require 'spec_helper'
module Bosh::Director::DeploymentPlan
describe NetworkPlanner::ReservationReconciler do
include Bosh::Director::IpUtil
describe :reconcile do
let(:network_planner) { NetworkPlanner::ReservationReconciler.new(instance_plan, logger) }
let(:instance_model) { Bosh::Director::Mod... | 43.4375 | 134 | 0.645047 |
d5b6c61c57d4b8ed4abc2955a863c2e1da2952ea | 1,791 | require 'test_helper'
class CategoriesControllerTest < ActionDispatch::IntegrationTest
test "should get category index" do
sign_in_as :moderator
get categories_path
assert_response :success
end
test "should create category" do
sign_in_as :moderator
get new_category_path
assert_response :... | 24.202703 | 84 | 0.691792 |
f7e5a09d13137add813de76e76d7f98d31f180de | 6,319 | require "test_helper"
class Feedkit::RequestTest < Minitest::Test
def test_should_be_html
url = "http://www.example.com/atom.xml"
body = "<a>hello</a><meta />"
stub_request(:get, url).to_return(body: body)
response = ::Feedkit::Request.download(url)
document = response.parse(validate: false)
... | 27.004274 | 104 | 0.67115 |
3397778c737c349c0d6e6176e66eb688e888d37f | 156 | class CreateRecipes < ActiveRecord::Migration[5.0]
def change
create_table :recipes do |t|
t.string :name
t.timestamps
end
end
end
| 15.6 | 50 | 0.660256 |
398884df10daa2021fff7fae6dc6e7532f97cbf7 | 121 | class AddPlayerIdToWins < ActiveRecord::Migration[6.1]
def change
add_column :wins, :player_id, :integer
end
end
| 20.166667 | 54 | 0.743802 |
bf67e54f6d3639883c30154894737ab09dbe72d0 | 217 | class User < ActiveRecord::Base
has_many :attendances, :class_name => "Attendance", :dependent => :destroy
has_many :attended_events, :through => :attendances
has_many :events, :dependent => :destroy
end
| 24.111111 | 76 | 0.709677 |
e9feed2bb37234b595c08cf31de66d99ebd3621d | 691 | class EntryPolicy
attr_reader :user, :entry
def initialize(user, entry)
@user = user
@entry = entry
end
def index?
true
end
def show?
#scope.where(id: entry.id).exists?
true
end
def create?
@entry.user_id == user.id
end
def new?
create?
end
def update?
@entr... | 12.563636 | 43 | 0.597685 |
ac6990b1a22ac28aec13e76d3ebf075465f1a3ad | 4,628 | =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: \" \\
OpenAPI spec version: 1.0.0
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 3.3.4-SNAPSHOT
=end
require 'spe... | 31.917241 | 157 | 0.714347 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.