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 |
|---|---|---|---|---|---|
031b29a6ebb542d81ac25f83186bc39e88c3e526 | 441 | class Brand < ActiveRecord::Base
has_and_belongs_to_many(:stores)
validates :name, :presence => true,
:length => {:minimum => 3, :maximum => 100},
:uniqueness => {:case_sensitive => false}
validates_numericality_of :price, :presence=>true
before_save(:uppercase_words)
private
def uppe... | 29.4 | 60 | 0.662132 |
186ee4b5c4687b0dcc73ba8e73173d579a24dab8 | 121 | class CharacterSerializer < ActiveModel::Serializer
attributes :id, :name
def player
object.player.id
end
end
| 15.125 | 51 | 0.743802 |
e9acb74f42fc50b85ddca23aaf075d5bd41e15de | 676 | require File.expand_path '../spec_helper.rb', __FILE__
require 'sidekiq/testing'
describe DOIWorker do
let(:entries) { BibTeX.open(fixture('paper.bib'), :filter => :latex) }
before(:each) do
Sidekiq::Worker.clear_all
end
subject do
described_class.new
end
context "instance methods" do
it "sh... | 25.037037 | 146 | 0.616864 |
87c7339de2bb979ca139e14781758f0b7a5db935 | 1,461 | class Cockatrice < Formula
desc "Virtual tabletop for multiplayer card games"
homepage "https://github.com/Cockatrice/Cockatrice"
url "https://github.com/Cockatrice/Cockatrice.git",
:tag => "2017-03-14-Release",
:revision => "6e723b2a992022ba343d45d881b3c92b9d1c6ba2"
version "2017-03-14"
head "htt... | 29.816327 | 92 | 0.713895 |
7a276faf370b85b0bb6cba95bbed15c74f92ac68 | 7,789 | # encoding: utf-8
require 'bigdecimal'
module Cql
module Protocol
class CqlByteBuffer < Ione::ByteBuffer
def read_unsigned_byte
read_byte
rescue RangeError => e
raise DecodingError, e.message, e.backtrace
end
def read_varint(len=bytesize, signed=true)
byte... | 27.329825 | 125 | 0.586596 |
08abd7d8bfea74f408ee2e1995b3621229d3082a | 65 | require File.dirname(__FILE__) + "/app"
run Sinatra::Application
| 21.666667 | 39 | 0.769231 |
ab47277fe0fcd5403561103b2e0d0deb099050d0 | 933 | Pod::Spec.new do |s|
s.name = 'qgnotification'
s.version = '3.2.0'
s.documentation_url = 'http://docs.qgraph.io'
s.summary = 'This sdk creates Carousel/Slider, Image, Video, Audio and GIF push notifications.'
s.homepage = 'https://github.com/quantumgraph/ios-notific... | 31.1 | 100 | 0.54448 |
1af90b77df0aad4f6bf52e8d707db287e06fb848 | 1,651 | module VCAP::CloudController
module Jobs
class AppApplyManifestActionJob < VCAP::CloudController::Jobs::CCJob
def initialize(app_guid, apply_manifest_message, apply_manifest_action)
@app_guid = app_guid
@apply_manifest_message = apply_manifest_message
@apply_manifest_action = apply_... | 28.465517 | 100 | 0.666869 |
91c094ed39f3dec348c42657fefe34267351ad5b | 19,268 | require 'rndk'
module RNDK
# Allows user to select from a items of alphabetically sorted
# words.
#
# Use the arrow keys to navigate on the items or type in the
# beginning of the word and it'll automagically adjust
# itself in the correct place.
#
# ## Keybindings
#
# Since Alphaitems is built fr... | 28.460857 | 95 | 0.575981 |
e97e74c1515e5fe8db73b23de73c5dc1bbdb4e11 | 11,289 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Ci::CreatePipelineService do
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:ref) { 'refs/heads/master' }
let(:source) { :push }
let(:service) { described_class.new(project, user, ... | 29.865079 | 95 | 0.558065 |
6abd6bd34dba4174f762bf78569e1a6e2ecf8341 | 19,727 | #
# Copyright (c) 2009-2011 RightScale Inc
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publis... | 36.804104 | 132 | 0.647488 |
0317476604a9569257bfe3ccf81b16d55594e099 | 98 | # frozen_string_literal: true
class AboutController < ApplicationController
def about; end
end
| 16.333333 | 45 | 0.816327 |
1a4544d11fb1454a125458c7d1eef2f5652f0776 | 141 | class AddMtWorkerIDToWorkerMessages < ActiveRecord::Migration
def change
add_column :worker_messages, :mt_worker_id, :string
end
end
| 23.5 | 61 | 0.801418 |
aba8a419c14b6b05ec05865ba44d2d76bbe4c3c3 | 2,105 | require "kitchen/transport/speedy/version"
require 'kitchen'
require 'mixlib/shellout'
module Kitchen
module Transport
module SpeedyBase
# require :log_prefix
# copy paste from ssh transport
# see https://github.com/test-kitchen/test-kitchen/pull/726
def create_new_connection(options, &... | 30.507246 | 122 | 0.641805 |
ab201fba6e075b7961447cde4f59ee4dbe3fac4e | 1,146 | require 'pact_broker/db/data_migrations/helpers'
module PactBroker
module DB
module DataMigrations
class MigrateWebhookHeaders
extend Helpers
def self.call(connection)
if columns_exist?(connection)
connection[:webhook_headers].for_update.each do | webhook_header |
... | 36.967742 | 101 | 0.643979 |
18d1dbafcd3edfa250b51015975c6b1342919a16 | 179 | AwsSesNewsletters::Engine.routes.draw do
# SNS
post 'email_responses/bounce' => 'email_responses#bounce'
post 'email_responses/complaint' => 'email_responses#complaint'
end
| 29.833333 | 65 | 0.776536 |
398a87b3441fe53c1d275ee147d33a44be436fe6 | 210 | module Moip2
module Resource
class Invoice < SimpleDelegator
attr_reader :client
def initialize(client, response)
super(response)
@client = client
end
end
end
end
| 16.153846 | 38 | 0.633333 |
e2c535d2d5d0ded680dfc8e8405b2522af6b0e37 | 525 | require_relative "base_index"
module Fontist
module Indexes
class DefaultFamilyFontIndex < BaseIndex
def self.path
Fontist.formula_index_path
end
def add_formula(formula)
formula.fonts.each do |font|
font.styles.each do |style|
font_name = style.default_fa... | 21 | 66 | 0.632381 |
610e35038e2ba4452d90458bc2c208e959e45626 | 1,419 | # frozen_string_literal: true
module RuboCop
module Cop
module Minitest
# This cop enforces the test to use `refute_nil` instead of using
# `refute_equal(nil, something)`, `refute(something.nil?)`, or `refute_predicate(something, :nil?)`.
#
# @example
# # bad
# refute_equa... | 26.773585 | 106 | 0.568006 |
7a378da6e9654b171f7d2da4db454108af63ccb1 | 324 | # encoding: UTF-8
# frozen_string_literal: true
class MigrateAllCurrencyModelsToSingle < ActiveRecord::Migration
def change
execute %[ UPDATE deposits SET type = 'Deposits::Coin' WHERE type <> 'Deposits::Bank' ]
execute %[ UPDATE withdraws SET type = 'Withdraws::Coin' WHERE type <> 'Withdraws::Bank' ]
end
... | 32.4 | 94 | 0.725309 |
7926a3681a35f330a0fabd0079c1528fde84bf7a | 22,022 | class Graph
require 'digest/md5'
attr_accessor :data_sets, :data
def initialize
###########removed between 1.9.3 and 1.9.6
#@title_size = 30
#@line_default = "&line=3,#87421F" + "& \n"
########### same since 1.9.3
@data = []
@x_labels = []
@y_min = 0
@y_max ... | 25.786885 | 231 | 0.573517 |
d5a61085351e5c74f52333041831947513bc26d4 | 35,789 | require "forwardable"
require "hamster/immutable"
require "hamster/enumerable"
module Hamster
def self.vector(*items)
items.empty? ? EmptyVector : Vector.new(items.freeze)
end
# A `Vector` is an ordered, integer-indexed collection of objects. Like `Array`,
# `Vector` indexing starts at 0. Also like `Array... | 32.80385 | 110 | 0.599709 |
030e590765a4d5d39cf6ae5eabce29c04bb9be2d | 2,824 | # Copyright:: 2019, The Authors
#
# 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... | 25.214286 | 81 | 0.640227 |
286d097190490f212666e1e5e272d2acc4efeaca | 1,400 | require 'spec_helper'
describe 'omnibus-supermarket::app' do
platform 'ubuntu', '18.04'
automatic_attributes['memory']['total'] = '16000MB'
it 'creates /var/opt/supermarket/etc/env' do
expect(chef_run).to create_file('/var/opt/supermarket/etc/env').with(
owner: 'supermarket',
group: 'supermarket... | 29.787234 | 94 | 0.655714 |
262ff1bc9a3aaaa442619d71346099d9b42f1eea | 1,384 | module Ingestors
class Ingestor
def initialize
super
@messages = Array.new
@ingested = 0
@processed = 0
@added = 0
@updated = 0
@rejected = 0
@token = ''
end
# accessor methods
attr_reader :messages
attr_reader :ingested
attr_reader :processed
... | 22.322581 | 91 | 0.617052 |
1a2d2b78616561686a611157a25e73c50465de11 | 846 | require 'test_helper'
class UsersControllerTest < ActionDispatch::IntegrationTest
setup do
@user = users(:one)
end
test "should get index" do
get users_url, as: :json
assert_response :success
end
test "should create user" do
assert_difference('User.count') do
post users_url, params: {... | 21.692308 | 100 | 0.666667 |
6a54db1abbd4ed75cb6fe2282e5a9792c595c6a9 | 502 | cask 'kollaborate-transfer' do
version '1.4.3.1'
sha256 '65ba2983e9f39c39895dc7613cc7c2c27c6aa75a789c0aae2cb7b6bcc55f55b6'
# digitalrebellion.com was verified as official when first introduced to the cask
url "http://www.digitalrebellion.com/download/kollabtransfer?version=#{version.no_dots}"
name 'Kollabora... | 35.857143 | 90 | 0.796813 |
615f3f868ac71ce8fff55464211c496f37894ad7 | 2,906 | # This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
requ... | 42.735294 | 86 | 0.746731 |
18542434981460502d660e3dbe498cfba04aab20 | 380 | ActiveAdmin.register Item do
permit_params :id, :name, :subcategory_id
config.sort_order = 'id_asc'
form do |f|
f.semantic_errors(*f.object.errors.keys)
f.inputs do
f.input :name
f.input :subcategory, as: :ajax_select, data: { search_fields: [:name], url: '/admin/subcategories/filter', limit... | 25.333333 | 146 | 0.684211 |
18e5f84f202022269bc97ebaf1473dc32a8de6ee | 381 | require "bundler/setup"
require "tn_congress"
require "pry"
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!
confi... | 23.8125 | 66 | 0.753281 |
086df6a9338165d40803e4889d2a97fc0b242eba | 7,945 | require File.dirname(__FILE__) + '/spec_helper'
describe Sunlight::Legislator do
before(:each) do
Sunlight::Base.api_key = 'the_api_key'
@example_hash = {"webform"=>"https://forms.house.gov/wyr/welcome.shtml", "title"=>"Rep", "nickname"=>"", "eventful_id"=>"P0-001-000016482-0", "district"=>"4", "congresspe... | 41.815789 | 695 | 0.639773 |
282128ed46046c7c6932199fd0f928284b1c9959 | 265 | require 'rails_helper'
RSpec.describe "themes/show", type: :view do
before(:each) do
@theme = assign(:theme, Theme.create!(
:title => "Title"
))
end
it "renders attributes in <p>" do
render
expect(rendered).to match(/Title/)
end
end
| 17.666667 | 44 | 0.626415 |
79d8f2dd0c735b61f1e46178010f50a6f1153bd7 | 1,275 | # coding: utf-8
require File.expand_path('../lib/corefines/version', __FILE__)
Gem::Specification.new do |s|
s.name = 'corefines'
s.version = Corefines::VERSION
s.author = 'Jakub Jirutka'
s.email = 'jakub@jirutka.cz'
s.homepage = 'https://github.com/jirutka/corefines'
s.l... | 34.459459 | 94 | 0.672941 |
38e977c6bd1308055d70456f984bb4a1575650ba | 562 | <% module_namespacing do -%>
class CreateAuthenticationProviders < ActiveRecord::Migration[5.1]
def change
create_table "authentication_providers", :force => true do |t|
t.string "name"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => fa... | 33.058824 | 101 | 0.637011 |
bb536825d6bfdb5901f0c1faf89f9370bd83d2f3 | 1,085 | class NXOS < Oxidized::Model
prompt /^(\r?[\w.@_()-]+[#]\s?)$/
comment '! '
def filter(cfg)
cfg.gsub! /\r\n?/, "\n"
cfg.gsub! prompt, ''
end
cmd :secret do |cfg|
cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
cfg.gsub! /^(snmp-server user (\S+) (\S+) auth (\S+)) (\S+) ... | 23.085106 | 109 | 0.541935 |
0899a5cc966fedeca4b58c622ee6592dfb61f239 | 1,101 | class Vt < Formula
# Tan_2015: "https://doi.org/10.1093/bioinformatics/btv112"
desc "Toolset for short variant discovery from NGS data"
homepage "https://genome.sph.umich.edu/wiki/Vt"
url "https://github.com/atks/vt/archive/0.5772.tar.gz"
sha256 "b147520478a2f7c536524511e48133d0360e88282c7159821813738ccbda97e... | 28.230769 | 105 | 0.737511 |
39402360b9ad36a01b19ac947a86924cf3cc03ed | 160 | class CreateMaterials < ActiveRecord::Migration[6.1]
def change
create_table :materials do |t|
t.string :name
t.timestamps
end
end
end
| 16 | 52 | 0.66875 |
b9ea95df407a5a6c1ba084fca99ca3e7cd7916ca | 73,970 | # 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
require 'seahorse/client/plugins/content_length.rb'
require 'aws-sdk-core/plugins... | 45.52 | 199 | 0.685467 |
d58bedf96435a167a9ca7278a431417d0f05e6ff | 4,763 | if ENV["CI"]
require "codeclimate-test-reporter"
CodeClimate::TestReporter.start
end
require "simplecov"
SimpleCov.start do
add_filter "/spec"
add_filter "/vendor"
end
require "twiruby"
# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which R... | 40.364407 | 129 | 0.741549 |
393f2afbfb0558333b04849928b29e76fcfdcef3 | 674 | require "mini_magick"
module Mosaic
module Transform
class << self
def to_greyscale(input, output)
convert "-colorspace Gray #{input} #{output}"
end
def resize(input, output, dimensions, opts)
suffix = opts[:ignore_aspect_ratio] ? '!' : ''
convert "#{input} -resize #{di... | 22.466667 | 71 | 0.580119 |
282f1ee1f446ebb99154deec631e54c0d62a3b69 | 176 | class Calculator
def add(a, b, c = 0)
a + b + c
end
def multiply(a, b)
a * b
end
def subtract(a, b)
a - b
end
def divide(a, b)
a / b
end
end
| 9.777778 | 22 | 0.488636 |
79af9c37378f47546a9a0d3ed5f54d63a7be51ca | 21,227 | # frozen_string_literal: true
module API
module Helpers
include Gitlab::Utils
include Helpers::Pagination
include Helpers::PaginationStrategies
SUDO_HEADER = "HTTP_SUDO"
GITLAB_SHARED_SECRET_HEADER = "Gitlab-Shared-Secret"
SUDO_PARAM = :sudo
API_USER_ENV = 'gitlab.api.user'
API_EXCEP... | 29.813202 | 132 | 0.690677 |
39e8b5d110dc075253a2fb69c9f01ff2ce851acc | 338 | cask 'djv' do
version '1.1.0'
sha256 'b922fc5d94e57d436779aa912d3f07746f541124149d5f4d8198d4ef0e2e8fd5'
url "http://downloads.sourceforge.net/project/djv/djv-stable/#{version}/djv-#{version}-OSX-64.dmg"
name 'DJV'
name 'DJV Imaging'
homepage 'http://djv.sourceforge.net'
license :bsd
app "djv-#{version... | 26 | 100 | 0.730769 |
384e5a54ecae6c62d3197ee8f89f0c22c435d728 | 83 | class Lab < ApplicationRecord
has_many :schedules
def to_s
name
end
end
| 10.375 | 29 | 0.710843 |
ffc2e947087fe128f805c243bff2819ca8d7e992 | 428 | module Channel9
module Instruction
# jmp label
# ---
# Unconditionally jumps to the label specified.
#
# Takes no inputs and produces no outputs.
class JMP < Base
attr :to
def initialize(stream, to)
super(stream)
@to = to
end
def arguments
[@to... | 17.12 | 51 | 0.563084 |
f7aa8d4a8bcb6282f8178a51123b0e7295f46ec6 | 512 | class ContestConfig < ActiveRecord::Base
######################################
############ Validations #############
######################################
validates :description, :length=>{:maximum=>254},:allow_nil=>true
######################################
############ Accessibility ###########
... | 34.133333 | 80 | 0.451172 |
5df1e2804afbe6995d03c7de02e12ccba8915fff | 807 | # frozen_string_literal: true
class ProjectRolesController < ApplicationController
include CurrentProject
before_action :authorize_project_admin!
def create
user = User.find(params[:user_id])
role = UserProjectRole.where(user: user, project: current_project).first_or_initialize
role.role_id = params... | 26.032258 | 115 | 0.695167 |
f85ace95fddc7e0cf2910380e71dbbae2f5a3b26 | 20,135 | # 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/heartcombo/simple_form-bootstrap
# All future development, tests, and organization should happen there.
# Background history: https://github... | 46.394009 | 258 | 0.677825 |
fffbe5eca14a07ca9df65a1c9aa3006b69e158f4 | 1,693 | module Fog
module Storage
class InternetArchive
class Real
require 'fog/internet_archive/parsers/storage/get_bucket_location'
# Get location constraint for an S3 bucket
#
# @param bucket_name [String] name of bucket to get location constraint for
#
# @return... | 28.694915 | 95 | 0.541051 |
62ee0d57d541a08d21a00f3befb72efb90b22597 | 6,266 | #
# Author:: Vasundhara Jagdale (<vasundhara.jagdale@msystechnologies.com>)
# Copyright:: Copyright 2015-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 m... | 41.496689 | 155 | 0.605809 |
7ab7c43a1f7902c34a86db6f5eee351d94591fbd | 1,411 | class DeviseCreateBystanders < ActiveRecord::Migration
def change
create_table(:bystanders) do |t|
## Database authenticatable
t.string :name, null: false
t.string :email, null: false
t.string :encrypted_password, null: false, default: ""
## Recoverable
... | 32.068182 | 104 | 0.65769 |
034d3343300185f948e7427f2219088dffed637c | 37 | module Trove
VERSION = "0.0.1"
end
| 9.25 | 19 | 0.648649 |
abe66f3e5c5baf6e2eba69845e254cc980ac0191 | 1,996 | require 'spec_helper'
require 'database_cleaner'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rspec/rails'
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
Act... | 31.1875 | 105 | 0.741483 |
b90d703527a1dcf51f7b2ab73690116f2f1be291 | 1,373 | # frozen_string_literal: true
module ModelToGraphql
module Generators
class BelongsToRelationResolverGenerator < GraphQL::Schema::Resolver
class << self
attr_accessor :relation
end
def resolve(path: [], lookahead: nil)
model_class = relation_model_class(relation, object)
... | 28.020408 | 106 | 0.667881 |
5d93bed88d759e200cf35013ef3c54eec5f627a7 | 460 | module VimeoMe2
module UserMethods
module Videos
# Get a list of albums for the current user.
# @param [Object] Arguments passed to http_request (optional keys include: headers, query)
def get_video_list(**args)
get("/videos", **args)
end
# Get one album by it's ID
# ... | 23 | 96 | 0.619565 |
261579dce5d749fad892cba56b79cbd0b7266e37 | 4,637 | # frozen_string_literal: true
require "abstract_unit"
require "action_dispatch/testing/assertions/response"
module ActionDispatch
module Assertions
class ResponseAssertionsTest < ActiveSupport::TestCase
include ResponseAssertions
FakeResponse = Struct.new(:response_code, :location, :body) do
... | 32.65493 | 89 | 0.623895 |
ff4b4c0ddabf3a2a50841eb9b995e8a5a25d3f01 | 859 | Rhinobook::Engine.routes.draw do
devise_for :users, class_name: "Rhinoart::User", module: :devise,
:controllers => { :sessions => "rhinoart/sessions", :passwords => "rhinoart/passwords" }
scope "(:locale)", locale: /ru|en/ do
root :to => 'books#index'
resources :books do
resources :do... | 26.030303 | 150 | 0.633295 |
bf56c584b7edb97b01c600e570709b8f96d96c5d | 1,331 | class ReviewsController < ApplicationController
before_action :authenticate_user!
before_action :find_review, only: [:edit, :update, :destroy ]
before_action :find_product, except: :create
def new
@review = Review.new
end
def create
@review = Review.new(review_params)
@review.user_id = current_user.id
... | 22.559322 | 86 | 0.712998 |
ab88e552c08b82da0f29dc2e92bd994866537a12 | 1,158 | require 'spec_helper'
describe HideAncestry::ModelManage::CustomAncestryUpdater do
include_examples 'Monkeys subtree'
let(:some_monkey) { build :monkey }
context 'calls in callback' do
it do
expect(described_class).to receive(:call).with some_monkey
some_monkey.save
end
end
describe 'i... | 25.173913 | 65 | 0.651986 |
791e3b77cb91a4a1ff34551e123ee305d70d5ceb | 3,847 | class Gocr < Formula
desc "Optical Character Recognition (OCR), converts images back to text"
homepage "http://jocr.sourceforge.net/"
url "https://www-e.uni-magdeburg.de/jschulen/ocr/gocr-0.50.tar.gz"
sha256 "bc261244f887419cba6d962ec1ad58eefd77176885093c4a43061e7fd565f5b5"
bottle do
cellar :any_skip_rel... | 34.972727 | 92 | 0.669613 |
f80a481c4b9eef465c7af33bf6af599e61c3d155 | 2,465 | # Copyright (C) 2010 Tom Verbeure, Simon Tokumine
#
# 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 ... | 32.012987 | 99 | 0.63002 |
79ab4231bea9c25db276132eb1350e6a93f9abc5 | 760 | # frozen_string_literal: true
Gem::Specification.new do |spec|
spec.name = "example"
spec.version = "0.9.3"
spec.summary = "Automated dependency management"
spec.description = "Core logic for updating a GitHub repos dependencies"
spec.author = "Dependabot"
spec.email = "supp... | 33.043478 | 75 | 0.621053 |
ff3fda88f87650fde950c60360dd6d7b901951ed | 2,609 | require 'spec_helper'
describe Atreides::Site do
describe "validation" do
before do
@site = Factory.create(:site)
end
it "should be valid and create a site" do
site = Atreides::Site.new(:name => "www-2")
site.valid?.should eql(true)
site.save.should eql(true)
site.lang.shou... | 32.6125 | 132 | 0.65504 |
3399aa5406b52a11b105e50248f6f301199a0a28 | 1,152 | # Configure Rails Environment
ENV["RAILS_ENV"] = "test"
require File.expand_path("../../spec/dummy/config/environment.rb", __FILE__)
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../spec/dummy/db/migrate", __FILE__)]
require "rails/test_help"
# Filter out Minitest backtrace while allowing backtrace... | 27.428571 | 101 | 0.773438 |
f740d702d322505c9435c75f56ad45d1db3a996e | 341 | require 'spec_helper'
describe "pending_actions/index" do
before(:each) do
assign(:pending_actions, [
stub_model(PendingAction),
stub_model(PendingAction)
])
end
it "renders a list of pending_actions" do
render
# Run the generator again with the --webrat flag if you want to use webra... | 21.3125 | 87 | 0.703812 |
386feabe94d2ab5b35f5c1f5ca83265f8c9ad954 | 455 | class SessionsController < ApplicationController
def new
end
def create
user = User.find_by_email(params[:email])
if user && user.authenticate(params[:password])
session[:user_id] = user.id
redirect_to root_url, notice: "Logged in!"
else
flash.now.alert = "Invalid email or password"... | 21.666667 | 51 | 0.668132 |
ff7a75b652d5290d1d3b92768d8498206abec6b6 | 28,381 | ##
# This code was generated by
# \ / _ _ _| _ _
# | (_)\/(_)(_|\/| |(/_ v1.0.0
# / /
#
# frozen_string_literal: true
module Twilio
module REST
class Api < Domain
class V2010 < Version
class AccountContext < InstanceContext
class AvailablePhoneNumberCountryContext < ... | 57.567951 | 506 | 0.572637 |
e2b1b671dfcb9b453760fd9f14de3bdbd8c3a857 | 1,476 | require 'pry'
require_relative './laboratory_test_result'
require_relative './format_conversor'
class Parser
DELIMITER = "|"
LAB_RESULT_START_TOKEN = "OBX|"
LAB_COMMENT_START_TOKEN = "NTE|"
TEST_TYPES = {
C100: "float",
C200: "float",
A250: "boolean",
B250: "nil_3plus"
}
def initialize... | 23.806452 | 72 | 0.631436 |
4a12ecd969803a4cf0d5b5c93cbc05f9901c107a | 123 | # frozen_string_literal: true
FactoryBot.define do
factory :field_project do
sequence(:kobo_id) { |n| n }
end
end
| 15.375 | 32 | 0.715447 |
91355d352b4ed44523f032fcbcc8b3908b59e59c | 150 | require 'test_helper'
class TranslationEngineTest < ActiveSupport::TestCase
test "truth" do
assert_kind_of Module, TranslationEngine
end
end
| 18.75 | 53 | 0.793333 |
3330fd5dcc3107df2994d28575347da6377697c3 | 768 | # frozen_string_literal: true
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 ... | 20.210526 | 77 | 0.64974 |
6216f0db8a17336034f10d97c47c5178e019120a | 1,240 | class Pwntools < Formula
include Language::Python::Virtualenv
desc "CTF framework used by Gallopsled in every CTF"
homepage "https://github.com/Gallopsled/pwntools"
url "https://github.com/Gallopsled/pwntools/archive/3.12.2.tar.gz"
sha256 "8e048b514ee449b4c76f4eba1b4fcd48fdefd1bf04ae4c62b44e984923d2e979"
r... | 35.428571 | 93 | 0.735484 |
ed6d1aebe2334dc2ed215c038268a0e832a88b70 | 2,447 | require 'thor'
require "rake-pipeline"
require 'rake-pipeline-web-filters'
require 'fileutils'
require_relative 'recipes'
require 'pry'
module CSConsole
class CLI < Thor
include Thor::Actions
desc "build", "Build the cs_console with various recipes"
method_option :build_type, default: :all, aliases: '-... | 32.197368 | 133 | 0.669391 |
f891de403d83a5b0c732b3ffada668d1d1df5925 | 264 | # frozen_string_literal: true
require 'mkmf'
config_string("strict_warnflags") {|w| $warnflags += " #{w}"}
with_werror("", {:werror => true}) do |opt, |
have_var("timezone", "time.h", opt)
have_var("altzone", "time.h", opt)
end
create_makefile('date_core')
| 22 | 61 | 0.666667 |
111c732168257bffd12473c9a5052823a2a073e0 | 889 | # frozen_string_literal: true
# Omniauth callacks for SAML authentication
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController # rubocop:disable Style/ClassAndModuleChildren
skip_before_action :authenticate_user!
protect_from_forgery with: :exception, except: :saml
def passthru
red... | 27.78125 | 125 | 0.731159 |
189dde8e151f7a31277b0f60c3e92dab81ac24c1 | 73 | require 'test_helper'
class ClinicHelperTest < ActionView::TestCase
end
| 14.6 | 45 | 0.821918 |
03389154b90bf63f2edc6e8322e1c47fc57fd5dd | 3,199 | class Heartbeat < Formula
desc "Lightweight Shipper for Uptime Monitoring"
homepage "https://www.elastic.co/beats/heartbeat"
url "https://github.com/elastic/beats.git",
tag: "v8.1.3",
revision: "271435c21bfd4e2e621d87c04f4b815980626978"
license "Apache-2.0"
head "https://github.com/elastic/be... | 33.322917 | 123 | 0.663957 |
e9abd204257793338b6ef5ff31581a18596bd61d | 2,833 | module SirTrevor
module Helpers
module ViewHelper
extend ActiveSupport::Concern
include Twitter::Autolink
def render_sir_trevor(json, image_type = 'large')
if hash = parse_sir_trevor(json)
hash.map { |object|
render_sir_trevor_block(object, image_type)
... | 31.131868 | 192 | 0.58101 |
6130f357d6720d1ee7962ec085821bbd5dd4dd5e | 1,392 | =begin
Copyright 2010-2017 Sarosys LLC <http://www.sarosys.com>
This file is part of the Arachni Framework project and is subject to
redistribution and commercial restrictions. Please see the Arachni Framework
web site for more information on licensing and terms of use.
=end
class Arachni::Checks::Bod... | 28.408163 | 86 | 0.496408 |
f76e813347bbe61cc5c93cb7aeb077ac301a563c | 3,334 | class Cms::ColumnsController < ApplicationController
include Cms::BaseFilter
include Cms::CrudFilter
model Cms::Column::Base
navi_view 'cms/main/conf_navi'
helper_method :column_type_options
private
def set_form
@cur_form ||= Cms::Form.site(@cur_site).find(params[:form_id])
end
def set_items... | 22.527027 | 95 | 0.644871 |
33c6c24449ccb69821524c6f3bfff84aed3a6b11 | 166 | require 'spec_helper'
require_relative './simple_check_shared'
describe Gitlab::HealthChecks::DbCheck do
include_examples 'simple_check', 'db_ping', 'Db', '1'
end
| 23.714286 | 55 | 0.777108 |
7a3f2e368ef1f4e5bdf95898ae146d5e3052bf22 | 49 | require_relative "app"
run Sinatra::Application
| 12.25 | 24 | 0.816327 |
1d578a712a8c6a973fdd69c3b80cc7daaea2a3d1 | 286 | module OdfCore
module Element
module Text
class CreationTime < AbstractElement
XML_ELEMENT_NAME = 'text:creation-time'
CHILDREN = [].freeze
ATTRIBUTES = ["style:data-style-name", "text:fixed", "text:time-value"].freeze
end
end
end
end
| 19.066667 | 86 | 0.636364 |
38961e4eff695e57f75ffa5cdc3fdc32d177240b | 7,220 | # frozen_string_literal: true
require "active_support/core_ext/file/atomic"
require "active_support/core_ext/string/conversions"
require "uri/common"
module ActiveSupport
module Cache
# A cache store implementation which stores everything on the filesystem.
class FileStore < Store
attr_reader :cache_p... | 32.522523 | 169 | 0.582548 |
61e66dbfc4724ec6a5ec2d013cca3a3e28e90763 | 2,521 | require "test_helper"
class Edition::ActiveEditorsTest < ActiveSupport::TestCase
test "can record editing intent" do
user = create(:writer)
edition = create(:edition)
edition.open_for_editing_as(user)
Timecop.travel(1.minute.from_now)
assert_equal [user], edition.recent_edition_openings.map(&:edi... | 40.015873 | 121 | 0.748512 |
f8ac27543e66e510ac62adf0211d7827d1ad5deb | 1,058 | class Gitea::Repository::Entries::GetService < Gitea::ClientService
attr_reader :user, :repo_name, :filepath, :args
# ref: The name of the commit/branch/tag. Default the repository’s default branch (usually master)
# filepath: path of the dir, file, symlink or submodule in the repo
# repo_name: the name of rep... | 25.804878 | 100 | 0.677694 |
6ac31a151f02679309d2a16fffb17578458a653f | 6,428 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
require 'metasploit/framework/login_scanner/glassfish'
require 'metasploit/framework/credential_collection'
class Metasploit3 < Msf::Auxiliary
include Msf::Exp... | 32.964103 | 126 | 0.627878 |
39536c1a03e029dee339fb3ad658c65ff9457c37 | 594 | require 'spec/helper'
spec_require 'erubis'
require 'examples/templates/template_erubis'
describe 'Template Erubis' do
behaves_like 'http'
ramaze
it '/' do
get('/').body.strip.should ==
"<a href=\"/\">Home</a> | <a href=\"/internal\">internal</a> | <a href=\"/external\">external</a>"
end
%w[/int... | 24.75 | 104 | 0.627946 |
ed0ed41521361d52891ba39437ba49753ba6472d | 942 | class Lego < Formula
desc "Let's Encrypt client"
homepage "https://go-acme.github.io/lego/"
url "https://github.com/go-acme/lego.git",
:tag => "v3.3.0",
:revision => "63758264cb8537f498820cc36ad3bcaf201a5a5f"
bottle do
cellar :any_skip_relocation
sha256 "30dea0a6027acd8ca7e69f5075729ad3a65... | 33.642857 | 94 | 0.726115 |
e27f2a65f1669f5243dff08aee6215954fefc8cf | 5,156 | #!/usr/bin/ruby -w
$LOAD_PATH.unshift "lib", "ext"
require 'ode'
require '../utils'
include UtilityFunctions
# Minimal test case for a segfault in Ruby-20021117.
header "Experiment: Proc.to_s segfault minimal testcase"
# Test unit struct -- makes passing test data around a bit more readble.
FlagUnit = Struct::new(... | 27.572193 | 72 | 0.44841 |
21d6a753747dfc3a21182805cffe8a5e16f5b2c7 | 1,763 | # frozen_string_literal: true
require "montrose/errors"
require "montrose/options"
module Montrose
# Abstract class for special recurrence rule required
# in all instances of Recurrence. Frequency describes
# the base recurrence interval.
#
class Frequency
include Montrose::Rule
FREQUENCY_TERMS = {... | 25.926471 | 100 | 0.67612 |
039203c8ed15bf02f54bd773827418bd971adc79 | 1,800 | ##
# $Id$
##
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
# http://metasploit.com/
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank ... | 23.076923 | 78 | 0.596111 |
87c2d720880c29538b2ea742c5aa38cede1241d8 | 629 | require 'slack_bot_server/version'
require 'slack_bot_server/server'
require 'logger'
# A framework for running and controlling multiple bots. This
# is designed to make it easier for developers to provide Slack
# integration for their applications, instead of having individual
# users run their own bot instances.
mod... | 27.347826 | 66 | 0.759936 |
38b00b392d32a7f9348d0ded8d33ad7803952036 | 1,295 | lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'acts_as_learnable/version'
Gem::Specification.new do |spec|
spec.name = 'acts_as_learnable'
spec.version = ActsAsLearnable::VERSION
spec.authors = ['Dan Kim']
spec.email = [... | 44.655172 | 296 | 0.703475 |
6ac52a9faf9ba18e13b7216c5c0155913e1ad45f | 542 | # frozen_string_literal: true
module Station
class Mapping
class RequiredValue < StandardError
def initialize(name)
super("'#{name}' is a required value")
end
end
class RequiredType < StandardError
def initialize(name, value, type)
super("'#{name}' is of type '#{value.cl... | 24.636364 | 89 | 0.630996 |
e2230a2d644b1bb0ace3807be0999c14fa798eed | 869 | # frozen_string_literal: true
class WebHookLog < ApplicationRecord
include SafeUrl
include Presentable
include DeleteWithLimit
include CreatedAtFilterable
self.primary_key = :id
belongs_to :web_hook
serialize :request_headers, Hash # rubocop:disable Cop/ActiveRecordSerialize
serialize :request_data,... | 21.725 | 79 | 0.765247 |
794f2d8dd49928c14f8e38374082f1baa537feac | 1,589 | # Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 38.756098 | 84 | 0.753933 |
e943683f52d90f9af7ce4396e25955c4ca408c67 | 102 | json.extract! upload, :id, :name, :created_at, :updated_at
json.url upload_url(upload, format: :json)
| 34 | 58 | 0.745098 |
bb8d8a11241701cccd680bc972ea6ae9512f69a1 | 2,212 | require 'spec_helper'
describe package('httpd'), :if => os[:family] == 'redhat' do
it { should be_installed }
end
describe package('apache2'), :if => os[:family] == 'ubuntu' do
it { should be_installed }
end
describe service('httpd'), :if => os[:family] == 'redhat' do
it { should be_enabled }
it { should be_... | 23.041667 | 100 | 0.659584 |
abf143e73366beebe5d3f140e61771b2ce1e3582 | 2,246 | module Cenit
module ApiBuilder
module BridgingServiceApplicationConn
extend ActiveSupport::Concern
included do
belongs_to :connection, class_name: Setup::Connection.name, inverse_of: nil
field :target_api_base_url, type: String
after_save :setup_connection
before_des... | 28.43038 | 88 | 0.616652 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.