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 |
|---|---|---|---|---|---|
210ea828185e1fee32184b98929d6922639221f8 | 489 | module Postgres
class Relation
def self.execute(sql)
ActiveRecord::Base.connection.execute(sql)
end
def self.exists?(name)
begin
# Quickest way to determine if a relation exists is to ask Postgres to
# cast its name to a regclass. If the relation is absent, this will
#... | 24.45 | 78 | 0.640082 |
39d42210b6c00cc5bae97c5c6e55d98c15012251 | 88 | class SampleAdapter < SourceAdapter
def initialize(source)
super(source)
end
end | 17.6 | 35 | 0.761364 |
1d55f346f0889e18157dc683739200eb9a3ece92 | 274 | FactoryGirl.define do
factory :ecm_pictures_picture, class: Ecm::Pictures::Picture do
image File.open(File.join(Ecm::References::Engine.root, 'spec/files', 'ecm/pictures', 'picture/image.jpg'))
end
end unless FactoryGirl.factories.registered?(:ecm_pictures_picture)
| 45.666667 | 111 | 0.773723 |
d51c2f738f17fc28ca41f1bf83173de45723a212 | 141 | module AnnotateGem
VERSION = "0.0.14".freeze
DESCRIPTION = "Add comments to your Gemfile with each dependency's description.".freeze
end
| 28.2 | 89 | 0.765957 |
26f52eb9f341426ae70917635fcee972d31912d8 | 42 | module JunitModel
VERSION = '0.1.1'
end
| 10.5 | 19 | 0.690476 |
1c003e0d9d5d4ee98efc0f3ed22e207f2b7ed04b | 159 | require 'motion_blender'
MotionBlender.incept
MotionBlender.use_motion_dir
require 'motion-openssl/version'
require 'motion-openssl/hooks'
require 'openssl'
| 17.666667 | 32 | 0.836478 |
6a10cf0a9c3e52fec6a11b60c26fd0f621d94988 | 1,351 | module Hanami
module Model
module Plugins
# Transform output into model domain types (entities).
#
# @since 0.7.0
# @api private
module Mapping
# Takes the output and applies the transformations
#
# @since 0.7.0
# @api private
class InputWithMa... | 24.125 | 91 | 0.513694 |
016dba33e5228831265c8f0dccb73611285dd83b | 159 | # frozen_string_literal: true
class AddAvatarImageToUsers < ActiveRecord::Migration[4.2]
def change
add_column :users, :avatar_image, :string
end
end
| 19.875 | 58 | 0.767296 |
21671f6ac15d124f70b962e06258aca5f90e2276 | 2,158 | # -*- encoding: utf-8 -*-
require File.expand_path '../lib/asciidoctor-pdf/version', __FILE__
require 'open3' unless defined? Open3
Gem::Specification.new do |s|
s.name = 'asciidoctor-pdf'
s.version = Asciidoctor::Pdf::VERSION
s.summary = 'Converts AsciiDoc documents to PDF using Prawn'
s.description = <<-EOS... | 42.313725 | 153 | 0.669138 |
1c345a6a40748989af61891a4ba2a3a4fc771dfc | 270 | class CreateShows < ActiveRecord::Migration[5.2]
def change
create_table :shows do |t|
t.string :name
t.string :description
t.string :spotify_uri
t.string :slug
t.boolean :deleted, default: false
t.timestamps
end
end
end
| 19.285714 | 48 | 0.640741 |
1c83e8b9d76c123598da23d633510f5bdf46fc74 | 790 | require 'ostruct'
require 'test_helper'
require 'support/steps'
class Micro::Case::CallTest < Minitest::Test
Failure = Micro::Case::Result
Add2ToAllNumbers1 = Micro::Cases.flow([
Steps::ConvertToNumbers,
Steps::Add2
])
def test_the_calling_of_use_cases
assert_raises(ArgumentError) { Steps::Conver... | 28.214286 | 69 | 0.759494 |
61dcca42ef74ef32113b4099e452f316672676c6 | 1,646 | cask "ccleaner" do
version "2.05.144"
sha256 "eb73902cabcbe4fcea8a67f5e95d973b8109a286bdab7f47c8f37c160071383a"
url "https://download.ccleaner.com/mac/CCMacSetup#{version.major}#{version.minor.rjust(2, "0")}.dmg"
name "Piriform CCleaner"
desc "Remove junk and unused files"
homepage "https://www.ccleaner.co... | 38.27907 | 102 | 0.659174 |
1dae3101f18b97c4cc24c840a4416e772298d17e | 115,167 | #
# Autogenerated by Thrift Compiler (0.9.3)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
require 'thrift'
require 'fb303_types'
module HiveObjectType
GLOBAL = 1
DATABASE = 2
TABLE = 3
PARTITION = 4
COLUMN = 5
VALUE_MAP = {1 => "GLOBAL", 2 => "DATABASE", 3 => "TABLE", 4 => "PART... | 32.745806 | 251 | 0.665772 |
e215d34e58c56f7b57f1bd6f47244194f4610c4c | 3,453 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = NormalRanking
include Msf::Exploit::Remote::Tcp
def initialize(info={})
super(update_info(info,
'Name' ... | 31.390909 | 153 | 0.565885 |
08516eef5f89a5f960a073aef08b6ec25d20f1f4 | 243 | class AddCheckableToHardwares < ActiveRecord::Migration[5.0]
def change
add_column :hardwares, :checkable, :boolean
add_column :hardwares, :last_checked_at, :datetime
add_column :hardwares, :notified_of_error, :boolean
end
end
| 30.375 | 60 | 0.765432 |
5d2ef3fffec5501c2044c9a18bf1d6a27d64a44e | 1,594 | require_dependency 'spam_protection'
require 'timeout'
class Comment < Feedback
belongs_to :article
belongs_to :user
content_fields :body
validates_presence_of :author, :body
attr_accessor :user_agent
attr_accessor :referrer
attr_accessor :permalink
def notify_user_via_email(user)
if user.notify_... | 19.204819 | 73 | 0.698871 |
18435888bbdaad06e5e7b477749ec71a0eeca63c | 620 | class AddDummyModels < ActiveRecord::Migration[5.1]
def change
create_table :posts, force: true do |t|
t.timestamps
t.string :title
t.integer :author_id
t.integer :status, null: false, default: 0
t.integer :likes, null: false, default: 0
t.integer :category
t.timestamp :p... | 23.846154 | 51 | 0.632258 |
26d5ff094512fec289fb68f67419d8ba951aa5c2 | 1,483 | ################################################################################
# (C) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
#
# 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 Licen... | 27.981132 | 92 | 0.63857 |
796a728f85ca8a69f318496d26277d2fd19f010f | 1,853 | require_relative 'boot'
require 'rails/all'
Bundler.require(*Rails.groups)
require_relative "danbooru_default_config"
require_relative "danbooru_local_config"
module Danbooru
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defau... | 33.690909 | 116 | 0.699946 |
339d93e61343bed5a68b4d572310f632ec2f0b3d | 703 | Pod::Spec.new do |s|
s.name = "NSString-Hashes"
s.version = "1.2.1"
s.summary = "Simple Category of NSString that allows for easy MD5, SHA1 and SHA2 hashing."
s.homepage = "https://github.com/hypercrypt/NSString-Hashes"
s.license = { :type => "public domain", :file => 'LICENSE... | 27.038462 | 97 | 0.59175 |
1c83fa5472fdc86f61ed9ea9b6bfe523a0fea0a9 | 561 | # frozen_string_literal: true
# Copyright 2019 OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0
require 'test_helper'
describe OpenTelemetry::SDK::Trace::NoopSpanProcessor do
let(:processor) { OpenTelemetry::SDK::Trace::NoopSpanProcessor.instance }
let(:span) { nil }
it 'implements #on_start... | 19.344828 | 75 | 0.727273 |
1168aae875c5bf4d14b58cf7c874a3de660a6a4c | 1,087 | module Internal
class EventBuilding
include ActiveModel::Model
include ActiveModel::Attributes
include ApiModelConvertible
attribute :id, :string
attribute :venue, :string
attribute :address_line1, :string
attribute :address_line2, :string
attribute :address_line3, :string
attribu... | 32.939394 | 109 | 0.727691 |
ff20f8a5b6ec00e6ac1ed28c0f22bbd23c30055a | 1,185 | require "language/haskell"
class Cryptol < Formula
include Language::Haskell::Cabal
desc "Domain-specific language for specifying cryptographic algorithms"
homepage "https://www.cryptol.net/"
url "https://hackage.haskell.org/package/cryptol-2.8.0/cryptol-2.8.0.tar.gz"
sha256 "b061bf88de09de5034a3707960af01f... | 32.027027 | 93 | 0.722363 |
611fd067b9e0dac950625375288275c25faf0073 | 123 | require 'spec_helper'
describe "home/index.html.erb" do
pending "add some examples to (or delete) #{__FILE__}"
end
| 20.5 | 57 | 0.707317 |
385b89c17f31bce8cada7d47f82556da5de96161 | 324 | module Spreedly
class CreditCard < PaymentMethod
field :first_name, :last_name, :full_name, :month, :year
field :number, :last_four_digits, :card_type, :verification_value
field :address1, :address2, :city, :state, :zip, :country, :phone_number
field :eligible_for_card_updater, type: :boolean
end
... | 29.454545 | 76 | 0.731481 |
1cbf92c8e1905cc3d3ad0a6760e12cdabf8a3867 | 1,933 | class Xtensor < Formula
desc "Multi-dimensional arrays with broadcasting and lazy computing"
homepage "https://xtensor.readthedocs.io/en/latest/"
url "https://github.com/QuantStack/xtensor/archive/0.23.3.tar.gz"
sha256 "97c43372b6bd1634b6d647a4b318fae541d0c305bac9ec299d3d1bd42790d1f2"
license "BSD-3-Clause"
... | 33.327586 | 122 | 0.672012 |
6a538f5ab40c4eb9bbeeb9b599f3966763c5a9f2 | 1,086 | module Puppet::Parser::Functions
newfunction(:calc_log_num_mtt, :type => :rvalue, :doc => <<-EOS
EOS
) do |args|
# Validate the number of args
if args.size < 0
raise(Puppet::ParseError, "calc_log_num_mtt(): Takes at least one " +
"args, but #{args.size} given.")
end
if args.... | 23.608696 | 83 | 0.597606 |
1a8aa885f9ab5e5c139cf4e102835e80d07cc0da | 3,084 | # frozen_string_literal: true
# Copyright 2016 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 applicab... | 35.448276 | 102 | 0.671206 |
21b8c778e7ebd010febb19c291ad64b254eafc42 | 4,932 | # frozen_string_literal: true
require "dependable"
# A dependency on another Homebrew formula.
class Dependency
extend Forwardable
include Dependable
attr_reader :name, :tags, :env_proc, :option_names
DEFAULT_ENV_PROC = proc {}.freeze
def initialize(name, tags = [], env_proc = DEFAULT_ENV_PROC, option_na... | 25.163265 | 101 | 0.65734 |
1d7d0dba8009e49dc29f2303f37790a310e29ff9 | 607 | define :enable_package, :version => nil do
name = params[:name]
version = params[:version]
full_name = name + ("-#{version}" if version)
unmask = params[:unmask] || false
update_file "local portage package.keywords" do
path "/etc/portage/package.keywords/local"
body "=#{full_name}"
not_if "grep '... | 28.904762 | 71 | 0.668863 |
b98092854d5016999e2cb3019241d8c10162e29e | 395 | require '../dna'
File.open("gc.txt", 'r') do |f|
id = ""
dna_strings = {}
f.each_line do |l|
if l =~ />(Rosalind_\d+)/
id = $1
else
dna_strings[id] ||= DNA.new
dna_strings[id].str << l.chomp
end
end
max = ['', 0]
dna_strings.each do |name, obj|
cg_content = obj.cg_content... | 17.173913 | 51 | 0.549367 |
873da9d3f8a6550b8e8ca04c100a785af1c096a6 | 1,624 | class PasswordsController < Devise::PasswordsController
include AuthHelper
skip_before_action :require_no_authentication, raise: false
skip_before_action :authenticate_user!, raise: false
def update
# params: reset_password_token, password, password_confirmation
original_token = params[:reset_password... | 33.142857 | 121 | 0.749384 |
1a2effd8d827e855d794579a6f3f62200192cddf | 113 | require "fullpagejs/rails/version"
require "fullpagejs/rails/engine"
module Fullpagejs
module Rails
end
end
| 14.125 | 34 | 0.79646 |
b9a0da50f79dd70a6945eed0900452a67e30faf7 | 975 | require "socket"
module StoryTeller::Dispatchers
class Agent
class SocketPathNotDefined < StandardError; end
def initialize(config)
@path = config[:path]
if @path.nil?
raise SocketPathNotDefined
end
@path.freeze
end
## This method is used in a multi threaded
# en... | 23.214286 | 57 | 0.646154 |
9111dcf87afc3f83408f590be3beb644f849d9b9 | 15,997 | # frozen_string_literal: true
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 49.221538 | 119 | 0.637495 |
33d07b1c10aaa74c7e4990cb44293fb810b259aa | 686 | class Admin::BaseController < ActionController::Base
render_inheritable
include Typus::Authentication::const_get(Typus.authentication.to_s.classify)
before_filter :set_models_constantized
before_filter :reload_config_and_roles
before_filter :authenticate
before_filter :set_locale
helper_method :admin_... | 19.055556 | 78 | 0.785714 |
014c5d29706d4c9b242649e0d00da34cd9616e55 | 1,091 | module RockRMS
class Client
module Batch
def list_batches(options = {})
res = get(batches_path, options)
Response::Batch.format(res)
end
def find_batch(id)
res = get(batches_path(id))
Response::Batch.format(res)
end
def create_batch(
name:,
... | 21.392157 | 61 | 0.532539 |
878a95d3595103513db366fc78ffac3e80062de8 | 4,788 | require "advanced_roadmap/gruff/pie" if Object.const_defined?(:Magick)
class MilestonesController < ApplicationController
menu_item :roadmap
before_filter :find_project, :only => [:new, :create]
before_filter :find_milestone, :only => [:show, :edit, :update, :destroy]
before_filter :authorize, :except => [:sho... | 31.294118 | 130 | 0.66604 |
ed6dd402c0941c4c8f16ee0f6f37c01beaa92b2e | 3,741 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = GoodRanking
include Msf::Exploit::FILEFORMAT
def initialize(info = {})
super(update_info(info,
'... | 31.70339 | 93 | 0.55707 |
615febc4cc0a9e9d17d826529a7c007f93ba14a0 | 3,971 | =begin
#Datadog API V2 Collection
#Collection of all Datadog Public endpoints.
The version of the OpenAPI document: 1.0
Contact: support@datadoghq.com
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
Unless explicitly stated otherwise all files in this repository are licensed ... | 27.964789 | 220 | 0.652229 |
0387a42539e15ac55002f9cff8908f58e0bfc239 | 1,313 | require 'spec_helper'
RSpec.describe Sugar, type: :lib do
subject{ Sugar }
before(:each) do
allow(Sugar).to receive(:config).and_return({
host: 'http://sugar.localhost/',
username: 'username',
password: 'password'
})
end
shared_examples_for 'a sugar request' do
let(:authorizatio... | 25.745098 | 79 | 0.616146 |
f7bf283ba397ab6d2b1bc87e2f29992b07e5cea6 | 1,276 | module Ruboty
module Todoist
module Resorces
class Item < Base
property :due_date
property :day_order
property :assigned_by_uid
property :due_date_utc
property :is_archived
property :labels
property :sync_id
property :in_history
propert... | 24.538462 | 95 | 0.584639 |
33eb654511663390e1a094306d1850c8b68c22a6 | 77 | class Sponsor < ActiveRecord::Base
mount_uploader :file, ImageUploader
end
| 19.25 | 37 | 0.805195 |
1a92acb40ff8e1a031cc6c09e0c729513ba88f29 | 578 | require "test_helper"
class UsersProfileTest < ActionDispatch::IntegrationTest
include ApplicationHelper
def setup
@user = users(:michael)
end
test "profile display" do
get user_path(@user)
assert_template 'users/show'
assert_select 'title', full_title(@user.name)
assert_select 'h1', text: @user.name... | 24.083333 | 57 | 0.757785 |
876806ec9c4d70de52f434d4c82b30de03136b71 | 1,770 | require "./lib/rackspace/version"
require 'rackspace-ruby-sdk-core'
require 'pry'
SERVICE_NAME_MAP = {
'auto_scale' => 'autoscale',
'backup' => 'cloudBackup',
'big_datum' => 'cloudBigData',
'block_storage' => 'cloudBlockStorage',
'cdn' => 'cloudFilesCDN',
'compute' => 'cloudSe... | 36.122449 | 88 | 0.577966 |
d5a32c1f5b8e4622cfd5f97b51979e6335234ace | 1,288 | # -*- encoding: utf-8 -*-
# stub: jekyll-theme-tactile 0.1.0 ruby lib
Gem::Specification.new do |s|
s.name = "jekyll-theme-tactile".freeze
s.version = "0.1.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.aut... | 36.8 | 112 | 0.66382 |
38227cba9f080cdf890657826beccb803fced36b | 354 | module Fastlane
module Helper
class UploadSymbolsToNewRelicHelper
# class methods that you define here become available in your action
# as `Helper::UploadSymbolsToNewRelicHelper.your_method`
#
def self.show_message
UI.message("Hello from the upload_symbols_to_new_relic plugin help... | 27.230769 | 79 | 0.720339 |
1c49305e818c672b996e9bab2a5d08fb243ce0ac | 465 | class Rss::Page
include Cms::Model::Page
include Cms::Page::SequencedFilename
include Rss::Addon::Page::Body
include Category::Addon::Category
include Cms::Addon::Release
include Cms::Addon::GroupPermission
include History::Addon::Backup
set_permission_name "article_pages"
store_in_repl_master
def... | 24.473684 | 57 | 0.754839 |
d5f3cf7e57fd4557f4e9f907cc54bfaa144b0a02 | 1,514 | require_relative '../../../search_test'
require_relative '../../../generator/group_metadata'
module USCoreTestKit
module USCoreV400
class CarePlanPatientCategoryStatusSearchTest < Inferno::Test
include USCoreTestKit::SearchTest
title 'Server returns valid results for CarePlan search by patient + cat... | 30.28 | 110 | 0.690885 |
91beade096d8c66133a781cd9885449316d371c7 | 251 | class CreateSentences < ActiveRecord::Migration
def change
create_table :sentences do |t|
t.string :content
t.string :author
t.references :story, index: true, foreign_key: true
t.timestamps null: false
end
end
end
| 20.916667 | 57 | 0.677291 |
288941e169b5bff797a20be9f25684d814bef837 | 10,183 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::ResourcesManagement::Mgmt::V2018_01_01_preview
#
# A service client - single point of access to the REST API.
#
class ManagementGroupsAPI < MsRestAzure:... | 40.090551 | 154 | 0.702936 |
186eb300f1c84f421e7f9fc714511ba673b645a2 | 3,358 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Jekyll::Diagrams::Rendering do
describe '.render_with_stdin_stdout' do
it 'call render_with_command' do
allow(described_class).to receive(:render_with_command)
described_class.render_with_stdin_stdout('command', 'content')
ex... | 29.982143 | 77 | 0.672126 |
b9105bcbc0fe6e65695af6fa848c05ceb5afc92c | 1,302 | class Atlantis < Formula
desc "Terraform Pull Request Automation tool"
homepage "https://www.runatlantis.io/"
url "https://github.com/runatlantis/atlantis/archive/v0.10.1.tar.gz"
sha256 "98a1dae80acfa1c322007d4a2e29a28733edc386d74b9b3b07608fe64820a843"
bottle do
cellar :any_skip_relocation
rebuild 1
... | 37.2 | 116 | 0.713518 |
e2c32a4ccb59f696b1fe3ee5edbb7de6e8b6f715 | 794 | # frozen_string_literal: true
RSpec.describe SC::Billing::Stripe::PaymentSources::CreateOperation, :stripe do
subject(:call) do
described_class.new.call(user, token)
end
let(:stripe_customer) { Stripe::Customer.create }
let(:user) { create(:user, stripe_customer_id: stripe_customer.id) }
let(:token) { s... | 27.37931 | 81 | 0.711587 |
b9e89a28a7e55e239862ed81daccbd8e927834f4 | 4,215 | # frozen_string_literal: true
RSpec.describe TTY::Prompt, '#slider' do
subject(:prompt) { TTY::TestPrompt.new }
let(:symbols) { TTY::Prompt::Symbols.symbols }
it "specifies ranges & step" do
prompt.input << "\r"
prompt.input.rewind
expect(prompt.slider('What size?', min: 32, max: 54, step: 2)).to ... | 29.475524 | 89 | 0.547805 |
08436dce2ceb97d2c57664540ee6c125762dfe42 | 4,350 | #-------------------------------------------------------------------------------
# This snippet was made to fix some unwanted behaviours of the timer and picture
# sprites on higher resolutions (meaning not the default 544x416 resolution).
# If you are using Yanfly's or Dekita's core scripts, put this below those!
#---... | 41.428571 | 80 | 0.445747 |
ac5785d9c91d443185d04fdb129157f6fea4d006 | 2,865 | # frozen_string_literal: true
module Ci
class Processable < ::CommitStatus
include Gitlab::Utils::StrongMemoize
accepts_nested_attributes_for :needs
scope :preload_needs, -> { preload(:needs) }
scope :with_needs, -> (names = nil) do
needs = Ci::BuildNeed.scoped_build.select(1)
needs = ... | 26.527778 | 94 | 0.669808 |
e821b083cf1d1be8fd69a3ae4d8e7625474ba934 | 1,108 | case node[:platform]
when "debian","ubuntu"
directory "/var/cache/local/preseeding" do
owner "root"
group "root"
mode 0755
recursive true
end
execute "preseed-mysql-server" do
command "debconf-set-selections /var/cache/local/preseeding/mysql-server.seed"
action :nothing
end
template... | 24.086957 | 84 | 0.684116 |
1d7dcfe73dd40e9dce2a705ba6885e78841dd2e9 | 928 | # frozen_string_literal: true
module Releases
class Sync
attr_reader :release, :full, :force
def initialize(release, full: true, force: false)
@release = release
@full = full
@force = force
end
def call
raise ImportError, "no key available: #{release.inspect}" unless release... | 21.581395 | 155 | 0.681034 |
7a5c0b58dcd600e7345ff98a4c8848af9bac8295 | 3,490 | # 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.884956 | 78 | 0.525788 |
4a06f6de86b95895d0473e67bd8f734fae7cac90 | 3,090 | require 'spec_helper'
require 'gds_api/test_helpers/content_store'
require 'gds_api/test_helpers/email_alert_api'
describe EmailAlertSubscriptionsController, type: :controller do
include GdsApi::TestHelpers::ContentStore
include GdsApi::TestHelpers::EmailAlertApi
include FixturesHelper
include GovukContentSche... | 31.530612 | 96 | 0.633657 |
5daaf259398eca98c79d0c4ae87c4cbfb8c08d28 | 1,296 | class AdminController < ApplicationController
layout 'admin'
layout 'application', only: [:unsubscribe, :perform_unsubscribe]
before_action :authenticate_user!
before_action :require_admin_access
def dashboard
end
def content_type
type_whitelist = Rails.application.config.content_types[:all].map(&:... | 20.903226 | 81 | 0.725309 |
03c4c4556a2f3ea109a41523af642e5cb9989962 | 725 | describe 'works well together with Neo4j::Core' do
let(:clazz) do
UniqueClass.create do
include Neo4j::ActiveNode
has_many :out, :stuff, type: :stuff, model_class: false
end
end
it 'can add Neo4j::Node to declared relationships' do
obj = clazz.create
node = Neo4j::Node.create
obj.... | 29 | 131 | 0.656552 |
d5ba42d750c02d499441363a67398a3a7b48451c | 702 | # frozen_string_literal: true
class MergeRequestPolicy < IssuablePolicy
rule { locked }.policy do
prevent :reopen_merge_request
end
# Only users who can read the merge request can comment.
# Although :read_merge_request is computed in the policy context,
# it would not be safe to prevent :create_note th... | 29.25 | 67 | 0.753561 |
d5072c329c8ca5f690bfac5a4e3d8059c14e1065 | 374 | # encoding: UTF-8
# frozen_string_literal: true
module Dump
# Get rails app root (Rails.root or RAILS_ROOT or fail)
module RailsRoot
def rails_root
case
when defined?(Rails)
Rails.root
when defined?(RAILS_ROOT)
RAILS_ROOT
else
fail 'Unknown rails app root'
... | 17.809524 | 57 | 0.639037 |
39c6689a5894d75cd1c912f689cc1517aee4e408 | 266 | class CreateStartOverlapMeetings < ActiveRecord::Migration
def self.up
create_table :start_overlap_meetings do |t|
t.date :starts_at
t.date :ends_at
t.timestamps
end
end
def self.down
drop_table :start_overlap_meetings
end
end
| 19 | 58 | 0.714286 |
bfe8a6d3e56ed4be1007f19bd2a9f7176a3f7cd7 | 6,844 | require 'spec_helper'
describe FbGraph::Auth do
let :optional_attributes do
{}
end
let(:auth) { FbGraph::Auth.new('client_id', 'client_secret', optional_attributes) }
subject { auth }
its(:client) { should be_a(Rack::OAuth2::Client) }
describe 'client' do
subject { auth.client }
let :optional_... | 36.021053 | 382 | 0.703682 |
79788f9ad7c1974a78ad1a1f338d84c5f304bab6 | 1,394 | title 'Connection Testing'
###############################
#
##############################
# Container 1
describe host('35.197.56.118', port: 5000, protocol: 'tcp') do
it { should be_reachable }
its('ipaddress') { should include '35.197.56.118' }
end
describe http('http://35.197.56.118:5000/') do
... | 29.041667 | 100 | 0.507174 |
3840c2f4071ecfb15776e0c88e1d3d42373149b2 | 1,124 | Pod::Spec.new do |s|
s.name = 'FBTencentOpenAPI'
s.version = '3.3.3.1'
s.summary = 'TencentOpenAPI v3.3.3'
s.description = <<-DESC
This pod is used who want to use tencentOpenAPI v3.3.3 with podfile.
DESC
s.author = 'http://open.qq.com'
s.homepa... | 34.060606 | 110 | 0.576512 |
ab968a29d94256d3ad8b10e4a822c642f97ae917 | 1,384 | #
# Copyright 2015, SUSE Linux GmbH
#
# 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 wr... | 26.615385 | 74 | 0.591763 |
ac5dcda34f04d82e597ecae222a8e01e24b5667e | 1,590 | =begin
#Kubernetes
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.2.3
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit te... | 26.065574 | 103 | 0.727673 |
7acec57136c7dc7a56c8a26f2fc2c5400b41ad8b | 383 | class ChangesForTableAccounts < ActiveRecord::Migration
def self.up
remove_column :accounts, :admin
remove_column :accounts, :password
add_column :accounts, :encrypted_password, :string, default: ""
end
def self.down
add_column :accounts, :admin, :boolean
add_column :accounts, :password, :str... | 27.357143 | 67 | 0.738903 |
5de949a2ffebba7f93d098663c084a6efc45613d | 1,603 | class Mvtools < Formula
desc "Filters for motion estimation and compensation"
homepage "https://github.com/dubhater/vapoursynth-mvtools"
url "https://github.com/dubhater/vapoursynth-mvtools/archive/v20.tar.gz"
sha256 "9a1bc87b9bad6642dd7d69b1b6e200c1d962ef55fc2787581e5d2cb437aa0b23"
head "https://github.com/d... | 32.06 | 93 | 0.724891 |
01a516575b85c7173a7c4485ab8fb7c8c70215a6 | 735 | module Mrkt
module ImportLeads
def import_lead(file, format = 'csv', lookup_field: nil, list_id: nil, partition_name: nil)
params = {
format: format,
file: Faraday::UploadIO.new(file, 'text/csv')
}
params[:lookupField] = lookup_field if lookup_field
params[:listId] = list_i... | 26.25 | 95 | 0.644898 |
4ab2d8662d607cdda09bfacf7ac64c37ba93c74a | 2,035 | #
# Copyright:: 2015-2020 Chef Software, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... | 35.086207 | 267 | 0.699754 |
ac8393bc6da00477cf853ed6de12bae7313c05e4 | 509 | require 'test/unit'
require 'red_grape'
class MapPipeTest < Test::Unit::TestCase
def setup
@g1 = RedGrape.load_graph 'data/graph-example-1.xml'
end
def test_map
assert_equal [
{"name"=>"marko", "age"=>29},
{"name"=>"vadas", "age"=>27},
{"name"=>"lop", "lang"=>"java"},
{"name"=>"j... | 23.136364 | 62 | 0.530452 |
e8ce40479f7736bbb2cf97c541439bd4f3671293 | 1,293 | module Integrity
class Notifier
include DataMapper::Resource
property :id, Serial
property :name, String, :required => true
property :enabled, Boolean, :required => true, :default => false
property :config, Yaml, :required => true, :lazy => false
belongs_to :project
v... | 27.510638 | 69 | 0.679041 |
e26a4e9b0d7ec4fa8672ac84110eb789d56e08c9 | 795 | require 'json'
require 'mechanize'
require 'csv'
# STDIN.each_line do |line|
# STDOUT.write line
# STDOUT.flush
# f.write line
# end
agent = Mechanize.new
agent.get('http://wakemate.com')
agent.page.link_with(:text => 'login').click
form = agent.page.form
form.username = ENV["WAKEMATE_EMAIL"]
form.password ... | 26.5 | 119 | 0.698113 |
abf68299f953688dfc9cd62c33b525006f31bf27 | 19,763 | # frozen_string_literal: true
# Please do not make direct changes to this file!
# This generator is maintained by the community around simple_form-bootstrap:
# https://github.com/rafaelfranca/simple_form-bootstrap
# All future development, tests, and organization should happen there.
# Background history: https://gith... | 45.536866 | 258 | 0.680716 |
1878475c490856e0a568a6beefa96b64338a54cb | 3,271 | class Action < ActiveRecord::Base
belongs_to :permissible, :polymorphic => true
has_many :permissions, :dependent => :destroy
validates_presence_of :name
validates_presence_of :permissible_type
validates_uniqueness_of :name, :scope => [:permissible_type, :permissible_id]
named_scope :permissible_actions_... | 43.613333 | 166 | 0.624885 |
f741379abbf375a9d48a4cf350629ea33fa0f1cb | 730 |
Pod::Spec.new do |s|
s.name = 'ecspconfig'
s.version = '0.1.5'
s.summary = 'ECSP配置模块'
s.description = <<-DESC
配置管理中心
1.配置文件获取及读取
2.对外提供配置项获取接口
DESC
s.homepage = 'http://www.weqicheng.com'
s.license = { :type => 'MIT', :file => 'LIC... | 31.73913 | 113 | 0.549315 |
3835684c4ea400368ebc81131636b329f8b4224a | 3,501 | require 'octokit'
require 'base64'
require 'yaml'
class GithubService
REPO = "hackclub/dns"
FILE = "hackclub.com.yaml"
def self.generate_and_submit_pr(subdomain)
dns_data = get_dns_records
if subdomain.changes
old_name = subdomain&.changes[:name]&.first
dns_data.delete old_name
end
... | 28.696721 | 144 | 0.694373 |
b95f4f1fe43d3f9747928a96e77bf7d773dfb0c8 | 62,622 | # 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/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
module Aws::ApplicationDiscoveryService
module Types
# Information about a... | 32.889706 | 125 | 0.620756 |
01458c0f08929e7aefbac5c4d8bfed87bb06043c | 2,085 | # -*- coding: utf-8 -*-
require 'spec_helper'
describe Api::ConfigController do
let(:member) do
FactoryGirl.create(:member, password: 'mala', password_confirmation: 'mala', config_dump: { 'use_wait' => '0' })
end
context 'logged in' do
describe '.getter' do
it 'renders json' do
get :getter... | 25.740741 | 132 | 0.567386 |
b9d1b305af0b05e5b23d57112677625de5e1a74b | 319 | require "test_helper"
module Fiesta
class TimestampNormalizerTest < Minitest::Test
def test_normalizing_timestamps
time = Time.parse("2015-10-09T14:50:23Z")
assert_equal time, TimestampNormalizer.new("20151009145023").run
assert_equal time, TimestampNormalizer.new(time).run
end
end
end
| 24.538462 | 70 | 0.746082 |
1cf31f3c814ed3c8c4f1e249bc7b4cbf27fa05f9 | 2,195 | #---
# Excerpted from "Ruby on Rails, 2nd Ed."
# We make no guarantees that this code is fit for any purpose.
# Visit http://www.editions-eyrolles.com/Livre/9782212120790/ for more book information.
#---
require File.dirname(__FILE__) + '/../test_helper'
require 'admin_controller'
# Re-raise errors caught by the cont... | 22.628866 | 109 | 0.662415 |
6a90be43dae47233d3f8fef68a9ac13797da64b7 | 2,098 | class OrdersController < ApplicationController
before_action :set_order, only: [:show, :edit, :update, :destroy]
# GET /orders
# GET /orders.json
def index
@orders = Order.all
end
# GET /orders/1
# GET /orders/1.json
def show
@food_item = FoodItem.find(@order.food_item)
@order = Order.find... | 25.585366 | 100 | 0.645853 |
0800feeb2c19fdf46c71a2e06ba0b321dff9afbc | 6,019 | require 'rails_helper'
RSpec.describe Admin::NotesController, type: :controller, admin: true do
let!(:petition) { FactoryBot.create(:open_petition) }
describe 'not logged in' do
describe 'GET /show' do
it 'redirects to the login page' do
get :show, petition_id: petition.id
expect(respon... | 34.198864 | 116 | 0.651105 |
4a559fb63b9cf50825276ddc15967d69646bc6f0 | 33 | class ShippingCharge < Charge
end | 16.5 | 29 | 0.848485 |
629c78c7f2b5ca0ca6cff24d639aca0c1c8ce728 | 3,021 | # frozen_string_literal: true
require 'json'
module Bolt
class Plugin
class Aws
class EC2
attr_accessor :client
attr_reader :config
def initialize(config)
require 'aws-sdk-ec2'
@config = config
@logger = Logging.logger[self]
end
def n... | 29.048077 | 99 | 0.549487 |
1c1763454a5a75ef6002b7f6e4d9c4c040cb6069 | 980 | # frozen_string_literal: true
class GitlabDanger
LOCAL_RULES ||= %w[
changes_size
documentation
frozen_string
duplicate_yarn_dependencies
prettier
eslint
karma
database
commit_messages
telemetry
utility_css
].freeze
CI_ONLY_RULES ||= %w[
metadata
changelog
... | 18.148148 | 101 | 0.706122 |
f7b833f3e5bbb629564f2e568b5c1421935ad64b | 46 | module OdptCommon::Modules::MethodMissing
end
| 15.333333 | 41 | 0.847826 |
39d30f2e65b87a54950e1901be8ad0d348eefe88 | 3,877 | require 'rails_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to test the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
#... | 29.823077 | 81 | 0.667784 |
612cca75e3badcba9d1aa067297044c6f74a2c84 | 309 | module SignalFx
module Tracing
module Compat
def self.apply
@compat.each { |mod| mod.apply } if @compat
end
def self.add_compat(mod)
@compat = [] unless @compat
@compat.push(mod)
end
end
end
end
require 'signalfx/tracing/compat/phusion_passenger'
| 18.176471 | 51 | 0.618123 |
ab17d94b227e737f9058cd42000e8702a732583b | 1,042 | # A StorageManager that stores file on remote filesystem using rclone. Rclone
# can store files on most cloud storage systems. Requires the `rclone` binary to
# be installed and configured.
#
# @see https://rclone.org/
class StorageManager::Rclone < StorageManager
class Error < StandardError; end
attr_reader :remot... | 25.414634 | 88 | 0.679463 |
6aef8dd78d3a5cc08f61dd13f3f7970dd5a0a467 | 37 | module Gyazo
VERSION = '3.1.0'
end
| 9.25 | 19 | 0.648649 |
e29457f1519f8733f624cb2e9e30d396a6cc9fd9 | 527 | # @param {String} s
# @return {Integer}
def length_of_longest_substring(s)
return s.length if s.length < 2
walker, runner, ans = 0, 1, 1
hash = {}
hash[s[0]] = 0
while runner < s.length
if !hash[s[runner]].nil?
stop = hash[s[runner]]
while walker <= stop
... | 25.095238 | 44 | 0.499051 |
261d83f3fcaad4ec2e9cc6b1fd88c2f0f5aae60f | 4,623 | # frozen_string_literal: true
require_relative 'data_model_data'
module MembershipData
MODEL = Teneo::DataModel::Membership
ITEMS = DataModelData::ITEMS.for(MODEL)
# noinspection RubyUnusedLocalVariable
TESTS = {
index: {
'get all' => {
check_params: ITEMS.only(MODEL).values
... | 41.276786 | 161 | 0.515682 |
1a319871b301f15455fab7298057b6f043a162d2 | 1,152 | require 'test_helper'
class UsersIndexTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
def setup
@admin = users(:nathan)
@non_admin = users(:archer)
end
test "index including pagination" do
log_in_as(@admin)
get users_path
assert_template 'users/index... | 24.510638 | 66 | 0.668403 |
03cbd342ef87b6006997989aeeaf50b2b3e55bbf | 6,484 | ##########################
# Developer: Victor Huang
# Date: 2/16/2017
# Time to solve the problem: 2 hours
##########################
require 'pp'
require 'benchmark'
class WordCountLib
# assume text without any Unicodes
def initialize(text)
@text = text
end
def frequencey_count
sentences = sanitize... | 31.940887 | 222 | 0.677514 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.