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 |
|---|---|---|---|---|---|
210c63d19e41d2fd6b2407be0fe00a8aaf5604fa | 600 | class PresenterBase
include ActionView::Helpers::FormTagHelper
include ActionView::Helpers::AssetUrlHelper
include ActionView::Helpers::NumberHelper
include ActionView::Helpers::TranslationHelper
include ActionView::Helpers::UrlHelper
include ActionView::Helpers::TagHelper
include Webpacker::Helper
incl... | 24 | 50 | 0.791667 |
1c9382b11dd227f63cc6c69135adf8f25d075e30 | 8,327 | # Copyright © 2011-2016 MUSC Foundation for Research Development~
# All rights reserved.~
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:~
# 1. Redistributions of source code must retain the above copyright notice, this l... | 36.845133 | 146 | 0.680557 |
08d6d15e5866deb218f689601a75b17861dcc40f | 140 | class RemoveNotesFromMember < ActiveRecord::Migration
def change
change_table :members do |t|
t.remove :notes
end
end
end
| 17.5 | 53 | 0.707143 |
5d071611c1d29b7a9e3760c6fddf0d0c0b7cd438 | 1,082 | module Auth
def current_user
@current_user ||= User.find_by(auth_token: request.headers["Authorization"])
end
def current_company
@current_company ||= Company.find_by(subdomain: subdomain)
end
def require_company!
render json: { errors: "Unspecified company" }, status: :unauthorized unless curr... | 30.914286 | 108 | 0.719963 |
1c5a4577af1837958d17c2a50fcd481178ce4faf | 2,774 | require 'spec_helper'
shared_examples 'Balance Transaction API' do
let(:stripe_helper) { StripeMock.create_test_helper }
it "returns an error if balance transaction does not exist" do
txn_id = 'txn_xxxxxxxxxxxxxxxxxxxxxxxx'
expect {
Stripe::BalanceTransaction.retrieve(txn_id)
}.to raise_error ... | 43.34375 | 361 | 0.769647 |
ac54989aeb41a8aad31b881d67103b3feaec5281 | 103 | module Contact
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
end
| 17.166667 | 46 | 0.76699 |
e82abdbf99151d98f18ae3583b402fb1297277a1 | 334 | Puppet::Type.type(:neutron_vpnaas_agent_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def self.file_path
'/etc/neutron/vpn_agent.ini'
end
# added for backwards compatibility with older versions of inifile
def file_path
self.class.file_pa... | 20.875 | 72 | 0.745509 |
bb61ca413a33c441e46465cf7a888cb8f6247ebe | 431 | # frozen_string_literal: true
module Heroku
#
# Job that handles background (asynchronous) provisioning.
#
# @raise [Heroku::ProvisioningError] if some provisioning step failed.
#
class ProvisioningJob < ApplicationJob
def perform(resource_id)
resource = Resource.find resource_id
raise Hero... | 26.9375 | 108 | 0.756381 |
87bb72d270687f95111b69c689b16e62812695fa | 809 | Pod::Spec.new do |s|
s.name = 'iRate'
s.version = '1.6.2'
s.license = 'zlib'
s.summary = 'Alternative to Appirater (prompts users to rate the application) with a simpler interface and support for iOS fast application switching.'
s.description = 'A handy class that prompts users of... | 62.230769 | 261 | 0.674907 |
5debeca146c06a9c107eefa503f3d2ef877b036f | 507 | cask 'dragthing' do
version '5.9.17'
sha256 '62d553878267d617aa2be48f09dfc401d08afce216cd42aef7441f4f95dd4cff'
# amazonaws.com/tlasystems was verified as official when first introduced to the cask
url "https://s3.amazonaws.com/tlasystems/DragThing-#{version}.dmg"
appcast 'http://www.dragthing.com/english/dow... | 36.214286 | 88 | 0.779093 |
e20db78b4abe8a4a602cd760b8e636a177f857ac | 837 | # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflec... | 36.391304 | 69 | 0.744325 |
edaa47c9c857608cca7c2fc759a46fd549057d3f | 48 | module ObzidianViewTool
VERSION = "0.1.0"
end
| 12 | 23 | 0.729167 |
016b5f89b0667272cc136ab0e82014fcb8a4f737 | 1,309 | # 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 source for your
# dat... | 42.225806 | 86 | 0.754775 |
6268ef13a07c5537c32c6147799ef2d5eb1f6f62 | 405 | # boolean_and - class BooleanA - implements && operatornd
class BooleanAnd
def initialize(left, right, line_number = 0)
@left = left
@right = right
@line_number = line_number
end
attr_reader :line_number
def call(env:, frames:)
@left.call(env: env, frames: frames) &&
@right.call(env: en... | 20.25 | 57 | 0.641975 |
628505e22efc5ef924d2dba65ef83abcb5b7d897 | 749 | # frozen_string_literal: true
module Stupidedi
module Versions
module FunctionalGroups
module FortyTen
module SegmentDefs
s = Schema
e = ElementDefs
r = ElementReqs
PLD = s::SegmentDef.build(:PLD, "Pallet Information",
"To specify pallet informat... | 28.807692 | 85 | 0.602136 |
f7a4a30c0e3b9c6a6cb99df9f2317a892d8bc283 | 4,496 | RSpec.describe KOSapiCLI::KOSapiTokenLoader do
let(:broken) do
{ 'broken' => { 'env' => 'file' } }
end
let(:valid) do
{ 'config' => { 'client_token' => { 'access_token' => 'fas4f68sef486sef4',
'refresh_token' => '',
'expires_... | 33.552239 | 85 | 0.581628 |
ac182e8b45737731d684b7dbee671505c19365bb | 246 | FactoryBot.define do
factory :telemetry_engine_spool, class: 'Telemetry::Engine::Spool' do
association :engine, factory: :telemetry_engine
sequence :number
n { rand }
rotational_velocity { Unit.new n * 30000, 'rpm' }
end
end
| 24.6 | 71 | 0.707317 |
4a415b42a0810a31b7bb171eee4645a4cea8dddd | 16,091 | #! /usr/bin/env ruby
require 'spec_helper'
require 'yaml'
require 'puppet/util/network_device/netapp/NaServer'
describe Puppet::Type.type(:netapp_quota).provider(:sevenmode) do
# let(:resource) do
# {
# :ensure => :present,
# :name => '/vol/vol1/qtree1',
# :provider => described_class.name
... | 34.530043 | 164 | 0.563358 |
010152669a2116279a601231663a32cb482b2c5d | 216 | module TZInfo
module Definitions
module America
module Anguilla
include TimezoneDefinition
linked_timezone 'America/Anguilla', 'America/Port_of_Spain'
end
end
end
end
| 18 | 67 | 0.662037 |
18ebd218c698b5418f04b17c72513a245990614d | 166 | # frozen_string_literal: true
require "tpm/key_attestation"
::TPM.send(:remove_const, "VENDOR_IDS")
::TPM::VENDOR_IDS = { "id:FFFFF1D0" => "FIDO Alliance" }.freeze
| 23.714286 | 63 | 0.722892 |
f7a022ce032628499473ec51baec5ace8757f139 | 40 | module MusicIds
VERSION = "0.4.0"
end
| 10 | 19 | 0.675 |
4a373c7c3dabf5f160bc6e5ff7b44150ffc0ac96 | 102 | module OpenGraphImage
class Engine < ::Rails::Engine
isolate_namespace OpenGraphImage
end
end
| 17 | 36 | 0.77451 |
ed4daa96e79724dfffa340061afe016d54336ded | 402 | =begin
see problem here: https://www.hackerrank.com/challenges/chocolate-feast
=end
#!/bin/ruby
t = gets.strip.to_i
for a0 in (0..t-1)
n,c,m = gets.strip.split(' ')
n = n.to_i
c = c.to_i
m = m.to_i
wrappers=toffees=n/c
while wrappers>=m
free_toffees = wrappers/m
toffees+=free_t... | 20.1 | 71 | 0.621891 |
91322a9c9ece0ba43127f8a9628b987608ed78ce | 5,537 | # frozen_string_literal: true
ArJdbc.load_java_part :MySQL
require 'bigdecimal'
require 'active_record/connection_adapters/abstract_mysql_adapter'
require 'active_record/connection_adapters/abstract/schema_definitions'
require 'arjdbc/abstract/core'
require 'arjdbc/abstract/connection_management'
require 'arjdbc/abst... | 26.878641 | 100 | 0.631931 |
62667b859f0e9652aabd46a849cf1b7691186a3e | 3,026 | ##
# This module requires Metasploit: http//metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpClient
def initialize(info = {})
super(update_info(i... | 29.960396 | 127 | 0.576338 |
330b6e427ca667549db42081a216d2fa6f208c02 | 1,828 | #
# Be sure to run `pod lib lint MDMultiSourceDemo.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'M... | 37.306122 | 110 | 0.654814 |
6a123aad1d151487777bb7392c1a75f5eae61af8 | 2,002 | require "factory_bot"
require "mockley_crew/engine"
require "mockley_crew/configuration"
require "mockley_crew/errors/connection_not_made"
require "mockley_crew/errors/database_not_found"
require "mockley_crew/errors/database_with_no_name"
require "mockley_crew/errors/invalid_data"
require "mockley_crew/errors/invali... | 25.666667 | 157 | 0.744256 |
ab111cb81de7b327eb471f4a9c000fc26e0d5a9e | 12,597 | require_relative "../../test_helper"
module SmartAnswer
module Calculators
class MarriageAbroadDataQueryTest < ActiveSupport::TestCase
context MarriageAbroadDataQuery do
setup do
@data_query = MarriageAbroadDataQuery.new
end
context "#marriage_data" do
should "l... | 39.365625 | 211 | 0.65976 |
d5164087354fc3ed605ea70fb4b3072abe15914a | 374 | # frozen_string_literal: true
module MongoQL
class Expression::Macro < Expression
attr_accessor :name
def initialize(name)
validate!(name)
@name = name
end
def validate!(name)
raise ArgumentError, "macro #{name} is not registered!" unless MongoQL::Macro.has_macro?(name)
end
... | 18.7 | 100 | 0.652406 |
28a66327ac5eda33e7ac233fa93e07433a600824 | 68 | module Text_Displayer
def display_text text_to_display
end
end
| 11.333333 | 34 | 0.823529 |
01163d6cf2f9793400593024e959d97479f7cee7 | 430 | require 'test_helper'
class StaticPagesControllerTest < ActionDispatch::IntegrationTest
test "should get home" do
get root_path
assert_response :success
end
test "should get help" do
get help_path
assert_response :success
end
test "should get about" do
get about_path
assert_respons... | 16.538462 | 65 | 0.725581 |
b93b520a79092067fe94d2f5d9edf64a55c9a417 | 425 | # frozen_string_literal: true
class Item
include Searchable
extend Forwardable
def_delegators :@item, :[]=, :each, :detect
@collection = []
def initialize(item = {})
@item = item
end
def self.from(source)
items = JSON.parse(File.read(source), object_class: Item)
@collection = Array(items)... | 17 | 61 | 0.68 |
ab7bcfc0240c1f6b03556a76d178762fafc779e3 | 1,201 | # frozen_string_literal: true
module ThemeCheck
# Reports missing content_for_header and content_for_layout in theme.liquid
class RequiredLayoutThemeObject < LiquidCheck
severity :error
category :liquid
doc docs_url(__FILE__)
LAYOUT_FILENAME = "layout/theme"
def initialize
@content_for_l... | 29.292683 | 90 | 0.738551 |
b9d53f6938083ca7c3c841378b1e070d9538db82 | 359 | require 'formula'
class FbClient < Formula
homepage 'https://paste.xinu.at'
url 'https://paste.xinu.at/data/client/fb-1.1.4.tar.gz'
sha1 '03483b5cdda9d27121941ddd10ffd20967f3f63b'
conflicts_with 'findbugs',
:because => "findbugs and fb-client both install a `fb` binary"
def install
system "make", "... | 23.933333 | 67 | 0.707521 |
629429c874c941610b580e911d9aab4ead04fa27 | 767 | Pod::Spec.new do |s|
s.name = 'PusherSwift'
s.version = '7.2.0'
s.summary = 'A Pusher client library in Swift'
s.homepage = 'https://github.com/pusher/pusher-websocket-swift'
s.license = 'MIT'
s.author = { "Hamilton Chapman" => "hamchapman@gmail.com" ... | 34.863636 | 107 | 0.611473 |
26e11329775113ef00714a949e32390a774c7688 | 172 | class ChangeDescriptionNullOnAnnouncementTemplates < ActiveRecord::Migration[5.0]
def change
change_column_null :announcement_templates, :description, true
end
end
| 28.666667 | 81 | 0.825581 |
03841913deab190972306e9fd8a9afe8e4ade3fd | 2,714 | #
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Author: Emilien Macchi <emilien.macchi@enovance.com>
#
# 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.apach... | 26.871287 | 154 | 0.687546 |
d5ab038574bf8628f9ecc7aa8a1f516929536848 | 223 | class CreateRecipes < ActiveRecord::Migration[5.2]
def change
create_table :recipes do |t|
t.string :name
t.integer :creator_id
t.string :directions
t.string :total_prep_time
end
end
end
| 20.272727 | 50 | 0.668161 |
61ca6d0e288672d437d11d950ea504ed1ff0a5b3 | 2,222 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe "prisoners/show", type: :view do
let(:page) { Nokogiri::HTML(rendered) }
let(:case_info) { build(:case_information) }
let(:prison) { build(:prison) }
let(:offender) { build(:mpc_offender, prison: prison, offender: case_info.offender, prison_r... | 26.771084 | 116 | 0.656166 |
7a155f161b8359f9fd065a6bed46de9754245529 | 443 | class CreateReviews < ActiveRecord::Migration[5.2]
def change
create_table :reviews, id: :uuid do |t|
t.text :content
t.integer :stars
t.uuid :customer_id
t.uuid :worker_id
t.belongs_to :customer, foreign_key: {to_table: :users}, type: :uuid
t.belongs_to :worker, foreign_key: {... | 29.533333 | 74 | 0.654628 |
1cb4d97ed902189dc96b94f1f983b5ec98aa088c | 479 | require 'spec_helper'
module Brightcontent
describe ModelExtensions do
let(:columns) { ["id", "name", "body", "created_at", "updated_at", "featured"] }
subject(:blog) { Blog }
its(:brightcontent_columns) { should eq columns }
context "with extra method" do
before { Blog.add_brightcontent_colu... | 29.9375 | 85 | 0.672234 |
ab01ab816f2e9bc6bccf08492f61862a0da9353b | 132 | require 'test_helper'
class RegionDistrictNameTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 16.5 | 54 | 0.727273 |
7989f11ec6e7c2747db097b4bca5607f1f93d895 | 12,621 | # frozen_string_literal: true
require 'csv'
namespace :touhou_music_discover do
namespace :export do
desc 'Touhou music with original songs file export'
task touhou_music_with_original_songs: :environment do
File.open('tmp/touhou_music_with_original_songs.tsv', 'w') do |f|
f.puts("jan\tisrc\tt... | 46.230769 | 377 | 0.682989 |
ab7e4268d0c69b7dbbe159ecb632db1886edafdf | 10,185 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::ApiManagement::Mgmt::V2016_07_07
module Models
#
# Report data.
#
class ReportRecordContract
include MsRestAzure
# @return [Stri... | 30.770393 | 77 | 0.473245 |
180f54fb67b65c5d5b7a89169473a8ce6feb8591 | 14,925 | # encoding: UTF-8
module Jekyll
class Document
include Comparable
extend Forwardable
attr_reader :path, :site, :extname, :collection
attr_accessor :content, :output
def_delegator :self, :read_post_data, :post_read
YAML_FRONT_MATTER_REGEXP = %r!\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)!m
... | 29.379921 | 90 | 0.629012 |
263f51123fba4287457b3ee2829bc951e4f1d323 | 2,102 | class Libdc1394 < Formula
desc "Provides API for IEEE 1394 cameras"
homepage "https://damien.douxchamps.net/ieee1394/libdc1394/"
license "LGPL-2.1"
stable do
url "https://downloads.sourceforge.net/project/libdc1394/libdc1394-2/2.2.6/libdc1394-2.2.6.tar.gz"
sha256 "2b905fc9aa4eec6bdcf6a2ae5f5ba021232739... | 42.04 | 106 | 0.724072 |
878f647d46f91c18f588af91dc7e8bee0b21efab | 439 | class CreateEgotterFollowerWorker
include Sidekiq::Worker
sidekiq_options queue: 'creating_high', retry: 0, backtrace: false
def perform(user_id)
user = User.find(user_id)
unless EgotterFollower.exists?(uid: user.uid)
EgotterFollower.create!(uid: user.uid, screen_name: user.screen_name)
end
r... | 29.266667 | 75 | 0.719818 |
e2e851194abf89943c44eea36156cfc81e228dd5 | 6,132 | module Ziya::Gauges
class Base
include Ziya::Helpers::BaseHelper
attr_accessor :license, :design_id
attr_reader :type, :components
attr_reader :options
def initialize( license, design_id )
@license = license
@design_id = design_id
# load up associated helper
... | 35.651163 | 107 | 0.466243 |
b95ed7de29efd567308fae6314725c6ba5d3cdf2 | 1,530 | # encoding: utf-8
class PictureUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
# include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader:
storage :file
# storage :fog
# Override the directory where uploaded f... | 28.867925 | 112 | 0.699346 |
f880984a85da31676578a91267dc81ff3cc31ccb | 3,572 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Groups::Analytics::CoverageReportsController do
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, namespace: group) }
let_it_be(:ref_path) { 'refs/heads/master' }
let_it_be(:firs... | 27.689922 | 115 | 0.650616 |
7a8e33fad7852d2b7dbd9b918c24f91be729fa48 | 643 |
# encoding: UTF-8
module Axlsx
# An override content part. These parts are automatically created by for you based on the content of your package.
class Override < AbstractContentType
# Serialization node name for this object
NODE_NAME = 'Override'
# The name and location of the part.
# @return [... | 24.730769 | 116 | 0.692068 |
6a5c3ace72a8865d189dc2f67fce77f2cae2b339 | 5,545 | require 'formula'
class Grass < Formula
homepage 'http://grass.osgeo.org/'
url 'http://grass.osgeo.org/grass64/source/grass-6.4.2.tar.gz'
sha1 '74481611573677d90ae0cd446c04a3895e232004'
head 'https://svn.osgeo.org/grass/grass/trunk'
option "without-gui", "Build without WxPython interface. Command line tool... | 34.018405 | 199 | 0.656988 |
bbab55b6d2aafc1c9b3f1d256b8be7a6b9ab71f6 | 2,000 | # Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum, this matches ... | 41.666667 | 85 | 0.768 |
01f9d7c63f8bf4f02185e6636ab7ec7163697037 | 1,107 | require 'rspec'
require 'bosh/dev/ruby_version'
namespace :fly do
# bundle exec rake fly:unit
desc 'Fly unit specs'
task :unit do
execute('test-unit')
end
# bundle exec rake fly:integration
desc 'Fly integration specs'
task :integration do
env(DB: (ENV['DB'] || 'postgresql'))
execute('test-i... | 24.065217 | 111 | 0.64047 |
e84aa620baabab8e02b146f8bd4b94d26c371664 | 704 | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "ActiveRecord integration using AttrFilters::ActiveModel", if: active_record? do
context "attributes lazy loading" do
it "should success add filter to an attribute" do
ActiveRecord::Base.establish_connection(
adapter: "sqlite3",
... | 27.076923 | 102 | 0.669034 |
083c7a5a7db7969e19ea93cddfce324e6fd039b6 | 719 | # coding: utf-8
Gem::Specification.new do |spec|
spec.name = "jekyll-athena"
spec.version = "0.0.2"
spec.authors = ["broccolini"]
spec.email = ["diana.mounter@gmail.com"]
spec.summary = %q{A simple and elegant theme for Jekyll and GitHub Pages.}
spec.homepage = "htt... | 34.238095 | 95 | 0.623088 |
627d7d4adea49b3452aec0f32518969ab3420dbf | 11,242 | require 'bundler/vendored_persistent'
module Bundler
# Handles all the fetching with the rubygems server
class Fetcher
# This error is raised if the API returns a 413 (only printed in verbose)
class FallbackError < HTTPError; end
# This is the error raised if OpenSSL fails the cert verification
cl... | 35.13125 | 109 | 0.648372 |
0867653140deb2e2759c9061de5a6a5fb3a77dc0 | 3,245 | # freeze_string_literals: true
# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to exp... | 39.573171 | 80 | 0.738059 |
4a7af6189db62aa2512a428921a3ab7a490eb05a | 1,134 | Rails.application.config.before_configuration do
Raven.configuration.silence_ready = true
end
Rails.application.configure do
config.cache_classes = true
config.eager_load = false
config.public_file_server.enabled = true
config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=3600'
}... | 31.5 | 80 | 0.779541 |
396a5d3de80faedd877235e56fc7c63099a15e5f | 1,035 | class Luaver < Formula
desc "Manage and switch between versions of Lua, LuaJIT, and Luarocks"
homepage "https://github.com/DhavalKapil/luaver"
url "https://github.com/DhavalKapil/luaver/archive/v1.1.0.tar.gz"
sha256 "441b1b72818889593d15a035807c95321118ac34270da49cf8d5d64f5f2e486d"
license "MIT"
head "https... | 27.972973 | 77 | 0.655072 |
bf5176fcbf415c37a629f0eb344fc1d5212194de | 5,365 | require 'mcollective/application/shell/watcher'
class MCollective::Application::Shell < MCollective::Application
description 'Run shell commands'
usage <<-END_OF_USAGE
mco shell [OPTIONS] [FILTERS] <ACTION> [ARGS]
mco shell run [--tail] [COMMAND]
mco shell start [COMMAND]
mco shell watch [HANDLE]
mco she... | 24.953488 | 79 | 0.588071 |
1a0a30bbc97234c018654a296e1da3b7b1b83d55 | 9,649 | require 'spec_helper'
module Omnibus
describe Builder do
let(:software) do
double(Software,
name: 'chefdk',
install_dir: project_dir,
project_dir: project_dir,
)
end
let(:project_dir) { on_windows ? 'C:/opscode/chefdk' : '/opt/chefdk' }
let(:on_windows) { false }
... | 28.049419 | 111 | 0.597886 |
7a380b11ad8398fed314244d03e5ca95ab03d5fc | 756 | require 'rails_helper'
require 'vcr'
VCR.configure do |configure|
configure.cassette_library_dir = "spec/vcr_cassettes"
configure.hook_into :webmock
configure.register_request_matcher :uri_regex do |request1, request2|
request1.uri.match(request2.uri)
end
end
module Params
# Add more helper methods to b... | 19.894737 | 71 | 0.669312 |
8704bfdb3207b0f991e4b9be4fed20b54b2f60ad | 3,624 | class CoronavirusLandingPagePresenter
COMPONENTS = %w[
header_section
announcements_label
announcements
see_all_announcements_link
risk_level
nhs_banner
sections
sections_heading
additional_country_guidance
topic_section
statistics_section
notifications
page_header
... | 28.761905 | 141 | 0.673013 |
e977bbce99ecde44786a1a8385e730add25637e6 | 1,528 | require 'active_support/rails'
require 'abstract_controller'
require 'action_dispatch'
require 'action_controller/metal/live'
require 'action_controller/metal/strong_parameters'
module ActionController
extend ActiveSupport::Autoload
autoload :Base
autoload :Caching
autoload :Metal
autoload :Middleware
au... | 26.344828 | 61 | 0.77945 |
387be8471b5e0dc17a547e00fd737b34a9459213 | 8,623 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe MergeRequests::SquashService do
include GitHelpers
let(:service) { described_class.new(project: project, current_user: user, params: { merge_request: merge_request }) }
let(:user) { project.first_owner }
let(:project) { create(:project, :repo... | 35.052846 | 195 | 0.689899 |
21408e6986ce504d239273c3c74ec63186337383 | 1,954 | # frozen_string_literal: true
module AtCoderFriends
module Parser
# parses problem page and extract modulo values
module Modulo
module_function
SECTIONS = [
Problem::SECTION_OUT_FMT,
Problem::SECTION_STATEMENT,
Problem::SECTION_TASK,
Problem::SECTION_INTRO
]... | 26.053333 | 78 | 0.42784 |
4a2bdbbf26976554333c56c0a7e2914f38982a2d | 2,376 | class MinimalRacket < Formula
desc "Modern programming language in the Lisp/Scheme family"
homepage "https://racket-lang.org/"
url "https://mirror.racket-lang.org/installers/7.9/racket-minimal-7.9-src-builtpkgs.tgz"
sha256 "293aa8ef709a6240472f16833351ba66a9e461261d2813c7fb1cc5ddf59c3000"
license any_of: ["MI... | 30.857143 | 94 | 0.677609 |
e802476a35e9aee31437101c43c369ebb0d719bc | 1,755 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe VariablesController, type: :controller do
describe '#index' do
context 'one orphaned variable' do
let!(:variable) { FactoryBot.create :variable }
before { get :index }
it { expect(assigns(:variables)).to eq [variable] }
en... | 38.152174 | 111 | 0.653561 |
ff5b0366ecadcca5fd04a7c35570139fa58b302a | 444 | cask 'omnioutliner' do
version '5.4.1'
sha256 '2f7147aa867ae2ba768ecdef58cc085df64216e123f836c7653d627426d6ffcd'
url "https://downloads.omnigroup.com/software/MacOSX/10.14/OmniOutliner-#{version}.dmg"
appcast "https://update.omnigroup.com/appcast/com.omnigroup.OmniOutliner#{version.major}"
name 'OmniOutliner... | 31.714286 | 91 | 0.772523 |
6105f9909de1aac2ab86e9126ca399b31254d6e7 | 1,056 | module LibTAD
module Astronomy
# All valid astronomy event classes
ASTRONOMY_EVENT_CLASS = [
# Combination of all known classes.
:all,
# The current phase for the place requested. Additional attributes for illumination (moon), azimuth, distance.
:current,
# Day length. Day len... | 27.789474 | 117 | 0.655303 |
874563504a409cfebb0159ddb14d6b618d8e504a | 1,059 | class AddFlightFieldsToTrip < ActiveRecord::Migration
def up
add_column :trips, :reservation_number, :string
add_column :trips, :airline, :string
add_column :trips, :flight_number, :string
add_column :trips, :connection_time, :string
add_column :trips, :loyalty_account_number, :string
add_colu... | 37.821429 | 58 | 0.732767 |
bb5261c492016c789043ae01a35eb95d50f3cf02 | 3,723 | #
# Author:: Serdar Sutay <serdar@chef.io>
# Author:: Patrick Wright <patrick@chef.io>
#
# Copyright (c) 2016, Chef Software, Inc. <legal@chef.io>
#
# 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... | 32.094828 | 149 | 0.695676 |
7ab2b98b79149c235869d7997a798489dc798aac | 1,035 | # Be sure to restart your server when you modify this file.
Rails.application.configure do
# Version of your assets, change this if you want to expire all your assets.
config.assets.version = '1.0'
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
#... | 36.964286 | 78 | 0.728502 |
03d5f50a5c52f995f7db9e9465c13f75b55ca479 | 833 | # frozen_string_literal: true
require "test_helper"
class NoteTest < Minitest::Test
def test_from_hash
hash = {
"id" => "8e5d6964bb810e0050b0",
"title" => "StarCraft beta coming this week!",
"hash" => "0c9c30f60cadabd31415",
"created_at" => "2010-02-11 03:46:56",
"updated_at" => "2... | 30.851852 | 66 | 0.655462 |
6a83b44a637e94bde7bc600d598ae21821bb90e7 | 2,129 | module Dedup
module Elasticsearchable
extend ActiveSupport::Concern
included do
class << self
def searcher
BasicSearcher.new(self)
end
end
Hash.class_eval do
def contains_blank?
self.blank? || self.values.contains_blank?
end unless Hash.i... | 22.892473 | 98 | 0.509629 |
e8eb9703d1c6bb9a42b5f301b3880aece649c2ec | 1,628 | # frozen_string_literal: true
module HathiTrust::SIP
# Handles MD5 checksums in a checksum.md5 or similar format
class Checksums
# @return [Hash] all checksums in the given collection
attr_reader :checksums
# Initialize a new set of Checksums. Ignores directory names in the
# file names.
#
... | 27.59322 | 89 | 0.630835 |
797d443c2481092ccae6755928ab3e3d94e18da6 | 2,585 | include_recipe 'bcpc-hadoop::hadoop_config'
::Chef::Recipe.send(:include, Bcpc_Hadoop::Helper)
::Chef::Resource::Bash.send(:include, Bcpc_Hadoop::Helper)
%w{hadoop-mapreduce-historyserver}.each do |pkg|
package hwx_pkg_str(pkg, node[:bcpc][:hadoop][:distribution][:release]) do
action :install
end
hdp_select... | 33.141026 | 144 | 0.72147 |
b9c0739ac89f98a21d4c0372dea1cbd9825df468 | 1,436 | describe "DELETE /authorised_email_domains/:id", type: :request do
let!(:email_domain) { create(:authorised_email_domain, name: "some.domain.org.uk") }
let(:regex_gateway) { instance_spy(Gateways::S3, write: nil) }
let(:email_domains_gateway) { instance_spy(Gateways::S3) }
before { allow(Gateways::S3).to recei... | 32.636364 | 98 | 0.714485 |
3827cb5108460fc70fa0052e75861c2860fc1014 | 990 | # frozen_string_literal: true
describe Spotlight::ViewConfigurationsController, type: :controller do
routes { Spotlight::Engine.routes }
let(:exhibit) { FactoryBot.create(:exhibit) }
describe 'when the user is not authorized' do
before do
sign_in FactoryBot.create(:exhibit_visitor)
end
descri... | 27.5 | 75 | 0.670707 |
f8d1d39a6188e5115376ac56dbfeee48effae9de | 407 | # frozen_string_literal: true
# This migration comes from spina_admin_conferences_engine (originally 20200420120946)
class RemoveTitleAndAbstractFromSpinaConferencesPresentations < ActiveRecord::Migration[6.0] # :nodoc:
def change
remove_column :spina_conferences_presentations, :title, :string, null: false
r... | 40.7 | 102 | 0.818182 |
62bda850bd69216dd3a9c776450756fdbaf3da9e | 9,917 | # Encoding: utf-8
# Cloud Foundry Java 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.apache.org/licenses/LICEN... | 35.291815 | 161 | 0.655037 |
ab87dac7f8674b635fad6cc66d2a1ba1a83b7261 | 541 | module Cache
class AdditionalCodeIndex < ::Cache::CacheIndex
def definition
{
mappings: {
dynamic: false,
properties: {
additional_code: { type: 'keyword' },
additional_code_type_id: { type: 'keyword' },
description: { type: 'text', analyzer: '... | 28.473684 | 80 | 0.548983 |
7a8b0b5659e5586674e7a060b59164fd646d1793 | 464 | class TapsController < ApplicationController
respond_to :json, :only => [:index, :show, :update]
before_filter :find_beer_tap, :only => [:show, :update]
def index
respond_with(BeerTap.all)
end
def show
respond_with(@beer_tap)
end
def update
keg = Keg.find(params[:keg_id])
@beer_tap.keg ... | 17.185185 | 57 | 0.672414 |
e28d2ca553643334b60c97ca034261bd90950bd0 | 1,307 | # frozen_string_literal: true
require 'spec_helper'
# This test serves as a regression test for a bug that caused an error
# message to be shown by JavaScript when the source branch was deleted.
# Please do not remove ":js".
describe 'Merge request > User sees MR with deleted source branch', :js do
let(:project) { ... | 31.878049 | 74 | 0.730681 |
39e4682447c22b34a35863e4c75956552f13a708 | 2,206 | # ref. http://pocke.hatenablog.com/entry/2016/01/16/155004
namespace :db do
# desc 'Generate model files from db schema'
desc 'スキーマからモデルを生成'
task gen: :environment do
module ModelGenerator
Models = {}
module Evaluator
module_function
def create_table(table_name, *)
... | 27.575 | 97 | 0.550771 |
1846ba47e01a34f5466a9869d13d66897dc29143 | 4,464 | require 'rails_helper'
if ExchangeTestingConfigurationHelper.general_agency_enabled?
RSpec.describe ShopGeneralAgencyNotices::GeneralAgencyHiredNotice, :dbclean => :after_each do
let!(:hbx_profile) { FactoryBot.create(:hbx_profile, organization: organization) }
let!(:person) { FactoryBot.create(:person, :with_work... | 44.19802 | 176 | 0.730735 |
bf9845d2e7da28d4b13c48b0b6de8d21ec9219fb | 4,840 | # @file TestL3LocalParameter.rb
# @brief L3 Local Parameter unit tests
#
# @author Akiya Jouraku (Ruby conversion)
# @author Sarah Keating
#
#
# ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ======
#
# DO NOT EDIT THIS FILE.
#
# This file was generated automatically by converting the fi... | 30.828025 | 101 | 0.631818 |
f7bc0a4b75b52c398298024d454e9d2666e75661 | 790 | cask "fog" do
version "1.4.5"
sha256 "dbf1216fce69ead08e9e9a37b18391d3d65e7f06ae4e6f633e7047832c6b1adc"
url "https://github.com/vitorgalvao/fog/releases/download/#{version}/Fog-#{version}-mac.zip"
name "Fog"
desc "Unofficial overcast.fm podcast app"
homepage "https://github.com/vitorgalvao/fog"
app "Fog... | 34.347826 | 140 | 0.744304 |
5ddce112005241fab8c2e8b9a869bbf65e6306c5 | 3,103 | require 'rails_helper'
RSpec.describe Api::V4::SplitRegistriesController, type: :controller do
describe "#show" do
before do
allow(Rails.configuration).to receive(:experience_sampling_weight).and_return(10)
end
it "includes sampling weight" do
get :show, params: { build_timestamp: '2019-11-1... | 31.663265 | 130 | 0.540445 |
18795cf1ad667a4d6b4d3c1703a561dda48f1413 | 339 | Rails.application.routes.draw do
get '/home', to: 'static_pages#home'
get '/help', to: 'static_pages#help'
get '/about', to: 'static_pages#about'
get '/contact', to: 'static_pages#contact'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root 'static_... | 24.214286 | 101 | 0.702065 |
61f581e88e16d7b8fef3c4d2bf2bddb6f264cd29 | 432 | module WindowBlessing
module Widgets
class Label < WindowBlessing::Window
attr_accessor_with_redraw :text, :fg, :bg
def initialize(rect, text, fill_options={})
super rect
@text = text
@fg = fill_options[:fg]
@bg = fill_options[:bg]
request_redraw_internal
end
def pointer_inside?(loc) false... | 18 | 45 | 0.689815 |
216119758f6b42710404ebfdc36a02eafe2c189e | 336 | unless ENV['CI']
require 'simplecov'
SimpleCov.start do
add_filter 'spec'
end
end
require 'livelyfeed'
require 'rspec'
require 'stringio'
require 'tempfile'
require 'timecop'
require 'webmock/rspec'
def fixture_path
File.expand_path("../fixtures", __FILE__)
end
def fixture(file)
File.new(fixture_path +... | 16 | 43 | 0.72619 |
b9f79c753bc089c8ff3d17c9bec339dbb56f68d3 | 1,355 | class AbiComplianceChecker < Formula
desc "Check binary and source compatibility for C/C++"
homepage "http://ispras.linuxbase.org/index.php/ABI_compliance_checker"
url "https://github.com/lvc/abi-compliance-checker/archive/1.99.21.tar.gz"
sha256 "c9ca13a9a7a0285214f9a18195efae57a99465392fbf05fdc4a15fceada4dedf"... | 38.714286 | 92 | 0.658303 |
e29046165e7bf7fd17e4f8c32f2c9b21867e0459 | 1,119 | module ClientApi
class TeamsService
def initialize(arg)
@params = arg.fetch(:params) { false }
@user = arg.fetch(:current_user) { raise ClientApi::CustomTeamError }
team_id = arg.fetch(:team_id) { raise ClientApi::CustomTeamError }
@team = Team.find_by_id(team_id)
raise ClientApi::Cu... | 27.975 | 75 | 0.637176 |
5da8edc2c6d6e2eb9a011b757d2eab7c5bda9902 | 378 | # frozen_string_literal: true
module ValidatorHelper
class Validatable
include ActiveModel::Model
def self.model_name
ActiveModel::Name.new self, nil, 'temp'
end
# we need to set explicitly i18n_scope to :activerecord
# this way we can test i18n of error messages without ActiveRecord
... | 21 | 70 | 0.716931 |
d58c2bee38f065f1e859a8179e42abba47d89880 | 4,771 | #
# 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, software
# distributed under ... | 35.080882 | 121 | 0.671138 |
33ca67e033e8b04dd6f4b0bdd72eab433bd79f8b | 621 | # TODO think about a better way
db_name = app_path.split('/').last
remove_file 'config/database.yml'
create_file 'config/database.yml' do
<<-YAML
defaults: &defaults
adapter: sqlite3
development:
database: dm_rails3_app_development.db
<<: *defaults
# Add more repositories
# repositories:
# repo1:
# ... | 18.818182 | 40 | 0.677939 |
6a1e390a89391cb8ee322b4af58e8f3a9e831985 | 142 | json.extract! protocol, :id, :Name, :Version, :Type, :DefinitionData, :created_at, :updated_at
json.url protocol_url(protocol, format: :json)
| 47.333333 | 94 | 0.753521 |
ed40657bc07b7ff50610e9e67f9829baad3efcd0 | 638 | # frozen_string_literal: true
require "simplecov"
SimpleCov.start
require "bundler/setup"
require "rails"
require "superconfig"
require "minitest/autorun"
require "minitest/utils"
ENV["RAILS_MASTER_KEY"] = "ruby-on-rails-sample-credentials"
class TestApp < Rails::Application
def credentials
@credentials ||= e... | 24.538462 | 70 | 0.752351 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.