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 |
|---|---|---|---|---|---|
871e05fa89c8673b6f22f8e671c5315c9bdff967 | 83 | # desc "Explaining what the task does"
# task :ocean do
# # Task goes here
# end
| 16.6 | 38 | 0.662651 |
e8de3b7274d7800cea13c5c690c453e9a675f986 | 573 | module VagrantPlugins
module OpenBSD
module Action
class SnapshotDelete
def initialize(app, env)
@app = app
end
def call(env)
env[:ui].info(I18n.t(
"vagrant.actions.vm.snapshot.deleting",
name: env[:snapshot_name]))
env[:mac... | 20.464286 | 76 | 0.551483 |
f8276728058e1f45f3d263579d8c05318dcdfcda | 3,676 | # encoding: utf-8
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
# Changes may cause incorrect behavior and will be lost if the code is
# rege... | 30.890756 | 79 | 0.508433 |
627d665023f65b1034b3760956a440546bef7d6c | 560 | class Admin::ImagesController < ApplicationController
before_action :verify_editor
def create
@image = Image.new(image_params)
@image.save
respond_to do |format|
format.json { render json: {image_id: @image.id, url: @image.file.url}.to_json }
end
end
def destroy
@image = Image.fin... | 17.5 | 88 | 0.632143 |
115a1b08c786f760d4fecb053b8cadfcc3131f45 | 51 | json.partial! "visitors/visitor", visitor: @visitor | 51 | 51 | 0.784314 |
e80e2430627e0e597fdb3af35bfbde820b8e07c6 | 979 | # Borrowed from http://my.rails-royce.org/2010/07/21/email-validation-in-ruby-on-rails-without-regexp/
# Mentioned in tweet here: https://twitter.com/_sohara/status/177120126083141633
require 'mail'
class EmailValidator < ActiveModel::EachValidator
def validate_each(record,attribute,value)
begin
m = Mail::A... | 40.791667 | 102 | 0.689479 |
ff72b7a67329aaaba188d4e2bfe0e1bb7e8da40a | 2,040 | require 'test_helper'
module Payment
class Adyen12ErrorsHandlerTest < ActiveSupport::TestCase
test 'error from authorization refusal is handled' do
params = {
'refusalReason' => 'Handled Refusal Reason',
'resultCode' => 'Declined'
}
response = ActiveMerchant::Billing::Response.n... | 35.172414 | 120 | 0.679902 |
3842b34d7878902caa85320b405d62040603e081 | 69 | module Telegram
module Bot
VERSION = '0.12.0'.freeze
end
end
| 11.5 | 29 | 0.666667 |
e8d4a71a42e22eb9cfa02fac95da3a7ee547037e | 9,654 | # xdr.rb - A module for reading and writing data in the XDR format
# Copyright (C) 2010 Red Hat Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, o... | 29.522936 | 80 | 0.52051 |
87956099248d12ddc9c57d23d5b89dd2ca7f79e2 | 482 | # frozen_string_literal: true
require 'spec_helper'
require 'vk/api/groups/methods/set_callback_server'
RSpec.describe Vk::API::Groups::Methods::SetCallbackServer do
subject(:model) { described_class }
it { is_expected.to be < Dry::Struct }
it { is_expected.to be < Vk::Schema::Method }
describe 'attributes' d... | 28.352941 | 61 | 0.73029 |
d5f44084b1c4092f2bd7340f223b2beb4ace937b | 4,147 | # 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.558333 | 114 | 0.712322 |
62638cf3029c3a01d70507d5a15835f0a9492b9a | 1,836 | require "net/https"
require "uri"
require 'base64'
require 'json'
#Quote your Twitter App consumer keys here.
#See [THIS CODE] for a better way to handle and configure your keys.
CONSUMER_KEY = "" # Add your API key here
CONSUMER_SECRET = "" # Add your API secret key here
@search_url = "https://api.twitter.com/labs/2... | 27.402985 | 84 | 0.72549 |
ac5efc4d1786a2f24726fbfcf3c12fa2138a76f8 | 2,747 | require_relative 'test_helper'
require 'chapter'
require 'ostruct'
class ChapterTest < Minitest::Test
include TestHelper
def subject
@subject ||= Chapter.new(mock_chapter.num, mock_chapter.name, zero_based: true)
end
def test_to_s
output = capture_output { print subject }
assert_equal(mock_chapte... | 30.186813 | 83 | 0.684383 |
e257a579e89c8ff1e7fb0d4004e1e25ca02dec9a | 825 | require 'puppet/provider/a2mod'
Puppet::Type.type(:a2mod).provide(:a2mod, :parent => Puppet::Provider::A2mod) do
desc "Manage Apache 2 modules on Debian and Ubuntu"
optional_commands :encmd => "a2enmod"
optional_commands :discmd => "a2dismod"
commands :apache2ctl => "apache2ctl"
confine :osfamily... | 22.916667 | 80 | 0.578182 |
4a621ec6e0a29f160d2aa62fdf0b43c6deb0ae47 | 5,759 | class Dealii < Formula
desc "Open source finite element library"
homepage "https://www.dealii.org"
url "https://github.com/dealii/dealii/releases/download/v8.5.1/dealii-8.5.1.tar.gz"
sha256 "d33e812c21a51f7e5e3d3e6af86aec343155650b611d61c1891fbc3cabce09ae"
revision 2
head "https://github.com/dealii/dealii.g... | 38.393333 | 122 | 0.628755 |
0341c00be364c2f8c34fbf34b1d1c8e83d11f65e | 187 | module PaginationHelper
def pagination(collection)
paginate collection, theme: 'twitter-bootstrap-3',
pagination_class: 'pagination-sm'
end
end | 31.166667 | 65 | 0.636364 |
791571071a09bf97fd18b79afeb50a62371cb493 | 104 | # frozen_string_literal: true
module SolidusCulqiFrontend
class Railtie < ::Rails::Railtie
end
end
| 14.857143 | 34 | 0.778846 |
085cce7a76ee9ddf7297cdba9cd74c59fa96369d | 315 | require 'spec_helper'
describe Typhoeus::Hydra do
describe '#max_concurrency' do
it 'is be accessible' do
h = Typhoeus::Hydra.new
expect(h.max_concurrency).to be_truthy
h.max_concurrency = 10
expect(h.max_concurrency).to eq(10)
end
end
end
| 21 | 50 | 0.6 |
5db1d5d231a198b641476bf1514519c78612be40 | 364 | # frozen_string_literal: true
class RemoveCruftFromReward < ActiveRecord::Migration[5.2]
def change
remove_column :rewards, :gift_card_number
remove_column :rewards, :expiration_date
remove_column :rewards, :batch_id
remove_column :rewards, :sequence_number
remove_column :rewards, :active
rem... | 28 | 58 | 0.769231 |
21154098a86d99084d868a5fff60fb113f6a25e8 | 406 | class PagesController < ApplicationController
before_action :authenticate_user!
before_action :find_user_categories
def index
@links = Link.where(:user_id => current_user.id).paginate(:page => params[:page])
@link = Link.new
@category = Category.new
end
def categories
end
def find_us... | 19.333333 | 84 | 0.716749 |
e9576371466bd246fdd8abbc1677a4ac2db2226f | 2,239 | # encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
DependencyDetection.defer do
named :typhoeus
depends_on do
defined?(Typhoeus) && defined?(Typhoeus::VERSION)
end
depends_on do
NewRelic::Agent:... | 30.256757 | 121 | 0.738276 |
bf029ff2ce5d296bec21de3207d876e691a239f2 | 1,933 | require 'dotenv/load'
RSpec.describe Todoable::Model::TodoList do
let(:new_list) { {:list => {:name => ('a'..'z').to_a.shuffle[0,8].join} }}
let(:client) { Todoable::Client.new(username: ENV['VALID_USERNAME'], password: ENV['VALID_PASSWORD']) }
let(:get_lists) {
VCR.use_cassette('get_lists') do
client.get_l... | 28.014493 | 104 | 0.705122 |
038658353921d59341293c103d2ecb3c9a324429 | 741 | module Telegram
module Bot
module Types
class InlineQueryResultVenue < Base
attribute :type, String, default: 'venue'
attribute :id, String
attribute :latitude, Float
attribute :longitude, Float
attribute :title, String
attribute :address, String
attri... | 30.875 | 61 | 0.676113 |
386649f69f59d96acfd08cfbfbe8ceeca1c65624 | 2,484 | # frozen_string_literal: true
module Dmpopidor
module Controllers
module Paginable
module Plans
# GET /paginable/plans/org_admin/:page
# Renders only the plans with a visibility superior to privately
def org_admin
unless current_user.present? && current_user.can_org_ad... | 33.12 | 115 | 0.616345 |
391192795b6a203e5f003bbe7a118ac6c9160a48 | 6,705 | =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... | 23.86121 | 177 | 0.591797 |
6ae471ad71ac8125ebc769185f96fa9e99d73194 | 294 | cask "font-oxanium" do
version :latest
sha256 :no_check
url "https://github.com/google/fonts/raw/master/ofl/oxanium/Oxanium%5Bwght%5D.ttf",
verified: "github.com/google/fonts/"
name "Oxanium"
homepage "https://fonts.google.com/specimen/Oxanium"
font "Oxanium[wght].ttf"
end
| 24.5 | 85 | 0.717687 |
1d178f406ac395f09279d6f816ba8a457750bf61 | 3,759 | def use_react_native_ABI37_0_0! (options={})
# The prefix to the react-native
prefix = options[:path] ||= "../node_modules/react-native"
# Include Fabric dependencies
fabric_enabled = options[:fabric_enabled] ||= false
# Include DevSupport dependency
production = options[:production] ||= false
# The P... | 67.125 | 114 | 0.709231 |
f85ffb80b1d730f97a5665b6512b10d34bca1677 | 2,933 | # 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::V7_0_preview
module Models
#
# The certificate list result.
#
class CertificateListResult
include MsRestAzu... | 28.475728 | 80 | 0.52881 |
edf111353e2eaffd5d31d2d3e19c164cf0f25559 | 384 | # Docker build stack
if node['dokku']['buildstack']['use_prebuilt']
docker_image node['dokku']['buildstack']['image_name'] do
source node['dokku']['buildstack']['prebuilt_url']
action :import
end
else
docker_image node['dokku']['buildstack']['image_name'] do
source node['dokku']['buildstack']['stack_u... | 25.6 | 59 | 0.682292 |
b968f9f19814a580e8b329edf920ad0e0d6043dc | 232 | Given(/^I use the account "([^"]*)"$/) do |account_id|
Aws.config[:sts] = {
stub_responses: {
get_caller_identity: {
account: account_id,
arn: 'an-arn',
user_id: 'a-user-id'
}
}
}
end
| 19.333333 | 54 | 0.508621 |
1d4503f415a105bd9f3e557bd6a6a2a9399ffaf2 | 2,587 | # This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... | 83.451613 | 200 | 0.582141 |
184ffe0da2dc9991794d2c744201ec59975ea873 | 157 | require "spec_helper"
describe AssetPathsFromManifest do
it "has a version number" do
expect(AssetPathsFromManifest::VERSION).not_to be nil
end
end
| 19.625 | 57 | 0.783439 |
33acd66883c13349b003da4578171d136cd4f6b3 | 637 | # frozen_string_literal: true
require 'ruby_helm/version'
require 'ruby_helm/commands'
module RubyHelm
class << self
attr_writer :configuration
def configuration
@configuration ||= Configuration.new
end
def configure
yield(configuration)
end
def reset!
@configuration = n... | 14.813953 | 42 | 0.66876 |
f78d98f647c38d298ef0eba0fa1d0dd51a3fa454 | 1,519 | module Spaceship
module Portal
class Person < PortalBase
# @return (String) Person Id
attr_accessor :person_id
# @return (String) First name
attr_accessor :firstname
# @return (String) Last name
attr_accessor :lastname
# @return (String) Email Address
attr_access... | 24.901639 | 65 | 0.601053 |
18603358544d12c1180800b21b66ae8970a4ef5a | 7,205 | #
# Author:: Kartik Null Cating-Subramanian (<ksubramanian@chef.io>)
# Copyright:: Copyright 2015-2016, Chef, 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... | 32.309417 | 96 | 0.664122 |
8780b410a072ae084c1e871b96cfd2ef17c56f88 | 2,717 | # frozen_string_literal: true
module Gitlab
module Checks
class DiffCheck < BaseChecker
include Gitlab::Utils::StrongMemoize
LOG_MESSAGES = {
validate_file_paths: "Validating diffs' file paths...",
diff_content_check: "Validating diff contents..."
}.freeze
def validate!
... | 26.90099 | 107 | 0.620169 |
d5f1d6308d7a5290084b247e5ad9162b498788c4 | 76 | require 'rails_helper'
RSpec.describe 'Enrollments', type: :request do
end
| 15.2 | 47 | 0.776316 |
bf92ef56120d720a627d7dfe811221c4f6081b2a | 991 | class SecuritysController < ApplicationController
before_action :authenticate_user!
def new
if User.search(params[:keyword]) != nil
if request.referer&.include?("/securitys") && User.search(params[:keyword]).count != User.all.count
@users = User.search(params[:keyword])
end
end
@b... | 29.147059 | 105 | 0.695257 |
f877f3bb8109cbee0e690b69f2d407f73988082a | 1,214 | ActiveAdmin.register Event do
active_admin_importable do |model, hash|
model.import(hash)
end
index do
selectable_column
id_column
column :event_name
column :description
column :start_time do |event|
event.date_time
end
column :tickets do |event|
link_to event.tickets... | 19.901639 | 83 | 0.618616 |
1a968918530ae20336fbc2b204a06728da3debae | 408 | module FbRails
module Integration
module ActionView
def include_facebook_javascript(options = {})
render options[:async] ? 'fb/async_js' : 'fb/blocking_js'
end
def fbml(tag, content = '', options = {})
if content.is_a?(Hash)
options = content
content = ''
... | 22.666667 | 65 | 0.573529 |
0133b0ae8bfda240013a098dd474edfd8c02b979 | 19,835 | # encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative sou... | 44.373602 | 140 | 0.541971 |
e821d17178bd2941fd38304253fdb202cfa58153 | 999 | class PopulateTestimonialTransactionId < ActiveRecord::Migration[4.2]
def up
execute("UPDATE testimonials
INNER JOIN participations ON (testimonials.participation_id = participations.id)
INNER JOIN conversations ON (participations.conversation_id = conversations.id)
INNER JOIN transactions ON (t... | 43.434783 | 93 | 0.76977 |
e9d47904323fc7cb2f5d9a5911baea1ea248572d | 5,785 | # spec/integration/docs_spec.rb
# rake rswag:specs:swaggerize
ENV["PASSPHRASE"] = File.read(".env_passphrase_rspec")
ENV["ETHERSCAN_APIKEY"] = File.read(".env_apikey_rspec")
require 'swagger_helper'
describe 'Document API' do
path '/api/encrypt' do
post 'encrypt string' do
tags 'Cryptography'
consumes 'appl... | 30.287958 | 817 | 0.689023 |
e8009af519771bb3f74ef67e81aecedff9a7b590 | 5,039 | # typed: false
# frozen_string_literal: true
# {Pathname} extension for dealing with ELF files.
# @see https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header
#
# @api private
module ELFShim
MAGIC_NUMBER_OFFSET = 0
private_constant :MAGIC_NUMBER_OFFSET
MAGIC_NUMBER_ASCII = "\x7fELF"
private_co... | 25.195 | 103 | 0.720381 |
e9f92ad2083357ef1a5eb7ea048c1f447bbedb19 | 49,226 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
module Aws::WorkLink
module Types
# @note When making an API call, you ... | 31.374124 | 140 | 0.628489 |
b985c4e757734d547aaf10058fa42f279589a2a2 | 506,464 | # WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
require 'seahorse/client/plugins/content_length.rb'
require 'aws-sdk-core/plugins/credentials_configuration.rb'
... | 42.873445 | 612 | 0.652143 |
e8af9c66ae43150885ce1c151aa110067f5391ae | 7,006 | # frozen_string_literal: true
require 'rails_helper'
RSpec.feature 'Administrator Reports' do
given(:user) { create :subject }
describe 'when subject is administrator' do
%w[identity_providers
service_providers organizations
rapid_connect_services services].each do |identifier|
%w[monthly... | 35.383838 | 76 | 0.666857 |
ffe0962f5c0630b7f486af681b908ff31b8d539e | 110 | class Tag < ActiveRecord::Base
has_many :question_tags
has_many :questions, :through => :question_tags
end | 13.75 | 47 | 0.772727 |
03c3bdaeea183d8aba725681d2eb89017354318c | 6,371 | # frozen_string_literal: true
RSpec.describe RuboCop::Cop::Naming::HeredocDelimiterCase, :config do
subject(:cop) { described_class.new(config) }
let(:config) do
RuboCop::Config.new(described_class.badge.to_s => cop_config)
end
context 'when enforced style is uppercase' do
let(:cop_config) do
{... | 24.132576 | 72 | 0.517658 |
4aaf78822b2a100e4a08c8ac841c3d4885858713 | 1,219 | class Vpcs < Formula
desc "Virtual PC simulator for testing IP routing"
homepage "https://vpcs.sourceforge.io/"
url "https://downloads.sourceforge.net/project/vpcs/0.8/vpcs-0.8-src.tbz"
sha256 "dca602d0571ba852c916632c4c0060aa9557dd744059c0f7368860cfa8b3c993"
license "BSD-2-Clause"
livecheck do
url :st... | 35.852941 | 94 | 0.771124 |
e23db0ad7b5dfd5d503cb69caedf9c0b84cc1be5 | 1,836 | require_relative '../environment'
class DefaultScopesTest < ActiveSupport::TestCase
def test_node_excluded_by_default_scope_should_still_move_with_parent
AncestryTestDatabase.with_model(
:width => 3, :depth => 3, :extra_columns => {:deleted_at => :datetime},
:default_scope_params => {:deleted_at => n... | 32.785714 | 77 | 0.691721 |
f8c9dd550256bd7ac5448a5ddbfcbdd2593f1de1 | 2,401 | #/postgresql.conf.
# Cookbook Name:: postgresql
# Recipe:: server
#
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Author:: Lamont Granquist (<lamont@opscode.com>)
# Copyright 2009-2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complia... | 32.013333 | 117 | 0.725948 |
6a6e8b603e800548dda27300b3aae9cf5f5bb7f2 | 1,396 | require 'test_helper'
module Sources
class TwitPicTest < ActiveSupport::TestCase
context "normalizing for source" do
should "normalize d3j5vwomefv46c.cloudfront.net links" do
source = "http://d3j5vwomefv46c.cloudfront.net/photos/large/820960031.jpg?1384107199"
assert_equal("https://twitpic.... | 60.695652 | 489 | 0.808023 |
f8a51013793455ef7ad1300a75e45ac8d2046425 | 1,155 | lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'fastlane/plugin/appcenter/version'
Gem::Specification.new do |spec|
spec.name = 'fastlane-plugin-appcenter'
spec.version = Fastlane::Appcenter::VERSION
spec.author = 'Microsoft Corporatio... | 37.258065 | 79 | 0.71342 |
ab7419ebb8e7f0cdabf920c87fb82f2b9ae71471 | 175 | # frozen_string_literal: true
require 'fix_db_schema_conflicts/schema_dumper'
module FixDBSchemaConflicts
require 'fix_db_schema_conflicts/railtie' if defined?(Rails)
end
| 21.875 | 62 | 0.845714 |
4a9c1f717ce20cb14c09546427a1ae689a91c77e | 896 | module Bootstrap::CardHelper
def card(options = {})
options = canonicalize_options(options)
options = ensure_class(options, %w[card])
content_tag(:div, options) do
content_tag(:div, class: 'card-block') do
yield
end
end
end
def card_header(*args, &block)
bootstrap_generato... | 24.888889 | 76 | 0.665179 |
613985ecc5ad65e796430e330db0b75676ee6afe | 43 | module StoneDeploy
VERSION = "0.1.0"
end
| 10.75 | 19 | 0.697674 |
5d3e8454caba38b7671188fdd46864c992777a03 | 7,346 | require 'uri'
module AssetCloud
class IllegalPath < StandardError
end
class Base
cattr_accessor :logger
VALID_PATHS = /\A
(
(\w) #Filename can be a single letter or underscore
| #OR it is many and follows the below rules
(
(\.?... | 27.107011 | 126 | 0.605636 |
3929a84a90aba9f75bdafe4438139c38bf0e825e | 2,422 | # frozen_string_literal: true
require 'spec_helper'
describe Logux::Model do
subject(:model) do
create(
:post,
logux_fields_updated_at: {
title: initial_meta.logux_order,
content: initial_meta.logux_order
}
)
end
let(:older_update_meta) do
create(
:logux_meta... | 25.765957 | 77 | 0.672998 |
28a97907a5aec3ef40a5b6e19b22b35946dfc8ed | 609 | class Digdag < Formula
desc "Workload Automation System"
homepage "https://www.digdag.io/"
url "https://dl.digdag.io/digdag-0.9.19.jar"
sha256 "b8241b1be250aae9b32165c66734650d09e7348844971888cc3bca2839165dfe"
bottle :unneeded
depends_on :java => "1.8+"
def install
libexec.install "digdag-#{version... | 24.36 | 75 | 0.674877 |
3926f13b10b767ceee0aabdad8bdb1cfc81156b8 | 2,100 | module Intrigue
module Ident
module Check
class Eclipse < Intrigue::Ident::Check::Base
###
### TODO - general case handled, but needs work on a bunch of edge cases
###
def generate_checks(url)
[
{
:type => "fingerprint",
:category => "application",... | 32.307692 | 94 | 0.431429 |
629b6e300b058fcb196848235d6eae9d68299be2 | 596 | #!/usr/bin/env ruby
class Routes
def initialize
@distances = {}
end
def distance(*segments)
# @distances[segments] ||= calculate_distance(*segments) # => only works if value != nil
if @distances.has_key?(segments)
@distances[segments]
else
@distances[segments] = calculate_dista... | 19.225806 | 92 | 0.652685 |
ab930ddddb6740438ab8b67b459aa324655aa499 | 212 | $LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'formulator'
require 'spec'
require 'spec/autorun'
Spec::Runner.configure do |config|
end
| 21.2 | 66 | 0.740566 |
6a5e95c004cb556b90b033c004c951e1f3674e1e | 826 | require 'test_helper'
class SiteLayoutTest < ActionDispatch::IntegrationTest
def setup
@user = users(:michael)
end
test "layout links" do
get root_path
assert_template 'static_pages/home'
assert_select "a[href=?]", root_path, count: 2 #count verifies that there are two links: one for logo and... | 29.5 | 135 | 0.711864 |
acf449e42dda88474f8faa4506a5f538e39efa09 | 786 | # frozen_string_literal: true
module Aoc2020
#----
class Day20Part1
def initialize(input_file)
@input = File.read(input_file).each_line(chomp: true)
end
def run
# ---
end
end
#----
class Day20Part2
def initialize(input_file)
@input = File.read(input_file).each_line(cho... | 18.714286 | 61 | 0.645038 |
2179e85de35136a886d79b2ba14e40c546d7c0eb | 3,441 | ModernTimesDatabase::RELIGIONS = {
"k_england" => "protestant",
"k_wales" => "protestant",
"d_the_isles" => "protestant",
"d_mecklemburg" => "protestant",
"d_crimea" => "orthodox",
"d_armenia" => "orthodox",
"k_persia" => "shiite",
"d_basra" => "shiite",
"d_baghdad" => "shiite",
"d_tripoli" => "shii... | 32.158879 | 69 | 0.601569 |
918905b0ea1cf7e6b87fb10ee5597bc6ddb1b44a | 1,594 | =begin
#CloudReactor API
#CloudReactor API Documentation
The version of the OpenAPI document: 0.2.0
Contact: jeff@cloudreactor.io
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.4.0
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for CloudReactorAPIClient::PaginatedW... | 30.075472 | 102 | 0.759724 |
f8b2ffb01d581da7a2d8e1fe765756fca90ad5f2 | 3,738 | class PhrasingPhrasesController < Phrasing.parent_controller.constantize
layout 'phrasing'
protect_from_forgery
include PhrasingHelper
before_filter :authorize_editor
def index
params[:locale] ||= I18n.default_locale
query = PhrasingPhrase
query = query.order("#{query.table_name}.key")
qu... | 27.485294 | 132 | 0.675495 |
e80456c278ed6bbb0b923f385d5feb2ed4816ebe | 249 | class CreateBeers < ActiveRecord::Migration[6.0]
def change
create_table :beers do |t|
t.string :name
t.string :category
t.string :abv
t.integer :user_id
t.integer :category_id
t.timestamps
end
end
end | 20.75 | 48 | 0.634538 |
e285794f6015a774907183335c08e5d5767e18f5 | 7,429 | # https://wiki.icinga.org/display/howtos/Setting+up+Icinga+Classic+UI+Standalone
default['icinga2']['classic_ui']['enable'] = true
# in favour of existing users for rhel
default['icinga2']['classic_ui']['apache_conf'] = value_for_platform(
%w(centos redhat fedora amazon) => { 'default' => 'icinga2-classic-ui' },
%... | 64.6 | 158 | 0.689191 |
f83b8cc5a48aeb81565a58b281d65a77883b5f14 | 176 | class AddPasswordResetDigest < ActiveRecord::Migration[5.0]
def change
add_column :users, :reset_digest, :string
add_column :users, :reset_sent_at, :datetime
end
end
| 25.142857 | 59 | 0.761364 |
bbb1d2a8496cd06570f58cbcbd17c5b60a1f3bd4 | 7,631 | module SVGChart
TOP_LEFT_OFFSET = 1
module_function
def bar_chart
%(<figure class="ac-chart-container ac-clearfix "><figcaption class="ac-chart-title">Pets per Floor</figcaption>
<svg xmlns="http://www.w3.org/2000/svg" style="width: 280px; height: auto;" viewBox="0 0 280 410" class="ac-chart a... | 82.053763 | 390 | 0.595597 |
629a3d70211658036de89f8422b7d71b9008a135 | 1,003 | require_relative "../base"
module ConceptQL
module Operators
module Selection
class Base < Operators::Base
include ConceptQL::Behaviors::Windowable
include ConceptQL::Behaviors::Selectable
def select_all?
arguments.include?("*")
end
def where_clauses(db)
... | 21.804348 | 65 | 0.557328 |
216efe0e14babef891e63ad441e9e15735a2f950 | 554 | require 'mailman'
module Bugsnag
class Mailman
def call(mail)
begin
Bugsnag.before_notify_callbacks << lambda {|notif|
notif.add_tab(:mailman, {"message" => mail.to_s})
}
yield
rescue Exception => ex
raise ex if [Interrupt, SystemExit, SignalException].inclu... | 21.307692 | 78 | 0.640794 |
ed6c5f47d4cd416850380ce8c890f9ae13a7556e | 139 | class StaticPagesController < ApplicationController
def home
end
def help
end
def about
end
def contact
end
end
| 9.266667 | 51 | 0.676259 |
9190ae040ec412280865caf220f309fe4cbc6007 | 2,927 | module MsChapAuth
def hexlify(msg)
msg.unpack('H*').first
end
def unhexlify(msg)
msg.scan(/../).collect { |c| c.to_i(16).chr }.join
end
def test_key key, challenge
des = OpenSSL::Cipher::DES.new('ECB')
des.encrypt
des.key = key
des.update challenge
#need to do it twice, don't kn... | 27.35514 | 103 | 0.591391 |
3914560b12319aaa433d65a6a1aa6c401b2358f2 | 967 | cask "lifesize" do
version "2.216.2929"
sha256 "2d7c2e78eb6484187d334e0f3ca1870b84a8fe649fea5b65cfd648903f04d935"
url "https://download.lifesizecloud.com/Lifesize-#{version}-mac.zip",
verified: "download.lifesizecloud.com/"
name "lifesize"
desc "Cloud contact and video conferencing"
homepage "https:/... | 31.193548 | 75 | 0.711479 |
1d67a0d5c15f5e8b19769f149ab899869dee4a2e | 7,528 | class MetasploitModule < Msf::Post
include Msf::Post::File
include Msf::Exploit::Remote::HttpServer
include Msf::Post::Windows::Powershell
def initialize(info = {})
super(
update_info(
info,
'Name' => 'BloodHound Ingestor',
'Description' => %q{
This module will execu... | 39.208333 | 305 | 0.652896 |
6141b65267bcda37c86f97f109038d8412a8a322 | 245 | require 'rails_helper'
RSpec.describe "Attendances", type: :request do
describe "GET /attendances" do
it "works! (now write some real specs)" do
get attendances_path
expect(response).to have_http_status(200)
end
end
end
| 22.272727 | 47 | 0.706122 |
1acc9a47b74ac2b0ed54e9230c56fbc347047ace | 627 | module Pione
module PNML
# `AmbiguousNetQueryResult` is an exception that raised when reuslt of net
# query is ambigous unexpectedly.
class AmbiguousNetQueryResult < StandardError
# @param name [String]
# net query method name
# @param query [Object]
# the query
# @param ... | 26.125 | 101 | 0.602871 |
11263f652b0ff0c0fb2f9a6e0aed84bca8dd9bc8 | 563 | require 'rails_helper'
RSpec.describe 'Homes', type: :request do
describe 'Visited by Anonymous user' do
it 'GET/ Homed#index: it display home page ' do
get home_index_path
expect(response).to have_http_status(:success)
end
end
describe 'Visited by signed_in user' do
before do
@use... | 24.478261 | 59 | 0.676732 |
0198cc29947bc62e4e3894e31b79d4a96b667575 | 1,038 | Puppet::Type.newtype(:keystone_user_role) do
desc <<-EOT
This is currently used to model the creation of
keystone users roles.
User roles are an assigment of a role to a user on
a certain tenant. The combintation of all of these
attributes is unique.
EOT
ensurable
newparam(:name, :nameva... | 19.961538 | 67 | 0.622351 |
ac99e3e20d80302eb8b578079d11ab43a5b57966 | 3,606 | require_relative "flag"
# This module generates Flags with a specific domain.
# For an explaination of the domain of a {Flag} see the documentation of the
# {Flag} class.
module FlagFactory
# Generates a normal GCC flag.
# Examples: -fomit-frame-pointer/-fno-omit-frame-pointer, -ffp-contract=fast
# @param name [... | 53.029412 | 184 | 0.698281 |
ff874ed11ed0ac9527a2fdb749bb08371ff00844 | 897 | require 'csv'
task oe_csv: :environment do
Kernel.puts 'Creating taxonomy.csv based on Open Eligibility...'
json ||= JSON.parse(File.read('data/oe.json'))
top_levels ||= json['taxonomy']['top_level']
CSV.open(
'data/taxonomy.csv',
'w',
write_headers: true,
headers: %w[taxonomy_id name parent... | 26.382353 | 70 | 0.540691 |
7a58cf76be3fa222cf7dea27ad2e95ae73b37a2a | 45 | module BlackViewTool
VERSION = "0.1.0"
end
| 11.25 | 20 | 0.711111 |
f80ed2bd2df17b5ff9eefbb7fcde7c112c07f98e | 6,561 | module Fastlane
module Actions
class JiraReleaseNotesAction < Action
def self.run(params)
Actions.verify_gem!('jira-ruby')
require 'jira-ruby'
client = JIRA::Client.new(
username: params[:username],
password: params[:password],
site: par... | 39.763636 | 188 | 0.440329 |
f89e478a263906fa2b863225e794d920853513c5 | 1,406 | module SQLite
class Database
def replace(table, hash)
keys = []
values = []
params = []
hash.each { |k,v| keys << k; params << '?'; values << v }
self.exec %Q{ replace into #{table}
(#{keys.join(',')})
values (#{params.join(",")}) }, values
end... | 16.541176 | 69 | 0.544097 |
e20d8f5b3078d2ab9a266a1bcd809204c1adc5a1 | 730 | $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "nite_dependencies/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "nite_dependencies"
s.version = "0.0.2"
s.authors = ["Nadav Blum"]
s.email = ["nadav@nit... | 29.2 | 85 | 0.621918 |
186bb43c82543f0202f047b6bb9016e976a8ed4d | 1,872 | class Librespot < Formula
desc "Open Source Spotify client library"
homepage "https://github.com/librespot-org/librespot"
url "https://github.com/librespot-org/librespot/archive/refs/tags/v0.4.1.tar.gz"
sha256 "ae3ce1f3bd0031cac687eb60e08abb2d327ba51623c583765eda70376d69a71f"
license "MIT"
head "https://git... | 39.829787 | 123 | 0.740385 |
f72b6f831e5d74846b35144550d472aa1dd5ed0d | 38 | module Vmail
VERSION = '2.9.11'
end
| 9.5 | 20 | 0.657895 |
38a3ec92417195ddd1822af0a48c0c3052b8b372 | 384 | # frozen_string_literal: true
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:all) do
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.start
end
config.before(:each, js: true) do
DatabaseCleaner.strategy = :truncation
e... | 18.285714 | 43 | 0.726563 |
61796cc9dbd829c1340e9dd22327219bccb24835 | 533 | class SessionsController < Devise::SessionsController
def create
auth = Authentication.new(sign_in_params)
if auth.authenticate
render json: {
message: 'Login successful!',
user: {
token: auth.generate_token,
email: auth.email
}
}, status: :ok
else
... | 22.208333 | 103 | 0.622889 |
18438976b3d4d2514d1b4d8ddf644b9ee4e0ec11 | 2,119 | require 'rails_helper'
RSpec.describe User, :type => :model do
subject (:user) { FactoryGirl.create(:user) }
it { should have_many(:following_tags) }
it { should have_many(:articles) }
it { should have_many(:stocked_articles) }
it { should have_many(:stocks) }
it { should have_many(:comments) }
it { sho... | 22.542553 | 84 | 0.648419 |
1cc8e1919c02a6a41291283084da11644b6e7e9e | 2,983 | # frozen_string_literal: true
require 'rails_helper'
describe ReminderSender do
describe '.send_all' do
it 'sends reminders for each of the upcoming events' do
upcoming_event = create(:event, starts_at: 1.day.from_now, ends_at: 2.days.from_now)
past_event = create(:event)
past_event.event_sess... | 33.897727 | 171 | 0.697285 |
394cc06e37eb13696ddbf4acd8c47f97cfee1e57 | 396 | class AddIndexToResourcePkOnScientificNames < ActiveRecord::Migration[4.2]
def change
# This is a resonable default, for things that HAD been harvested... it will screw up synonyms, but there's no way
# to fix without reharvesting them:
ScientificName.where('resource_pk IS NULL').update_all('resource_pk =... | 44 | 118 | 0.767677 |
6aa9f2b75559f2865f6442637b5ff30509781a99 | 290 | require 'test_helper'
class SendEnvelopeControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get send_envelope_index_url
assert_response :success
end
test "should get create" do
get send_envelope_create_url
assert_response :success
end
end
| 19.333333 | 66 | 0.775862 |
e24a65aaa921f3fc45ce2b36d37e410e3277266c | 421 | require "bundler/setup"
require "salt"
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_monkey_patching!
config.expect_with :rspec ... | 26.3125 | 66 | 0.748219 |
e26661a8f4107e030b1c479059bdc747a590e092 | 5,359 | describe "VM Retirement Management" do
before(:each) do
miq_server = EvmSpecHelper.local_miq_server
@zone = miq_server.zone
@ems = FactoryGirl.create(:ems_vmware, :zone => @zone)
@vm = FactoryGirl.create(:vm_vmware, :ems_id => @ems.id)
end
it "#retirement_check" do
expect(MiqEvent).to receive... | 29.938547 | 109 | 0.676992 |
21c7a2b0afa91a26a26140eacea0950a3d4a4712 | 1,345 | #-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2020 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork ... | 40.757576 | 91 | 0.771004 |
d52364f37de6a556dcc62540dbf8c4deb3b880e1 | 5,102 | require 'cgi'
class RemoteUrl < ActiveRecord::Base
self.establish_connection( DC::ANALYTICS_DB ) unless Rails.env.testing?
belongs_to :document
belongs_to :note, :class_name=>'Annotation'
DOCUMENT_CLOUD_URL = /^https?:\/\/(www\.)?documentcloud.org/
scope :aggregated, -> {
select( 'sum(hits) AS hits, d... | 34.945205 | 130 | 0.662485 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.