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 |
|---|---|---|---|---|---|
f7ef0ba02ca50e7707186adad4fb3e10180d3686 | 170 | require 'jquery/modal/filters/ajax_request_filters'
module Jquery
module Filters
end
end
ActiveSupport.on_load(:action_controller) do
include Jquery::Filters
end
| 15.454545 | 51 | 0.811765 |
4a1037a53fc87dea4778df710215deb38cc78c9f | 241 | # frozen_string_literal: true
title 'Chruby should be installable and available'
describe file('/usr/local/share/chruby/chruby.sh') do
it { should exist }
end
describe file('/usr/local/share/chruby/auto.sh') do
it { should exist }
end
| 21.909091 | 53 | 0.742739 |
91a148e471b342b9c590de86eafce61148bd3bf5 | 713 | require 'trb1-representable/binding'
module Trb1
module Representable
module Hash
class Binding < Representable::Binding
def self.build_for(definition)
return Collection.new(definition) if definition.array?
new(definition)
end
def read(hash, as)
hash.h... | 20.371429 | 64 | 0.584853 |
ac606c9d8f81303ec3b46855b772f24f1311cc0f | 33,179 | # frozen_string_literal: true
require "abstract_unit"
require "active_support/log_subscriber/test_helper"
require "active_support/messages/rotation_configuration"
# common controller actions
module RequestForgeryProtectionActions
def index
render inline: "<%= form_tag('/') {} %>"
end
def show_button
re... | 31.689589 | 129 | 0.756322 |
bb0971993c2ddf455e4b17da51e1e408e2c70fc7 | 305 | # frozen_string_literal: true
class BranchDecorator < Draper::Decorator
delegate_all
def as_json(*)
{
id: id,
name: name,
order_id: order_id,
path: path,
created_at: created_at.iso8601,
updated_at: updated_at.iso8601,
count: srpms.count
}
end
end
| 16.944444 | 41 | 0.632787 |
e80b219b8a481071e8c2ee679e31a73c03fa2195 | 364 | class CreateCatalogues < ActiveRecord::Migration
def change
create_table :catalogues do |t|
t.string :name
t.integer :parent_id
t.integer :lft, default: 0
t.integer :rgt, default: 0
t.integer :depth, default: 0
t.timestamps
end
add_index :catalogues, :parent_id
ad... | 21.411765 | 48 | 0.648352 |
627cff0925663471da941c16542a79e83e38400e | 2,342 | require "rails_helper"
class OrdersController < ApplicationController
end
describe OrdersController, type: :controller do
shared_examples "a payload setter" do |payload_type|
describe "#set_#{payload_type}_payload" do
it "sets the #{payload_type}_payload to an array of the passed arguments" do
con... | 39.033333 | 103 | 0.694278 |
1d1ed3f329e7c9c21bd0eb6cbddc2ec35fbc6304 | 2,051 | # 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.
#
# This file is the source Rails uses to define your schema when running `bin/rai... | 40.215686 | 91 | 0.740614 |
91aa14fab33c1af0dadc96ff9e4cfc99fe977227 | 1,369 | class Mkcert < Formula
desc "Simple tool to make locally trusted development certificates"
homepage "https://github.com/FiloSottile/mkcert"
url "https://github.com/FiloSottile/mkcert/archive/v1.4.1.tar.gz"
sha256 "b539e11ac0a06ff4831b76134b8d391610287cf8e56b002365b3786b96e0acbe"
bottle do
cellar :any_ski... | 37 | 93 | 0.73046 |
5d7957d1e8a63b8654f6e149143d93575de79940 | 573 | # frozen_string_literal: true
require 'simplecov' unless ENV['CI']
require 'capybara'
require 'capybara/dsl'
$LOAD_PATH << './lib'
$LOAD_PATH << './features/support'
require 'site_prism'
require_relative 'fixtures/all'
Capybara.default_max_wait_time = 0
RSpec.configure do |rspec|
rspec.default_formatter = :docu... | 17.363636 | 53 | 0.710297 |
798986e865b2d840556c96e9243c49d5c2c5b776 | 107 | # frozen_string_literal: true
FactoryBot.define do
factory :field_type do
name { 'text' }
end
end
| 13.375 | 29 | 0.71028 |
6a0b4a8af20edc465bed3d7ef6d6654bfa3d07b6 | 2,017 | # -*- encoding: utf-8 -*-
# stub: ffi 1.15.5 ruby lib
# stub: ext/ffi_c/extconf.rb
Gem::Specification.new do |s|
s.name = "ffi".freeze
s.version = "1.15.5"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "bug_tracker_uri" => "https:... | 46.906977 | 401 | 0.676748 |
e2e1cf0ea69e007eaf260a8a85f3245fa93b6b79 | 11,213 | #!/usr/bin/env ruby
#
# Mapping demo: Outbound, from inhouse to EANCOM
#
# Inhouse format: GS1 Germany's WebEDI ASCII interface for ORDERS
# Output format: EANCOM'02 ORDERS, according to GS1 Germany'
# recommendations for application
# (EDI-Anwendungsempfehlungen V 2.0 (ORDERS) in EANCO... | 27.415648 | 96 | 0.607331 |
5de591a76d9d386dcd376d6c6691f5a2be43609d | 433 | require "bundler/setup"
require "peatio/ganjacoin"
require "pry-byebug"
require "webmock/rspec"
require "mocha"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` a... | 24.055556 | 66 | 0.757506 |
396ce85ef105835305d577e7c6c3010f055d62da | 1,962 | # frozen_string_literal: true
require "active_support/core_ext/object/inclusion"
# A set of transformations that can be applied to a blob to create a variant. This class is exposed via
# the `ActiveStorage::Blob#variant` method and should rarely be used directly.
#
# In case you do need to use this directly, it's ins... | 35.035714 | 104 | 0.737003 |
bfc614ef066b29dcbf58d9c730b4c62b800013b3 | 133 | module Types
class ApiUserType < BaseObject
field :id, ID, null: false
field :display_name, String, null: false
end
end
| 19 | 44 | 0.699248 |
ffc8c35fbcc3c3cf6d9302680e03981df9e14c43 | 1,801 | # frozen_string_literal: true
module Packages
class GroupPackagesFinder
attr_reader :current_user, :group, :params
InvalidPackageTypeError = Class.new(StandardError)
def initialize(current_user, group, params = { exclude_subgroups: false, order_by: 'created_at', sort: 'asc' })
@current_user = cur... | 25.366197 | 115 | 0.705164 |
bb65ee8b65548d47c9c727288399dd39260cefca | 2,167 | # 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... | 38.696429 | 116 | 0.702353 |
9143cda3847f45069a2678a98e4d59f17aa80526 | 7,233 | module Capachrome
module Remote
#
# Specification of the desired and/or actual capabilities of the browser that the
# server is being asked to create.
#
class Capabilities
DEFAULTS = {
:browser_name => "",
:version => "",
:platform ... | 29.402439 | 108 | 0.512374 |
6aca1e39a17d0d01a5401b645aea2de77304f213 | 1,370 | require 'spec_helper'
describe Zuora::Objects::AmendRequest do
describe "most persistence methods" do
it "are not publicly available" do
[:update, :destroy, :where, :find].each do |meth|
subject.public_methods.should_not include(meth)
end
end
end
describe "generating a request" do
... | 34.25 | 127 | 0.70219 |
338b159aa05bc29eb6bb1513ae33ab5c39a0409e | 162 | class PagesController < ApplicationController
def index
p params[:controller]
end
def residential
end
def corporate
end
end
| 13.5 | 45 | 0.641975 |
030f693bc70242899aa43f8391beda6a1d64bf70 | 600 | # frozen_string_literal: true
Spree::HomeController.class_eval do
before_action :get_homepage
helper 'spree/blogs/posts'
def index
@searcher = build_searcher(params.merge(include_images: true))
@products = @searcher.retrieve_products.limit(8)
@taxonomies = Spree::Taxonomy.includes(root: :children)
... | 22.222222 | 66 | 0.718333 |
f78b818b79c3d97ecf533bfd608507c94feaac98 | 1,358 | title 'Tests to confirm bison works as expected'
plan_origin = ENV['HAB_ORIGIN']
plan_name = input('plan_name', value: 'bison')
control 'core-plans-bison-works' do
impact 1.0
title 'Ensure bison works as expected'
desc '
Verify bison by ensuring that
(1) its installation directory exists
(2) it returns t... | 34.820513 | 84 | 0.698822 |
1af0c43678681497e182644029972f4f31b6c0c9 | 1,003 | # frozen_string_literal: true
require_relative './base'
require_relative 'attributes/id'
require_relative 'attributes/expiry'
require_relative 'attributes/active'
require_relative 'attributes/eta'
module Warframe
module Models
# Sortie data model.
# {https://api.warframestat.us/pc/sortie /:platform/sortie}
... | 27.108108 | 63 | 0.695912 |
6a1850702b994b68a569e68c92d5a46e873310dc | 1,529 | # -*- encoding: utf-8 -*-
# stub: builder 3.2.4 ruby lib
Gem::Specification.new do |s|
s.name = "builder".freeze
s.version = "3.2.4"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Jim Weirich".free... | 63.708333 | 278 | 0.714192 |
083e1a3ebdd4c5d1c02a69e1020e50f064c7954d | 15,353 | module IdentityCache
module QueryAPI
extend ActiveSupport::Concern
included do |base|
base.after_commit :expire_cache
if Gem::Version.new(ActiveRecord::VERSION::STRING) < Gem::Version.new("4.0.4")
base.after_touch :expire_cache
end
end
module ClassMethods
# Similar to... | 38.672544 | 195 | 0.65466 |
f8e45aaa7e750577a359e56d7cc2c3b384e45b03 | 995 | # frozen_string_literal: true
module Cleanup
module Deprecators
# Used to deprecate methods with non-idiomatic getter names.
#
# There are methods in the code with non-idiomatic method names. Typically,
# Ruby getters are named as nouns for the attribute they are returning.
# Prefer User#status o... | 36.851852 | 95 | 0.684422 |
d5be8a0486b0c351ea212f77ae33f9d3cf1772c1 | 510 | # Network configuration
require 'spec_helper'
describe file('/etc/sysconfig/network-scripts/ifcfg-eth0') do
it { should be_file }
end
# Ugly hack to get around vbox still using biosdevname on 7.0. We fix it
# during provisioning so device name is correct when building subsequent
# images. I didn't like having to... | 30 | 73 | 0.741176 |
bf4968ad0ad7e58850946d6f5302e14ea4ff6093 | 1,261 | # frozen_string_literal: true
require 'forwardable'
module Expire
# All Backups go here
class BackupList
include Enumerable
extend Forwardable
def initialize(backups = [])
# @backups = backups.sort.reverse
@backups = backups
end
attr_reader :backups
def_delegators :backups, ... | 18.014286 | 85 | 0.640761 |
ed7e783334ecbd1949336081b8132f0a006a1e56 | 1,113 | module Fog
module Metering
class TeleFonica
class Real
def list_meters(options = [])
data = {
'q' => []
}
options.each do |opt|
filter = {}
['field', 'op', 'value'].each do |key|
filter[key] = opt[key] if opt[key]
... | 23.680851 | 64 | 0.424079 |
abdb60ab09c57b9a07dd59e506efab0cfcaf65ea | 2,840 | # typed: false
require_relative './test'
class Vonage::VoiceTest < Vonage::Test
def calls
Vonage::Voice.new(config)
end
def calls_uri
'https://api.nexmo.com/v1/calls'
end
def call_uri
'https://api.nexmo.com/v1/calls/' + call_uuid
end
def test_create_method
params = {
to: [{type: ... | 25.132743 | 88 | 0.715493 |
edec2e6463ea378948e7dc9558d7427e95a56d38 | 2,511 | CafeGrader::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
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.act... | 35.871429 | 104 | 0.759458 |
4abd5c1b8064dd9c588c13c21233b22af04bc290 | 302 | class Notification
def self.draft_for_review(draft: nil)
if draft.in_review? && draft.friend.remote_clinic_lawyers.present?
ReviewMailer.review_needed_email(draft).deliver_now
elsif draft.in_review?
ReviewMailer.lawyer_assignment_needed_email(draft).deliver_now
end
end
end
| 30.2 | 70 | 0.781457 |
390c5b718e80766358c4dc8ef025b6aeb48e1cf0 | 1,933 | require File.dirname(__FILE__) + '/../spec_helper'
describe CalendarDateSelect::IncludesHelper do
include ActionView::Helpers::TagHelper
include ActionView::Helpers::AssetTagHelper
include CalendarDateSelect::IncludesHelper
describe "calendar_date_select_includes" do
it "should include the specified loc... | 41.12766 | 137 | 0.756337 |
5df45ca9fdef0f71a54a4df7ae557da2a663aad5 | 475 | require 'rails_helper'
describe "asset_events/_condition_update_event_form.html.haml", :type => :view do
it 'fields' do
test_asset = create(:buslike_asset)
assign(:asset, test_asset)
assign(:asset_event, ConditionUpdateEvent.new(:asset => test_asset))
render
expect(rendered).to have_field('asset... | 31.666667 | 81 | 0.755789 |
388fbabb2a5086dd94ec2a89a99dd9b5c2c4c50b | 9,044 | =begin
#Datadog API V2 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... | 30.972603 | 234 | 0.630916 |
3975c51b31c16edcf8f4fef03098bde8368af513 | 5,486 | require "spec_helper"
describe "nginx::configuration" do
let(:chef_run) do
ChefSpec::SoloRunner.new.converge(described_recipe, "nginx::service")
end
it "creates the configuration directory" do
expect(chef_run).to create_directory("/etc/nginx").with(
owner: "root",
group: "root",
recurs... | 27.989796 | 79 | 0.609005 |
5d73a61ebb16907043bec189a9e43380f87ad018 | 263 | # frozen_string_literal: true
# Returns the full path to the folder with the given name inside the current
# Git workspace
def git_folder folder_name
"#{git_root_folder}/#{folder_name}"
end
def git_root_folder
output_of 'git rev-parse --show-toplevel'
end
| 20.230769 | 76 | 0.775665 |
085315e137ce8866457bae51e53d53960328af6c | 1,697 | require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/fixtures/classes'
describe "Kernel#`" do
it "is a private method" do
Kernel.should have_private_instance_method(:`)
end
it "returns the standard output of the executed sub-process" do
ip = 'world'
`echo disc #... | 28.762712 | 77 | 0.600471 |
1c6a22a03e7044718aa58816307469c6be98dbf6 | 6,380 | =begin
#Selling Partner API for Direct Fulfillment Payments
#The Selling Partner API for Direct Fulfillment Payments provides programmatic access to a direct fulfillment vendor's invoice data.
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.26
=... | 29.953052 | 132 | 0.631975 |
62198266609eb49ae162597aae068cadfdc4a0c3 | 235 | class StorageProvider::LocalProvider < StorageProvider::BaseProvider
def default_environment_variables
{
'DIRECTORY' => nil
}
end
def required_environment_variables
default_environment_variables.keys
end
end
| 19.583333 | 68 | 0.761702 |
87ffd250a40260c031612c1cb7fbcc85c88b4a13 | 78 | module Keap
module XMLRPC
class ProductImage < Object
end
end
end
| 11.142857 | 31 | 0.692308 |
79cfc554c4ea5082729d2d14a8898723c645ef8d | 39,868 | #
# REST API Querying capabilities
# - Paging - offset, limit
# - Sorting - sort_by=:attr, sort_oder = asc|desc
# - Filtering - filter[]=...
# - Selecting Attributes - attributes=:attr1,:attr2,...
# - Querying by Tag - by_tag=:tag_path (i.e. /department/finance... | 39.356367 | 165 | 0.628323 |
eddd8f8222684f075e033c518f737d22a7241de3 | 136 | class RenameServicesServiceId < ActiveRecord::Migration[5.2]
def change
rename_column :bookings, :services, :service_id
end
end
| 22.666667 | 60 | 0.772059 |
e2666f56a5fc22b2285956468a391d89e0363f5b | 741 | require 'spec_helper'
describe MetasploitDataModels::Search::Operation::Port::Number do
context 'CONSTANTS' do
context 'BITS' do
subject(:bits) {
described_class::BITS
}
it { should == 16 }
end
context 'MAXIMUM' do
subject(:maxium) {
described_class::MAXIMUM
... | 18.073171 | 78 | 0.580297 |
5dbf89faf73c467470ef82fe4c93aba830775b75 | 2,094 | # The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
Rails.application.configure do
# Settings... | 39.509434 | 85 | 0.776982 |
1a2c1e122a2fc0cb71e4ca227925c83003c489bb | 479 | #------------------------------------------------------------------------------
#
# WARNING !
#
# This is a generated file. DO NOT EDIT THIS FILE! Your changes will
# be lost the next time this file is regenerated.
#
# This file was generated using asterisk-ari-client ruby gem.
#
#----------------------------------... | 23.95 | 79 | 0.461378 |
08bbd331c30c0783ff7123b43c36d8a86fbdee0b | 6,025 | # frozen_string_literal: true
module Solargraph
module Parser
module Legacy
# A factory for generating chains from nodes.
#
class NodeChainer
include NodeMethods
Chain = Source::Chain
# @param node [Parser::AST::Node]
# @param filename [String]
... | 40.436242 | 130 | 0.524149 |
338d8c4d5330114a340a0cbdbf3e1b1f5d5d1fb8 | 1,160 | module Deliveries
module Couriers
module Ups
module JsonRequest
private
def call(body, method: :post, url_params: {}, query_params: {})
plain_response = HTTParty.public_send(
method,
api_endpoint % url_params,
body: body&.to_json,
qu... | 28.292683 | 92 | 0.562069 |
085f25e296afdc620f49eee2d25c4094e031b2da | 1,292 | # frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
Gem::Specification.new do |spec|
spec.name = 'mitamae-plugin-resource-apt-repository'
spec.version = '0.0.1'
spec.authors = ['Moritz Heiber']
spec.email = [... | 39.151515 | 104 | 0.674149 |
f79faf984674b3a77f8806d790078234fb89be21 | 333 | class Squares
SQUARE = 2
private_constant :SQUARE
def initialize(number)
@sum = (1..number).method(:sum)
end
def square_of_sum
sum.call**SQUARE
end
def sum_of_squares
sum.call { |number| number**SQUARE }
end
def difference
square_of_sum - sum_of_squares
end
private
attr_rea... | 13.32 | 40 | 0.678679 |
e2cd29bf95b68a39beda5f796b10a66a03449f45 | 311 | class CreateGuideTaxa < ActiveRecord::Migration
def change
create_table :guide_taxa do |t|
t.integer :guide_id
t.integer :taxon_id
t.string :name
t.string :display_name
t.timestamps
end
add_index :guide_taxa, :guide_id
add_index :guide_taxa, :taxon_id
end
end
| 20.733333 | 47 | 0.678457 |
281d91c6a462aa28f66db2fe44f2d21032eb37bf | 2,351 | require 'spec_helper'
describe 'collectd::plugin::exec', :type => :class do
let :facts do
{
:osfamily => 'Debian',
:concat_basedir => tmpfilename('collectd-exec'),
:id => 'root',
:kernel => 'Linux',
:path => '/usr/local/sbin:/usr/local/b... | 32.652778 | 92 | 0.540621 |
391e14b9b60e3b2d09441d9464f126ed46aca38c | 59 | module Marvel
module Api
VERSION = "0.1.0"
end
end
| 9.833333 | 21 | 0.627119 |
5d8da2c7394c247f5d34b64178e6034fb628cf70 | 746 | require 'active_support/concern'
require 'rails/rack/logger'
# Borrowed from [lograge](https://github.com/roidrage/lograge)
# The MIT License (MIT)
# Copyright (c) 2016 Mathias Meyer
module Rails
module Rack
# Overwrites defaults of Rails::Rack::Logger that cause
# unnecessary logging.
# This effectively... | 26.642857 | 62 | 0.671582 |
f88bf237301f1ee9dcb1be8a12ef5314612540fa | 1,119 | require 'rails_helper'
describe 'Sub-group project issue boards', :feature, :js do
let(:group) { create(:group) }
let(:nested_group_1) { create(:group, parent: group) }
let(:project) { create(:empty_project, group: nested_group_1) }
let(:board) { create(:board, project: project) }
let(:label) { create(:label... | 25.431818 | 76 | 0.659517 |
28bc43e7c61f0d5f729e81fbf02faa860883404b | 86 | module Clockpicker
module Rails
class Railtie < ::Rails::Railtie; end
end
end
| 14.333333 | 41 | 0.709302 |
26472bfad1ef524d75db7c2007d4e3fad84bb2aa | 1,886 | #
# Author:: Adam Jacob (<adam@opscode.com>)
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Copyright:: Copyright (c) 2008, 2011 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licen... | 24.493506 | 74 | 0.604454 |
ab7504cedac66e3b523253b6450c27ba8deaf867 | 1,342 | # 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... | 27.958333 | 74 | 0.628912 |
e2b7f556405655081c7a78f142b0fe52a124f094 | 2,533 | # Extracted from dm-validations 0.9.10
#
# Copyright (c) 2007 Guy van den Berg
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the right... | 33.773333 | 105 | 0.69246 |
032609b5788c1395e422226accb99502bbcdeb05 | 2,342 | class Github::CheckSuite < ApplicationRecord
BLOCKED_AUTHORS = %w[
tensorflow-copybara
gatsbybot
].freeze
attr_accessor :github_token,
:github_run_id,
:repository_full_name,
:head_sha,
:pull_request_number,
:head_branch, :act... | 26.314607 | 196 | 0.660974 |
5ddd3e91eef65fe9c99e454040f1e4b4c47027e0 | 228 | class AddSoapServiceArchivedAtField < ActiveRecord::Migration
def self.up
add_column :soap_services, :archived_at, :datetime, :default => nil
end
def self.down
remove_column :soap_services, :archived_at
end
end
| 22.8 | 71 | 0.758772 |
bf2a7c3408187649c62dfe318b0bd39583854974 | 117 | class Comment < ApplicationRecord
belongs_to :coliving, optional: true
belongs_to :coworking, optional: true
end
| 23.4 | 39 | 0.794872 |
28629f3cb186c235d4b0567f364aae7d3839637b | 578 | $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "/../lib")))
ARGV << "-b"
require "rubygems"
require "bundler"
Bundler.setup
#require "vendor/gems/environment"
require "ostruct"
require "spec"
require "spec/autorun"
require "redis"
require "merb"
require "rack/cache"
require "rack/cache/metastore"
requir... | 24.083333 | 74 | 0.762976 |
b9a859e17c52d40389cacee83f9a4d0d4070913f | 167 | # frozen_string_literal: true
HOMEBREW_PREFIX = Pathname("/usr/local").freeze
HOMEBREW_REPOSITORY = Pathname("/usr/local/Homebrew").freeze
HOMEBREW_VERSION = "2.6.0"
| 27.833333 | 60 | 0.778443 |
bfd6a3a95f3bba43d3a18eabb491f59f243f3941 | 317 | # frozen_string_literal: true
class AddSystemToChatRooms < ActiveRecord::Migration[6.1]
def change
add_column(:chat_rooms, :system, :boolean, default: false, null: false)
add_index(:chat_rooms, :user_id, unique: true, where: 'system = true', name: 'index_on_chat_rooms_user_id_where_system_true')
end
end
| 39.625 | 129 | 0.763407 |
bfb1ad3398c06bea6b58de3c9c3e49da4357ab39 | 1,318 | class Glide < Formula
desc "Simplified Go project management, dependency management, and vendoring"
homepage "https://github.com/Masterminds/glide"
url "https://github.com/Masterminds/glide/archive/v0.13.1.tar.gz"
sha256 "84c4e365c9f76a3c8978018d34b4331b0c999332f628fc2064aa79a5a64ffc90"
head "https://github.c... | 36.611111 | 93 | 0.751897 |
d56b398b529b08eb9f9738808a02b36b5bc15fe8 | 602 | require 'pycall/error'
module PyCall
class PyError < Error
def initialize(type, value, traceback)
@type = type
@value = value
@traceback = traceback
super("Exception occurred in Python")
end
attr_reader :type, :value, :traceback
def to_s
"#{type}: #{value}".tap do |msg... | 19.419355 | 62 | 0.584718 |
62cfef8ded87915a2bab727f3b612a0d2bcc7c1c | 5,643 | require 'simplecov'
require 'rubygems'
SimpleCov.start 'rails' do
add_filter '/test/'
add_filter '/config/'
add_group 'Controllers', 'app/controllers'
add_group 'Models', 'app/models'
add_group 'Concerns', 'app/concerns'
add_group 'Datatables', 'app/datatables'
add_group 'Helpers', 'app/helpers'
add_g... | 38.128378 | 92 | 0.737551 |
1d37cdc46fc8bbcb5e8f27edacfd656175ce2d35 | 2,719 | require 'test_helper'
# require 'test/model_stub'
#require File.join(File.dirname(__FILE__), '../../lib/active_scaffold/data_structures/set.rb')
class ActionColumnsTest < MiniTest::Test
def setup
@columns = ActiveScaffold::DataStructures::ActionColumns.new([:a, :b])
@columns.action = stub(:core => stub(:mode... | 23.850877 | 94 | 0.641412 |
6176db2511e33a1c8892abb8974385ed01c01cf1 | 837 | require File.dirname(__FILE__) + '/../../spec_helper'
require 'matrix'
describe "Matrix#square?" do
it "returns true when the Matrix is square" do
Matrix[ [1,2], [2,4] ].square?.should be_true
Matrix[ [100,3,5], [9.5, 4.9, 8], [2,0,77] ].square?.should be_true
end
it "returns true when the Matrix has... | 27 | 71 | 0.653524 |
7993fac5dd219a0ac2adfb397d42bc61e5b142af | 2,675 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Projects::Analytics::CycleAnalytics::SummaryController do
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, group: group) }
let(:params) { { namespace_id: project.namespace.to_param... | 27.864583 | 152 | 0.680374 |
b9e21c199f904807423026b35cd5c5c243d609e8 | 756 | Crossbeams::MenuMigrations::Migrator.migration('Nspack') do
up do
add_program_function 'New', functional_area: 'Production', program: 'Reworks', url: '/production/reworks/reworks_run_types/bulk_update_pallet_dates/reworks_runs/new', group: 'Bulk Update Pallet Dates', seq: 32
add_program_function 'List', funct... | 63 | 213 | 0.771164 |
ab24128f608a9fb5641dc0ae790049c1a90e6c87 | 537 | actions :create, :delete
default_action :create
attribute :mode, :kind_of => String, :default => 'rsync'
attribute :source, :kind_of => String, :required => true
attribute :target, :kind_of => String, :required => true
attribute :user, :kind_of => [String, NilClass]
attribute :host, :kind_of => [String, NilClass]
attr... | 41.307692 | 61 | 0.716946 |
b9b85bb695907f05f6087c3ec1ee83ea59130729 | 1,122 | require 'test_helper'
class Manage::XformsControllerTest < ActionController::TestCase
setup do
@manage_xform = manage_xforms(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:manage_xforms)
end
test "should get new" do
get :new
assert_r... | 22.44 | 66 | 0.714795 |
ff6d3169f99a8bc9cb27e742f267459a36abda09 | 3,742 | class Heartbeat < Formula
desc "Lightweight Shipper for Uptime Monitoring"
homepage "https://www.elastic.co/products/beats/heartbeat"
url "https://github.com/elastic/beats.git",
:tag => "v7.8.0",
:revision => "f79387d32717d79f689d94fda1ec80b2cf285d30"
head "https://github.com/elastic/beats.git"... | 31.711864 | 141 | 0.644041 |
18499e1b445bae644d67d2ab1f0c9a05e378d7b2 | 745 | # frozen_string_literal: true
require 'diff/lcs'
require "modern/app/router"
require 'modern/util/trie_node'
module Modern
class App
class TrieRouter < Router
def initialize(inputs)
super(inputs)
@trie = build_trie(routes)
end
def resolve(http_method, path)
trie_pat... | 19.605263 | 91 | 0.614765 |
03291a272edc29834e6cb87a2b640df1e652d20b | 349 | require './plugins/plugins.rb'
# BotSnack when someone high5s us
class BotSnack < Plugin
@@snacks = [
'omm nom nom nom',
'*puke*',
'MOAR!',
'=.='
]
def response(_to, _from, msg)
return unless relevant?(msg)
return @@snacks[rand(0..@@snacks.length)] if msg =~ %r{botsnack}x
nil
end
... | 16.619048 | 69 | 0.593123 |
e900d86c2e40f6cc8e5fa3c1678b01f153d3aa8f | 530 | # == Schema Information
#
# Table name: user_team_project_relationships
#
# id :integer not null, primary key
# project_id :integer
# user_team_id :integer
# greatest_access :integer
# created_at :datetime not null
# updated_at :datetime not null
#
# Read a... | 24.090909 | 68 | 0.679245 |
91ff458a4335c6df0aaf07781f97ee41644b0a7b | 1,190 | module Api
module V3
module Dashboards
module ChartParameters
class Base
attr_reader :country_id,
:commodity_id,
:context,
:start_year,
:end_year
# @param params [Hash]
# @option pa... | 26.444444 | 82 | 0.515126 |
1ced5a0bb423fd247d45cfd54faffd005d1bde36 | 1,531 | class Zellij < Formula
desc "Pluggable terminal workspace, with terminal multiplexer as the base feature"
homepage "https://zellij.dev"
url "https://github.com/zellij-org/zellij/archive/v0.14.0.tar.gz"
sha256 "45ce99d0c13de562f27b46e9693ff0cdf1dba2d15568410fcb67c9b0e9d6b500"
license "MIT"
bottle do
sha... | 46.393939 | 122 | 0.758328 |
334cff9b6008735e3c587d253c41ddbd8e9c3f03 | 1,073 | RSpec.describe Metasploit::Credential::Origin::Manual, type: :model do
it_should_behave_like 'Metasploit::Concern.run'
context 'associations' do
it { is_expected.to have_many(:cores).class_name('Metasploit::Credential::Core').dependent(:destroy) }
it { is_expected.to belong_to(:user).class_name('Mdm::User'... | 27.512821 | 106 | 0.701771 |
edaff40a4031658a85b311adc64e533862de85b4 | 153 | class CreateTasks < ActiveRecord::Migration[6.0]
def change
create_table :tasks do |t|
t.string :title
t.timestamps
end
end
end
| 15.3 | 48 | 0.653595 |
e2dd97f0cf4f54208b8c37923084bd500b830039 | 202 | # Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
Mime::Type.register "application/pdf", :pdf
| 25.25 | 59 | 0.737624 |
03392c088147c7f0f9cd7114a4152275919cbb7b | 3,941 | 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.484211 | 102 | 0.758183 |
e22389f40eed0c10100969b6eea3b7b2b57fb035 | 295 | # frozen_string_literal: true
require 'discourse_dev'
require 'rails'
module DiscourseDev
class Railtie < Rails::Railtie
railtie_name :discourse_dev
rake_tasks do
path = File.expand_path(__dir__)
Dir.glob("#{path}/tasks/**/*.rake").each { |f| load f }
end
end
end
| 18.4375 | 61 | 0.681356 |
bff247246fd098c7a70e19ab485d171e55cf57c9 | 7,450 | #! /usr/bin/env ruby
require 'spec_helper'
require 'oregano/application/cert'
describe Oregano::Application::Cert => true do
before :each do
@cert_app = Oregano::Application[:cert]
Oregano::Util::Log.stubs(:newdestination)
end
it "should operate in master run_mode" do
expect(@cert_app.class.run_mode... | 30.912863 | 127 | 0.665369 |
87e009149353a58609ff9dc8ad2e92ac276a4517 | 125 | module V1
class Base < ApplicationAPI
version "v1", :using => :path
mount SampleAPI
mount SecretAPI
end
end
| 13.888889 | 33 | 0.664 |
bf0ccfd831d4dedfc6a74df02d0b48ed26c05102 | 594 | require 'test/unit'
require File.dirname(__FILE__) + '/../bin/translate'
class GoogleTranslateTest < Test::Unit::TestCase
def setup
@translate = File.dirname(__FILE__) + '/../bin/translate.rb'
end
def test_trying_to_translate
assert_equal("Teste", `ruby #{@translate} Test`.strip!)
end
def te... | 28.285714 | 75 | 0.720539 |
f87efd992d819014413e81ce02c2d9efbd742250 | 2,566 | # Wraps CanCan functionality to load resources via a polymorphic parent.
# See CanCan wiki article on nested resources for more.
module PolymorphicAuthorizable
extend ActiveSupport::Concern
included do
def parent_resource_name
params[:resource_type].singularize
end
def parent_resource_class
... | 40.09375 | 95 | 0.740842 |
8732d8a5f59bc58d5f3773ebd3635287423866a5 | 1,561 | Gem::Specification.new do |s|
s.name = "mongrel_cluster_rolling_restart"
s.version = "0.1.1"
s.date = "2008-09-24"
s.summary = "Allows for a mongrel cluster to be restarted in a rolling fashion"
s.description = "Mongrel Cluster Rolling Restart allows for a mongrel cluster to be restarted in a ro... | 38.073171 | 251 | 0.699552 |
bb118ce682f2041675af2f457712a3ca1a81dfb9 | 8,216 | require 'spec_helper'
describe TeamStats do
let(:team) { Fabricate(:team) }
before do
allow_any_instance_of(Map).to receive(:update_png!)
end
context 'with no activities' do
let(:stats) { team.stats }
context '#stats' do
it 'aggregates stats' do
expect(stats.count).to eq 0
end
... | 44.410811 | 122 | 0.614167 |
4a1f3d859208fac5ccf2fc15a6cab2163f85dd01 | 111 | platform_is :windows do
require 'win32ole'
describe 'WIN32OLE_EVENT#on_event_with_outargs' do
end
end
| 12.333333 | 52 | 0.774775 |
082a2c5669a3e2dff37af20777fb235a1adcc7b3 | 4,130 | module Worker
class Matching
class DryrunError < StandardError
attr :engine
def initialize(engine)
@engine = engine
end
end
def initialize(options={})
@options = options
reload 'all'
end
def process(payload, metadata, delivery_info)
payload.symbolize... | 27.171053 | 89 | 0.582082 |
bfa4b167902e52b7c4de29537ea951f72bb4c100 | 156 | FactoryGirl.define do
factory :user do
email { Faker::Internet.email }
password 'fakepassword'
password_confirmation 'fakepassword'
end
end
| 19.5 | 40 | 0.730769 |
7ab993126bc1bd2ecd9a950eb5774442176c3791 | 667 | module Airbrake
module Filters
# Replaces root directory with a label.
# @api private
class RootDirectoryFilter
# @return [String]
PROJECT_ROOT_LABEL = '/PROJECT_ROOT'.freeze
# @return [Integer]
attr_reader :weight
def initialize(root_directory)
@root_directory = ro... | 22.233333 | 65 | 0.592204 |
269c9b63f65d17357966659d612bc83708489aea | 1,767 | require 'test_helper'
class TriggersControllerTest < ActionController::TestCase
context "a non-admin logged in user" do
setup do
@user = login
@user.update_attributes(:admin => 0)
assert !@user.admin?
end
should "be redirected" do
get :index
assert_redirected_to "/tasks/lis... | 24.205479 | 81 | 0.615733 |
28ddeed306163557abe056d89d9221d0a1e2ea9a | 234 | module ApplicationHelper
# Returns the full title on a per-page basis.
def full_title(page_title = '')
base_title = "Ruby on Rails Tutorial Sample App"
if page_title.empty?
base_title
else
page_title + " | " + base_title
end
end
end
| 19.5 | 48 | 0.760684 |
ff57e3b0e0e843bd046f64abeadcc5ab8a4ca24f | 1,565 | module BatchRollback
class Railtie < Rails::Railtie
rake_tasks do
namespace :batch_rollback do
task :pre_migrate do
ActiveRecord::SchemaMigration.create_table
ENV["BR_CURRENT_VERSION"] = ActiveRecord::SchemaMigration.all_versions.last
end
task :post_migrate do
... | 31.938776 | 97 | 0.640895 |
bf7befde654a216ed3a3d5727a6dc57d0b2db8be | 946 | cask 'miniconda' do
version '4.7.10'
sha256 'c8b31ea37b0b6a3e2fb19990ef895ab5cf1c095f8e9138defac95ee88e70920d'
# repo.anaconda.com/miniconda was verified as official when first introduced to the cask
url "https://repo.anaconda.com/miniconda/Miniconda3-#{version}-MacOSX-x86_64.sh"
name 'Continuum Analytics Mi... | 28.666667 | 90 | 0.614165 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.