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 |
|---|---|---|---|---|---|
e94ec75023be6f2fd68f54b98dae25cc6fefc506 | 267 | require 'spec_helper'
klass = OneviewSDK::API600::C7000::NetworkSet
RSpec.describe klass, integration: true, type: DELETE, sequence: rseq(klass) do
let(:current_client) { $client_600 }
include_examples 'NetworkSetDeleteExample', 'integration api600 context'
end
| 33.375 | 79 | 0.782772 |
115e73895dad49365d3b610192aec962305fc2bf | 102 | class FitnessClassCategory < ApplicationRecord
belongs_to :fitness_class
belongs_to :category
end
| 14.571429 | 46 | 0.843137 |
390338693c1d9cded87e1c54a1a2986dab2a0db1 | 2,623 | # encoding: UTF-8
require 'gooddata'
GoodData.with_connection do |c|
GoodData.with_project('project_id') do |project|
t = project.dashboards('dashboard_id').tabs.find { |t| t.identifier == 'tab_identifier' }
# How many items are there on the tab?
t.items.count
# The items count also several utili... | 45.224138 | 134 | 0.672512 |
0126b22ba941ec555a3cfaebc6e74b4a9d5e93fd | 135 | require 'spec_helper'
describe ContainerCI do
it 'has a version number' do
expect(ContainerCI::VERSION).not_to be nil
end
end
| 16.875 | 46 | 0.748148 |
f7f86e0de1bb84d9a8688d12dd8a6d22a92de690 | 92 | json.partial! "archive_org_audios/archive_org_audio", archive_org_audio: @archive_org_audio
| 46 | 91 | 0.869565 |
39fe06441de3b02bd5a3198aeb271516d527ff4c | 1,302 | class PopulateAdvisoryCommittees < ActiveRecord::Migration[5.2]
include MigrationHelper
class AdvisoryCommittee < ApplicationRecord
attribute :value, :string
end
def change
add_lookup AdvisoryCommittee, 1, value: 'NHS Abdominal Aortic Aneurysm (AAA) Programme RAC'
add_lookup AdvisoryCommittee, 2,... | 59.181818 | 121 | 0.768817 |
f8f518a5df6e4939fac35693eab8a8d1b110cfd0 | 4,537 | # encoding: utf-8
require "cgi"
require "nokogiri"
module DText
def parse(str)
return "" unless str
state = ["newline"]
result = ""
# Normalize newlines.
str.strip!
str.gsub!(/(\r\n?)/, "\n")
str.gsub!(/\n{3,}/, "\n\n")
str = CGI.escapeHTML str
# Nuke spaces between newlines.
... | 34.112782 | 203 | 0.529645 |
d5783fc96abe272193ad5b1450bf0ac26daba91d | 1,460 | require "rails_helper"
describe InternalController, type: :request do
let(:publisher_username) { "publisher_username" }
let(:publisher_password) { "publisher_password" }
let(:author_username) { "author_username" }
let(:author_password) { "author_password" }
before do
BasicAuth.class_variable_set(:@@cred... | 30.416667 | 106 | 0.755479 |
5da559d237020e71a11006dfaa3b26ca602bf568 | 158 | class RestrictionListType < ActiveModel::Type::Value
def cast(value)
value.map { |restriction| RestrictionType.new.cast(restriction) }.freeze
end
end
| 26.333333 | 76 | 0.759494 |
620ca7528987384e741c64f02c9e0d40f2c3c33b | 7,303 | require File.dirname(__FILE__) + '/../../test_helper'
class USPSTest < Test::Unit::TestCase
def setup
@packages = TestFixtures.packages
@locations = TestFixtures.locations
@carrier = USPS.new(:login => 'login')
@international_rate_responses = {
:vanilla => xml_fixture('usps/beverly_hills_... | 42.958824 | 350 | 0.630837 |
6a144b394a9403304b59244a6edecce1d8f361b9 | 4,830 | module Spree
module Adyen
# Class responsible for taking in a notification from Adyen and applying
# some form of modification to the associated payment.
#
# I would in the future like to refactor this by breaking this into
# separate classes that are only aware of how to process specific kinds of... | 30.961538 | 80 | 0.637888 |
5deac9b2d2c567ab62c8fc49b7c6b59c38801dfc | 1,206 | # encoding: utf-8
# author: Mesaguy
describe file('/opt/prometheus/exporters/clickhouse_exporter_perconalab/active') do
it { should be_symlink }
its('mode') { should cmp '0755' }
its('owner') { should eq 'root' }
its('group') { should eq 'prometheus' }
end
describe file('/opt/prometheus/exporters/clic... | 30.923077 | 148 | 0.685738 |
1d3ebdcdc3275de8b3200e73b35ef8e5f1331098 | 1,394 | def gen_build_config
cp "#{ENV['MRUBY_HOME']}/build_config.rb", './build_config.rb'
end
if !ENV['MRUBY_HOME']
# Maybe MRuby is next to this gem?
ENV['MRUBY_HOME'] ||= Dir.pwd + '/../mruby'
end
# Still no luck? Raise hell!
if !ENV['MRUBY_HOME'] || !File.directory?(ENV['MRUBY_HOME'])
$stderr.puts 'Unable to fi... | 22.483871 | 73 | 0.648494 |
2670bc1088700cb6038cf6c7da301e88a576c8d7 | 2,776 | class AllowRevisionDeletion < ActiveRecord::Migration[5.2]
def up
remove_foreign_key :revisions_image_revisions, :revisions
add_foreign_key :revisions_image_revisions,
:revisions,
on_delete: :cascade
remove_foreign_key :image_assets, :image_blob_revisions
add_f... | 37.513514 | 79 | 0.634006 |
335bdf9957ab0dc9d699e2bc8b8377c006441c3a | 1,781 | #
# Be sure to run `pod lib lint QBase.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 = 'QBase'
s.ve... | 32.981481 | 96 | 0.637282 |
ed1409cf2f4903797ab364cb4708066b0fe429e0 | 158 | require 'test_helper'
class IvaldiContentBuilder::Test < ActiveSupport::TestCase
test "truth" do
assert_kind_of Module, IvaldiContentBuilder
end
end
| 19.75 | 58 | 0.791139 |
919078501a7baeba850cec6a8d5e572a574a9fd9 | 3,377 | require 'socket'
require 'open3'
require 'json'
# Only one isntance of osrm-routed is ever launched, to avoid collisions.
# The default is to keep osrm-routed running and load data with datastore.
# however, osrm-routed it shut down and relaunched for each scenario thats
# loads data directly.
class OSRMLoader
clas... | 24.471014 | 164 | 0.632514 |
ac2db99ee01b8a1a40c1d63d5678de56e83c69c0 | 11,691 | # frozen_string_literal: true
module Gitlab
module GitalyClient
class RefService
include Gitlab::EncodingHelper
# 'repository' is a Gitlab::Git::Repository
def initialize(repository)
@repository = repository
@gitaly_repo = repository.gitaly_repository
@storage = reposit... | 38.97 | 145 | 0.673082 |
115b99c33fff5cbc0394aaf7aa308c4c24319d34 | 3,600 | module ActiveScaffold::DataStructures::Association
class Abstract
def initialize(association)
@association = association
end
attr_writer :reverse
delegate :name, :foreign_key, :==, to: :@association
def allow_join?
!polymorphic?
end
def klass
@association.klass unless p... | 23.684211 | 92 | 0.655 |
623d64448d514bd407e21892a7fcb58ca7f2ec92 | 1,445 | class Kontena::Cli::GridCommand < Kontena::Command
subcommand ["list","ls"], "List all grids", load_subcommand('grids/list_command')
subcommand "create", "Create a new grid", load_subcommand('grids/create_command')
subcommand "update", "Update grid", load_subcommand('grids/update_command')
subcommand "use", "S... | 65.681818 | 113 | 0.76955 |
5d2c6f3dbf20b4497a58d5557e965069d800dc42 | 435 | # vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2
#
# Copyright (c) 2016-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found ... | 29 | 77 | 0.724138 |
6a42567b69abd79e48541f127c409a3b9dc409ac | 6,712 | require "rubygems"
require "thread"
require "bugsnag/version"
require "bugsnag/configuration"
require "bugsnag/meta_data"
require "bugsnag/report"
require "bugsnag/cleaner"
require "bugsnag/helpers"
require "bugsnag/session_tracker"
require "bugsnag/delivery"
require "bugsnag/delivery/synchronous"
require "bugsnag/de... | 35.141361 | 143 | 0.706794 |
1c5f48977d3fd57d099bae12780534bec3a84660 | 1,852 | Capistrano::Configuration.instance(true).load do
set_default :ruby_version, "2.0.0-p195"
# set_default :rbenv_bootstrap, "bootstrap-ubuntu-11-10"
namespace :rbenv do
desc "Install rbenv, Ruby, and the Bundler gem"
task :install, roles: :app do
run "#{sudo} apt-get -y install curl git-core"
ru... | 36.313725 | 138 | 0.638769 |
21f1e34d400f74fd38f6b98b40571f373adb51ca | 1,280 | class Gocryptfs < Formula
desc "Encrypted overlay filesystem written in Go"
homepage "https://nuetzlich.net/gocryptfs/"
url "https://github.com/rfjakob/gocryptfs/releases/download/v2.0.1/gocryptfs_v2.0.1_src-deps.tar.gz"
sha256 "31be3f3a9400bd5eb8a4d5f86f7aee52a488207e12d312f2601ae08e7e26dd02"
license "MIT"
... | 27.234043 | 121 | 0.7125 |
621175fbbf95a3dcc99d27753e91811a3a74e8cb | 5,187 | #
# Be sure to run `pod spec lint NetworkTool.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github... | 36.528169 | 107 | 0.597262 |
d56d06c853c3dfd74a579343bdd44836bd013499 | 594 | class ContactController < ApplicationController
def index
@contact = Contact.new
end
def new
@user = current_user
@contact = Contact.new
end
def create
@contact = Contact.new(params[:contact])
if @contact.valid?
render action: 'new'
end
end
def contact_send
@contact = ... | 21.214286 | 83 | 0.69697 |
386d6e737bde7e386cd68bdae26f8a41302f548c | 64 | module Sprockets
module Rails
VERSION = "3.1.1"
end
end
| 10.666667 | 21 | 0.65625 |
5d328c2edc27da0130a75d660e3ddc2e6223743a | 23,219 | #
# Author:: Lamont Granquist (<lamont@getchef.com>)
# Copyright:: Copyright (c) 2008-2014 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 Lic... | 35.776579 | 141 | 0.617253 |
b901a7e64ca4cbe796c066dbe514b11a0ffe56de | 651 | module RoleControl
module Actor
class DoChain
attr_reader :scope, :action, :actor
def initialize(actor, action)
@action = action
@actor = actor
end
def to(klass, context={}, add_active_scope: true)
@scope = klass.scope_for(action, actor, context)
if add_ac... | 21.7 | 66 | 0.583717 |
33e7341a434f35bacc2a46576541f6da24b1f34c | 659 | #
# Copyright 2015, Noah Kantrowitz
#
# 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 writin... | 34.684211 | 74 | 0.772382 |
0185d50e809cf656d46f2a9f6524863e47d80e6a | 709 | require 'mongo'
Mongo::Logger.logger = Logger.new("./logs/mongo.log")
class MongoDB
attr_accessor :users, :equipos
def initialize
client = Mongo::Client.new("mongodb://rocklov-db:27017/rocklov")
@users = client[:users]
@equipos = client[:equipos]
end
def remove_user(email)... | 18.179487 | 72 | 0.619182 |
e29c31a3a2d211416cd2b7b372406e55704d1eb4 | 469 | require "komachi_foundation/source"
require "thor"
module KomachiFoundation
class Generator < Thor::Group
include Thor::Actions
def self.source_paths
@_source_paths ||= Source.list
end
argument :file_name
source_root File.expand_path('../templates', __FILE__)
def copy_templates
... | 18.76 | 58 | 0.690832 |
e90a20e34e6dd1d8c4f98925d050fbab561a8cd1 | 1,253 | # Copyright (c) 2017 Salesforce
# Copyright (c) 2009 37signals, LLC
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, co... | 46.407407 | 107 | 0.772546 |
edb1f2e7739849be1a0e8a2fb591342b869ee902 | 604 | Pod::Spec.new do |s|
s.name = 'TAKUUID'
s.version = '1.5.0'
s.license = 'MIT'
s.summary = 'create UUID and store to Keychain library'
s.homepage = 'https://github.com/taka0125/TAKUUID'
s.author = { 'Takahiro Ooishi' => 'taka0125@gmail.com' }
s.source = { :git => 'htt... | 33.555556 | 96 | 0.581126 |
f838b43ad6d065aeeb71aa18c93ecdf7df704935 | 142 | module Hydra::Derivatives
class VideoDerivatives < Runner
def self.processor_class
Processors::Video::Processor
end
end
end
| 17.75 | 34 | 0.732394 |
4a7f17bd0118229a9d255e6f4589ea01f1e1ff82 | 1,560 | require 'helpers/shared_helpers'
require 'swagger_docs'
module API
module V1
# Root api endpoints
class Root < Grape::API
helpers SharedHelpers
helpers do
# Metadata communities hash with 'name => url' pairs.
# Return: [Hash]
# { community1: 'url/for/comm1', ..., communi... | 31.2 | 97 | 0.625 |
e802cf9f368a418b4dc211769530a9f861e6549c | 6,055 | require 'spec_helper'
describe 'cassandra::schema::table' do
context 'Create Table' do
let :facts do
{
operatingsystemmajrelease: 7,
osfamily: 'RedHat',
os: {
'family' => 'RedHat',
'name' => 'RedHat',
'release' => {
'full' => '7.6.1810',
... | 27.775229 | 128 | 0.514121 |
1dd8f4b4d3dcd75dfb7cddb77886a10a62be91a6 | 1,923 | module ApplicationHelper
include PresentersHelper
TRUNCATE_CHARS_DEFAULT = 300
def page_title(title)
@page_title ||= []
@page_title.push(title) if title.present?
@page_title.join(' | ')
end
def humanize_uri_code(vocab, code)
t("controlled_vocabularies.#{vocab}.#{code}")
end
def humaniz... | 32.05 | 108 | 0.720229 |
183482630b46bd9c53f73dd6c2e7590973b4b8f3 | 442 | require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the DonationsHelper. For example:
#
# describe DonationsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# ... | 27.625 | 71 | 0.71267 |
e26e72be17554b96b98b5acebce7d167dc65aebe | 97 | module CacheDebugging
Digestor = CacheDigests::TemplateDigestor rescue ActionView::Digestor
end | 32.333333 | 71 | 0.85567 |
03db6b6bab02f7b94c0e26181facbdd81d68cd24 | 949 | require 'rack/protection'
module Rack
module Protection
##
# Prevented attack:: CSRF
# Supported browsers:: all
# More infos:: http://en.wikipedia.org/wiki/Cross-site_request_forgery
#
# Only accepts unsafe HTTP requests if a given access token matches the token
# included in th... | 29.65625 | 94 | 0.651212 |
87ba45d896d775ccb8df36b8cb8c5f786462d1ba | 20,522 | # -*- coding: binary -*-
module Msf
###
#
# Complex payload generation for Windows ARCH_X86 that speak HTTP(S) using WinHTTP
#
###
module Payload::Windows::ReverseWinHttp
include Msf::Payload::Windows::ReverseHttp
#
# Register reverse_winhttp specific options
#
def initialize(*args)
super
registe... | 33.314935 | 115 | 0.568658 |
8711f038b3f02e04c8d2e66433b0e004a8b8f48a | 2,755 | require 'helper'
describe Twitter::REST::API::Trends do
before do
@client = Twitter::REST::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :access_token => 'AT', :access_token_secret => 'AS')
end
describe '#trends' do
context 'with woeid passed' do
before do
stub_get('/1.1/tre... | 39.927536 | 195 | 0.665336 |
62d817379ab69edc8fc2d16f6b63076d4e5e5ee9 | 215 | class CreateProjects < ActiveRecord::Migration[6.1]
def change
create_table :projects do |t|
t.string :name
t.string :description
t.integer :location_id
t.timestamps
end
end
end
| 17.916667 | 51 | 0.660465 |
d50d6fae1ce5dcbd7ef342b61d12d7b1790bd295 | 1,781 | $secret = File.read 'secret.txt'
require 'digest'
require 'jwt'
def login(username, password)
password_hash = Digest::SHA512.digest password
password.gsub /./, ' '
rows = $db.execute('SELECT * FROM users WHERE username=? AND password_hash=? LIMIT 1;', [username, password_hash])
return false if rows.empty?... | 25.084507 | 116 | 0.68557 |
2877535165e53d7278e6f802feb7de9fdffbda12 | 14,156 | =begin
#NSX-T Data Center Policy API
#VMware NSX-T Data Center Policy REST API
OpenAPI spec version: 3.1.0.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.17
=end
require 'date'
module NSXTPolicy
# Child wrapper object for IPSecVpnSession, used in hierarchical A... | 35.039604 | 508 | 0.645097 |
ed5e76cd86f601399728799707ead16fb8e864d3 | 1,622 | require 'test_helper'
class UsersControllerTest < ActionDispatch::IntegrationTest
def setup
@user = users(:michael)
@other_user = users(:archer)
end
test "should redirect edit when not logged in" do
get edit_user_path(@user)
assert_not flash.empty?
assert_redirected_to login_url
end
... | 27.491525 | 87 | 0.644266 |
38935dc667eaaf36613a9c0ea2b81c3245825676 | 3,594 | class Campfire < Linkbot::Connector
Linkbot::Connector.register('campfire', self)
def initialize(options)
super(options)
end
def start
request_options = {
:head => {
'authorization' => [@options['username'], @options['password']],
'Content-Type' => 'application/json'
}
... | 33.90566 | 133 | 0.622983 |
7999327130a34b9cebbf32bdef620fc022a9c751 | 733 | class CatalogCulture < ActiveRecord::Base
# specify schema and table name
self.table_name = :cultures
# specify primary key name
self.primary_key = :id
# override decimal set
set_integer_columns :id, :mkey
ignore_columns :step, :record_view, :area, :period,
:attrib_type, :attributor, :attrib_date,... | 29.32 | 56 | 0.768076 |
614a447771db2b961a00cc2cc56f7eaf8530af29 | 50 | include_recipe 'gusztavvargadr_octopus::tentacle'
| 25 | 49 | 0.88 |
182ca84a10205b6191ffd7b8eef64870bbcd1c19 | 13,642 | # Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmat... | 49.071942 | 154 | 0.751356 |
6154ff25f5a62641f296b1c754ebcea0cbbd90bd | 488 | module MotionKit
module_function
def objective_c_method_name(str)
str.split('_').inject([]) { |buffer,e| buffer.push(buffer.empty? ? e : e.capitalize) }.join
end
def camel_case(str)
str.split('_').map(&:capitalize).join
end
def setter(method_name)
setter = "set#{method_name[0].capitalize}#{me... | 19.52 | 95 | 0.64959 |
b9108dd9b02d50391b6a1c1eb11c5cd3db16e930 | 2,668 | # -*- encoding: utf-8 -*-
# stub: selenium-webdriver 3.14.0 ruby lib
Gem::Specification.new do |s|
s.name = "selenium-webdriver".freeze
s.version = "3.14.0"
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "changelog_uri" => "http... | 50.339623 | 207 | 0.661169 |
5dc3841ed98c330fd9fb834f46b44dbad8baec8d | 1,390 | module Billy
class Skill
ATTRIBUTES = [:name, :internal_location, :external_location]
attr_accessor *ATTRIBUTES
def initialize(config = {})
config.each { |k,v| public_send("#{k}=",v) }
end
def to_s
name
end
def to_h
ATTRIBUTES.each_with_object({}) do |attribute, hash... | 19.857143 | 75 | 0.620863 |
b9e81acf79dfa89a7a9de1b023ca3898a2ab60b8 | 1,781 | # frozen_string_literal: true
require_dependency 'claims_api/json_marshal'
require_dependency 'claims_api/concerns/file_data'
module ClaimsApi
class PowerOfAttorney < ApplicationRecord
include FileData
attr_encrypted(:form_data, key: Settings.db_encryption_key, marshal: true, marshaler: ClaimsApi::JsonMarsh... | 28.269841 | 116 | 0.679955 |
1d41415b7fcb1ffc2d97a9760bdec25cb04e3b6e | 2,934 | require 'test_helper'
class SetSubscriptionsForItemJobTest < ActiveSupport::TestCase
fixtures :all
def setup
User.current_user = Factory(:user)
end
test 'perform for datafile' do
person1 = Factory(:person)
person2 = Factory(:person)
subscribable = nil
# when subscribable is created, SetSu... | 38.605263 | 122 | 0.777437 |
1c88eaa9f80020dd762e73dbc4bf082bc6758ede | 358 | require 'helper'
class TestUtils < Test::Unit::TestCase
def test_blank
assert EmailVeracity::Utils.blank?([]), '[] should be blank.'
assert EmailVeracity::Utils.blank?(''), '"" should be blank.'
assert EmailVeracity::Utils.blank?(Hash.new), '{} should be blank.'
assert EmailVeracity::Utils.blank?(ni... | 27.538462 | 71 | 0.678771 |
e8425d8ea005f325227597180013d2affe0431ae | 100 | # frozen_string_literal: true
class ImageOptim
class ConfigurationError < StandardError; end
end
| 16.666667 | 47 | 0.82 |
e2e41cccf06498e23cfc379ffdc5f70f4fe0be14 | 2,196 | require 'test_helper'
class UserTest < ActiveSupport::TestCase
def setup
@user = User.new name: 'Example User', email: 'user@example.com',
password: 'foobar', password_confirmation: 'foobar'
end
test 'should be valid' do
assert @user.valid?
end
test 'name should be present' do
... | 28.153846 | 77 | 0.67031 |
e927f562bd4b460534be5084e3750803d29c794e | 400 | cask 'neo4j' do
# note: "4" is not a version number, but an intrinsic part of the product name
version '1.2.9'
sha256 '2e26dfe20e98286dd7871235c39d8a077d9f53e2971997731e0592a60313b16a'
url "https://neo4j.com/artifact.php?name=neo4j-desktop-#{version}.dmg"
appcast 'https://neo4j.com/download/'
name 'Neo4j D... | 30.769231 | 80 | 0.74 |
bb8019e4006c09c18371a226c97b9665277a99c7 | 213 | require 'pry'
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.run_all_when_everything_filtered = true
config.filter_run :focus
config.order = 'random'
end
| 23.666667 | 63 | 0.807512 |
624d69126b58f9f9b777fd9dfa6b4613973dde35 | 118 | class AddUserIdToSong < ActiveRecord::Migration[5.0]
def change
add_column :songs, :user_id, :integer
end
end
| 19.666667 | 52 | 0.737288 |
bbe4c60faa243ea2e95a05effedeeb7402a27e9f | 903 | # frozen_string_literal: true
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :require_login, :active_user?
skip_before_action :active_user?, only: [:clearance]
helper_method :logged_in?, :current_user
def current_user
User.find_by(id: session[:... | 21.5 | 64 | 0.76412 |
ab6f456bf2f07b824e8f4b497f89f3a16e1ed50f | 867 | Pod::Spec.new do |s|
s.name = "FMDB"
s.version = "4.0.2"
s.summary = "A Cocoa / Objective-C wrapper around SQLite - Salesforce Mobile SDK fork"
s.homepage = "https://github.com/ccgus/fmdb"
s.license = "MIT"
s.author = { "August Mueller" => "gus@flyingmeat.com" }
s.platf... | 29.896552 | 93 | 0.574394 |
62ec8435819fb294411135e04a75375cbad9ff45 | 220 | # Change multipart limit from 128 (default) to unlimited
# http://stackoverflow.com/questions/27773368/rails-4-2-internal-server-error-with-maximum-file-multiparts-in-content-reached
Rack::Utils.multipart_part_limit = 0
| 55 | 125 | 0.813636 |
268b435cf02a46f22176bd7afed8b2829df43a27 | 10,110 | require 'puppet/util/logging'
require 'semver'
require 'json'
# Support for modules
class Puppet::Module
class Error < Puppet::Error; end
class MissingModule < Error; end
class IncompatibleModule < Error; end
class UnsupportedPlatform < Error; end
class IncompatiblePlatform < Error; end
class MissingMetada... | 28.398876 | 156 | 0.654303 |
ababb38bc79ba7c755892fe590c472238a249ec4 | 1,895 | require 'spec_helper'
require 'mspec/expectations/expectations'
require 'mspec/matchers'
shared_examples_for "have_instance_variable, on all Ruby versions" do
after :all do
Object.const_set :RUBY_VERSION, @ruby_version
end
it "matches when object has the instance variable, given as string" do
matcher = ... | 30.564516 | 86 | 0.722427 |
6a71a75350d415e6edabc130ca4a7fa073566f51 | 7,656 | # Copyright 2014 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, ... | 30.501992 | 80 | 0.560345 |
0113930862fa33800225f0d8aa59f5e0a065c1ca | 317 | require 'spec_helper'
RSpec.describe Phantomblaster::Configuration do
subject { described_class.new }
it { expect(subject).to respond_to(:api_key) }
it { expect(subject).to respond_to(:api_key=) }
it { expect(subject).to respond_to(:scripts_dir) }
it { expect(subject).to respond_to(:scripts_dir=) }
end
| 26.416667 | 53 | 0.731861 |
1ac764c200dbfc8d5ac73f3852ddfbb413d40fc5 | 579 | require 'tmpdir'
require 'equivalent-xml/rspec_matchers'
require 'byebug'
require 'simplecov'
require 'coveralls'
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
SimpleCov.start do
track_files "bin/**/*"
track_files "devel/**/*.rb"
add_filter "spec/**/*.rb"
end
puts "running in #{ENV['ROBOT_ENVIRONMENT']}... | 24.125 | 71 | 0.749568 |
ed208ecdaaeaa39aab0fcf8caca1ffb2d6746021 | 1,748 | # ------------------------------------------------------------
# MicroApp: Ruby GEM
# ------------------------------------------------------------
KDsl.microapp :r03_props do
settings do
name parent.key
app_type :react
title 'R03 Props... | 40.651163 | 162 | 0.528032 |
1ca765d136f868f7f953666617027d82bbc5a4ce | 2,093 | #
# Author:: Adam Jacob (<adam@chef.io>)
# Copyright:: Copyright (c) 2008-2016 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
#
# ... | 53.666667 | 191 | 0.694219 |
6a1ab72cf16c105549364533cb5d8cf07facad00 | 188 | require 'spec_helper'
describe Jsg do
it 'has a version number' do
expect(Jsg::VERSION).not_to be nil
end
it 'does something useful' do
expect(false).to eq(true)
end
end
| 15.666667 | 38 | 0.691489 |
3871214d7a4f1ae946ae590268717e6f9cb54863 | 716 | # frozen_string_literal: true
module Docs
module V1
module Tasks
extend Dox::DSL::Syntax
document :api do
resource 'Tasks' do
endpoint '/projects/:id/tasks'
group 'Tasks'
end
end
document :index do
action 'Get tasks'
end
document ... | 15.911111 | 40 | 0.541899 |
1ac0e5ddbe0862ed31f95c2f3d874c402039baea | 145 | require 'peperusha/version'
require 'peperusha/authenticate'
module Peperusha
class Error < StandardError; end
# Your code goes here...
end
| 18.125 | 34 | 0.765517 |
1d5507ac7565103955ec249d11590260990e2c56 | 281 | # frozen_string_literal: true
# add the build->push process onto the end of the deploy:published stack
# after 'deploy:published', 'docker:capdeploy_hook'
# push the no_release auto-cull to the very front of the task stack
# before 'deploy:starting', 'docker:trim_release_roles'
| 35.125 | 72 | 0.779359 |
bf97b12e8bca6a1add87fc0937858595b035572f | 349 | # frozen_string_literal: true
namespace :action_text_lite do
desc "Copy over the migration"
task install: %w( copy_migrations )
task :copy_migrations do
Rake::Task["railties:install:migrations"].reenable # Otherwise you can't run 2 migration copy tasks in one invocation
Rake::Task["action_text:install:m... | 29.083333 | 121 | 0.762178 |
3926c4fe5a7242d0071cac3e454f396ee52fc2cf | 2,823 | require 'test_helper'
describe "Fog::Network[:openstack] | lb_vip requests" do
describe "success" do
before do
@lb_vip_format = {
'id' => String,
'subnet_id' => String,
'pool_id' => String,
'protocol' => String,
'prot... | 30.354839 | 100 | 0.541977 |
21fee78bf8f9fd32d3e0e124dad26aa23c27b838 | 876 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'mercadolibre/version'
Gem::Specification.new do |spec|
spec.name = "mercadolibre"
spec.version = Mercadolibre::VERSION
spec.authors = ["Matias Hick"]
spec.email ... | 35.04 | 81 | 0.665525 |
1cac3df190d05f83885468ed5ead13a3568d24f4 | 226 | # Allows for assertion of a location against the qct_qda HubZone layer
class QctQdaAssertion
extend AssertionHelper
class << self
def assertion(location)
assertion_by_type('qct_qda', location)
end
end
end
| 20.545455 | 70 | 0.747788 |
ed06c5efc526ee8810045f2f01d93e2dcf687780 | 47,701 | # 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... | 52.075328 | 132 | 0.567766 |
5d155d28f8d3e0ff99466be5c3acbe3f9fa2d7ac | 993 | require 'rails_helper'
RSpec.describe "Admin V1 Coupons as :client", type: :request do
let(:user) { create(:user, profile: :client) }
context "GET /coupons" do
let(:url) { "/admin/v1/coupons" }
let!(:coupon) { create_list(:coupon, 5) }
before(:each) { get url, headers: auth_header(user) }
include_... | 30.090909 | 63 | 0.649547 |
1afcbfd44cf80e04192156b34d360e61a563638f | 887 | module AeEasy
module Qa
class ValidateExternal
attr_reader :data, :errors, :rules, :outputs, :collection_name, :options
def initialize(data, config, outputs, collection_name, options)
@data = data
@rules = config['individual_validations'] if config
@outputs = outputs
@... | 28.612903 | 90 | 0.600902 |
87948f74fa492ff92480feba39e2592ad44ae2a9 | 5,525 | describe 'Ridgepole::Client#diff -> migrate' do
context 'when change fk' do
let(:actual_dsl) {
erbh(<<-EOS)
create_table "parent", <%= i cond(5.1, id: :integer) %>, force: :cascade do |t|
end
create_table "child", force: :cascade do |t|
t.integer "parent_id"
t.in... | 28.188776 | 88 | 0.565611 |
f77c1b59f0a2054b3ccbf0a40dfcfd223ef6e814 | 4,278 | require 'rails_helper'
RSpec.describe 'Before you start page', type: :system do
include CertificateSupport
let(:user) { login_certificate_manager_user }
let(:msa_encryption_certificate) { create(:msa_encryption_certificate, component: create(:msa_component, team_id: user.team)) }
let(:sp_encryption_certificat... | 52.814815 | 157 | 0.77957 |
bf9ae9091f10d52cef0b7b5c1d55c74a8b803577 | 1,211 | module AsposeWordsCloud
#
class ProtectionRequest < BaseObject
attr_accessor :password, :new_password, :protection_type
# attribute mapping from ruby-style variable name to JSON key
def self.attribute_map
{
#
:'password' => :'Password',
#
:'new_... | 22.425926 | 79 | 0.554913 |
288738db377e6faa9f106cb1c29773e35bc531df | 2,998 | require File.expand_path('./spec_helper', File.dirname(__FILE__))
# Specs some of the behavior of awesome_nested_set although does so to
# demonstrate the use of this gem
describe Comment do
before do
@user = User.create!
@comment = Comment.create!(body: 'Root comment', user: @user)
end
describe 'that i... | 29.98 | 75 | 0.61441 |
182a2af9da678b46d385e902be50ff9b594d1e59 | 157 | class SwapProjectDataManagementPlansRelationship < ActiveRecord::Migration[6.0]
def change
remove_reference :projects, :data_management_plan
end
end
| 26.166667 | 79 | 0.821656 |
e2e784d19f2916265a72824cc89c63768fe3d6d7 | 1,609 | # Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | 47.323529 | 72 | 0.778745 |
39acc66236e6a6f1a25e874c8685c70d1aeb2313 | 372 | case node[:platform]
when "ubuntu"
package "logrotate"
LOGROTATE_CONF_BASEDIR = "/etc/logrotate.d"
end
node.logrotate.apps&.each do |app|
logroate_conf_dir = "#{LOGROTATE_CONF_BASEDIR}/#{app.name}"
template logrotate_conf_dir do
action :craete
mode "644"
source "templates/etc/logrotate.d/logrotate.... | 23.25 | 61 | 0.731183 |
6a67021a71277e385139adf4788d37d0fd182700 | 245 | class RedactorRails::Asset
include Mongoid::Document
include Mongoid::Timestamps
include RedactorRails::Orm::Mongoid::AssetBase
delegate :url, :current_path, :size, :content_type, :filename, to: :data
validates_presence_of :data
end
| 24.5 | 74 | 0.771429 |
7a702a7ea51d2ee16ae944a46432b209b99ee3e6 | 2,440 | # frozen_string_literal: true
require 'rails_helper'
require 'support/sm_client_helpers'
require 'support/shared_examples_for_mhv'
RSpec.describe 'Message Attachments Integration' do
include SM::ClientHelpers
let(:va_patient) { true }
let(:current_user) { build(:user, :mhv, va_patient: va_patient, mhv_account_... | 35.362319 | 115 | 0.707787 |
38a6645dbf5edd81a4675d13eefffb274fd1efd8 | 330 | class Admin::HomeBannersController < Admin::BaseController
layout 'juntos_bootstrap'
inherit_resources
actions :index, :new, :create, :destroy, :edit, :update
defaults resource_class: HomeBanner, collection_name: 'home_banners', instance_name: 'home_banner'
def update
update! { admin_home_banners_path }
... | 30 | 100 | 0.769697 |
87063f234ca03860d5e79e169e8a1fc31c207013 | 1,627 | # frozen_string_literal: true
module Engine
class SharePrice
attr_reader :coordinates, :price, :color, :corporations, :can_par
def self.from_code(code, row, column, unlimited_colors, multiple_buy_colors: [])
return nil if !code || code == ''
price = code.scan(/\d/).join('').to_i
can_par =... | 24.651515 | 84 | 0.532883 |
18f021f3f8e2218d899d01ac3957263b38b6c5c8 | 3,268 | require 'pry'
require 'sinatra/base'
require 'slim'
require 'activeresource'
# Active Resource Test client
module ActiveResourceTest
# Handle JSON response
class JsonFormatter
include ActiveResource::Formats::JsonFormat
attr_reader :collection_name
def initialize(collection_name)
@collection_n... | 25.936508 | 142 | 0.554774 |
5d25afaa69121f645043a7d2712b3501f7bfec1b | 970 | require 'test_helper'
class UsersSignupTest < ActionDispatch::IntegrationTest
test "invalid signup information" do
get signup_path
assert_no_difference 'User.count' do
post users_path, params: { user: { name: "",
email: "user@invalid",
... | 33.448276 | 78 | 0.505155 |
3350563aca17e5aad09c115abd4bcdf1c3bf720d | 128 | class Line < ActiveRecord::Base
belongs_to :script
belongs_to :actor
has_many :translations
attr_accessible :index
end
| 16 | 31 | 0.773438 |
bf7e61c7576e63676aab30caa905bc26fabf1438 | 2,278 | class ScmManager < Formula
desc "Manage Git, Mercurial, and Subversion repos over HTTP"
homepage "https://www.scm-manager.org"
url "https://maven.scm-manager.org/nexus/content/repositories/releases/sonia/scm/scm-server/1.47/scm-server-1.47-app.tar.gz"
version "1.47"
sha256 "58e86e0cd3465733a14db09d95a0ef72906... | 31.205479 | 159 | 0.674715 |
284dd0d84dbfa48a9fd201c9b4ab8481025d63dd | 3,313 | class Users::RegistrationsController < Devise::RegistrationsController
layout "registrations"
before_filter :load_registration_form_data, only: [:new, :create]
def permit_params
if params[:user]
params.require(:user).permit(
:birthday,
:description,
:email,
:icon,
... | 32.165049 | 109 | 0.630244 |
bfa68015049124ec179d5f0f9d3c2a1ab1e398a9 | 922 | RSpec.describe RubyCiruits do
it "has a version number" do
expect(RubyCiruits::VERSION).not_to be nil
end
context "when creating a logic AND gate" do
AND1 = LogicGates::AND.new(0, 0)
AND2 = LogicGates::AND.new(1, 0)
AND3 = LogicGates::AND.new(1, 1)
it "with 2 inputs (0, 0)" do
expec... | 20.488889 | 47 | 0.574837 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.