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 |
|---|---|---|---|---|---|
b97b21d7b9392c0d8723af18af4cb7f441337fa2 | 2,317 | $:.unshift File.join(File.dirname(__FILE__), 'lib')
require 'sinatra'
require 'tex_sanitizer'
require 'tex_template'
require "sinatra/config_file"
require 'digest'
class TeX2SVG < Sinatra::Base
register Sinatra::ConfigFile
Version = '1.0.10'
config_file 'config.yml'
pdflatex = settings.pdflatex
pdf2svg = s... | 37.983607 | 131 | 0.634441 |
11784bc2ea35318eafaf7f85006c91bab0fa5c56 | 285 | require 'redis'
module Mallory
module Backend
class Redis
def initialize(host, port)
redis = ::Redis.new(:host => host, :port => port)
@proxies = redis.smembers("good_proxies")
end
def any
@proxies.sample
end
end
end
end
| 15 | 57 | 0.575439 |
61d6b6039b19f6c26b5db3de8bfbb4b163af608f | 25 | module RoutineHelper
end
| 8.333333 | 20 | 0.88 |
1831320892d69fe77ebcf800d3cb97b9d848fc83 | 5,387 | require 'English'
require 'digest' # required for {set,reset}_api_token
require 'base64' # required for {set,reset}_api_token
# We always assume the following fields exists:
# => :user_name, :last_name, :first_name
# If there are added columns, add the default values to default_values
class User < ApplicationRecord
... | 36.154362 | 102 | 0.702432 |
1c1111796f6209175a88daf2da94eee183d21b20 | 486 | class ContactUsPage < Fae::StaticPage
@slug = 'contact_us'
# required to set the has_one associations, Fae::StaticPage will build these associations dynamically
def self.fae_fields
{
hero: { type: Fae::Image, languages: Fae.languages.keys },
email: { type: Fae::TextField },
body: {
... | 21.130435 | 103 | 0.559671 |
1c1f18e72dbc408f48e0d9138fba2aad2bd7d568 | 26 | module HousesHelper
end
| 5.2 | 19 | 0.807692 |
ff286c13e1773f2b144d46fa0d3b940dbc685bea | 4,221 | 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... | 40.586538 | 102 | 0.749112 |
3378b1438bd2705f6c42e099a869f0931452711f | 484 | cask 'petite-chez-scheme' do
version '8.4'
sha256 '3ed7200c3e265d36d03129569a78bfde8aedaea1ec7565d3c7a4daca26389701'
url "http://www.scheme.com/download/pcsv#{version}-ta6osx-1.pkg.tar.gz"
name 'Petite Chez Scheme'
homepage 'http://www.scheme.com/petitechezscheme.html'
license :unknown # TODO: change licen... | 34.571429 | 112 | 0.760331 |
ac4981ee76913402e5a9c3c3f77c7fe38758da33 | 9,623 | require 'sexp_processor'
require 'set'
require 'active_support/inflector'
#This is a mixin containing utility methods.
module Brakeman::Util
QUERY_PARAMETERS = Sexp.new(:call, Sexp.new(:call, nil, :request, Sexp.new(:arglist)), :query_parameters, Sexp.new(:arglist))
PATH_PARAMETERS = Sexp.new(:call, Sexp.new(:ca... | 26.078591 | 131 | 0.622467 |
1c727a7911068711dab4b657dc4dba93bd93bab9 | 1,485 | module PaginatingFind
module Helpers
DEFAULT_OPTIONS = { :name => :page, :window_size => 2,
:always_show_anchors => true, :link_to_current_page => false,
:params => {} }
def paginating_links(paginator, options = {}, html_options = {})
name = options[:name] || DEFAULT_OPTIONS[:name]
... | 30.9375 | 175 | 0.602694 |
26bb3224cf86976b4bf5227c83c6ccffb026d8a6 | 192 | require File.expand_path('../1.8.7', __FILE__)
module Regexp::Syntax
module Ruby
class V18 < Regexp::Syntax::Ruby::V187
def initialize
super
end
end
end
end
| 13.714286 | 46 | 0.619792 |
263b408133ff540f03e02a5cfebde47894eb6d9f | 1,955 | # 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... | 34.298246 | 86 | 0.720716 |
6a066ffef3184febb9e5edd9160d6115f0f92938 | 12,858 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
require 'net/ssh'
require 'sshkey' # TODO: Actually include this!
class Metasploit3 < Msf::Auxiliary
include Msf::Auxiliary::Scanner
include Msf::Auxiliary::... | 34.657682 | 168 | 0.620625 |
1cddd87e91732c3c4b38d463bc480c79306880ea | 392 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe MergeRequestBasicEntity do
let(:resource) { build(:merge_request) }
subject do
described_class.new(resource).as_json
end
it 'has public_merge_status as merge_status' do
expect(resource).to receive(:public_merge_status).and_return('ch... | 21.777778 | 76 | 0.760204 |
6117be810e1fc8ffb75c02ff96fed267664c39bb | 1,819 | require_dependency "front_end_builds/application_controller"
module FrontEndBuilds
# This controller is responsible for serving the index.html
# based on the incoming params. This is what serves you front
# end.
#
# Best is not a resource, but we are going to isolate serving the
# best build to its own co... | 27.984615 | 84 | 0.669049 |
91fdb29c857821bd98ab92efd8d095cd7f4aa1bb | 55 | Qpdf.config = {
:exe_path => '/usr/local/bin/qpdf'
}
| 13.75 | 36 | 0.6 |
ace281b3ff2caa9d51cb378fa16b47f053f4a00f | 249 | maintainer "YOUR_COMPANY_NAME"
maintainer_email "YOUR_EMAIL"
license "All rights reserved"
description "Installs/Configures irssi"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.0.1"
| 35.571429 | 72 | 0.714859 |
013dfb416edde6ea323deaec86e51192a582a987 | 238 | require 'spec_helper'
require 'cantango/config/permit_registry_ex'
describe CanTango::Config::Permits::Registration do
subject { CanTango::Config::Permits.instance }
it_should_behave_like CanTango::Config::Permits::Registration
end | 26.444444 | 63 | 0.810924 |
284d2b778c482bf9181d8dbf845bbcc52b7eda1e | 181 | class RemoveThemeIdFromUsers < ActiveRecord::Migration
def self.up
remove_column :users, :theme_id
end
def self.down
add_column :users, :theme_id, :integer
end
end
| 18.1 | 54 | 0.734807 |
01599b086942d12aa05f6f2e84198240ccb64bde | 971 | require 'rails_helper'
module ActiveAdmin
RSpec.describe Resource, "Ordering" do
describe "#order_by" do
let(:application) { ActiveAdmin::Application.new }
let(:namespace) { ActiveAdmin::Namespace.new application, :admin }
let(:resource_config) { ActiveAdmin::Resource.new namespace, Post }
... | 33.482759 | 73 | 0.683831 |
5d995dda72f51c4f0c57f8a863da3ec85ed54b78 | 772 | require "test_helper"
class Nonsensor::MidpointDisplacementTest < Minitest::Test
def test_first_and_last_values_are_set
[1, 2, 3, 5, 7, 9, 10, 10.0, 11, 100, 1000].each do |batch_size|
gen = Nonsensor::MidpointDisplacement.new(start: batch_size, batch_size: batch_size)
values = gen.take!(batch_size)
... | 25.733333 | 90 | 0.713731 |
f7ac8f473d56ab65226386c240760697e0f953ac | 3,038 | module AASM
class InstanceBase
attr_accessor :from_state, :to_state, :current_event
def initialize(instance, name=:default) # instance of the class including AASM, name of the state machine
@instance = instance
@name = name
end
def current_state
@instance.aasm_read_state(@name)
... | 31.319588 | 163 | 0.666228 |
019bb4c88d9d78a3b5333367cd02d71d0f17b9f6 | 1,972 | class TinyFugue < Formula
desc "Programmable MUD client"
homepage "https://tinyfugue.sourceforge.io/"
url "https://downloads.sourceforge.net/project/tinyfugue/tinyfugue/5.0%20beta%208/tf-50b8.tar.gz"
version "5.0b8"
sha256 "3750a114cf947b1e3d71cecbe258cb830c39f3186c369e368d4662de9c50d989"
license "GPL-2.0-o... | 39.44 | 132 | 0.719067 |
e96067534e84b66d7b6fffc88e90774270684614 | 7,472 | require 'json'
def get_auth_info(job_url)
<<-DOC
You need to pass the environment variable JENKINS_USER_AUTH
It should be in the format <LDAP username>:<access token>
To find your access token, go to http://<jenkins-url>/me/configure
DOC
end
namespace :pl do
desc "do a local build"
task :local_build => "pl:fe... | 39.326316 | 126 | 0.602516 |
6a36641171dd2900175d8e61869926851f9c180b | 8,126 | require 'spec_helper'
require 'rest_helper'
require 'active_support'
require 'pp'
describe ActiveOrient::OrientDB do
before(:all) do
reset_database
ORD.create_class "V","E"
ORD.create_vertex_class 'dataset', :the_dataset
ORD.create_class 'linked_data'
end
# let(:rest_class) { (Clas... | 35.484716 | 113 | 0.654689 |
6a82c3ced3ff5fff76eb921873e278031c20e7af | 59 | module Frank
class Action < ActiveRecord::Base
end
end
| 11.8 | 35 | 0.745763 |
0353c45d233477e9aee53fed6f9e61cb73ccfb3b | 4,021 | 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... | 38.663462 | 102 | 0.751057 |
012f22ccf2a66591e9a4e18083332411c93fb8bc | 814 | class Issue < ApplicationRecord
validates :issue_date, uniqueness: true, presence: true
scope :published, -> { where(published: true) }
has_many :articles
after_save :touch_articles
validate :is_wednesday
paginates_per 12
def to_param
self.issue_date.to_s
end
def standard_articles
self.... | 17.319149 | 57 | 0.723587 |
e8b29572af7894825bacfef767acca91f125739b | 2,632 | module FBEvents
$: << './'
require 'open-uri'
require 'openssl'
require 'yaml'
require 'json'
require 'date'
VERSION = '1.0.0'
def FBEvents.get(group_id, client_id, client_secret, resource)
ScmsUtils.log( "Getting FaceBook Access Token" )
access_token = FBEvents.get_access_token(client_id, client_secret... | 29.244444 | 162 | 0.68921 |
03589bc117d21ee74a51fc639c44d9d5d14f67eb | 962 | #ruby 1.9.3
inp = gets.chomp
arr = inp.split(' ').map(&:to_i)
avg = arr.inject(:+) / arr.count
puts case avg
when 91..100 then 'A'
when 81..90 then 'B'
when 71..80 then 'C'
when 61..70 then 'D'
else 'F'
end
=begin
Title: The Report Card!
Problem: Priyanka is Professor at Zing University. Help the profess... | 28.294118 | 113 | 0.682952 |
ed8c8275ba10d8843770a79cef54b0a037a4b05d | 340 | require 'rdoc/test_case'
class TestRDocRubyToken < RDoc::TestCase
def test_Token_text
token = RDoc::RubyToken::Token.new 0, 0, 0, 'text'
assert_equal 'text', token.text
end
def test_TkOp_name
token = RDoc::RubyToken::TkOp.new 0, 0, 0, '&'
assert_equal '&', token.text
assert_equal '&', tok... | 17 | 54 | 0.664706 |
ffa051d4b4788f5a1f7a5f8eeec66e875db67350 | 2,199 | require File.expand_path("../../spec_helper", __FILE__)
describe CouchRest::Exception do
it "returns a 'message' equal to the class name if the message is not set, because 'message' should not be nil" do
e = CouchRest::Exception.new
expect(e.message).to eq "CouchRest::Exception"
end
it "returns the 'mes... | 29.32 | 116 | 0.703956 |
5d070b3e51c21454db601ff8581ed1765b516c60 | 149 | class CreateWithCarrierwaves < ActiveRecord::Migration
def change
create_table :with_carrierwaves do |t|
t.string :pdf
end
end
end
| 18.625 | 54 | 0.724832 |
26e8c4fb7a9da08b63933d03ed0cffee89e4bb77 | 2,835 | ##########################################################################
# Copyright 2018 ThoughtWorks, 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/li... | 38.310811 | 133 | 0.617284 |
282970a699de317a7f79dc74ee719c22d04cb6fb | 170 | # This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run EndangeredPetsSample::Application
| 34 | 67 | 0.788235 |
38146a44fce13862494529223d0f7ae43cef7e0f | 934 | # frozen_string_literal: true
require File.expand_path('lib/jekyll-last-modified-at/version.rb', __dir__)
Gem::Specification.new do |s|
s.name = 'jekyll-last-modified-at'
s.version = Jekyll::LastModifiedAt::VERSION
s.summary = 'A liquid tag for Jekyll to indicate the ... | 40.608696 | 100 | 0.648822 |
616030cf8eb7cd839b74a798bc0445ee05631d98 | 1,140 | test_name 'C3426 - clone (file path)'
# Globals
repo_name = 'testrepo_clone'
hosts.each do |host|
tmpdir = host.tmpdir('vcsrepo')
step 'setup - create repo' do
install_package(host, 'git')
my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..'))
scp_to(host, "#{my_root}/acceptance/... | 26.511628 | 87 | 0.630702 |
e9702c981bb06ad22ec9c01a5f66322088874f65 | 243 | # frozen_string_literal: true
class CreateComments < ActiveRecord::Migration[6.0]
def change
create_table :comments do |t|
t.integer :user_id
t.integer :opinion_id
t.text :content
t.timestamps
end
end
end
| 17.357143 | 51 | 0.674897 |
1c0f68f508a3ee693cff39441a46fffdfa25e75a | 275 | # encoding: utf-8
require "logstash/devutils/rspec/spec_helper"
require "logstash/outputs/websocket"
describe "output/websocket" do
subject(:output) { LogStash::Outputs::WebSocket.new }
it "should register" do
expect {output.register}.to_not raise_error
end
end
| 21.153846 | 55 | 0.756364 |
6af3d4ea1ddb541faf678acb9de99df07911d4ce | 6,908 | #
# Author:: Adam Jacob (<adam@opscode.com>)
# Copyright:: Copyright (c) 2009 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 License.
# You may obtain a copy of the License at
#
# htt... | 40.397661 | 186 | 0.632455 |
624ff9a29206ec4cbace16ed28915eb1af3ba6a7 | 2,050 | require 'net/https'
require 'json'
require 'rest-client'
OSU_AUTH_URL = 'https://osu.ppy.sh/oauth/authorize'.freeze
OSU_TOKEN_URL = 'https://osu.ppy.sh/oauth/token'.freeze
OSU_SELF_REQUEST_URL = 'https://osu.ppy.sh/api/v2/me'.freeze
class OsuAuthRequest < ApplicationRecord
before_create { self.nonce = SecureRandom.... | 31.060606 | 139 | 0.678049 |
abf926a9550e01ae643f44a0d47d2ec621d01c29 | 1,312 | require_relative '../spec_helper'
describe Dogapi::Client do
USER_HANDLE = 'test@example.com'.freeze
USER_DESCRIPTION = {
handle: USER_HANDLE,
name: 'TEST'
}.freeze
USER_EMAILS = (1..4).map { |i| "test#{i}@example.com" }
describe '#invite' do
it_behaves_like 'an api method with options',
... | 27.914894 | 67 | 0.565549 |
21d9ae5442d5daa042a63d354cd3e85e325bfffa | 823 | # == Schema Information
#
# Table name: browsing_histories
#
# id :integer not null, primary key
# user_id :integer
# listing_id :integer
# viewed_at :datetime
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_browsing_histories_on_listing_... | 23.514286 | 55 | 0.693803 |
d52f0d7273135bdb6a1a09bda03914ae9be198b5 | 9,305 | #==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene... | 34.850187 | 120 | 0.478882 |
d53dd2acbd8a32c2f2e51454852449348993867b | 966 | #
# Copyright 2016, SUSE
#
# 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, soft... | 35.777778 | 99 | 0.781573 |
1ccc17d625295a2381e7c1d5931ea6c085563a57 | 525 | require "spec_helper"
describe "Element#append_to" do
html <<-HTML
<div id="foo"></div>
<div id="bar"></div>
<div id="baz"></div>
HTML
it "should insert the receiver into the target element" do
Element.find('#foo').children.size.should == 0
Element.parse('<ul class="kapow"></ul>').append_to... | 26.25 | 75 | 0.641905 |
6254fcc7605cf69b7ee4e53a25a51a6ffb8d875f | 6,331 | module Evening_Standup_Commands
def gathering_responds_from_form_evening(responds:,
arguments_from_form:,
creating_standup: )
arguments_from_form.each_with_index do |u, index|
if !creating_standup && first_argument(index)
responds... | 26.161157 | 101 | 0.423788 |
6278436a224d7911421f502c558e81570b63f2cc | 137,592 | # Copyright 2015 Google 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 to in writing,... | 42.730435 | 139 | 0.642254 |
ff8052189c1cbeeaf0cf0da41795d10e9b396845 | 1,461 | module ThreadedTestString
class ::String
include Doing::Color
def highlight_errors
cols = `tput cols`.strip.to_i
string = dup
errs = string.scan(/(?<==\n)(?:Failure|Error):.*?(?=\n=+)/m)
errs.map! do |error|
err = error.dup
err.gsub!(%r{^(/.*?/)([^/:]+):(\d+):in (.... | 28.647059 | 98 | 0.461328 |
9100c176552e3b1dd6ebf53ee61213f97d80296b | 1,096 | require 'test_helper'
class ProductsControllerTest < ActionController::TestCase
setup do
@product = products(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:products)
end
test "should get new" do
get :new
assert_response :success
en... | 21.92 | 74 | 0.69708 |
7a30e1dff06127e82196518992e9bd4105df5b29 | 1,779 | #!/usr/bin/env ruby
#
# $Id$
# $Revision$
#
# This script lists each payload module along with its length
# NOTE: No encoding or BadChar handling is performed
#
msfbase = __FILE__
while File.symlink?(msfbase)
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
end
$:.unshift(File.expand_path(F... | 21.695122 | 75 | 0.672288 |
bf60b96938dc42d1e6c4d8c7ea47f759aa3a2f9f | 902 | module Users
module ParticipableService
extend ActiveSupport::Concern
included do
attr_reader :noteable
end
def noteable_owner
return [] unless noteable && noteable.author.present?
[as_hash(noteable.author)]
end
def participants_in_noteable
return [] unless noteable... | 21.47619 | 104 | 0.659645 |
21d95093e41908d28f66ee86057ecfe428c10c7d | 367 | class AddOgColumnsToGpArticleDocs < ActiveRecord::Migration[4.2]
def change
add_column :gp_article_docs, :og_type, :string
add_column :gp_article_docs, :og_title, :string
add_column :gp_article_docs, :og_description, :text
add_column :gp_article_docs, :og_description_use_body, :boolean
add_column ... | 36.7 | 67 | 0.773842 |
1d6443e4feaf8392e5b4a947a7a64845aeb284db | 33,548 | # frozen_string_literal: true
#
# Cookbook:: aws-parallelcluster
# Attributes:: default
#
# Copyright:: 2013-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the
# License. A copy of the... | 59.376991 | 253 | 0.672618 |
33bbbbbf2c1becb3f26ddc75bbba93beb02cbf4c | 128 | module Skyslope
class ChecklistType < BaseModel
attribute :checklist_type_id
attribute :checklist_type_name
end
end
| 18.285714 | 34 | 0.789063 |
617ad0739a9a26a5575a668bbd6b7003eba61b92 | 796 | # Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
require 'spec_helper'
describe 'client.snapshot#delete_repository' do
let(:expected_args) do
[
'DELET... | 20.947368 | 91 | 0.658291 |
e9a4edaa527959e07fbbcbf15086c06201b265a1 | 65 | module RIM
module Version
Version = "1.4.8"
end
end
| 6.5 | 18 | 0.584615 |
ed551521b1dce6c638e9a787b750014d0a8972a0 | 1,117 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe ::Gitlab::SubscriptionPortal, skip: Gitlab.jh? do
using RSpec::Parameterized::TableSyntax
where(:method_name, :test, :development, :result) do
:default_subscriptions_url | false | false | 'https://customers.gitlab.com'
:default_subscript... | 39.892857 | 112 | 0.709937 |
1c0ec674016a5a04f05daf79a971891d336d625c | 4,248 | require_dependency "webinius_cms/application_controller"
module WebiniusCms
class PagesController < ApplicationController
layout 'webinius_cms/admin'
before_action :authorize, except: :show
before_action :set_page, only: [:show]
before_action :set_page_with_id, only: [:update, :edit, :destroy, :high... | 31.466667 | 242 | 0.608051 |
39396c493fa0ec91f021e09f91da866526d61716 | 5,788 | =begin
PureCloud Platform API
With the PureCloud Platform API, you can control all aspects of your PureCloud environment. With the APIs you can access the system configuration, manage conversations and more.
OpenAPI spec version: v2
Contact: DeveloperEvangelists@genesys.com
Generated by: https://github.com/swagger-ap... | 24.948276 | 177 | 0.60038 |
e865ed137e18741c8330c221d7642570da0d8e0f | 4,793 |
Pod::Spec.new do |spec|
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# These will help people to find your library, and whilst it
# can feel like a chore to fill in it's definitely to your advantage. The
# summary should be tweet-length, and the description more in... | 36.587786 | 113 | 0.592948 |
019d7b967fc653978a8cb87f8d5a9f1b49e83d9b | 1,653 | class NatsStreamingServer < Formula
desc "Lightweight cloud messaging system"
homepage "https://nats.io"
url "https://github.com/nats-io/nats-streaming-server/archive/refs/tags/v0.22.1.tar.gz"
sha256 "116035f0c3c7e6154b7b1352d53ab16bd90b89afbce4afb70fe5d686ca4f24b0"
license "Apache-2.0"
head "https://github... | 36.733333 | 122 | 0.743497 |
bf23a71f2f69b41b2a59c62954c37a7fead4f6c0 | 867 | module Shoulda
module Matchers
module ActiveModel
# @private
module Helpers
def pretty_error_messages(object)
format_validation_errors(object.errors)
end
def format_validation_errors(errors)
list_items = errors.to_hash.keys.map do |attribute|
me... | 24.083333 | 61 | 0.566321 |
61c660a7774784953206e7beb66948e2f4cd0941 | 2,002 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::ContainerInstance::Mgmt::V2018_10_01
module Models
#
# The instance view of the container group. Only valid in response.
#
class ContainerGrou... | 29.014493 | 75 | 0.507493 |
3960ce9ac4411984a7cf2396df5628b4eb635362 | 993 | require_relative '../test_helper'
module Batch
class ModelTest < Minitest::Test
class SimpleJob < RocketJob::Job
include RocketJob::Batch
self.destroy_on_complete = false
self.collect_output = true
self.slice_size = 10
def perform(record)
record
end
... | 21.586957 | 82 | 0.551863 |
6aac2004dd18835891dd7ba4cae92bbb513cc9da | 538 | cask 'ledger-live' do
version '1.15.0'
sha256 '5feba1d89b4da67e229d5a6fd0e0e2b10a407d80c124aefbfba60d6ce7d3dc72'
# github.com/LedgerHQ/ledger-live-desktop was verified as official when first introduced to the cask
url "https://github.com/LedgerHQ/ledger-live-desktop/releases/download/v#{version}/ledger-live-de... | 35.866667 | 124 | 0.776952 |
110930088ea0c2ca67770096997671c69a8d2b42 | 45 | Style::Lib::Rails::Engine.routes.draw do
end
| 15 | 40 | 0.755556 |
f7e095514ec43e99997a0932354d618af013760c | 216 | require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../../../shared/complex/numeric/conj', __FILE__)
describe "Numeric#conjugate" do
it_behaves_like(:numeric_conj, :conjugate)
end
| 30.857143 | 74 | 0.740741 |
f7305ccaba5a6f3a3a761235bcd29f48f9cf24bc | 352 | # encoding: binary
module RbNaCl
# Serialization features shared across all "key-like" classes
module Serializable
def to_s; to_bytes; end
def to_str; to_bytes; end
# Inspect this key
#
# @return [String] a string representing this key
def inspect
"#<#{self.class}:#{Util.bin2hex(to_... | 23.466667 | 63 | 0.661932 |
1c7a10b3f11aa816787eb444bec8b4c380f8085e | 1,101 | require "test_helper"
class CoinsControllerTest < ActionDispatch::IntegrationTest
setup do
@coin = coins(:one)
end
test "should get index" do
get coins_url
assert_response :success
end
test "should get new" do
get new_coin_url
assert_response :success
end
test "should create coin" ... | 22.469388 | 131 | 0.700272 |
034b530dafe199f8faa1e067481cd2e14f1d5272 | 690 |
require 'logger'
require 'mysql2'
# let's establish some basic universal stuff to work against
# where the hell are we?
DIR = File.dirname(File.realpath(__FILE__))
# here's our basic data structure
Transaction = Struct.new(:account, :date, :label, :amount, :category)
# prep the logger
Log = Logger.new "#{DIR}/log... | 25.555556 | 128 | 0.718841 |
ed2430655161ed50e5d36966ccaec7320638be39 | 3,618 | require 'cocoapods'
require 'pathname'
module CocoapodsHelper
UI = FastlaneCore::UI
class CocoapodsHelperException < RuntimeError; end
# Following the lead of npm ci (https://docs.npmjs.com/cli/v7/commands/npm-ci):
# The Podfile.lock must exist.
# The Podfile and Podfile.lock must be in sync.
# A pod ins... | 41.586207 | 123 | 0.734107 |
ac11de2d0d25fa1e2dda6f6fb515abbe7a5558ba | 103 | require 'rom/memory/gateway'
require 'rom/memory/relation'
ROM.register_adapter(:memory, ROM::Memory)
| 20.6 | 42 | 0.786408 |
182582eed3b721bff42c4cb54132d29cfc14eebd | 641 | require "date"
module Clockedin
class ClockEntry
attr_reader :line, :time_span
def initialize(line)
@line = line
@time_span = init_time_span
end
def starts_at
time_span.starts_at
end
def ends_at
time_span.ends_at
end
private
def init_time_span
T... | 18.852941 | 71 | 0.614665 |
61fc4c7ef0e8a670f7ab508a6abaad7dda94f759 | 3,010 | # Copyright (c) 2018 Public Library of Science
# 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 rights to use, copy, modify, merge, pub... | 33.076923 | 107 | 0.736545 |
2609363be0143096205c0a7fbf35a2c6acce67cf | 3,479 | class Filebeat < Formula
desc "File harvester to ship log files to Elasticsearch or Logstash"
homepage "https://www.elastic.co/products/beats/filebeat"
url "https://github.com/elastic/beats.git",
tag: "v7.11.2",
revision: "1d9cced55410003f5d0b4594ff5471d15a4e2900"
# Outside of the "x-pack" fold... | 31.342342 | 122 | 0.622305 |
01365b94dbf39518b40861b00d4fdf65c185152f | 1,017 | require 'tempfile'
require 'json'
require 'English'
require 'open3'
module Packer
class Runner
class ErrorInvalidConfig < RuntimeError
end
def initialize(config)
@config = config
end
def run(command, args={})
config_file = Tempfile.new('')
config_file.write(@config)
conf... | 22.6 | 97 | 0.635202 |
e277c6fa2e4a4c5a35827065679e6c2173ac9204 | 371 | module AccountReactivationConcern
extend ActiveSupport::Concern
def confirm_password_reset_profile
return if current_user.decorate.password_reset_profile
redirect_to root_url
end
def reactivate_account_session
@_reactivate_account_session ||= ReactivateAccountSession.new(
user: current_user,... | 23.1875 | 66 | 0.787062 |
33637737d382d2debb7190cca197c6a8612c27e2 | 476 | FactoryGirl.define do
sequence(:store_credits_order_number) { |n| "R1000#{n}" }
factory :store_credit, class: Spree::StoreCredit do
user
created_by { create(:user) }
category { create(:store_credit_category) }
amount { 150.00 }
currency { 'USD' }
credit_type { create(:primary_credit_type) }... | 26.444444 | 67 | 0.705882 |
792150342cd9f7c4c2456909f112e3b7ae026b6d | 179 | class EmailAddressExhibit < DisplayCase::Exhibit
def self.applicable_to?(object)
object.class.name == 'EmailAddress'
end
def to_s
@context.mail_to(email)
end
end
| 17.9 | 48 | 0.726257 |
7a17bc5fbd6724627fb8b29a931bb99fd6159192 | 15,894 | module RSpec
module Mocks
# @private
class Proxy
SpecificMessage = Struct.new(:object, :message, :args) do
def ==(expectation)
expectation.orig_object == object && expectation.matches?(message, *args)
end
end
# @private
def ensure_implemented(*_args)
... | 32.771134 | 117 | 0.666604 |
7a4bc23dd90ab51f76560e0069ea3ff2cd9f9eda | 3,358 | # frozen_string_literal: true
module Hcaptcha
module Helpers
DEFAULT_ERRORS = {
hcaptcha_unreachable: 'Oops, we failed to validate your hCaptcha response. Please try again.',
verification_failed: 'hCaptcha verification failed, please try again.'
}.freeze
def self.hcaptcha(options)
if o... | 35.723404 | 117 | 0.648898 |
ed7e888e21467684165ee9417c4d90665b2c9b11 | 135 | class AddDoneToProject < ActiveRecord::Migration[5.2]
def change
add_column :projects, :done, :boolean, default: false
end
end
| 22.5 | 57 | 0.740741 |
bb243adab6c9ebf0e0e0d648ebe7d02a5de48af8 | 2,377 | require 'fog/core/collection'
require 'fog/kubevirt/compute/models/service'
module Fog
module Kubevirt
class Compute
class Services < Fog::Collection
attr_reader :kind, :resource_version
model Fog::Kubevirt::Compute::Service
def all(filters = {})
begin
srvs =... | 28.297619 | 73 | 0.496845 |
79cbcc0ba8e23b62995e9fb1ac49638c36108f2b | 576 | #
# Cookbook Name:: cgit-cookbook
# Recipe:: default
#
# Copyright 2015, Kai Sasaki
#
# MIT License
template "/etc/apache2/conf-available/cgit.conf" do
source "cgit_httpd.conf.erb"
mode '0440'
owner 'root'
group 'root'
variables(
'ip_address' => node[:ipaddress]
)
end
template "/etc/apache2/envvars" d... | 14.769231 | 51 | 0.6875 |
289e0f2354f040f95232fcc61effe7bfc1a95c3e | 327 | require 'test_helper'
class AdminNotifierTest < ActionMailer::TestCase
test "contact_form" do
mail = AdminNotifier.contact_form
assert_equal "Contact form", mail.subject
assert_equal ["to@example.org"], mail.to
assert_equal ["from@example.com"], mail.from
assert_match "Hi", mail.body.encoded
en... | 25.153846 | 48 | 0.733945 |
1d7c244ca0f05fd003535dca8dab1d99e8fed914 | 53,454 | class MiqExpression
require_nested :Tag
include Vmdb::Logging
attr_accessor :exp, :context_type, :preprocess_options
config = YAML.load(ERB.new(File.read(Rails.root.join("config", "miq_expression.yml"))).result) # rubocop:disable Security/YAMLLoad
BASE_TABLES = config[:base_tables]
INCLUDE_TABLES = config[... | 36.712912 | 280 | 0.622517 |
f8bbcc3221f6f7a54488c14fbe77ba3862858ff5 | 393 | require "spec_helper"
describe(Shoe) do
it { should have_and_belong_to_many(:stores) }
it("validates presence of a shoe brand") do
new_shoe = Shoe.new({:brand => ""})
expect(new_shoe.save()).to(eq(false))
end
it("capitalizes entry when saved") do
new_shoe = Shoe.create({:brand => ... | 24.5625 | 50 | 0.62341 |
acb86fb028efe8278a1f9cec65113922bb58636f | 5,679 | module RSpec
module Mocks
# ArgumentMatchers are placeholders that you can include in message
# expectations to match arguments against a broader check than simple
# equality.
#
# With the exception of `any_args` and `no_args`, they all match against
# the arg in same position in the argument... | 24.584416 | 84 | 0.558725 |
6a3e6b8641b2e4fbe1f60ef39802bc9bd89ad8c4 | 4,864 | Shindo.tests('Radosgw::Provisioning | provisioning requests', ['radosgw']) do
current_timestamp = Time.now.to_i
user_format = {
'email' => String,
'display_name' => String,
'user_id' => String,
'suspended' => Integer,
'keys' =>
[
{
'access_key' => String,... | 28.444444 | 109 | 0.644326 |
f7ef39a846ab355a71f7f521ec8e12f5f31d91e6 | 509 | # frozen_string_literal: true
return unless defined? ::ActiveSupport::CurrentAttributes
require "spec_helper"
RSpec.describe OperatorRecordable::CurrentAttributesStore do
before { described_class::Current.reset }
describe "#[]" do
before { described_class::Current[:foo1] = "bar1" }
it { expect(describe... | 23.136364 | 63 | 0.701375 |
08e792328e0c1298940892dc7b34d358cae31118 | 437 | require 'acts_as_list'
require 'acts_as_markup'
require 'acts_as_published'
require 'friendly_id'
require 'haml-rails'
require 'paperclip'
require 'route_translator'
require 'twitter/bootstrap/components/rails'
require 'ecm/pictures/engine'
require 'ecm/pictures/configuration'
require 'ecm/pictures/version'
module Ec... | 19 | 44 | 0.784897 |
f8eed6887b591d6ba53ecbbb5f0ef5537b71fdae | 1,958 | class Admin::Api::WebHooksFailuresController < Admin::Api::BaseController
representer WebHookFailures
before_action :authorize_web_hooks
# swagger
##~ sapi = source2swagger.namespace("Account Management API")
##~ e = sapi.apis.add
##~ e.path = "/admin/api/webhooks/failures.xml"
##~ e.responseClass = "Li... | 36.259259 | 258 | 0.695097 |
1db8e1026be43ef906ca0179e38fd38ce5f28f57 | 2,116 | require_relative './configuration_file_finder'
module Reek
module Configuration
class ConfigFileException < StandardError; end
#
# Reeks singleton configuration instance.
#
module AppConfiguration
@configuration = {}
@has_been_initialized = false
class << self
attr_read... | 27.842105 | 98 | 0.614367 |
1d710ed388cd4d0373b9456c8d05560c09064667 | 455 | # 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::V2019_12_01
module Models
#
# Defines values for EffectiveRouteSource
#
module EffectiveRouteSource
Unk... | 23.947368 | 70 | 0.701099 |
1dc83f917bc7e2eb04188501dc5a373126cc1889 | 204 | require 'test_helper'
class HaloPaysTest < Minitest::Test
def test_that_it_has_a_version_number
refute_nil ::HaloPays::VERSION
end
def test_it_does_something_useful
assert false
end
end
| 17 | 39 | 0.784314 |
398bb11d3b946845246ddd60486260b1dae6727a | 14,079 | # -*- coding: utf-8 -*-
require 'spec_helper'
require_relative 'shared/block_examples'
# rubocop:disable EmptyLines, LineLength
describe RubyToBlock::Block, '移動・回転ジャンル', to_blocks: true do
parts = <<-EOS
car1.on(:start) do
move(10)
self.position = [0, 0]
self.x += 10
self.x = 0
self.y += 10
self.y = 0
... | 36.1 | 91 | 0.335535 |
1a2629ed422a1428d1b9f9fd19bb0d59a8d729c4 | 383 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe GitlabSchema.types['Subscription'] do
it 'has the expected fields' do
expected_fields = %i[
issuable_assignees_updated
issue_crm_contacts_updated
issuable_title_updated
issuable_labels_updated
]
expect(described_... | 22.529412 | 73 | 0.759791 |
1d3689497d78cd8fe6711601f296b32d2b52a036 | 408 |
module CouchRest
class Database
alias :delete_orig! :delete!
def delete!
clear_model_fresh_cache
delete_orig!
end
# If the database is deleted, ensure that the design docs will be refreshed.
def clear_model_fresh_cache
::CouchRest::Model::Base.subclasses.each{|klass| klass.re... | 20.4 | 130 | 0.720588 |
f77c7cb231ba51e102482b5ff3aff2a0f4414997 | 768 | $START_OPTIONS = { :session_store => "memory" }
require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
require File.join(File.dirname(__FILE__), "session_spec")
require File.join(File.dirname(__FILE__), "controllers", "sessions")
describe Merb::MemorySession do
before do
@session_class = Merb:... | 27.428571 | 72 | 0.733073 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.