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 |
|---|---|---|---|---|---|
ab3c87d0f1bef40036609353d2be1ca1e7636a18 | 7,676 | # frozen_string_literal: true
# Pagy initializer file (4.7.1)
# Customize only what you really need and notice that Pagy works also without any of the following lines.
# Should you just cherry pick part of this file, please maintain the require-order of the extras
# Pagy Variables
# See https://ddnexus.github.io/pag... | 42.40884 | 128 | 0.706748 |
e27d9ed255ed9fc5ae7f07ce758f071369128c15 | 1,064 | require 'test_helper'
class Attr3sControllerTest < ActionController::TestCase
setup do
@attr3 = attr3s(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:attr3s)
end
test "should get new" do
get :new
assert_response :success
end
tes... | 21.28 | 88 | 0.68609 |
e237e45654c837090aef70a3e906ba9f2e0653dc | 426 | # 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::KeyVault::V2015_06_01
module Models
#
# Defines values for JsonWebKeyEncryptionAlgorithm
#
module JsonWebKeyEncryptionAlgori... | 23.666667 | 70 | 0.706573 |
e94aa3628e7d23aaf9b965ec170fca8a24459b8c | 373 | require_relative '../automated_init'
context "Data Structure" do
test "Is a Schema object" do
ancestors = Schema::Controls::DataStructure.ancestors
assert(ancestors.include? Schema)
end
test "Can configure its dependencies" do
example = Schema::Controls::DataStructure::ConfigureDependencies.example
... | 26.642857 | 76 | 0.753351 |
089304ed4a4f409435e4ea8ad3372615f272efa3 | 457 | require 'benchmark/ips'
require 'benchmark/ipsa'
require 'sentry-raven-without-integrations'
Raven.configure do |config|
config.logger = Logger.new(nil)
config.dsn = "dummy://12345:67890@sentry.localdomain:3000/sentry/42"
end
exception = begin
1/0
rescue => e
e
... | 19.869565 | 70 | 0.691466 |
bf7f25cb8d01be92fe3f70030f729b56c0ab023d | 1,812 | require 'spec_helper'
describe Volunteer do
describe '#name' do
it 'returns the name of the volunteer' do
test_volunteer = Volunteer.new({:name => 'Jane', :project_id => 1, :id => nil})
expect(test_volunteer.name).to eq 'Jane'
end
end
describe '#project_id' do
it 'returns the project_id ... | 31.241379 | 85 | 0.612583 |
79535fd50c404ed11610dda1953cebbad675eabb | 2,126 | #--
# Project: google_checkout4r
# File: test/unit/carrier_calculated_shipping_test.rb
# Author: Tony Chan <api.htchan at gmail dot com>
# Copyright: (c) 2007 by Manuel Holtgrewe
# License: MIT License as follows:
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this s... | 37.298246 | 78 | 0.765757 |
18605fface1f7afe833dd107108cb7a3d25a501a | 799 | Rails.application.routes.draw do
root 'static_pages#home'
get '/help', to: 'static_pages#help'
get '/about', to: 'static_pages#about'
get '/contact', to: 'static_pages#contact'
get '/signup', to: 'users#new'
get '/login', to: 'sessions#new'
get '/blocked_users', to: 'blocked_us... | 31.96 | 71 | 0.624531 |
4af72f5d2f4a1eb19de29f143ef73eb3ae8a0beb | 762 | # typed: false
require 'spec_helper'
require 'ddtrace/profiling/transport/parcel'
RSpec.describe Datadog::Profiling::Transport::Parcel do
subject(:parcel) { described_class.new(data) }
let(:data) { instance_double(Array) }
it { is_expected.to be_a_kind_of(Datadog::Transport::Parcel) }
describe '#initialize... | 23.8125 | 65 | 0.695538 |
bfb6c589bb464592994ef46da0bd200d50e67130 | 60 | json.extract! @domain, :id, :name, :created_at, :updated_at
| 30 | 59 | 0.716667 |
912cd9bc4e621dbd2686bb9377a94e53556ede85 | 1,762 | #
# Be sure to run `pod lib lint TGCore.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 = 'TGCore'
s.... | 39.155556 | 108 | 0.642452 |
6a7581fa52fd740206556747c7250cf109f8bdd7 | 192 | require 'rails_helper'
RSpec.describe Activity, type: :model do
it { should belong_to(:user) }
it { should validate_presence_of(:kind) }
it { should validate_presence_of(:amount) }
end
| 24 | 45 | 0.734375 |
625ef63abbc08109e674e6529555146189750e13 | 3,677 | module PdfHelper
require 'wicked_pdf'
require 'wicked_pdf_tempfile'
def self.included(base)
# Protect from trying to augment modules that appear
# as the result of adding other gems.
return if base != ActionController::Base
base.class_eval do
alias_method_chain :render, :wicked_pdf
a... | 38.705263 | 245 | 0.655426 |
7a86229539270d7aa53f7c2d1533c67b710886b8 | 5,018 | 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... | 44.40708 | 114 | 0.762654 |
01ba6efc5310e5c7d09fa586ab9d5435c8f4f521 | 1,438 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'capybara/rspec', :type => :feature do
it "should include Capybara in rspec" do
visit('/foo')
expect(page.body).to include('Another World')
end
context "resetting session" do
it "sets a cookie in one example..." do
visit('/set_... | 27.132075 | 87 | 0.689152 |
f7f64233a79edfb6aa802d2aeae330a8ffa9bb29 | 937 | test_name "puppet should match existing job"
confine :except, :platform => 'windows'
require 'puppet/acceptance/common_utils'
extend Puppet::Acceptance::CronUtils
teardown do
step "Cron: cleanup"
agents.each do |agent|
clean agent
end
end
agents.each do |host|
step "ensure the user exist via puppet"
se... | 29.28125 | 101 | 0.676628 |
e898dc35abe597e48739dcb7a24d632d8b357632 | 5,596 | require 'vcr'
require 'multi_json'
module VCRHelpers
def normalize_cassette_hash(cassette_hash)
cassette_hash['recorded_with'] = "VCR #{VCR.version}"
cassette_hash['http_interactions'].map! { |h| normalize_http_interaction(h) }
cassette_hash
end
def normalize_headers(object)
object.headers = {}... | 33.710843 | 123 | 0.696926 |
18f7714f75d150ce2e650bf1047e061cceb30852 | 458 | cask :v1 => 'yubikey-neo-manager' do
version '1.3.0'
sha256 '9b28bc6350a7afe2e7e3e4397423359487de876ee67aafeca7902f9aaa5f1756'
url "https://developers.yubico.com/yubikey-neo-manager/Releases/yubikey-neo-manager-#{version}-mac.pkg"
name 'YubiKey NEO Manager'
homepage 'https://developers.yubico.com/yubikey-neo... | 32.714286 | 105 | 0.759825 |
21281cd6f2b058ed9c582f0ebc46586ff227a855 | 1,632 | require 'test_helper'
class UsersSignupTest < ActionDispatch::IntegrationTest
def setup
ActionMailer::Base.deliveries.clear
end
test "invalid signup information" do
get signup_path
assert_no_difference 'User.count' do
post users_path, user: { name: "",
email: "... | 33.306122 | 78 | 0.64277 |
91791a254bf86ae85adbc0dd059853410fc39459 | 388 | describe Joybox::UI::MenuLabel do
behaves_like Joybox::UI::MenuLabel
describe "Initialization" do
it "should initialize with text & color" do
color = "#FFFFFF".to_color
menu_label = MenuLabel.new text: 'MenuLabel', color: color
menu_label.should.not == nil
menu_label.text.should == 'M... | 29.846154 | 64 | 0.680412 |
01bc52bdc011b6eaf81e5f4d35371543db31483c | 1,132 | require "bundler/setup"
require "pry-byebug"
require "pry-doc"
require "rdoc_rubocop"
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` and `main`
config.disable... | 25.155556 | 79 | 0.673145 |
03fb9a70a57d81949573c4931dcb2b21c1a1fabe | 6,049 | #!/usr/bin/env ruby
# Add all files in testscripts\SlingRuby\lib directory to ruby "require" search path
require './ruby-lib-dir.rb'
require 'sling/test'
require 'sling/search'
require 'sling/contacts'
require 'test/unit.rb'
include SlingSearch
include SlingUsers
include SlingContacts
class TC_Kern939Test < Test::Un... | 42.300699 | 102 | 0.66044 |
38bb242ba046b32af4ccfaf5accfdb44c217b3a1 | 1,316 | # frozen_string_literal: true
require 'stannum/constraints/base'
module Stannum::Constraints
# An absence constraint asserts that the object is nil or empty.
#
# @example Using an Absence constraint
# constraint = Stannum::Constraints::Absence.new
#
# constraint.matches?(nil) #=> true
# constraint... | 30.604651 | 80 | 0.658055 |
7acc839479fcf5a72f5bea3cc8c4b91716e01345 | 1,519 | module Shopr
class TaxRate < ApplicationRecord
include Shopr::AssociatedCountries
# The order address types which may be used when choosing how to apply the tax rate
ADDRESS_TYPES = %w[billing delivery].freeze
# Validations
validates :name, presence: true
validates :address_type, inclusion: ... | 34.522727 | 117 | 0.702436 |
792b473b7939e58a3ce3e35f446cc579fa6e9a3c | 34,089 | # frozen_string_literal: true
require 'optparse'
require 'pathname'
##
# RDoc::Options handles the parsing and storage of options
#
# == Saved Options
#
# You can save some options like the markup format in the
# <tt>.rdoc_options</tt> file in your gem. The easiest way to do this is:
#
# rdoc --markup tomdoc --writ... | 25.923194 | 101 | 0.60961 |
4aee7a6f83b201aa438abcd3e6109e6efe3a9992 | 5,105 | # frozen_string_literal: true
module ActionDispatch
# :stopdoc:
module Journey
class Route
attr_reader :app, :path, :defaults, :name, :precedence, :constraints,
:internal, :scope_options
alias :conditions :constraints
module VerbMatchers
VERBS = %w{ DELETE GET HEAD... | 25.525 | 176 | 0.544368 |
abb5a683f07cffae133581106cf825f782d74737 | 1,698 | module ArelHelpers
def ah = ArelHelpers
class << self
def cast(val, type)
Arel::Nodes::InfixOperation.new('::', val, Arel.sql(type))
end
def contains(a, b)
Arel::Nodes::InfixOperation.new('@>', a, b)
end
def cover(a, b)
Arel::Nodes::InfixOperation.new('&&', a, b)
end
... | 22.342105 | 85 | 0.62073 |
bf8741c36adbfd776de27ea41db6d93ffc541c24 | 885 | module QRDA
module Cat1
class CommunicationFromProviderToProviderImporter < SectionImporter
def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.4']"))
super(entry_finder)
@entry_does_not_have_reason = true
... | 40.227273 | 144 | 0.715254 |
91579575a3af055956c06f4e7c89e54106df631b | 46,333 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Network::Mgmt::V2020_05_01
#
# VpnGateways
#
class VpnGateways
include MsRestAzure
#
# Creates and initializes a new instance of the VpnGat... | 43.140596 | 149 | 0.698724 |
4a76ecaae0e16de7f47e5e0e0e421fb04e23a10c | 398 | require 'thor'
require 'shopware/api/client'
require 'shopware/cli/config'
require 'shopware/cli/shell'
module Shopware
module CLI
module Subcommands
class Subcommand < Thor
attr_reader :client
include Config
include Shell
def initialize(*args)
super
... | 15.92 | 47 | 0.623116 |
33747776a25c9fa8cf4424f3fa154e506d37296d | 1,291 | #-- copyright
# ReportingEngine
#
# Copyright (C) 2010 - 2014 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT AN... | 32.275 | 81 | 0.711851 |
ff02ee0deb321d0886a837add5dfa2b2d8d313b7 | 280 | class Admin::BaseController < ApplicationController
before_action :authorize_admin!
private
def authorize_admin!
return true if current_user && current_user.admin?
flash[:alert] = "You are not permitted to access that."
redirect_to root_url
end
end
| 21.538462 | 59 | 0.728571 |
26eee1c045c760940e1ccb37ef3ebf3064714a12 | 2,319 | require 'rubygems'
require 'thor'
require 'yaml'
require 'json'
require 'launchy'
require 'progress_bar'
require 'screenshot'
require "screenshooter/version"
# Should get the values from the .browserstack file
def get_credentials
if ENV['BROWSERSTACK_USERNAME'] and ENV['BROWSERSTACK_TOKEN']
[ENV['BROWSERSTACK_US... | 32.661972 | 128 | 0.648124 |
ab202e19b23e0b12620bd34f319e45b0d77ddc88 | 23 | puts "Hello, world!"
| 5.75 | 20 | 0.608696 |
012a98e6c58652951df8db925f29e0ad0ff0d609 | 1,274 | class CreateLeads < ActiveRecord::Migration[4.2]
def self.up
create_table :leads, force: true do |t|
t.string :uuid, limit: 36
t.references :user
t.references :campaign
t.integer :assigned_to
t.string :first_name, limit: 64, null: false, default: ""
t.string :last_name, li... | 32.666667 | 68 | 0.597331 |
b90c77f6b6094d35012847eded3a251b3db7d75b | 512 | # Same as /sessions/new
get '/login' do
erb :'/users/login'
end
# Same as post /sessions
post '/login' do
user = User.find_by(username: params[:user][:username])
password = params[:user][:password]
if user && User.authenticate(params[:user][:username], password)
session[:user_id] = user.id
redirect "/... | 17.655172 | 66 | 0.662109 |
e2a5e853ce8356fa79909566bbbde9e9f756b3ed | 758 | class Baza::InfoActiveRecordMysql
attr_reader :db
def self.connection
require "active_record"
require "activerecord-jdbc-adapter" if RUBY_PLATFORM == "java"
@conn_pool ||= ::ActiveRecord::Base.establish_connection(
adapter: "mysql",
host: "localhost",
database: "baza-test",
use... | 19.947368 | 66 | 0.630607 |
4af832e3febf6df26c0a368d7836c4a87ddf3f85 | 1,267 | namespace :webmasters_cms do
desc "dump a rails database"
task :dump_db, [:out_file] => [:environment] do |t, args|
if db_config = ActiveRecord::Base.configurations[Rails.env]
db_name = db_config['database']
out_file = args[:out_file] || "/tmp/#{Time.now.strftime("%Y_%m_%d")}__#{db_name}.sql"
... | 32.487179 | 93 | 0.61326 |
086cc29f5e7b907dba218b1f3c50573a5457aa90 | 75 | FactoryGirl.define do
factory :comment do
comment "MyText"
end
end
| 12.5 | 21 | 0.72 |
ed8e0332f49a6c3d1f6718f1afed9b73b1055230 | 285 | class CreateReviews < ActiveRecord::Migration[5.1]
def change
create_table :reviews do |t|
t.belongs_to :user, index: true
t.belongs_to :instrument, index: true
t.column :title, :string
t.column :content, :string
t.timestamps
end
end
end
| 23.75 | 50 | 0.645614 |
d5c14c36445c09bcbb7917f8958a63dd38b109f0 | 121 | class AddAvatarToAtractivo < ActiveRecord::Migration
def change
add_column :atractivos, :avatar, :string
end
end
| 20.166667 | 52 | 0.768595 |
bf82e065db5d9bde3675595cce5edf227c846c30 | 584 | # Note that for simplicity's sake this is not thread-safe
class SqlMonitor
def initialize
reset
end
def start(name, id, payload)
return if %w(CACHE SCHEMA).include?(payload[:name])
@last_start = Time.now
end
def finish(name, id, payload)
return if %w(CACHE SCHEMA).include?(payload[:name])
... | 19.466667 | 84 | 0.67637 |
e8a0646c05d70bf00c6c3c5166ac24d96d46c8b8 | 4,968 | require 'spec_helper'
describe "gws_share_files_upload_policy", type: :feature, dbscope: :example, js: true do
let(:site) { gws_site }
let!(:folder) { create :gws_share_folder }
let!(:category) { create :gws_share_category }
context "sanitizer setting" do
before { login_gws_user }
before do
upl... | 31.443038 | 100 | 0.646135 |
38c26b143c7fbcbfb7995a5c2998076d64d8d338 | 79 | class Collection < ApplicationRecord
belongs_to :user
belongs_to :show
end
| 15.8 | 36 | 0.797468 |
117ac12d105770e0be0df4ddcc025606ee7855ef | 3,010 | require_relative '../spec_helper'
describe 'interpolations' do
describe 'interpolate' do
let(:i) { Mumukit::Directives::Interpolations.new }
it { expect(i.interpolations? '').to be false }
it { expect(i.interpolations? 'test "foo" {}').to be false }
it { expect(i.interpolations? 'test "foo" { /* her... | 54.727273 | 189 | 0.43588 |
e8a512886b6170f40893541e70c30e2c023f1e85 | 1,575 | class Makefile2graph < Formula
desc "Create a graph of dependencies from GNU-Make"
homepage "https://github.com/lindenb/makefile2graph"
url "https://github.com/lindenb/makefile2graph/archive/v1.5.0.tar.gz"
sha256 "9464c6c1291609c211284a9889faedbab22ef504ce967b903630d57a27643b40"
head "https://github.com/linde... | 36.627907 | 93 | 0.754921 |
e2a8f77acaec8e0a12a0d3dea9d38f74477f71cc | 90 | Rails.application.routes.draw do
mount Mayodon::Webapp::Engine => "/mayodon-webapp"
end
| 22.5 | 52 | 0.755556 |
877866b9b232d10da9b57c93a0330cb451d0880b | 2,047 | # frozen_string_literal: true
module Gitlab
module Database
# This abstract class is used for models which need to exist in multiple de-composed databases.
class SharedModel < ActiveRecord::Base
self.abstract_class = true
# if shared model is used, this allows to limit connections
# on whi... | 31.984375 | 115 | 0.656082 |
f8b29f8ae0a5cad27c73e2b7deabf08e1171d865 | 212 | class AddImageToProducts < ActiveRecord::Migration[5.0]
def self.up
change_table :products do |t|
t.attachment :image
end
end
def self.down
drop_attached_file :products, :image
end
end
| 17.666667 | 55 | 0.698113 |
79fde515490f6f4c552566358efc701e10b563ac | 1,126 | # Configure Rails Environment
ENV["RAILS_ENV"] = "test"
require_relative "../test/dummy/config/environment"
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)]
require "rails/test_help"
# Filter out Minitest backtrace while allowing backtrace from other libraries
# to be ... | 38.827586 | 146 | 0.796625 |
ed3dfd9bd44b4cb2dccc35d517b6f0e304d2733d | 944 | require 'rails_helper'
include Warden::Test::Helpers
RSpec.describe Admin::CustomEmailsController do
let!(:admin) {create(:admin, superadmin: true)}
before do
sign_in admin
end
describe "GET show" do
it "renders the show template" do
get :show
expect(assigns(:form).present?).to be_truthy
... | 30.451613 | 104 | 0.681144 |
b99034853409187aa2f2f1204a84d314944ddadd | 2,209 | # frozen_string_literal: true
require 'rails_helper'
require 'gumboot/shared_examples/application_controller'
class SomeReportsController < ApplicationController; end
RSpec.describe ApplicationController, type: :controller do
include_examples 'Application controller'
controller do
before_action :ensure_auth... | 26.939024 | 77 | 0.685831 |
b983774bbab988c12e7c8dbf38dcfa2e92c810b4 | 3,939 | # frozen_string_literal: true
require 'test_helper'
class DeletePlainObjectWorkerTest < ActiveSupport::TestCase
class DestroyableObjectsTest < DeletePlainObjectWorkerTest
def setup
factory_names = %i[simple_provider service application_plan metric]
@objects = factory_names.map { |factory_name| Facto... | 36.137615 | 181 | 0.720741 |
3835aa1bc243df5f8402bba70c0c239be7bfffd4 | 121 | Rails.application.routes.draw do
root :to => redirect("/style-guide")
mount StyleGuide::Engine => "/style-guide"
end
| 24.2 | 44 | 0.710744 |
abc0fd99488a824d09e82623f975babade3b5a20 | 628 | require 'active_support/concern'
require 'rails/rack/logger'
module Rails
module Rack
# Overwrites defaults of Rails::Rack::Logger that cause
# unnecessary logging.
# This effectively removes the log lines from the log
# that say:
# Started GET / for 192.168.2.1...
class Logger
# Overwr... | 24.153846 | 60 | 0.652866 |
79fb5374dbdaddca7fd909defec24c53c0e5d067 | 1,702 | module Spree
class StockItem < ActiveRecord::Base
acts_as_paranoid
belongs_to :stock_location, class_name: 'Spree::StockLocation'
belongs_to :variant, class_name: 'Spree::Variant', touch: true
has_many :stock_movements
validates_presence_of :stock_location, :variant
validates_uniqueness_of :... | 26.59375 | 105 | 0.683314 |
0318d1798c42768e8221ea9f2e58d96db6ac656d | 172 | # frozen_string_literal: true
require 'test_helper'
class EvidencesControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
end
| 17.2 | 63 | 0.755814 |
388c5a605ee6b3a301d2d9826bd7f1669a30a306 | 674 | module Chapex
module Check
# check class base
class Base
@subclasses = []
def self.inherited(subclass)
@subclasses << subclass.new
end
def self.all
@subclasses
end
attr_reader :violations
def initialize
@violations = []
end
def... | 18.216216 | 52 | 0.568249 |
4a1d5f24361734d7e86b1c46533bcd307e1153c5 | 171 | class User < ActiveRecord::Base
validates_presence_of :username
has_secure_password
has_many :user_workouts
has_many :workouts, through: :user_workouts
end | 28.5 | 47 | 0.777778 |
87a0662e1620dca199ef85bb6bec47e1dd26ec30 | 439 | module Grape
module Validations
class PresenceValidator < Validator
def validate!(params)
return unless @scope.should_validate?(params)
super
end
def validate_param!(attr_name, params)
unless params.respond_to?(:key?) && params.key?(attr_name)
raise Grape::Exce... | 25.823529 | 105 | 0.658314 |
1aa337ac21a7c35dd606fdc57d8d8fb636ac7889 | 213 | # frozen_string_literal: true
def reverse(input)
reverse_input = input.length - 1
while reverse_input >= 0
return input[reverse_input]
reverse_input -= 1
end
# raise NotImplementedError
end
| 19.363636 | 36 | 0.713615 |
8766b58a463197dd5cd927a0da866ffae12b52e3 | 539 | class ServiceInstanceUsageQuery
attr_reader :instance
def initialize(instance)
@instance = instance
end
def execute
db_name = instance.db_name
escaped_database = ActiveRecord::Base.connection.quote(db_name)
query = <<-SQL
SELECT SUM(ROUND(((data_length + index_length) / 1024 / 1024), 2))... | 23.434783 | 72 | 0.710575 |
016f596e4e84e94e3e4b5712a8887308fc01b478 | 4,645 | class Bot
DM_CHANNEL_PREFIX = 'D'
DM_RESPONSE = configatron.bot.dm_response
PUBLIC_CHANNEL_NAME = configatron.bot.channel_name
ERROR_RESPONSE = configatron.bot.error_response
BOT_NAME = configatron.bot.name
@instance = nil
def self.instance
@instance
end
def self.create(client, storage, log)
... | 22.22488 | 103 | 0.665877 |
f82e2b761152b04bfcd8c83b9ba5658758f156f3 | 400 | require 'array/hash_builder'
class Array
def chain_map(*methods)
result = self
result = result.map(&(methods.shift)) until methods.empty?
return result unless block_given?
result.map { |*args| yield(*args) }
end
def as_hash(keys)
Array::HashBuilder.new(self, keys).build
end
def random
... | 16.666667 | 62 | 0.665 |
aba2a826d97760fa87d841e09394f0e9302d4df1 | 1,940 | #
# Search component:
# * prompt for search
# * display matching paragraphs from agenda, highlighting search strings
# * keep query string in window location URL in synch
#
class Search < Vue
# initialize query text based on data passed to the component
def initialize
@text = @@item.query || ''
end
d... | 24.556962 | 79 | 0.626804 |
d520ecbc80ec9025e30426e4b7f8bdf6749bcdbf | 1,305 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module LineItemImporter
class Application < Rails::Application
config.middleware.use 'Rack::RawUploa... | 43.5 | 99 | 0.720307 |
382f56db4fd6c49bcce45a7f57124c76d0a667d3 | 4,066 | ##
# $Id$
##
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
# http://metasploit.com/
##
require 'msf/core'
class Metasploit3 < Msf::Auxiliary
include ... | 39.096154 | 87 | 0.659616 |
b9749bab84fd49dd55d48a752080107b88134ee4 | 6,262 | # frozen_string_literal: true
require "concurrent/map"
require "action_view/path_set"
module ActionView
class DependencyTracker # :nodoc:
@trackers = Concurrent::Map.new
def self.find_dependencies(name, template, view_paths = nil)
tracker = @trackers[template.handler]
return [] unless tracker
... | 33.666667 | 115 | 0.594219 |
38fc8a1c66e0c02b7f1d8c6f34e50279c63271f5 | 3,410 | require 'matrix'
class Matrix
public :"[]=", :set_element, :set_component
end
class MazeController < ApplicationController
helper_method :getRandomMaze
helper_method :getPaths
def index
@submission = Submission.find(params[:id])
end
#Helper Functions
def getRandomMaze(y, x)
x_size = x
y_size = y
s... | 26.850394 | 136 | 0.613783 |
113c6fb11639b1114deed1726fe655271b1ccb00 | 3,962 | require "set"
require "tempfile"
require "hbc/container/base"
module Hbc
class Container
class Dmg < Base
def self.me?(criteria)
!criteria.command.run("/usr/bin/hdiutil",
# realpath is a failsafe against unusual filenames
args: ["... | 29.567164 | 133 | 0.527764 |
28cb270ccdff2a0fd7ca51a8d22aa3d0dfad826a | 860 | cask "dynobase" do
version "1.4.2"
if Hardware::CPU.intel?
sha256 "df8cc4e530d181083f31214f31d789f8185954b668ceef86acb58b163b1c0625"
url "https://github.com/Dynobase/dynobase/releases/download/#{version}/Dynobase-#{version}.dmg",
verified: "github.com/Dynobase/dynobase/"
else
sha256 "e655596... | 26.875 | 106 | 0.726744 |
79ca09eef81dcd019ba4e30275c3e6299003e167 | 2,456 |
#
# Specifying sentofu
#
# Wed May 22 07:56:28 JST 2019
#
require 'spec_helper'
describe Sentofu do
describe '.version_match' do
{
[ '3.0.1', '*' ] => true,
[ '3.0.1', 'x' ] => true,
[ '3.0.1', '3.x' ] => true,
[ '3.0.1', '3.*' ] => true,
[ '3.0.1', '3.0' ] => true,
[ '3.... | 20.638655 | 80 | 0.514658 |
263701cbb8c60256734079ad620a0fae0423e0e8 | 1,330 | # Copyright 2011-2020, The Trustees of Indiana University and Northwestern
# University. Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | 40.30303 | 107 | 0.697744 |
edf818ea45499d8fb7d506569e48132fe503689a | 3,264 | # Copyright �2011-2012 Pieter van Beek <pieterb@sara.nl>
#
# 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 applicabl... | 24 | 75 | 0.609681 |
18544f249afee42c41c237463dbf140c2a668632 | 2,555 | require 'sqs_worker/manager'
require 'sqs_worker/worker_resolver'
require 'sqs_worker/heartbeat/log_file_heartbeat_monitor'
module SqsWorker
class Runner
HEARTBEAT_THRESHOLD = 60
def self.run_all
new.run_all
end
def run_all
trap_signals
prepare_to_start_processing
start_pr... | 22.610619 | 135 | 0.626614 |
6a8d09786a45db60cb7661bdc4a72804a38819d8 | 289 | require_relative "../../config/environment"
class MovieRecommender::Movie
attr_accessor :title, :url
@@all =[]
def initialize(title:, url:)
@title = title
@url = url
@@all << self
end
def self.all
@@all
end
def self.destroy
@@all.clear
end
end
| 11.115385 | 43 | 0.602076 |
79486fcf205cc005766ffb78a55daad4036e2a4a | 74 | # frozen_string_literal: true
module StoryBranch
VERSION = '2.0.1'
end
| 12.333333 | 29 | 0.743243 |
1a53f2628074292847357c1bca6e87d24074d457 | 913 | require 'test_helper'
class DeploymentTasksTest < Minitest::Test
def setup
load "test/fixtures/123_test_task.rb"
ActiveRecord::Base.connection.execute("delete from #{::DeploymentTasks.database_table_name}")
end
def test_that_it_has_a_version_number
refute_nil ::DeploymentTasks::VERSION
end
def... | 21.738095 | 97 | 0.751369 |
2600e6525b803b8a455e6c4dd2e89e956b29de54 | 8,893 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... | 28.873377 | 152 | 0.688856 |
b940b83cf872bd0b74cab7a4e75300af60c8c4fe | 13,812 | #--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++
require 'rubygems'
require 'rubygems/user_interaction'
require 'rubygems/specification'
require 'rubygems/spec_fetcher'
##
# The SourceIndex object indexes all the gems available fro... | 25.20438 | 95 | 0.65892 |
e989b700148d64e4c626bc5a9586e17c9927c9d4 | 7,002 | class Chadwick < Formula
desc "Tools for parsing Retrosheet MLB play-by-play files"
homepage "https://chadwick.sourceforge.io"
url "https://downloads.sourceforge.net/project/chadwick/chadwick-0.7/chadwick-0.7.2/chadwick-0.7.2.tar.gz"
sha256 "f7b3af15281106e101e2ccc4cb182a3f15dbdc3327f2bcb045bfc486a8fda46e"
li... | 48.965035 | 108 | 0.665667 |
1c0a9b466d22ae4bef8a41816e5c49f2916640b9 | 2,440 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'smashing'
s.version = '1.3.1.pre'
s.date = '2020-06-04'
s.executables = %w(smashing)
s.summary = "The wonderfully excellent dashboard framework."
s.description = "A framework for pulling together an overview of data ... | 42.807018 | 442 | 0.65123 |
aca117522bb166580e83d6fcb6657f8f1b762883 | 2,234 | # frozen_string_literal: true
require 'spec_helper'
require_relative '../../../../lib/rubocop/cop/sorbet/signatures/signature_build_order'
RSpec.describe(RuboCop::Cop::Sorbet::SignatureBuildOrder, :config) do
subject(:cop) { described_class.new(config) }
describe('offenses') do
it('allows the correct order'... | 29.786667 | 101 | 0.593107 |
e2328e1ae3c725275ae400a39640ae74ab884fb5 | 4,219 | # frozen_string_literal: true
require_relative 'boot'
require 'rails'
# Pick the frameworks you want:
require 'active_model/railtie'
# require "active_job/railtie"
require 'active_record/railtie'
require 'active_storage/engine'
require 'action_controller/railtie'
require 'action_mailer/railtie'
# require "action_mail... | 39.429907 | 118 | 0.676227 |
61898a8f950bd1c5681ea5c40f694e3d103fa3c0 | 739 | RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
# use :focus decorator on a test group to only run that group.
config.filt... | 23.83871 | 97 | 0.7659 |
7a2011bef4fa10ef0ec3290528f64c007f58b442 | 2,190 | class Ppsspp < Formula
desc "PlayStation Portable emulator"
homepage "https://ppsspp.org/"
license all_of: ["GPL-2.0-or-later", "BSD-3-Clause"]
head "https://github.com/hrydgard/ppsspp.git", branch: "master"
# Remove stable block when patch is removed
stable do
url "https://github.com/hrydgard/ppsspp.g... | 37.118644 | 122 | 0.698174 |
01ad8eb63b806ffee1f3d15411e10c6547a9c3dd | 539 | class AttachmentPresenter < Presenter
delegate :id, :contents, :created_at, :contents_are_image?, :note, to: :model
def to_hash
{
:id => id,
:name => contents.original_filename,
:timestamp => created_at,
:icon_url => contents_are_image? ? model.contents.url(:icon) : nil ,
... | 26.95 | 79 | 0.623377 |
e232352936471c60ee0d0ca1b4461934285341db | 3,638 | require 'helpers'
describe StolenSleigh::Solution do
describe "class methods" do
describe "#new" do
it "creates a new object" do
expect( StolenSleigh::Solution.new ).to be_a StolenSleigh::Solution
end
end
describe "with Marshal" do
before do
@orig_solution = StolenSleig... | 31.362069 | 104 | 0.618197 |
3852009acabee0f68109677ea01fdf6006357e73 | 1,662 | require "spec_helper"
describe Bhm::Events::Base do
it "can act as events factory" do
alert = Bhm::Events::Base.create(:alert, alert_payload)
expect(alert).to be_instance_of Bhm::Events::Alert
expect(alert.kind).to eq(:alert)
heartbeat = Bhm::Events::Base.create(:heartbeat, heartbeat_payload)
e... | 30.777778 | 104 | 0.674489 |
912e391f79e5181093b82dbd6fe0a4c673d66716 | 779 | FactoryBot.define do
factory :content_item_request_data, class: Hash do
content_id { SecureRandom.uuid }
sequence(:base_path) { |n| "/test-content-#{n}" }
title { "Test content" }
description { "Test description" }
document_type { "answer" }
schema_name { "answer" }
public_updated_at { Tim... | 27.821429 | 80 | 0.608472 |
ace6ab962745773c404acc1b44c570da4f3baa0e | 751 | require File.expand_path('../../../../spec_helper', __FILE__)
require File.expand_path('../../../../shared/file/owned', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)
describe "File::Stat#owned?" do
it_behaves_like :file_owned, :owned?, FileStat
end
describe "File::Stat#owned?" do
before(:eac... | 23.46875 | 67 | 0.6498 |
e9458bd156399b8b2b01c64ac008684519a26f3c | 4,277 | #
# Cookbook Name:: delivery_server
# Recipe:: default
#
# Copyright (c) 2016 The Authors, All Rights Reserved.
# include_recipe 'delivery_build::credentials'
node['delivery_server']['packages'].each do |name, versioned_name|
unless node['delivery_server']['use_package_manager']
remote_file "/var/tmp/#{versione... | 26.079268 | 193 | 0.708674 |
f7dcf139c2c17de8940c091b80cf6ca017f478c0 | 4,737 | require 'rails_helper'
describe 'suggested searches', type: :feature do
include StubbedRequests::Courses
include StubbedRequests::Providers
include StubbedRequests::Subjects
let(:filter_page) { PageObjects::Page::ResultFilters::Location.new }
let(:results_page) { PageObjects::Page::Results.new }
let(:sort... | 31.58 | 97 | 0.710365 |
08bab594d6e31f42500f66b25843b6ba4bd956c3 | 2,841 | # Copyright 2019 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 applicable law or agreed to in writing, ... | 43.707692 | 83 | 0.608589 |
8721bbd4938dcc16b4d42c060e857016702309b4 | 830 | require 'spec_helper'
include SpecInfra::Helper::SmartOS
describe process("memcached") do
let(:stdout) { " 1407\n" }
its(:pid) { should eq 1407 }
its(:command) { should eq "ps -C memcached -o pid= | head -1" }
end
describe process("memcached") do
let(:stdout) { "/usr/bin/memcached -m 14386 -p 11211 -u nobody... | 27.666667 | 92 | 0.625301 |
1d3792b89a59792004e40d1471200a9218eb4b7a | 207 | class ChangedTeamsAddedSuspendedUntil < ActiveRecord::Migration
def self.up
add_column :teams, :suspended_until, :datetime
end
def self.down
remove_column :teams, :suspended_until
end
end
| 20.7 | 63 | 0.758454 |
d5ba946072fab667a3a8c6f1d05f22c8b10056fb | 1,166 | class Rke < Formula
desc "Rancher Kubernetes Engine, a Kubernetes installer that works everywhere"
homepage "https://rancher.com/docs/rke/v0.1.x/en/"
url "https://github.com/rancher/rke.git",
:tag => "v0.1.11",
:revision => "45d79aa3598a35196fbb4472e2e5eac86172cff5"
bottle do
cellar :any_s... | 33.314286 | 94 | 0.709262 |
b9d50d76e46ff3b8d9801bcc98a1dae7c4485e68 | 16,254 | class ListingsController < ApplicationController
include PeopleHelper
# Skip auth token check as current jQuery doesn't provide it automatically
skip_before_filter :verify_authenticity_token, :only => [:close, :update, :follow, :unfollow]
before_filter :only => [ :edit, :update, :close, :follow, :unfollow ] d... | 37.025057 | 236 | 0.715578 |
26baa1f3c3bc1d3c9293e566af6f9141a4bc11a4 | 4,979 | # frozen_string_literal: true
require 'fileutils'
require 'pathname'
require_relative 'settings'
require_relative 'sample/vcf_collection'
require_relative 'sample/cram'
require_relative 'sample/fastqc_report'
require_relative 'report/render'
module JgaAnalysisQC
class Sample
TEMPLATE_PREFIX = 'report'
FAST... | 34.10274 | 97 | 0.658365 |
1166a8cfa535d51ef671dadfc75468dbc53f38e4 | 986 | #
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint flutter_mongo_stitch.podspec' to validate before publishing.
#
Pod::Spec.new do |s|
s.name = 'flutter_mongodb_realm'
s.version = '0.0.1'
s.summary = 'A new Flutter plugin.'
s.... | 37.923077 | 104 | 0.602434 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.